mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-20 04:39:04 +00:00
Fix bulk gem purchase issues
This commit is contained in:
parent
5cd9ad6945
commit
66199eefbe
7 changed files with 13 additions and 13 deletions
|
|
@ -5,11 +5,8 @@
|
|||
android:screenOrientation="portrait"
|
||||
android:installLocation="auto" >
|
||||
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="com.android.vending.BILLING" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -162,8 +162,8 @@ android {
|
|||
multiDexEnabled true
|
||||
resConfigs "en", "bg", "de", "en-rGB", "es", "fr", "hr-rHR", "in", "it", "iw", "ja", "ko", "lt", "nl", "pl", "pt-rBR", "pt-rPT", "ru", "tr", "zh", "zh-rTW"
|
||||
|
||||
versionCode 2404
|
||||
versionName "2.5"
|
||||
versionCode 2407
|
||||
versionName "2.6"
|
||||
}
|
||||
|
||||
viewBinding {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ open class HabiticaAlertDialog(context: Context) : AlertDialog(context, R.style.
|
|||
private var buttonsWrapper: LinearLayout
|
||||
private var noticeTextView: TextView
|
||||
|
||||
private var additionalContentView: View? = null
|
||||
internal var additionalContentView: View? = null
|
||||
|
||||
var isScrollingLayout: Boolean = false
|
||||
get() {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ class FixValuesEditText(context: Context, attrs: AttributeSet) : FrameLayout(con
|
|||
binding.editTextWrapper.setHintTextAppearance(attributes.getResourceId(R.styleable.FixValuesEditText_hintStyle, R.style.PurpleTextLabel))
|
||||
iconBackgroundColor = attributes.getColor(R.styleable.FixValuesEditText_iconBgColor, 0)
|
||||
|
||||
val iconName = attributes.getString(R.styleable.FixValuesEditText_fixIconName)
|
||||
when (iconName) {
|
||||
when (attributes.getString(R.styleable.FixValuesEditText_fixIconName)) {
|
||||
"health" -> binding.iconView.setImageBitmap(HabiticaIconsHelper.imageOfHeartLightBg())
|
||||
"experience" -> binding.iconView.setImageBitmap(HabiticaIconsHelper.imageOfExperience())
|
||||
"mana" -> binding.iconView.setImageBitmap(HabiticaIconsHelper.imageOfMagic())
|
||||
|
|
|
|||
|
|
@ -213,6 +213,8 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
} else {
|
||||
limitedTextView.setBackgroundColor(ContextCompat.getColor(context, R.color.green_10))
|
||||
}
|
||||
val gemContent = additionalContentView as? PurchaseDialogGemsContent
|
||||
gemContent?.stepperView?.maxValue = (user?.purchased?.plan?.numberOfGemsLeft() ?: 1).toDouble()
|
||||
}
|
||||
|
||||
buyButton.elevation = 0f
|
||||
|
|
|
|||
|
|
@ -25,7 +25,5 @@ internal class PurchaseDialogGemsContent(context: Context) : PurchaseDialogConte
|
|||
super.setItem(item)
|
||||
|
||||
notesTextView.text = item.notes
|
||||
|
||||
stepperView.maxValue = item.limitedNumberLeft?.toDouble()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,17 +54,21 @@ class StepperValueFormView @JvmOverloads constructor(
|
|||
|
||||
private var valueString = ""
|
||||
set(value) {
|
||||
if (value.isEmpty()) return
|
||||
val hasChanged = field != value || editText.text.toString() != field
|
||||
field = value
|
||||
if (value.isEmpty()) {
|
||||
onValueChanged?.invoke(0.0)
|
||||
return
|
||||
}
|
||||
|
||||
if (editText.text.toString() != field) {
|
||||
if (hasChanged) {
|
||||
editText.setText(field)
|
||||
if (editTextIsFocused) {
|
||||
editText.setSelection(field.length)
|
||||
}
|
||||
}
|
||||
val newValue = field.toDoubleOrNull() ?: 0.0
|
||||
if (this.value != newValue) {
|
||||
if (this.value != newValue || hasChanged) {
|
||||
this.value = newValue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue