Skip to content

Commit

Permalink
fix bulk stat allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Jun 7, 2024
1 parent 012a8fe commit 7d445cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions Habitica/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@

-keepattributes Signature
-keep class kotlin.coroutines.Continuation
-dontwarn com.habitrpg.android.habitica.extensions.ViewGroupExt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME=4.3.7
CODE=7891
CODE=7911

0 comments on commit 7d445cc

Please sign in to comment.