mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
content display tweaks
This commit is contained in:
parent
813d40ace1
commit
197fbc68df
8 changed files with 33 additions and 16 deletions
|
|
@ -11,7 +11,8 @@
|
|||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/shopitem_image_size"
|
||||
android:layout_height="@dimen/shopitem_image_size" />
|
||||
android:layout_height="@dimen/shopitem_image_size"
|
||||
android:layout_marginTop="@dimen/spacing_medium" />
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -31,6 +32,7 @@
|
|||
android:gravity="center"/>
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/stats_table"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp">
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/shopitem_image_size"
|
||||
android:layout_height="@dimen/shopitem_image_size" />
|
||||
android:layout_height="@dimen/shopitem_image_size"
|
||||
android:layout_marginTop="@dimen/spacing_medium" />
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/shopitem_image_size"
|
||||
android:layout_height="@dimen/shopitem_image_size" />
|
||||
android:layout_height="@dimen/shopitem_image_size"
|
||||
android:layout_marginTop="@dimen/spacing_medium" />
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
<com.habitrpg.common.habitica.views.PixelArtView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/shopitem_image_size"
|
||||
android:layout_height="@dimen/shopitem_image_size" />
|
||||
android:layout_height="@dimen/shopitem_image_size"
|
||||
android:layout_marginTop="@dimen/spacing_medium" />
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
|||
|
|
@ -1520,8 +1520,8 @@
|
|||
<string name="you_own_all_items">You own all of these items</string>
|
||||
<string name="try_on_next_month">You can try them on by customizing your avatar. Be sure to check back later for next month’s options!</string>
|
||||
<string name="try_on_next_season">You can try them on by customizing your avatar. Be sure to check back later for next season’s options!</string>
|
||||
<string name="try_on_customize">"You can try them on by customizing your avatar. "</string>
|
||||
<string name="try_on_equipment">"You can try them on by Equipment. Be sure to check back later for next month’s options! "</string>
|
||||
<string name="try_on_customize">You can try them on by customizing your avatar.</string>
|
||||
<string name="try_on_equipment">You can try them on from Equipment. New stock comes in at the beginning of each month!</string>
|
||||
<string name="healers">Healers</string>
|
||||
<string name="rogues">Rogues</string>
|
||||
<string name="warriors">Warriors</string>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ fun LoadingButton(
|
|||
when (state) {
|
||||
LoadingButtonState.FAILED -> HabiticaTheme.colors.errorBackground
|
||||
LoadingButtonState.SUCCESS -> Color.Transparent
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.disabledContainerColor else colorStyle.containerColor
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.containerColor else colorStyle.disabledContainerColor
|
||||
},
|
||||
animationSpec = colorSpec,
|
||||
)
|
||||
|
|
@ -118,7 +118,7 @@ fun LoadingButton(
|
|||
when (state) {
|
||||
LoadingButtonState.FAILED -> Color.White
|
||||
LoadingButtonState.SUCCESS -> if (type == LoadingButtonType.DESTRUCTIVE) HabiticaTheme.colors.errorColor else HabiticaTheme.colors.successColor
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.disabledContentColor else colorStyle.disabledContainerColor
|
||||
else -> if (state != LoadingButtonState.DISABLED) colorStyle.contentColor else colorStyle.disabledContentColor
|
||||
},
|
||||
animationSpec = colorSpec,
|
||||
)
|
||||
|
|
@ -289,5 +289,11 @@ private fun Preview() {
|
|||
}, content = {
|
||||
Text("Do something")
|
||||
})
|
||||
LoadingButton(LoadingButtonState.CONTENT, {}, content = {
|
||||
Text("Do something")
|
||||
})
|
||||
LoadingButton(LoadingButtonState.DISABLED, {}, content = {
|
||||
Text("Disabled Button")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,9 +124,13 @@ class PurchaseDialog(
|
|||
}
|
||||
shopItem.isTypeGear -> {
|
||||
contentView = PurchaseDialogGearContent(context)
|
||||
lifecycleScope.launchCatching {
|
||||
inventoryRepository.getEquipment(shopItem.key).firstOrNull()
|
||||
?.let { contentView.setEquipment(it) }
|
||||
if (shopItem.purchaseType == "mystery_set") {
|
||||
lifecycleScope.launchCatching {
|
||||
inventoryRepository.getEquipment(shopItem.key).firstOrNull()
|
||||
?.let { contentView.setEquipment(it) }
|
||||
}
|
||||
} else {
|
||||
contentView.hideStatsTable()
|
||||
}
|
||||
checkGearClass()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.ui.views.shops
|
|||
import android.content.Context
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.databinding.DialogPurchaseContentGearBinding
|
||||
import com.habitrpg.android.habitica.models.inventory.Equipment
|
||||
|
|
@ -23,19 +24,20 @@ internal class PurchaseDialogGearContent(context: Context) : PurchaseDialogConte
|
|||
}
|
||||
|
||||
fun setEquipment(equipment: Equipment) {
|
||||
if (equipment.isValid) {
|
||||
if (equipment.isValid && equipment.type != "mystery") {
|
||||
configureFieldsForValue(binding.strLabel, binding.strValue, equipment.str)
|
||||
configureFieldsForValue(binding.perLabel, binding.perValue, equipment.per)
|
||||
configureFieldsForValue(binding.conLabel, binding.conValue, equipment.con)
|
||||
configureFieldsForValue(binding.intLabel, binding.intValue, equipment.intelligence)
|
||||
} else {
|
||||
configureFieldsForValue(binding.strLabel, binding.strValue, 0)
|
||||
configureFieldsForValue(binding.perLabel, binding.perValue, 0)
|
||||
configureFieldsForValue(binding.conLabel, binding.conValue, 0)
|
||||
configureFieldsForValue(binding.intLabel, binding.intValue, 0)
|
||||
hideStatsTable()
|
||||
}
|
||||
}
|
||||
|
||||
fun hideStatsTable() {
|
||||
binding.statsTable.isVisible = false
|
||||
}
|
||||
|
||||
private fun configureFieldsForValue(
|
||||
labelView: TextView?,
|
||||
valueTextView: TextView?,
|
||||
|
|
|
|||
Loading…
Reference in a new issue