From 4083bdcbb11559620b88d22ee0e27a077f0f5c41 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 16 Jul 2018 23:08:41 +0200 Subject: [PATCH] show a Purchase Simple Thank You button in the settings --- .../contacts/activities/SettingsActivity.kt | 10 +++++++++ app/src/main/res/layout/activity_settings.xml | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SettingsActivity.kt index 1cf3bb24..19eb91db 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/activities/SettingsActivity.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.contacts.activities import android.os.Bundle import com.simplemobiletools.commons.dialogs.RadioGroupDialog 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.models.RadioItem import com.simplemobiletools.contacts.R @@ -23,6 +25,7 @@ class SettingsActivity : SimpleActivity() { override fun onResume() { super.onResume() + setupPurchaseThankYou() setupCustomizeColors() setupManageShownContactFields() setupUseEnglish() @@ -36,6 +39,13 @@ class SettingsActivity : SimpleActivity() { updateTextColors(settings_holder) } + private fun setupPurchaseThankYou() { + settings_purchase_thank_you_holder.beVisibleIf(config.appRunCount > 10 && !isThankYouInstalled()) + settings_purchase_thank_you_holder.setOnClickListener { + launchPurchaseThankYouIntent() + } + } + private fun setupCustomizeColors() { settings_customize_colors_holder.setOnClickListener { startCustomizationActivity() diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 18addc99..b1f7cccc 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -11,6 +11,28 @@ android:layout_height="wrap_content" android:orientation="vertical"> + + + + + +