diff --git a/Habitica/res/drawable-hdpi/shop_header_sparkle.png b/Habitica/res/drawable-hdpi/shop_header_sparkle.png
new file mode 100644
index 000000000..b2c3dd568
Binary files /dev/null and b/Habitica/res/drawable-hdpi/shop_header_sparkle.png differ
diff --git a/Habitica/res/drawable-mdpi/shop_header_sparkle.png b/Habitica/res/drawable-mdpi/shop_header_sparkle.png
new file mode 100644
index 000000000..ad5159125
Binary files /dev/null and b/Habitica/res/drawable-mdpi/shop_header_sparkle.png differ
diff --git a/Habitica/res/drawable-night/shop_category_header_background.xml b/Habitica/res/drawable-night/shop_category_header_background.xml
new file mode 100644
index 000000000..eb9ad4a7c
--- /dev/null
+++ b/Habitica/res/drawable-night/shop_category_header_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Habitica/res/drawable-xhdpi/shop_header_sparkle.png b/Habitica/res/drawable-xhdpi/shop_header_sparkle.png
new file mode 100644
index 000000000..209842b32
Binary files /dev/null and b/Habitica/res/drawable-xhdpi/shop_header_sparkle.png differ
diff --git a/Habitica/res/drawable-xxhdpi/shop_header_sparkle.png b/Habitica/res/drawable-xxhdpi/shop_header_sparkle.png
new file mode 100644
index 000000000..ed6378d1d
Binary files /dev/null and b/Habitica/res/drawable-xxhdpi/shop_header_sparkle.png differ
diff --git a/Habitica/res/drawable/ic_arrow_drop_down_10dp.xml b/Habitica/res/drawable/ic_arrow_drop_down_10dp.xml
new file mode 100644
index 000000000..71aca5d72
--- /dev/null
+++ b/Habitica/res/drawable/ic_arrow_drop_down_10dp.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Habitica/res/drawable/shop_category_header_background.xml b/Habitica/res/drawable/shop_category_header_background.xml
new file mode 100644
index 000000000..67c142ebe
--- /dev/null
+++ b/Habitica/res/drawable/shop_category_header_background.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_else_background.xml b/Habitica/res/drawable/shop_header_else_background.xml
new file mode 100644
index 000000000..cb61299d7
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_else_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_healer_background.xml b/Habitica/res/drawable/shop_header_healer_background.xml
new file mode 100644
index 000000000..1333ee4d2
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_healer_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_rogue_background.xml b/Habitica/res/drawable/shop_header_rogue_background.xml
new file mode 100644
index 000000000..85fa9fc15
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_rogue_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_time_background.xml b/Habitica/res/drawable/shop_header_time_background.xml
new file mode 100644
index 000000000..e1519e027
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_time_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_warrior_background.xml b/Habitica/res/drawable/shop_header_warrior_background.xml
new file mode 100644
index 000000000..9ec917a50
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_warrior_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/drawable/shop_header_wizard_background.xml b/Habitica/res/drawable/shop_header_wizard_background.xml
new file mode 100644
index 000000000..a6f29b100
--- /dev/null
+++ b/Habitica/res/drawable/shop_header_wizard_background.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Habitica/res/layout/shop_section_header.xml b/Habitica/res/layout/shop_section_header.xml
index fecc350b3..d085f9c36 100644
--- a/Habitica/res/layout/shop_section_header.xml
+++ b/Habitica/res/layout/shop_section_header.xml
@@ -4,46 +4,97 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:layout_marginHorizontal="12dp">
-
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@drawable/shop_category_header_background"
+ android:layout_marginBottom="@dimen/spacing_large">
+
+
+ android:gravity="center"
+ android:textColor="@color/white" />
+
+
+
+
+
+
+
+
+
@style/PopupTheme
- @style/PopupTheme
- @style/PopupTheme
- - @color/brand_400
+ - @color/text_brand_neon
- @style/AlertDialogTheme
- false
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/models/shops/EmptyShopCategory.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/models/shops/EmptyShopCategory.kt
index 550854888..c2e4706b6 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/models/shops/EmptyShopCategory.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/models/shops/EmptyShopCategory.kt
@@ -7,12 +7,12 @@ import android.text.style.ForegroundColorSpan
import androidx.core.content.ContextCompat
import com.habitrpg.android.habitica.R
-class EmptyShopCategory(val categoryIdentifier: String, context: Context?) {
+class EmptyShopCategory(val categoryIdentifier: String, val shopIdentifier: String?, context: Context?) {
val title: String = context?.getString(R.string.you_own_all_items) ?: ""
val description: Spannable
init {
val stringId = when (categoryIdentifier) {
- "backgrounds" -> R.string.try_on_next_month
+ "backgrounds" -> if (shopIdentifier == Shop.CUSTOMIZATIONS) R.string.try_on_next_month else R.string.try_on_customize
"color" -> R.string.try_on_next_season
"skin" -> R.string.try_on_next_season
"mystery_sets" -> R.string.try_on_equipment
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ShopRecyclerAdapter.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ShopRecyclerAdapter.kt
index 66adbbeca..1e1d6a822 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ShopRecyclerAdapter.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ShopRecyclerAdapter.kt
@@ -5,7 +5,10 @@ import android.text.method.LinkMovementMethod
import android.view.View
import android.view.ViewGroup
import android.widget.Button
+import android.widget.LinearLayout
import android.widget.TextView
+import androidx.core.view.isVisible
+import androidx.core.view.marginTop
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.databinding.ShopArmoireGearBinding
@@ -26,6 +29,7 @@ import com.habitrpg.android.habitica.ui.viewHolders.SectionViewHolder
import com.habitrpg.android.habitica.ui.viewHolders.ShopItemViewHolder
import com.habitrpg.android.habitica.ui.views.getTranslatedClassName
import com.habitrpg.android.habitica.ui.views.insufficientCurrency.InsufficientGemsDialog
+import com.habitrpg.common.habitica.extensions.dpToPx
import com.habitrpg.common.habitica.extensions.fromHtml
import com.habitrpg.common.habitica.extensions.loadImage
import com.habitrpg.common.habitica.helpers.MainNavigationController
@@ -93,7 +97,7 @@ class ShopRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter 1) {
+ 40.dpToPx(context)
+ } else {
+ 16.dpToPx(context)
+ }
if (gearCategories.contains(obj)) {
context?.let { context ->
val adapter =
@@ -160,6 +169,7 @@ class ShopRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter
- displayCustomizationFragment(type, category)
- },
- { type, category ->
- displayAvatarEquipmentFragment(type, category)
- },
- { type, equipped, isCostume ->
- displayEquipmentFragment(type, equipped, isCostume)
- },
- )
+ val avatar by userViewModel.user.observeAsState()
+ Column {
+
+ Column(horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier.background(colorResource(R.color.window_background))) {
+ ComposableAvatarView(
+ avatar = avatar,
+ configManager = appConfigManager,
+ modifier =
+ Modifier
+ .padding(vertical = 24.dp)
+ .size(140.dp, 147.dp),
+ )
+ Box(
+ Modifier
+ .background(colorResource(R.color.content_background), RoundedCornerShape(topStart = 22.dp, topEnd = 22.dp))
+ .fillMaxWidth()
+ .height(22.dp),
+ )
+ }
+ AvatarOverviewView(
+ userViewModel,
+ showCustomization,
+ !showCustomization,
+ battleGearWeapon.value?.twoHanded == true,
+ costumeWeapon.value?.twoHanded == true,
+ { type, category ->
+ displayCustomizationFragment(type, category)
+ },
+ { type, category ->
+ displayAvatarEquipmentFragment(type, category)
+ },
+ { type, equipped, isCostume ->
+ displayEquipmentFragment(type, equipped, isCostume)
+ },
+ )
+ }
}
}
}
@@ -169,6 +201,12 @@ open class AvatarOverviewFragment :
) {
super.onCreateOptionsMenu(menu, inflater)
inflater.inflate(R.menu.menu_share_avatar, menu)
+
+ mainActivity?.toolbar?.let {
+ val color = ContextCompat.getColor(requireContext(), R.color.window_background)
+ ToolbarColorHelper.colorizeToolbar(it, mainActivity, backgroundColor = color)
+ requireActivity().window.statusBarColor = color
+ }
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/SectionViewHolder.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/SectionViewHolder.kt
index 71e739e3e..1ae223e04 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/SectionViewHolder.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/SectionViewHolder.kt
@@ -6,9 +6,12 @@ import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
+import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.Spinner
import android.widget.TextView
+import androidx.appcompat.content.res.AppCompatResources
+import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.extensions.getImpreciseRemainingString
@@ -19,6 +22,7 @@ import com.habitrpg.android.habitica.ui.views.CurrencyView
import java.util.Date
class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
+ val headerContainer: LinearLayout = itemView.findViewById(R.id.header_container)
private val label: TextView = itemView.findViewById(R.id.label)
private val switchesInLabel: TextView? = itemView.findViewById(R.id.switches_in_label)
private val selectionSpinner: Spinner? = itemView.findViewById(R.id.class_selection_spinner)
@@ -28,6 +32,9 @@ class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val switchClassCurrency: CurrencyView? = itemView.findViewById(R.id.change_class_currency_view)
internal val notesView: TextView? = itemView.findViewById(R.id.headerNotesView)
private val countPill: TextView? = itemView.findViewById(R.id.count_pill)
+ val divider: View? = itemView.findViewById(R.id.divider)
+ val classSelectionButton: FrameLayout? = itemView.findViewById(R.id.class_selection_button)
+ val classSelectionLabel: TextView? = itemView.findViewById(R.id.class_name_label)
var context: Context = itemView.context
var spinnerSelectionChanged: (() -> Unit)? = null
@@ -35,6 +42,9 @@ class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
constructor(parent: ViewGroup) : this(parent.inflate(R.layout.customization_section_header))
init {
+ classSelectionButton?.setOnClickListener {
+ selectionSpinner?.performClick()
+ }
selectionSpinner?.onItemSelectedListener =
object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
@@ -99,11 +109,40 @@ class SectionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}
}
+ fun setSelectedClass(selectedGearCategory: String) {
+ var textColor = R.color.white
+ when (selectedGearCategory) {
+ "warrior" -> {
+ classSelectionButton?.background = AppCompatResources.getDrawable(context, R.drawable.shop_header_warrior_background)
+ classSelectionLabel?.text = context.getString(R.string.warrior)
+ }
+ "wizard" -> {
+ classSelectionButton?.background = AppCompatResources.getDrawable(context, R.drawable.shop_header_wizard_background)
+ classSelectionLabel?.text = context.getString(R.string.mage)
+ }
+ "healer" -> {
+ classSelectionButton?.background = AppCompatResources.getDrawable(context, R.drawable.shop_header_healer_background)
+ classSelectionLabel?.text = context.getString(R.string.healer)
+ textColor = R.color.yellow_1
+ }
+ "rogue" -> {
+ classSelectionButton?.background = AppCompatResources.getDrawable(context, R.drawable.shop_header_rogue_background)
+ classSelectionLabel?.text = context.getString(R.string.rogue)
+ }
+ else -> {
+ classSelectionButton?.background = AppCompatResources.getDrawable(context, R.drawable.shop_header_else_background)
+ classSelectionLabel?.text = context.getString(R.string.classless)
+ textColor = R.color.gray_100
+ }
+ }
+ classSelectionLabel?.setTextColor(ContextCompat.getColor(context, textColor))
+ }
+
var spinnerAdapter: ArrayAdapter? = null
set(value) {
field = value
selectionSpinner?.adapter = field
- selectionSpinner?.visibility = if (value != null) View.VISIBLE else View.GONE
+ classSelectionButton?.visibility = if (value != null) View.VISIBLE else View.GONE
}
var selectedItem: Int = 0
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ShopItemViewHolder.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ShopItemViewHolder.kt
index f101319d4..933a43b1b 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ShopItemViewHolder.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ShopItemViewHolder.kt
@@ -120,7 +120,7 @@ class ShopItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), Vi
binding.itemDetailIndicator.layoutParams = layoutParams
}
- binding.priceLabel.isLocked = item.locked || !canBuy
+ binding.priceLabel.isLocked = item.locked || (!canBuy && item.currency == "gold")
}
override fun onClick(view: View) {
diff --git a/version.properties b/version.properties
index 3c5a3f96f..311d50402 100644
--- a/version.properties
+++ b/version.properties
@@ -1,2 +1,2 @@
NAME=4.3.7
-CODE=7841
\ No newline at end of file
+CODE=7861
\ No newline at end of file