diff --git a/Habitica/build.gradle b/Habitica/build.gradle index e7624c566..7d9d097fa 100644 --- a/Habitica/build.gradle +++ b/Habitica/build.gradle @@ -132,7 +132,7 @@ dependencies { implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' implementation "androidx.paging:paging-runtime-ktx:2.1.2" implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' implementation 'com.willowtreeapps:signinwithapplebutton:0.2' @@ -158,8 +158,8 @@ 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 2519 - versionName "2.8" + versionCode 2531 + versionName "3.0" } viewBinding { @@ -267,6 +267,11 @@ android { } } +androidExtensions { + features = ['parcelize'] + experimental = true +} + Properties props = new Properties() def propFile = new File('signingrelease.properties') if (propFile.canRead()) { diff --git a/Habitica/res/layout/party_member.xml b/Habitica/res/layout/party_member.xml index 9f9921d81..6b96bfc89 100644 --- a/Habitica/res/layout/party_member.xml +++ b/Habitica/res/layout/party_member.xml @@ -77,7 +77,7 @@ @@ -95,7 +95,7 @@ @@ -113,7 +113,7 @@ diff --git a/Habitica/res/layout/purchase_gem_view.xml b/Habitica/res/layout/purchase_gem_view.xml index b02ee12fd..eec80af16 100644 --- a/Habitica/res/layout/purchase_gem_view.xml +++ b/Habitica/res/layout/purchase_gem_view.xml @@ -15,17 +15,21 @@ android:contentDescription="@string/gems" android:layout_marginTop="20dp"/> - + android:layout_height="wrap_content" + android:gravity="center"> + android:layout_gravity="center" + android:scaleType="fitStart" + android:layout_marginEnd="8dp" + /> - + + - \ No newline at end of file diff --git a/Habitica/res/values-night/colors.contributor.xml b/Habitica/res/values-night/colors.contributor.xml new file mode 100644 index 000000000..238101d52 --- /dev/null +++ b/Habitica/res/values-night/colors.contributor.xml @@ -0,0 +1,13 @@ + + + #E6E6E6 + #E62E84 + #E61C1C + #E61017 + #E65C00 + #E69215 + #4CE6AD + #25D5E6 + #35ABE6 + #8F50FF + \ No newline at end of file diff --git a/Habitica/res/values-night/colors.tavern.xml b/Habitica/res/values-night/colors.tavern.xml new file mode 100644 index 000000000..1960e2e45 --- /dev/null +++ b/Habitica/res/values-night/colors.tavern.xml @@ -0,0 +1,9 @@ + + + #121212 + #333333 + @color/text_green + #4D4D4D + #000000 + #000000 + \ No newline at end of file diff --git a/Habitica/res/values-sw320dp/dimens.xml b/Habitica/res/values-sw320dp/dimens.xml deleted file mode 100644 index a6b3daec9..000000000 --- a/Habitica/res/values-sw320dp/dimens.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/Habitica/res/values-sw600dp/dimens.xml b/Habitica/res/values-sw600dp/dimens.xml deleted file mode 100644 index 1ba777d65..000000000 --- a/Habitica/res/values-sw600dp/dimens.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Habitica/res/values/bools.xml b/Habitica/res/values/bools.xml deleted file mode 100644 index a6b3daec9..000000000 --- a/Habitica/res/values/bools.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/Habitica/res/values/colors.classes.xml b/Habitica/res/values/colors.classes.xml deleted file mode 100644 index a6b3daec9..000000000 --- a/Habitica/res/values/colors.classes.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/Habitica/res/values/dimens.xml b/Habitica/res/values/dimens.xml index d043d5668..af620e297 100644 --- a/Habitica/res/values/dimens.xml +++ b/Habitica/res/values/dimens.xml @@ -113,7 +113,7 @@ 21dp 16dp - 38dp + 53dp 24dp 26dp 16dp diff --git a/Habitica/res/values/strings.xml b/Habitica/res/values/strings.xml index 7c7679474..8da6df30b 100644 --- a/Habitica/res/values/strings.xml +++ b/Habitica/res/values/strings.xml @@ -1096,12 +1096,11 @@ %s to %s How it works Limitations - Between September 22nd and 30th, simply purchase any Gem bundle like usual and your account will be credited with the promotional amount of Gems. More Gems to spend, share, or save for any future releases! - This promotion only applies during the limited time event. This event starts on September 22nd at 8:00 AM EDT (12:00 UTC) and will end September 30th at 8:00 PM EDT (00:00 UTC). The promo offer is only available when buying Gems for yourself. + Between %s and %s, simply purchase any Gem bundle like usual and your account will be credited with the promotional amount of Gems. More Gems to spend, share, or save for any future releases! The Fall Gala is in full swing so we thought it was the perfect time to introduce our first ever Gem Sale! Now you will get more Gems with each purchase than ever before. View Gem Bundles - Between October 29th and November 2nd, simply purchase any Gem bundle like usual and your account will be credited with the promotional amount of Gems. More Gems to spend, share, or save for any future releases! - This promotion only applies during the limited time event. This event starts on October 29th at 8:00 AM EDT (12:00 UTC) and will end November 2nd at 8:00 PM EDT (00:00 UTC). The promo offer is only available when buying Gems for yourself. + Between %s and %s, simply purchase any Gem bundle like usual and your account will be credited with the promotional amount of Gems. More Gems to spend, share, or save for any future releases! + This promotion only applies during the limited time event. This event starts on %s (12:00 UTC) and will end %s (00:00 UTC). The promo offer is only available when buying Gems for yourself. The Gem Sale is back to haunt the very end of this year’s Fall Gala! This is one last chance to get more Gems than ever, so stock up while it lasts! Dark Mode Theme Mode diff --git a/Habitica/res/values/styles.challenges.xml b/Habitica/res/values/styles.challenges.xml index d4f01eadb..3c22d9e79 100644 --- a/Habitica/res/values/styles.challenges.xml +++ b/Habitica/res/values/styles.challenges.xml @@ -1,7 +1,5 @@ - - - \ No newline at end of file diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/models/WorldState.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/models/WorldState.kt index cb99a5444..65da67a38 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/models/WorldState.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/models/WorldState.kt @@ -3,6 +3,7 @@ package com.habitrpg.android.habitica.models import com.facebook.internal.Mutable import com.habitrpg.android.habitica.models.inventory.QuestProgress import com.habitrpg.android.habitica.models.inventory.QuestRageStrike +import java.util.* class WorldState { @@ -11,4 +12,7 @@ class WorldState { var progress: QuestProgress? = null var rageStrikes: MutableList? = null + var currentEventKey: String? = null + var currentEventStartDate: Date? = null + var currentEventEndDate: Date? = null } \ No newline at end of file diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/FallExtraGemsHabiticaPromotion.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/FallExtraGemsHabiticaPromotion.kt index 489e8504b..74c348dda 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/FallExtraGemsHabiticaPromotion.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/FallExtraGemsHabiticaPromotion.kt @@ -18,15 +18,13 @@ import com.habitrpg.android.habitica.ui.views.promo.PromoMenuView import java.text.SimpleDateFormat import java.util.* -class FallExtraGemsHabiticaPromotion: HabiticaPromotion() { +class FallExtraGemsHabiticaPromotion(startDate: Date?, endDate: Date?) : HabiticaPromotion() { override val identifier: String get() = "fall_extra_gems" override val promoType: PromoType get() = PromoType.GEMS_AMOUNT - override val startDate: Date - get() = DateUtils.createDate(2020, 9, 22) - override val endDate: Date - get() = DateUtils.createDate(2020, 9, 30) + override val startDate: Date = startDate ?: DateUtils.createDate(2020, 9, 22) + override val endDate: Date = endDate ?: DateUtils.createDate(2020, 9, 30) override fun pillBackgroundDrawable(context: Context): Drawable { return ContextCompat.getDrawable(context, R.drawable.fall_promo_pill_bg) ?: ShapeDrawable() @@ -95,13 +93,15 @@ class FallExtraGemsHabiticaPromotion: HabiticaPromotion() { ContextCompat.getColor(context, R.color.green_50), ContextCompat.getColor(context, R.color.brand_300) ).shuffled() - binding.amountBackground.background = BitmapDrawable(context.resources, + val drawable = BitmapDrawable(context.resources, HabiticaIconsHelper.imageOfFallGemPromoBG( colors[0], colors[1], colors[2], colors[3] )) + binding.amountBackgroundLeft.background = drawable + binding.amountBackgroundRight.background = drawable binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6")) binding.gemsTextView.setTextColor(Color.parseColor("#FEE2B6")) binding.footerTextView.visibility = View.VISIBLE @@ -135,7 +135,8 @@ class FallExtraGemsHabiticaPromotion: HabiticaPromotion() { fragment.binding?.promptButton?.setTextColor(ContextCompat.getColor(context, R.color.white)) fragment.binding?.promptButton?.setOnClickListener { MainNavigationController.navigate(R.id.gemPurchaseActivity) } - fragment.binding?.instructionDescriptionView?.setText(R.string.fall_promo_info_instructions) - fragment.binding?.limitationsDescriptionView?.setText(R.string.fall_promo_info_limitations) + fragment.binding?.instructionDescriptionView?.text = context.getString(R.string.fall_promo_info_instructions, formatter.format(startDate), formatter.format(endDate)) + val limitationsFormatter = SimpleDateFormat.getDateTimeInstance() + fragment.binding?.limitationsDescriptionView?.text = context.getString(R.string.gems_promo_info_limitations, limitationsFormatter.format(startDate), limitationsFormatter.format(endDate)) } } \ No newline at end of file diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/HabiticaPromotion.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/HabiticaPromotion.kt index 79d60e96e..4fe32a1bf 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/HabiticaPromotion.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/HabiticaPromotion.kt @@ -36,10 +36,10 @@ abstract class HabiticaPromotion { abstract fun configureInfoFragment(fragment: PromoInfoFragment) } -fun getHabiticaPromotionFromKey(key: String): HabiticaPromotion? { +fun getHabiticaPromotionFromKey(key: String, startDate: Date?, endDate: Date?): HabiticaPromotion? { return when (key) { - "fall_extra_gems" -> FallExtraGemsHabiticaPromotion() - "spooky_extra_gems" -> SpookyExtraGemsHabiticaPromotion() + "fall_extra_gems" -> FallExtraGemsHabiticaPromotion(startDate, endDate) + "spooky_extra_gems" -> SpookyExtraGemsHabiticaPromotion(startDate, endDate) else -> null } } diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/SpookyExtraGemsHabiticaPromo.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/SpookyExtraGemsHabiticaPromo.kt index e5b21cd6b..030c48b7c 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/SpookyExtraGemsHabiticaPromo.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/models/promotions/SpookyExtraGemsHabiticaPromo.kt @@ -18,15 +18,13 @@ import com.habitrpg.android.habitica.ui.views.promo.PromoMenuView import java.text.SimpleDateFormat import java.util.* -class SpookyExtraGemsHabiticaPromotion: HabiticaPromotion() { +class SpookyExtraGemsHabiticaPromotion(startDate: Date?, endDate: Date?) : HabiticaPromotion() { override val identifier: String get() = "spooky_extra_gems" override val promoType: PromoType get() = PromoType.GEMS_AMOUNT - override val startDate: Date - get() = DateUtils.createDate(2020, 10, 29) - override val endDate: Date - get() = DateUtils.createDate(2020, 11, 2) + override val startDate: Date = startDate ?: DateUtils.createDate(2020, 10, 29) + override val endDate: Date = endDate ?: DateUtils.createDate(2020, 11, 2) override fun pillBackgroundDrawable(context: Context): Drawable { return ContextCompat.getDrawable(context, R.drawable.spooky_promo_pill_bg) ?: ShapeDrawable() @@ -89,8 +87,10 @@ class SpookyExtraGemsHabiticaPromotion: HabiticaPromotion() { val context = binding.root.context binding.root.background = promoBackgroundDrawable(context) binding.purchaseButton.background = buttonDrawable(context) - binding.amountBackground.background = BitmapDrawable(context.resources, + val drawable = BitmapDrawable(context.resources, HabiticaIconsHelper.imageOfSpookyGemPromoBG()) + binding.amountBackgroundLeft.background = drawable + binding.amountBackgroundRight.background = drawable binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6")) binding.gemsTextView.setTextColor(Color.parseColor("#FEE2B6")) binding.footerTextView.visibility = View.VISIBLE @@ -124,7 +124,7 @@ class SpookyExtraGemsHabiticaPromotion: HabiticaPromotion() { fragment.binding?.promptButton?.setTextColor(ContextCompat.getColor(context, R.color.white)) fragment.binding?.promptButton?.setOnClickListener { MainNavigationController.navigate(R.id.gemPurchaseActivity) } - fragment.binding?.instructionDescriptionView?.setText(R.string.spooky_promo_info_instructions) - fragment.binding?.limitationsDescriptionView?.setText(R.string.spooky_promo_info_limitations) - } + fragment.binding?.instructionDescriptionView?.text = context.getString(R.string.spooky_promo_info_instructions, formatter.format(startDate), formatter.format(endDate)) + val limitationsFormatter = SimpleDateFormat.getDateTimeInstance() + fragment.binding?.limitationsDescriptionView?.text = context.getString(R.string.gems_promo_info_limitations, limitationsFormatter.format(startDate), limitationsFormatter.format(endDate)) } } \ No newline at end of file diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ChatRecyclerViewHolder.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ChatRecyclerViewHolder.kt index 4317fa6a5..8c065d604 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ChatRecyclerViewHolder.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/viewHolders/ChatRecyclerViewHolder.kt @@ -155,7 +155,7 @@ class ChatRecyclerViewHolder(itemView: View, private var userId: String, private binding.messageWrapper.background = if ((name != null && msg.text?.contains("@$name") == true) || (username != null && msg.text?.contains(username) == true)) { ContextCompat.getDrawable(context, R.drawable.layout_rounded_bg_brand_700) } else { - ContextCompat.getDrawable(context, R.drawable.layout_rounded_bg) + ContextCompat.getDrawable(context, R.drawable.layout_rounded_bg_content) } binding.messageWrapper.setScaledPadding(context, 8, 8, 8, 8) diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt index 11287298c..68302635c 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/ChatBarView.kt @@ -79,8 +79,8 @@ class ChatBarView : LinearLayout { private var autocompleteAdapter: AutocompleteAdapter? = null private fun setupView(context: Context) { - orientation = LinearLayout.VERTICAL - this.setBackgroundResource(R.color.white) + orientation = VERTICAL + this.setBackgroundResource(R.color.content_background) HabiticaBaseApplication.userComponent?.inject(this) diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/OldQuestProgressView.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/OldQuestProgressView.kt index fc4a7cd69..45204434b 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/OldQuestProgressView.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/ui/views/social/OldQuestProgressView.kt @@ -44,8 +44,6 @@ class OldQuestProgressView : LinearLayout { private fun setupView(context: Context) { setWillNotDraw(false) - inflate(R.layout.quest_progress_old, true) - orientation = VERTICAL setScaledPadding(context, 16, 16, 16, 16) diff --git a/Habitica/src/main/java/com/habitrpg/android/habitica/utils/WorldStateSerialization.kt b/Habitica/src/main/java/com/habitrpg/android/habitica/utils/WorldStateSerialization.kt index b22125571..051ef40ac 100644 --- a/Habitica/src/main/java/com/habitrpg/android/habitica/utils/WorldStateSerialization.kt +++ b/Habitica/src/main/java/com/habitrpg/android/habitica/utils/WorldStateSerialization.kt @@ -3,47 +3,56 @@ package com.habitrpg.android.habitica.utils import com.google.gson.JsonDeserializationContext import com.google.gson.JsonDeserializer import com.google.gson.JsonElement +import com.habitrpg.android.habitica.extensions.getAsString import com.habitrpg.android.habitica.models.WorldState import com.habitrpg.android.habitica.models.inventory.QuestProgress import com.habitrpg.android.habitica.models.inventory.QuestRageStrike import java.lang.reflect.Type +import java.util.* class WorldStateSerialization: JsonDeserializer { override fun deserialize(json: JsonElement?, typeOfT: Type?, context: JsonDeserializationContext?): WorldState { val worldBossObject = json?.asJsonObject?.get("worldBoss")?.asJsonObject val state = WorldState() - if (worldBossObject == null) { - return state - } - if (worldBossObject.has("active") && !worldBossObject["active"].isJsonNull) { - state.worldBossActive = worldBossObject["active"].asBoolean - } - if (worldBossObject.has("key") && !worldBossObject["key"].isJsonNull) { - state.worldBossKey = worldBossObject["key"].asString - } - if (worldBossObject.has("progress")) { - val progress = QuestProgress() - val progressObj = worldBossObject.getAsJsonObject("progress") - if (progressObj.has("hp")) { - progress.hp = progressObj["hp"].asDouble + if (worldBossObject != null) { + if (worldBossObject.has("active") && !worldBossObject["active"].isJsonNull) { + state.worldBossActive = worldBossObject["active"].asBoolean } - if (progressObj.has("rage")) { - progress.rage = progressObj["rage"].asDouble + if (worldBossObject.has("key") && !worldBossObject["key"].isJsonNull) { + state.worldBossKey = worldBossObject["key"].asString } - state.progress = progress - } - if (worldBossObject.has("extra")) { - val extra = worldBossObject["extra"].asJsonObject - if (extra.has("worldDmg")) { - val worldDmg = extra["worldDmg"].asJsonObject - state.rageStrikes = mutableListOf() - worldDmg.entrySet().forEach { (key, value) -> - val strike = QuestRageStrike(key, value.asBoolean) - state.rageStrikes?.add(strike) + if (worldBossObject.has("progress")) { + val progress = QuestProgress() + val progressObj = worldBossObject.getAsJsonObject("progress") + if (progressObj.has("hp")) { + progress.hp = progressObj["hp"].asDouble + } + if (progressObj.has("rage")) { + progress.rage = progressObj["rage"].asDouble + } + state.progress = progress + } + if (worldBossObject.has("extra")) { + val extra = worldBossObject["extra"].asJsonObject + if (extra.has("worldDmg")) { + val worldDmg = extra["worldDmg"].asJsonObject + state.rageStrikes = mutableListOf() + worldDmg.entrySet().forEach { (key, value) -> + val strike = QuestRageStrike(key, value.asBoolean) + state.rageStrikes?.add(strike) + } } } } + + val event = json?.asJsonObject?.getAsJsonObject("currentEvent") + if (event != null) { + state.currentEventKey = event.getAsString("event") + state.currentEventStartDate = context?.deserialize(event.get("start"), Date::class.java) + state.currentEventEndDate = context?.deserialize(event.get("end"), Date::class.java) + } + return state } diff --git a/Habitica/staff/release/output-metadata.json b/Habitica/staff/release/output-metadata.json new file mode 100644 index 000000000..a8d7fe899 --- /dev/null +++ b/Habitica/staff/release/output-metadata.json @@ -0,0 +1,20 @@ +{ + "version": 1, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.habitrpg.android.habitica", + "variantName": "staffRelease", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "properties": [], + "versionCode": 2523, + "versionName": "3.0", + "enabled": true, + "outputFile": "Habitica-staff-release.apk" + } + ] +} \ No newline at end of file