adding the Purchase Simple Thank You button

This commit is contained in:
tibbi 2018-08-10 23:58:25 +02:00
parent dde4c7ac60
commit 3623dc2236
2 changed files with 45 additions and 6 deletions

View File

@ -3,6 +3,8 @@ package com.simplemobiletools.flashlight.activities
import android.content.Intent
import android.os.Bundle
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.isThankYouInstalled
import com.simplemobiletools.commons.extensions.launchPurchaseThankYouIntent
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import com.simplemobiletools.flashlight.R
@ -19,6 +21,7 @@ class SettingsActivity : SimpleActivity() {
override fun onResume() {
super.onResume()
setupPurchaseThankYou()
setupCustomizeColors()
setupCustomizeWidgetColors()
setupUseEnglish()
@ -36,6 +39,13 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupPurchaseThankYou() {
settings_purchase_thank_you_holder.beVisibleIf(config.appRunCount > 10 && !isThankYouInstalled())
settings_purchase_thank_you_holder.setOnClickListener {
launchPurchaseThankYouIntent()
}
}
private fun setupCustomizeWidgetColors() {
settings_customize_widget_colors_holder.setOnClickListener {
Intent(this, WidgetConfigureActivity::class.java).apply {

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/settings_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -11,6 +12,28 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/settings_purchase_thank_you_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_purchase_thank_you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/purchase_simple_thank_you"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_customize_colors_holder"
android:layout_width="match_parent"
@ -74,7 +97,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/use_english_language"/>
android:text="@string/use_english_language"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
@ -97,7 +121,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/avoid_whats_new"/>
android:text="@string/avoid_whats_new"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
@ -120,7 +145,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/turn_flashlight_on"/>
android:text="@string/turn_flashlight_on"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
@ -143,7 +169,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/bright_display"/>
android:text="@string/bright_display"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
@ -166,7 +193,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/show_stroboscope"/>
android:text="@string/show_stroboscope"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
@ -189,7 +217,8 @@
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/force_portrait_mode"/>
android:text="@string/force_portrait_mode"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
</LinearLayout>