mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
fix bulk stat allocation
This commit is contained in:
parent
012a8fe24f
commit
7d445cc75e
3 changed files with 10 additions and 3 deletions
1
Habitica/proguard-rules.pro
vendored
1
Habitica/proguard-rules.pro
vendored
|
|
@ -133,3 +133,4 @@
|
|||
|
||||
-keepattributes Signature
|
||||
-keep class kotlin.coroutines.Continuation
|
||||
-dontwarn com.habitrpg.android.habitica.extensions.ViewGroupExt
|
||||
|
|
@ -44,7 +44,6 @@ class BulkAllocateStatsDialog(context: Context, private val userRepository: User
|
|||
init {
|
||||
setView(binding.root)
|
||||
this.setButton(BUTTON_POSITIVE, context.getString(R.string.save)) { _, _ ->
|
||||
saveChanges()
|
||||
}
|
||||
this.setButton(BUTTON_NEUTRAL, context.getString(R.string.action_cancel)) { _, _ ->
|
||||
this.dismiss()
|
||||
|
|
@ -54,7 +53,7 @@ class BulkAllocateStatsDialog(context: Context, private val userRepository: User
|
|||
private fun saveChanges() {
|
||||
getButton(BUTTON_POSITIVE).isEnabled = false
|
||||
lifecycleScope.launchCatching {
|
||||
userRepository.bulkAllocatePoints(
|
||||
val result = userRepository.bulkAllocatePoints(
|
||||
binding.strengthSliderView.currentValue,
|
||||
binding.intelligenceSliderView.currentValue,
|
||||
binding.constitutionSliderView.currentValue,
|
||||
|
|
@ -96,6 +95,13 @@ class BulkAllocateStatsDialog(context: Context, private val userRepository: User
|
|||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
getButton(BUTTON_POSITIVE).setOnClickListener {
|
||||
saveChanges()
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkRedistribution(excludedSlider: StatsSliderView) {
|
||||
val diff = allocatedPoints - pointsToAllocate
|
||||
if (diff > 0) {
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
NAME=4.3.7
|
||||
CODE=7891
|
||||
CODE=7911
|
||||
Loading…
Reference in a new issue