mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix bulk warning handling
This commit is contained in:
parent
a298c7ffef
commit
13829e34a5
4 changed files with 20 additions and 19 deletions
|
|
@ -162,7 +162,7 @@ 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 2441
|
||||
versionCode 2444
|
||||
versionName "2.7"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@
|
|||
android:background="@color/gray_500"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentStart="true"/>
|
||||
<ImageButton
|
||||
android:id="@+id/up_button"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray_600"
|
||||
android:src="@drawable/ic_arrow_drop_up_gray_48dp_states"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/down_button"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray_600"
|
||||
android:src="@drawable/ic_arrow_drop_down_gray_48dp_states"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/up_button"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/gray_600"
|
||||
android:src="@drawable/ic_arrow_drop_up_gray_48dp_states"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1055,6 +1055,6 @@
|
|||
<string name="excess_items">Excess Items</string>
|
||||
<string name="excessItemsXLeft">You only need %d %s to hatch all possible pets. Are you sure you want to purchase %d?</string>
|
||||
<string name="purchaseX">Purchase %d</string>
|
||||
<string name="excessItemsNoneLeft">You\'ve already hatched all possible %s pets. Are you sure you want to purchase %d %s?</string>
|
||||
<string name="excessItemsNoneLeft">You already have everything you need for all %s pets. Are you sure you want to purchase %d %ss?</string>
|
||||
<string name="equip">Equip</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import io.reactivex.functions.Consumer
|
|||
import org.greenrobot.eventbus.EventBus
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.max
|
||||
|
||||
class PurchaseDialog(context: Context, component: UserComponent?, val item: ShopItem) : HabiticaAlertDialog(context) {
|
||||
|
||||
|
|
@ -403,13 +404,13 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
ownedCount += egg.numberOwned
|
||||
}
|
||||
}
|
||||
}.firstElement().subscribe {
|
||||
val remaining = 20 - ownedCount
|
||||
onResult(remaining)
|
||||
}
|
||||
}.firstElement().doOnComplete {
|
||||
val remaining = 18 - ownedCount
|
||||
onResult(max(0, remaining))
|
||||
}.subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
|
||||
} else if (item.purchaseType == "hatchingPotions") {
|
||||
var ownedCount = 0
|
||||
inventoryRepository.getPets("Wolf", "quest", item.key).filter {
|
||||
inventoryRepository.getPets("Wolf", "premium", item.key).filter {
|
||||
return@filter it.size > 0
|
||||
}.flatMap { inventoryRepository.getOwnedPets() }.doOnNext { for (pet in it) {
|
||||
if (pet.key?.contains(item.key) == true) {
|
||||
|
|
@ -428,10 +429,10 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
ownedCount += potion.numberOwned
|
||||
}
|
||||
}
|
||||
}.firstElement().subscribe {
|
||||
}.firstElement().doOnComplete {
|
||||
val remaining = 18 - ownedCount
|
||||
onResult(remaining)
|
||||
}
|
||||
onResult(max(0, remaining))
|
||||
}.subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
|
||||
} else {
|
||||
onResult(-1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue