diff --git a/Habitica/res/drawable/button_background.xml b/Habitica/res/drawable/button_background.xml
index fe9bcbe82..274aa4f76 100644
--- a/Habitica/res/drawable/button_background.xml
+++ b/Habitica/res/drawable/button_background.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Habitica/res/layout/dialog_pet_suggest_hatch.xml b/Habitica/res/layout/dialog_pet_suggest_hatch.xml
index eecc61a48..e91dbfcda 100644
--- a/Habitica/res/layout/dialog_pet_suggest_hatch.xml
+++ b/Habitica/res/layout/dialog_pet_suggest_hatch.xml
@@ -32,7 +32,8 @@
android:layout_width="wrap_content"
android:layout_height="24dp"
style="@style/Pill"
- android:padding="0dp"
+ android:paddingHorizontal="4dp"
+ android:minWidth="24dp"
android:gravity="center"
tools:text="12"
android:layout_alignEnd="@id/egg_frame_view"
@@ -73,7 +74,8 @@
android:id="@+id/potion_count_view"
android:layout_width="wrap_content"
android:layout_height="24dp"
- android:padding="0dp"
+ android:paddingHorizontal="4dp"
+ android:minWidth="24dp"
android:gravity="center"
style="@style/Pill"
tools:text="12"
diff --git a/Habitica/res/layout/fragment_guild_detail.xml b/Habitica/res/layout/fragment_guild_detail.xml
index 76805661f..106055841 100644
--- a/Habitica/res/layout/fragment_guild_detail.xml
+++ b/Habitica/res/layout/fragment_guild_detail.xml
@@ -140,8 +140,8 @@
android:layout_width="match_parent"
android:layout_height="65dp"
android:gravity="center_vertical"
- android:paddingStart="16dp"
- android:paddingEnd="16dp"
+ android:paddingStart="@dimen/spacing_large"
+ android:paddingEnd="@dimen/spacing_large"
android:baselineAligned="false">
+ style="@style/Subheader1"/>
+
\ No newline at end of file
diff --git a/Habitica/res/layout/speechbubble.xml b/Habitica/res/layout/speechbubble.xml
index b8db0b087..51401e330 100644
--- a/Habitica/res/layout/speechbubble.xml
+++ b/Habitica/res/layout/speechbubble.xml
@@ -10,7 +10,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:src="@drawable/justin_textbox"
- android:layout_gravity="right"
+ android:layout_gravity="end"
android:layout_marginEnd="30dp"/>
21dp
16dp
- 50dp
+ 54dp
24dp
26dp
16dp
diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml
index 21e038c76..91d728e28 100644
--- a/Habitica/res/values/strings.xml
+++ b/Habitica/res/values/strings.xml
@@ -280,6 +280,7 @@
You rummage in the Armoire and find food. What\'s that doing in here?
You wrestle with the Armoire and gain Experience. Take that!
Sell (%d Gold)
+ Sell
Hatch with potion
Hatch with egg
Invite party
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/CustomizationRecyclerViewAdapter.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/CustomizationRecyclerViewAdapter.kt
index 912387490..ccc25f0b3 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/CustomizationRecyclerViewAdapter.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/CustomizationRecyclerViewAdapter.kt
@@ -152,6 +152,7 @@ class CustomizationRecyclerViewAdapter() : androidx.recyclerview.widget.Recycler
if (customization.type == "background" && customization.identifier == "") {
binding.imageView.load(R.drawable.no_background)
+ binding.imageView.bitmap = null
} else {
binding.imageView.loadImage(customization.getIconName(userSize, hairColor))
}
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ItemRecyclerAdapter.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ItemRecyclerAdapter.kt
index c90b777f2..571988e2a 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ItemRecyclerAdapter.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/adapter/inventory/ItemRecyclerAdapter.kt
@@ -164,7 +164,7 @@ class ItemRecyclerAdapter(val context: Context, val user: User?) : BaseRecyclerV
menu.setTitle(item?.text)
menu.setImage(getImageName(item))
if (item !is QuestContent && item !is SpecialItem) {
- menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.sell, item?.value), true))
+ menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.sell_no_price), true, "gold", item?.value?.toDouble() ?: 0.0))
}
if (item is Egg) {
menu.addMenuItem(BottomSheetMenuItem(resources.getString(R.string.hatch_with_potion)))
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/menu/BottomSheetMenuItem.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/menu/BottomSheetMenuItem.kt
index 235742b71..86829fffe 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/menu/BottomSheetMenuItem.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/menu/BottomSheetMenuItem.kt
@@ -5,33 +5,23 @@ import android.content.res.ColorStateList
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import android.widget.LinearLayout
-import android.widget.TextView
import androidx.core.content.ContextCompat
import com.habitrpg.android.habitica.R
+import com.habitrpg.android.habitica.databinding.MenuBottomSheetItemBinding
-class BottomSheetMenuItem {
-
- private var title: String? = null
- private var isDestructive: Boolean? = null
-
- constructor(title: String) {
- this.title = title
- this.isDestructive = false
- }
-
- constructor(title: String, isDestructive: Boolean?) {
- this.title = title
- this.isDestructive = isDestructive
- }
+class BottomSheetMenuItem(private val title: String, private val isDestructive: Boolean = false, private val currency: String? = null, private val price: Double = 0.0) {
fun inflate(context: Context, inflater: LayoutInflater, contentView: ViewGroup): View {
- val menuItemView = inflater.inflate(R.layout.menu_bottom_sheet_item, contentView, false) as? LinearLayout
- val textView = menuItemView?.findViewById(R.id.textView)
- textView?.text = this.title
- if (this.isDestructive == true) {
- menuItemView?.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(context, R.color.red_10))
+ val binding = MenuBottomSheetItemBinding.inflate(inflater, contentView, false)
+ binding.textView.text = this.title
+ if (this.isDestructive) {
+ binding.root.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(context, R.color.maroon_100))
}
- return menuItemView ?: View(context)
+ if (price > 0) {
+ binding.currencyView.currency = currency ?: "gold"
+ binding.currencyView.value = price
+ binding.currencyView.setTextColor(ContextCompat.getColor(context, R.color.white))
+ }
+ return binding.root
}
}
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/PixelArtView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/PixelArtView.kt
index b486198c1..413c747af 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/PixelArtView.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/PixelArtView.kt
@@ -40,13 +40,16 @@ class PixelArtView @JvmOverloads constructor(
var targetHeight = bitmap?.height ?: 0
val smallestSide = min(width, height)
- if (smallestSide > 0 && targetWidth > 0 && smallestSide != targetWidth) {
- targetWidth = (targetWidth / 3) * (smallestSide / (targetWidth / 3))
- }
- if (smallestSide > 0 && targetHeight > 0 && smallestSide != targetHeight) {
- targetHeight = (targetHeight / 3) * (smallestSide / (targetHeight / 3))
- }
-
+ val factor = min(
+ (if (smallestSide > 0 && targetWidth > 0 && smallestSide != targetWidth) {
+ smallestSide / (targetWidth / 3)
+ } else 1),
+ if (smallestSide > 0 && targetHeight > 0 && smallestSide != targetHeight) {
+ smallestSide / (targetHeight / 3)
+ } else 1
+ )
+ targetWidth = (targetWidth / 3) * factor
+ targetHeight = (targetHeight / 3) * factor
val left = (width - targetWidth) / 2
val top = (height - targetHeight) / 2
targetRect = Rect(left, top, left + targetWidth, top + targetHeight)