Add UI for free upgrade

This commit is contained in:
Moez Bhatti
2018-04-15 17:44:06 -04:00
parent 4357cbb82d
commit 439d599e93
3 changed files with 85 additions and 47 deletions
@@ -42,16 +42,21 @@ class PlusActivity : QkThemedActivity<PlusViewModel>(), PlusView {
override val upgradeIntent by lazy { upgrade.clicks() }
override val upgradeDonateIntent by lazy { upgradeDonate.clicks() }
override fun onCreate(savedInstanceState: Bundle?) {
init {
appComponent.inject(this)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.qksms_plus_activity)
setTitle(R.string.title_qksms_plus)
showBackButton(true)
viewModel.bindView(this)
fontProvider.getLato {
val typeface = Typeface.create(it, Typeface.BOLD)
free.setVisible(false)
fontProvider.getLato { lato ->
val typeface = Typeface.create(lato, Typeface.BOLD)
collapsingToolbar.setCollapsedTitleTypeface(typeface)
collapsingToolbar.setExpandedTitleTypeface(typeface)
}
@@ -71,7 +76,7 @@ class PlusActivity : QkThemedActivity<PlusViewModel>(), PlusView {
.autoDisposable(scope())
.subscribe { color ->
upgradeDonate.setBackgroundTint(color)
thanks.setBackgroundTint(color)
upgraded.setBackgroundTint(color)
}
colors.theme
@@ -87,9 +92,8 @@ class PlusActivity : QkThemedActivity<PlusViewModel>(), PlusView {
upgrade.text = getString(R.string.qksms_plus_upgrade, state.upgradePrice, state.currency)
upgradeDonate.text = getString(R.string.qksms_plus_upgrade_donate, state.upgradeDonatePrice, state.currency)
upgrade.setVisible(state.currentPlan == BillingManager.UpgradeStatus.REGULAR)
upgradeDonate.setVisible(state.currentPlan == BillingManager.UpgradeStatus.REGULAR)
thanks.setVisible(state.currentPlan != BillingManager.UpgradeStatus.REGULAR)
toUpgrade.setVisible(state.currentPlan == BillingManager.UpgradeStatus.REGULAR)
upgraded.setVisible(state.currentPlan == BillingManager.UpgradeStatus.UPGRADED)
}
override fun initiatePurchaseFlow(billingManager: BillingManager, sku: String) {
@@ -57,31 +57,58 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<common.widget.QkTextView
<LinearLayout
android:id="@+id/toUpgrade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:text="@string/qksms_plus_description_title"
android:textStyle="bold"
app:textColor="primary"
app:textSize="primary" />
android:layout_marginBottom="32dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
android:orientation="vertical">
<common.widget.QkTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:text="@string/qksms_plus_description_summary"
app:textColor="secondary"
app:textSize="secondary" />
<common.widget.QkTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/qksms_plus_description_title"
android:textStyle="bold"
app:textColor="primary"
app:textSize="primary" />
<common.widget.QkTextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/qksms_plus_description_summary"
app:textColor="secondary"
app:textSize="secondary" />
<common.widget.QkTextView
android:id="@+id/upgrade"
style="@style/TextButton"
android:layout_marginTop="16dp"
android:background="@drawable/rounded_rectangle_2dp"
android:text="@string/qksms_plus_upgrade"
app:textColor="primaryOnTheme"
tools:backgroundTint="@color/tools_theme" />
<common.widget.QkTextView
android:id="@+id/upgradeDonate"
style="@style/TextButton"
android:layout_marginTop="8dp"
android:background="@drawable/rounded_rectangle_outline_2dp"
android:text="@string/qksms_plus_upgrade_donate"
app:textColor="primary"
tools:backgroundTint="@color/separatorLight" />
</LinearLayout>
<android.support.constraint.ConstraintLayout
android:id="@+id/thanks"
android:id="@+id/upgraded"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="24dp"
android:layout_marginStart="24dp"
android:background="@drawable/rounded_rectangle_2dp"
android:padding="16dp"
tools:backgroundTint="@color/separatorLight">
@@ -92,7 +119,8 @@
android:layout_height="24dp"
android:src="@drawable/ic_favorite_black_24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
tools:tint="@color/tools_theme" />
<common.widget.QkTextView
android:id="@+id/thanksTitle"
@@ -118,28 +146,32 @@
</android.support.constraint.ConstraintLayout>
<common.widget.QkTextView
android:id="@+id/upgrade"
style="@style/TextButton"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/rounded_rectangle_2dp"
android:text="@string/qksms_plus_upgrade"
app:textColor="primaryOnTheme"
tools:backgroundTint="@color/tools_theme" />
<LinearLayout
android:id="@+id/free"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginEnd="32dp"
android:layout_marginStart="32dp"
android:orientation="vertical">
<common.widget.QkTextView
android:id="@+id/upgradeDonate"
style="@style/TextButton"
android:layout_marginBottom="32dp"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:layout_marginTop="8dp"
android:background="@drawable/rounded_rectangle_outline_2dp"
android:text="@string/qksms_plus_upgrade_donate"
app:textColor="primary"
tools:backgroundTint="@color/separatorLight" />
<common.widget.QkTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/qksms_plus_free_title"
app:textColor="secondary"
app:textSize="secondary" />
<common.widget.QkTextView
android:id="@+id/donate"
style="@style/TextButton"
android:layout_marginTop="16dp"
android:background="@drawable/rounded_rectangle_2dp"
android:text="@string/qksms_plus_donate"
app:textColor="primaryOnTheme"
tools:backgroundTint="@color/tools_theme" />
</LinearLayout>
<common.widget.Separator
android:layout_width="match_parent"
@@ -122,6 +122,8 @@
<string name="qksms_plus_upgrade_donate">Unlock + donate for %1$s %2$s</string>
<string name="qksms_plus_thanks_title">Thank you for supporting QKSMS!</string>
<string name="qksms_plus_thanks_summary">You now have access to all QKSMS+ features</string>
<string name="qksms_plus_free_title">QKSMS+ is free for F-Droid users! If you\'d like to support development, feel free to make a donation.</string>
<string name="qksms_plus_donate">Donate via PayPal</string>
<string name="qksms_plus_coming_soon">Coming soon</string>
<string name="qksms_plus_themes_title">Premium themes</string>
<string name="qksms_plus_themes_summary">Unlock beautiful theme colors not available on the Material Design palette</string>