fix promo designs

This commit is contained in:
Phillip Thelen 2022-09-15 13:39:22 +02:00
parent 7b4100c32e
commit 616b77cf0a
39 changed files with 71 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -17,6 +17,7 @@
android:background="@drawable/g1g1_box" android:background="@drawable/g1g1_box"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:layout_marginBottom="@dimen/spacing_large"
android:clipChildren="true" android:clipChildren="true"
android:clipToPadding="true" android:clipToPadding="true"
android:clickable="true" android:clickable="true"
@ -29,14 +30,16 @@
android:scaleType="center" android:scaleType="center"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_alignParentBottom="false"/> android:layout_alignParentBottom="false"
android:importantForAccessibility="no"/>
<ImageView <ImageView
android:id="@+id/promo_banner_right_image" android:id="@+id/promo_banner_right_image"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scaleType="center" android:scaleType="center"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"/> android:layout_alignParentEnd="true"
android:importantForAccessibility="no"/>
<LinearLayout <LinearLayout
android:layout_centerInParent="true" android:layout_centerInParent="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -40,6 +40,7 @@
android:layout_marginEnd="2dp" android:layout_marginEnd="2dp"
tools:text="21" /> tools:text="21" />
<com.habitrpg.android.habitica.ui.views.DayNightTextView <com.habitrpg.android.habitica.ui.views.DayNightTextView
android:id="@+id/gem_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:dayTextColor="@color/white" app:dayTextColor="@color/white"

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.models.promotions package com.habitrpg.android.habitica.models.promotions
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
@ -88,18 +89,33 @@ class FallExtraGemsHabiticaPromotion(startDate: Date?, endDate: Date?) : Habitic
override fun configurePurchaseBanner(binding: FragmentSubscriptionBinding) { override fun configurePurchaseBanner(binding: FragmentSubscriptionBinding) {
} }
@SuppressLint("SetTextI18n")
override fun configureGemView(binding: PurchaseGemViewBinding, regularAmount: Int) { override fun configureGemView(binding: PurchaseGemViewBinding, regularAmount: Int) {
val context = binding.root.context val context = binding.root.context
binding.root.background = promoBackgroundDrawable(context) binding.root.background = promoBackgroundDrawable(context)
binding.purchaseButton.background = buttonDrawable(context) binding.purchaseButton.background = buttonDrawable(context)
binding.purchaseButton.setTextColor(ContextCompat.getColor(context, R.color.white))
binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6")) binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6"))
binding.gemLabel.setTextColor(Color.parseColor("#FEE2B6"))
binding.footerTextView.visibility = View.VISIBLE binding.footerTextView.visibility = View.VISIBLE
binding.footerTextView.text = context.getString(R.string.usually_x_gems, regularAmount) binding.footerTextView.text = context.getString(R.string.usually_x_gems, regularAmount)
binding.gemAmount.text = when (regularAmount) { when (regularAmount) {
4 -> "5 GEMS" 4 -> {
21 -> "30 GEMS" binding.gemAmount.text = "5"
42 -> "60 GEMS" binding.gemImage.setImageResource(R.drawable.fall_gems_4)
84 -> "125 GEMS" }
21 -> {
binding.gemAmount.text = "30"
binding.gemImage.setImageResource(R.drawable.fall_gems_21)
}
42 -> {
binding.gemAmount.text = "60"
binding.gemImage.setImageResource(R.drawable.fall_gems_42)
}
84 -> {
binding.gemAmount.text = "125"
binding.gemImage.setImageResource(R.drawable.fall_gems_84)
}
else -> regularAmount.toString() else -> regularAmount.toString()
} }
} }

View file

@ -1,5 +1,6 @@
package com.habitrpg.android.habitica.models.promotions package com.habitrpg.android.habitica.models.promotions
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
@ -88,18 +89,33 @@ class SpookyExtraGemsHabiticaPromotion(startDate: Date?, endDate: Date?) : Habit
override fun configurePurchaseBanner(binding: FragmentSubscriptionBinding) { override fun configurePurchaseBanner(binding: FragmentSubscriptionBinding) {
} }
@SuppressLint("SetTextI18n")
override fun configureGemView(binding: PurchaseGemViewBinding, regularAmount: Int) { override fun configureGemView(binding: PurchaseGemViewBinding, regularAmount: Int) {
val context = binding.root.context val context = binding.root.context
binding.root.background = promoBackgroundDrawable(context) binding.root.background = promoBackgroundDrawable(context)
binding.purchaseButton.background = buttonDrawable(context) binding.purchaseButton.background = buttonDrawable(context)
binding.purchaseButton.setTextColor(ContextCompat.getColor(context, R.color.white))
binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6")) binding.gemAmount.setTextColor(Color.parseColor("#FEE2B6"))
binding.gemLabel.setTextColor(Color.parseColor("#FEE2B6"))
binding.footerTextView.visibility = View.VISIBLE binding.footerTextView.visibility = View.VISIBLE
binding.footerTextView.text = context.getString(R.string.usually_x_gems, regularAmount) binding.footerTextView.text = context.getString(R.string.usually_x_gems, regularAmount)
binding.gemAmount.text = when (regularAmount) { when (regularAmount) {
4 -> "5 GEMS" 4 -> {
21 -> "30 GEMS" binding.gemAmount.text = "5"
42 -> "60 GEMS" binding.gemImage.setImageResource(R.drawable.spooky_gems_4)
84 -> "125 GEMS" }
21 -> {
binding.gemAmount.text = "30"
binding.gemImage.setImageResource(R.drawable.spooky_gems_21)
}
42 -> {
binding.gemAmount.text = "60"
binding.gemImage.setImageResource(R.drawable.spooky_gems_42)
}
84 -> {
binding.gemAmount.text = "125"
binding.gemImage.setImageResource(R.drawable.spooky_gems_84)
}
else -> regularAmount.toString() else -> regularAmount.toString()
} }
} }

View file

@ -27,6 +27,7 @@ import com.habitrpg.android.habitica.ui.viewmodels.MainUserViewModel
import com.habitrpg.android.habitica.ui.views.CurrencyViews import com.habitrpg.android.habitica.ui.views.CurrencyViews
import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog import com.habitrpg.android.habitica.ui.views.dialogs.HabiticaAlertDialog
import com.habitrpg.common.habitica.helpers.RecyclerViewState import com.habitrpg.common.habitica.helpers.RecyclerViewState
import io.reactivex.rxjava3.kotlin.combineLatest
import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import javax.inject.Inject import javax.inject.Inject
@ -270,19 +271,19 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
private fun loadMarketGear() { private fun loadMarketGear() {
compositeSubscription.add( compositeSubscription.add(
inventoryRepository.retrieveMarketGear() inventoryRepository.retrieveMarketGear()
.zipWith( .combineLatest(
inventoryRepository.getOwnedEquipment().map { equipment -> equipment.map { it.key } }, inventoryRepository.getOwnedEquipment().map { equipment -> equipment.map { it.key } }
{ shop, equipment ->
for (category in shop.categories) {
val items = category.items.asSequence().filter {
!equipment.contains(it.key)
}.sortedBy { it.locked }.toList()
category.items.clear()
category.items.addAll(items)
}
shop
}
) )
.map { (shop, equipment) ->
for (category in shop.categories) {
val items = category.items.asSequence().filter {
!equipment.contains(it.key)
}.sortedBy { it.locked }.toList()
category.items.clear()
category.items.addAll(items)
}
shop
}
.subscribe( .subscribe(
{ {
this.gearCategories = it.categories this.gearCategories = it.categories

View file

@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
Runs all the tests Runs all the tests
### android staffapk
```sh
[bundle exec] fastlane android staffapk
```
Build Staff APK for sara
### android staff ### android staff
```sh ```sh

View file

@ -1,2 +1,2 @@
NAME=4.0.2 NAME=4.0.3
CODE=4510 CODE=4521