mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix armoire notifications
This commit is contained in:
parent
1a0df90180
commit
0bb02d49be
5 changed files with 15 additions and 15 deletions
|
|
@ -25,7 +25,8 @@
|
|||
tools:visibility="visible" />
|
||||
<LinearLayout
|
||||
android:id="@+id/content_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="12dp"
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@
|
|||
<string name="pets">Pets</string>
|
||||
<string name="mounts">Mounts</string>
|
||||
|
||||
<string name="armoireEquipment">You found a piece of rare Equipment in the Armoire: %s! Awesome!</string>
|
||||
<string name="armoireEquipment">You found %s in the Armoire</string>
|
||||
<string name="armoireFood">You rummage in the Armoire and find %1$s %2$s. What\'s that doing in here?</string>
|
||||
<string name="armoireExp">You wrestle with the Armoire and gain Experience. Take that!</string>
|
||||
<string name="armoireNotesFull">Open the Armoire to randomly receive special Equipment, Experience, or food! Equipment pieces remaining: %d</string>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.*
|
|||
class RewardsRecyclerviewFragment : TaskRecyclerViewFragment() {
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
inventoryRepository.retrieveInAppRewards().subscribe(Consumer { }, RxErrorHandler.handleEmptyError())
|
||||
compositeSubscription.add(inventoryRepository.retrieveInAppRewards().subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ class RewardsRecyclerviewFragment : TaskRecyclerViewFragment() {
|
|||
}
|
||||
recyclerView.itemAnimator = SafeDefaultItemAnimator()
|
||||
|
||||
inventoryRepository.getInAppRewards().subscribe(Consumer {
|
||||
compositeSubscription.add(inventoryRepository.getInAppRewards().subscribe(Consumer {
|
||||
(recyclerAdapter as RewardsRecyclerViewAdapter?)?.updateItemRewards(it)
|
||||
}, RxErrorHandler.handleEmptyError())
|
||||
}, RxErrorHandler.handleEmptyError()))
|
||||
}
|
||||
|
||||
override fun getLayoutManager(context: Context?): LinearLayoutManager =
|
||||
|
|
@ -54,11 +54,11 @@ class RewardsRecyclerviewFragment : TaskRecyclerViewFragment() {
|
|||
|
||||
override fun onRefresh() {
|
||||
refreshLayout.isRefreshing = true
|
||||
userRepository.retrieveUser(true, true)
|
||||
compositeSubscription.add(userRepository.retrieveUser(true, true)
|
||||
.flatMap<List<ShopItem>> { inventoryRepository.retrieveInAppRewards() }
|
||||
.doOnTerminate {
|
||||
refreshLayout?.isRefreshing = false
|
||||
}.subscribe(Consumer { }, RxErrorHandler.handleEmptyError())
|
||||
}.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
}
|
||||
|
||||
private fun setGridSpanCount(width: Int) {
|
||||
|
|
|
|||
|
|
@ -26,16 +26,16 @@ class HabiticaSnackbar
|
|||
private constructor(parent: ViewGroup, content: View, callback: ContentViewCallback) : BaseTransientBottomBar<HabiticaSnackbar>(parent, content, callback) {
|
||||
|
||||
fun setTitle(title: CharSequence?): HabiticaSnackbar {
|
||||
val textView = view.findViewById<View>(R.id.snackbar_title) as TextView
|
||||
textView.text = title
|
||||
textView.visibility = if (title != null) View.VISIBLE else View.GONE
|
||||
val textView = view.findViewById<View>(R.id.snackbar_title) as? TextView
|
||||
textView?.text = title
|
||||
textView?.visibility = if (title != null) View.VISIBLE else View.GONE
|
||||
return this
|
||||
}
|
||||
|
||||
fun setText(text: CharSequence?): HabiticaSnackbar {
|
||||
val textView = view.findViewById<View>(R.id.snackbar_text) as TextView
|
||||
textView.text = text
|
||||
textView.visibility = if (text != null) View.VISIBLE else View.GONE
|
||||
val textView = view.findViewById<View>(R.id.snackbar_text) as? TextView
|
||||
textView?.text = text
|
||||
textView?.visibility = if (text != null) View.VISIBLE else View.GONE
|
||||
return this
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
if (shopItem.key == "armoire") {
|
||||
snackbarText[0] = when {
|
||||
buyResponse.armoire["type"] == "gear" -> context.getString(R.string.armoireEquipment, buyResponse.armoire["dropText"])
|
||||
buyResponse.armoire["type"] == "food" -> context.getString(R.string.armoireFood, buyResponse.armoire["dropArticle"], buyResponse.armoire["dropText"])
|
||||
buyResponse.armoire["type"] == "food" -> context.getString(R.string.armoireFood, buyResponse.armoire["dropArticle"] ?: "", buyResponse.armoire["dropText"])
|
||||
else -> context.getString(R.string.armoireExp)
|
||||
}
|
||||
}
|
||||
|
|
@ -231,7 +231,6 @@ class PurchaseDialog(context: Context, component: UserComponent?, val item: Shop
|
|||
.doOnNext {
|
||||
val event = ShowSnackbarEvent()
|
||||
if (snackbarText[0].isNotEmpty()) {
|
||||
event.title = context.getString(R.string.successful_purchase, shopItem.text)
|
||||
event.text = snackbarText[0]
|
||||
} else {
|
||||
event.text = context.getString(R.string.successful_purchase, shopItem.text)
|
||||
|
|
|
|||
Loading…
Reference in a new issue