diff --git a/Habitica/res/layout/activity_notifications.xml b/Habitica/res/layout/activity_notifications.xml
index 5866b4e2e..59eb84eea 100644
--- a/Habitica/res/layout/activity_notifications.xml
+++ b/Habitica/res/layout/activity_notifications.xml
@@ -39,15 +39,73 @@
-
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Habitica/res/layout/no_notifications.xml b/Habitica/res/layout/no_notifications.xml
index 1e43abf54..0c98882e2 100644
--- a/Habitica/res/layout/no_notifications.xml
+++ b/Habitica/res/layout/no_notifications.xml
@@ -1,9 +1,7 @@
) {
binding.notificationItems.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE or LinearLayout.SHOW_DIVIDER_END
- val currentViews = mutableSetOf().apply {
- addAll(binding.notificationItems.children)
- }
-
lifecycleScope.launch(ExceptionHandler.coroutine()) {
+ val currentViews = mutableSetOf().apply {
+ addAll(binding.notificationItems.children)
+ }
notifications.forEach {
val item: View? = when (it.type) {
Notification.Type.NEW_CHAT_MESSAGE.type -> createNewChatMessageNotification(it)
@@ -174,6 +194,7 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
currentViews.forEach { binding.notificationItems.removeView(it) }
lifecycleScope.launch {
+ binding.progressView.isVisible = false
delay(250)
if (binding.notificationItems.visibility != View.VISIBLE) {
binding.notificationItems.fadeInAnimation(200)
@@ -194,22 +215,6 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
}
}
- private fun createNotificationsHeaderView(notificationCount: Int): View? {
- val header = inflater?.inflate(R.layout.notifications_header, binding.notificationItems, false)
-
- val badge = header?.findViewById(R.id.notifications_title_badge) as? TextView
- badge?.text = notificationCount.toString()
-
- val dismissAllButton = header?.findViewById(R.id.dismiss_all_button) as? Button
- dismissAllButton?.setOnClickListener {
- binding.root.flash()
- HapticFeedbackManager.tap(it)
- viewModel.dismissAllNotifications(notifications)
- }
-
- return header
- }
-
private fun createNewChatMessageNotification(notification: Notification): View? {
val data = notification.data as? NewChatMessageData
val stringId = if (viewModel.isPartyMessage(data)) R.string.new_msg_party else R.string.new_msg_guild
@@ -349,7 +354,7 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
val dismissButton = item?.findViewById(R.id.dismiss_button) as? ImageView
dismissButton?.setOnClickListener {
- container?.flash()
+ it.flash()
HapticFeedbackManager.tap(it)
removeNotificationAndRefresh(notification)
viewModel.dismissNotification(notification)
diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt
index 04deca11e..96b3a5b62 100644
--- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt
+++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/fragments/purchases/SubscriptionBottomSheetFragment.kt
@@ -112,7 +112,11 @@ open class SubscriptionBottomSheetFragment : BottomSheetDialogFragment() {
for (sku in subscriptions) {
updateButtonLabel(sku, sku.subscriptionOfferDetails?.firstOrNull()?.pricingPhases?.pricingPhaseList?.firstOrNull()?.formattedPrice ?: "")
}
- subscriptions.minByOrNull { it.subscriptionOfferDetails?.firstOrNull()?.pricingPhases?.pricingPhaseList?.firstOrNull()?.priceAmountMicros ?: 0 }?.let { selectSubscription(it) }
+ subscriptions
+ .filter { buttonForSku(it)?.isVisible == true }
+ .minByOrNull {
+ it.subscriptionOfferDetails?.firstOrNull()?.pricingPhases?.pricingPhaseList?.firstOrNull()?.priceAmountMicros ?: 0
+ }?.let { selectSubscription(it) }
hasLoadedSubscriptionOptions = true
updateSubscriptionInfo()
}