mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-06-05 21:59:19 +02:00
adding the Purchase Simple Thank You button
This commit is contained in:
@ -3,6 +3,8 @@ package com.simplemobiletools.flashlight.activities
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
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.extensions.updateTextColors
|
||||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||||
import com.simplemobiletools.flashlight.R
|
import com.simplemobiletools.flashlight.R
|
||||||
@ -19,6 +21,7 @@ class SettingsActivity : SimpleActivity() {
|
|||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
setupPurchaseThankYou()
|
||||||
setupCustomizeColors()
|
setupCustomizeColors()
|
||||||
setupCustomizeWidgetColors()
|
setupCustomizeWidgetColors()
|
||||||
setupUseEnglish()
|
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() {
|
private fun setupCustomizeWidgetColors() {
|
||||||
settings_customize_widget_colors_holder.setOnClickListener {
|
settings_customize_widget_colors_holder.setOnClickListener {
|
||||||
Intent(this, WidgetConfigureActivity::class.java).apply {
|
Intent(this, WidgetConfigureActivity::class.java).apply {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/settings_scrollview"
|
android:id="@+id/settings_scrollview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
@ -11,6 +12,28 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
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
|
<RelativeLayout
|
||||||
android:id="@+id/settings_customize_colors_holder"
|
android:id="@+id/settings_customize_colors_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -74,7 +97,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@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>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -97,7 +121,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@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>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -120,7 +145,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@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>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -143,7 +169,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:text="@string/bright_display"/>
|
android:text="@string/bright_display"
|
||||||
|
app:switchPadding="@dimen/medium_margin"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -166,7 +193,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@dimen/medium_margin"
|
android:paddingStart="@dimen/medium_margin"
|
||||||
android:text="@string/show_stroboscope"/>
|
android:text="@string/show_stroboscope"
|
||||||
|
app:switchPadding="@dimen/medium_margin"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -189,7 +217,8 @@
|
|||||||
android:clickable="false"
|
android:clickable="false"
|
||||||
android:paddingLeft="@dimen/medium_margin"
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
android:paddingStart="@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>
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Reference in New Issue
Block a user