mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-07-13 17:51:57 +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
|
-keepattributes Signature
|
||||||
-keep class kotlin.coroutines.Continuation
|
-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 {
|
init {
|
||||||
setView(binding.root)
|
setView(binding.root)
|
||||||
this.setButton(BUTTON_POSITIVE, context.getString(R.string.save)) { _, _ ->
|
this.setButton(BUTTON_POSITIVE, context.getString(R.string.save)) { _, _ ->
|
||||||
saveChanges()
|
|
||||||
}
|
}
|
||||||
this.setButton(BUTTON_NEUTRAL, context.getString(R.string.action_cancel)) { _, _ ->
|
this.setButton(BUTTON_NEUTRAL, context.getString(R.string.action_cancel)) { _, _ ->
|
||||||
this.dismiss()
|
this.dismiss()
|
||||||
|
|
@ -54,7 +53,7 @@ class BulkAllocateStatsDialog(context: Context, private val userRepository: User
|
||||||
private fun saveChanges() {
|
private fun saveChanges() {
|
||||||
getButton(BUTTON_POSITIVE).isEnabled = false
|
getButton(BUTTON_POSITIVE).isEnabled = false
|
||||||
lifecycleScope.launchCatching {
|
lifecycleScope.launchCatching {
|
||||||
userRepository.bulkAllocatePoints(
|
val result = userRepository.bulkAllocatePoints(
|
||||||
binding.strengthSliderView.currentValue,
|
binding.strengthSliderView.currentValue,
|
||||||
binding.intelligenceSliderView.currentValue,
|
binding.intelligenceSliderView.currentValue,
|
||||||
binding.constitutionSliderView.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) {
|
private fun checkRedistribution(excludedSlider: StatsSliderView) {
|
||||||
val diff = allocatedPoints - pointsToAllocate
|
val diff = allocatedPoints - pointsToAllocate
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
NAME=4.3.7
|
NAME=4.3.7
|
||||||
CODE=7891
|
CODE=7911
|
||||||
Loading…
Reference in a new issue