mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-24 14:45:46 +00:00
AG fixes
This commit is contained in:
parent
1b12b3924d
commit
c083deef26
11 changed files with 30 additions and 16 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 2447
|
||||
versionCode 2450
|
||||
versionName "2.7"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@
|
|||
android:layout_height="@dimen/diamond_button_height"
|
||||
android:text="@string/login_btn_apple"
|
||||
android:drawableStart="@drawable/apple_icon"
|
||||
android:visibility="gone"
|
||||
style="@style/LoginButton"/>
|
||||
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
android:textSize="12sp"
|
||||
android:textColor="@color/gray_200"
|
||||
android:layout_marginTop="@dimen/spacing_medium"
|
||||
android:visibility="gone"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1032,7 +1032,7 @@
|
|||
<string name="purchase_equipment_title">Purchase Equipment</string>
|
||||
<string name="create_task_description">Add a task for something you would like to accomplish this week</string>
|
||||
<string name="complete_task_description">Check off any of your tasks to earn rewards</string>
|
||||
<string name="hatch_pet_description">Head over to your Items and try combining a Hatching Potion and Egg</string>
|
||||
<string name="hatch_pet_description">Complete tasks to get a Hatching Potion and Egg then hatch your Pet!</string>
|
||||
<string name="feedPet_description">Complete tasks to get food! You can feed it to your pet from Pets & Mounts</string>
|
||||
<string name="purchase_equipment_description">Equipment is a way to customize your avatar and improve your stats</string>
|
||||
<string name="createdTaskTitle">Created your first task</string>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
package com.habitrpg.android.habitica.events
|
||||
|
||||
class ShowAchievementDialog(var type: String, val id: String)
|
||||
class ShowAchievementDialog(var type: String, val id: String, val isLastOnboardingAchievement: Boolean = false)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class NotificationsManager (private val context: Context) {
|
|||
|
||||
private fun handlePopupNotifications(notifications: List<Notification>): Boolean? {
|
||||
val now = Date()
|
||||
if (now.time - (lastNotificationHandling?.time ?: 0) < 500) {
|
||||
if (now.time - (lastNotificationHandling?.time ?: 0) < 300) {
|
||||
return true
|
||||
}
|
||||
lastNotificationHandling = now
|
||||
|
|
@ -74,7 +74,9 @@ class NotificationsManager (private val context: Context) {
|
|||
Notification.Type.ACHIEVEMENT_GUILD_JOINED.type -> displayAchievementNotification(it)
|
||||
Notification.Type.ACHIEVEMENT_CHALLENGE_JOINED.type -> displayAchievementNotification(it)
|
||||
Notification.Type.ACHIEVEMENT_INVITED_FRIEND.type -> displayAchievementNotification(it)
|
||||
Notification.Type.ACHIEVEMENT_GENERIC.type -> displayGenericAchievementNotification(it)
|
||||
Notification.Type.ACHIEVEMENT_GENERIC.type -> displayGenericAchievementNotification(it, notifications.find { notif ->
|
||||
notif.type == Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type
|
||||
} != null)
|
||||
Notification.Type.ACHIEVEMENT_ONBOARDING_COMPLETE.type -> displayAchievementNotification(it)
|
||||
Notification.Type.FIRST_DROP.type -> displayFirstDropNotification(it)
|
||||
else -> false
|
||||
|
|
@ -121,9 +123,9 @@ class NotificationsManager (private val context: Context) {
|
|||
return true
|
||||
}
|
||||
|
||||
private fun displayGenericAchievementNotification(notification: Notification): Boolean {
|
||||
private fun displayGenericAchievementNotification(notification: Notification, isLastOnboardingAchievement: Boolean): Boolean {
|
||||
val achievement = (notification.data as? AchievementData)?.achievement ?: ""
|
||||
EventBus.getDefault().post(ShowAchievementDialog(achievement, notification.id))
|
||||
EventBus.getDefault().post(ShowAchievementDialog(achievement, notification.id, isLastOnboardingAchievement))
|
||||
logOnboardingEvents(achievement)
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -707,6 +707,7 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
.subscribe(Action {
|
||||
retrieveUser(true)
|
||||
val dialog = AchievementDialog(this)
|
||||
dialog.isLastOnboardingAchievement = event.isLastOnboardingAchievement
|
||||
dialog.setType(event.type)
|
||||
dialog.enqueue()
|
||||
apiClient.readNotification(event.id)
|
||||
|
|
@ -759,7 +760,7 @@ open class MainActivity : BaseActivity(), TutorialView.OnTutorialReaction {
|
|||
dialog.setTitle(getString(R.string.hatched_pet_title, potionName, eggName))
|
||||
dialog.setAdditionalContentView(petWrapper)
|
||||
dialog.addButton(R.string.equip, true) { _, _ ->
|
||||
inventoryRepository.equip(user, "pet", "Pet-" + egg.key + "-" + potion.key)
|
||||
inventoryRepository.equip(user, "pet", egg.key + "-" + potion.key)
|
||||
.subscribe(Consumer {}, RxErrorHandler.handleEmptyError())
|
||||
}
|
||||
dialog.addButton(R.string.share, false) { hatchingDialog, _ ->
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ class ShopRecyclerAdapter(private val configManager: AppConfigManager) : android
|
|||
val item = obj as? ShopItem ?: return
|
||||
val itemHolder = holder as? ShopItemViewHolder ?: return
|
||||
itemHolder.bind(item, item.canAfford(user, 1))
|
||||
if (ownedItems.containsKey(item.key+"-"+item.pinType)) {
|
||||
itemHolder.itemCount = ownedItems[item.key+"-"+item.pinType]?.numberOwned ?: 0
|
||||
ownedItems[item.key+"-"+item.purchaseType]?.let {
|
||||
itemHolder.itemCount = it.numberOwned
|
||||
}
|
||||
itemHolder.isPinned = pinnedItemKeys.contains(item.key)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
}
|
||||
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
compositeSubscription.add(adapter.getUnlockCustomizationEvents()
|
||||
.flatMap<UnlockResponse> { customization ->
|
||||
.flatMap { customization ->
|
||||
val user = this.user
|
||||
if (user != null) {
|
||||
userRepository.unlockPath(user, customization)
|
||||
|
|
@ -57,9 +57,11 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
Flowable.empty()
|
||||
}
|
||||
}
|
||||
.flatMap { userRepository.retrieveUser(withTasks = false, forced = true) }
|
||||
.flatMap { inventoryRepository.retrieveInAppRewards() }
|
||||
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
compositeSubscription.add(adapter.getUnlockSetEvents()
|
||||
.flatMap<UnlockResponse> { set ->
|
||||
.flatMap { set ->
|
||||
val user = this.user
|
||||
if (user != null) {
|
||||
userRepository.unlockPath(user, set)
|
||||
|
|
@ -67,6 +69,8 @@ class AvatarCustomizationFragment : BaseMainFragment() {
|
|||
Flowable.empty()
|
||||
}
|
||||
}
|
||||
.flatMap { userRepository.retrieveUser(withTasks = false, forced = true) }
|
||||
.flatMap { inventoryRepository.retrieveInAppRewards() }
|
||||
.subscribe(Consumer { }, RxErrorHandler.handleEmptyError()))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.habitrpg.android.habitica.ui.views.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Typeface
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.util.TypedValue
|
||||
|
|
@ -15,6 +16,7 @@ import com.habitrpg.android.habitica.models.user.User
|
|||
import com.habitrpg.android.habitica.ui.helpers.DataBindingUtils
|
||||
|
||||
class AchievementDialog(context: Context) : HabiticaAlertDialog(context) {
|
||||
var isLastOnboardingAchievement: Boolean = false
|
||||
|
||||
private val binding: DialogAchievementDetailBinding = DialogAchievementDetailBinding.inflate(context.layoutInflater)
|
||||
|
||||
|
|
@ -51,6 +53,7 @@ class AchievementDialog(context: Context) : HabiticaAlertDialog(context) {
|
|||
binding.titleView.setTextSize(TypedValue.COMPLEX_UNIT_SP,14f)
|
||||
binding.achievementWrapper.visibility = View.GONE
|
||||
binding.onboardingDoneIcon.visibility = View.VISIBLE
|
||||
binding.titleView.typeface = Typeface.DEFAULT
|
||||
val titleText = context.getString(titleID)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
binding.titleView.setText(Html.fromHtml(titleText, Html.FROM_HTML_MODE_LEGACY), TextView.BufferType.SPANNABLE)
|
||||
|
|
@ -67,8 +70,10 @@ class AchievementDialog(context: Context) : HabiticaAlertDialog(context) {
|
|||
|
||||
addButton(R.string.onwards, isPrimary = true, isDestructive = false) { _, _ ->
|
||||
}
|
||||
addButton(R.string.view_onboarding_tasks, false, false) { _, _ ->
|
||||
MainNavigationController.navigate(R.id.adventureGuideActivity)
|
||||
if (!isLastOnboardingAchievement) {
|
||||
addButton(R.string.view_onboarding_tasks, false, false) { _, _ ->
|
||||
MainNavigationController.navigate(R.id.adventureGuideActivity)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addButton(R.string.view_achievements, isPrimary = true, isDestructive = false) { _, _ ->
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"properties": [],
|
||||
"versionCode": 2447,
|
||||
"versionName": "2447",
|
||||
"versionCode": 2450,
|
||||
"versionName": "2450",
|
||||
"enabled": true,
|
||||
"outputFile": "Habitica-staff-release.apk"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue