From 80de1c3a7927617c01c9ec1bb218a7247262a586 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Apr 2022 15:20:50 +0200 Subject: [PATCH] require Simple Thank You for the widget --- app/build.gradle | 2 +- .../WidgetDateTimeConfigureActivity.kt | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2ea180df..78de0a1a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:75f44f03fd' + implementation 'com.github.SimpleMobileTools:Simple-Commons:c47a13a8da' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'com.shawnlin:number-picker:2.4.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDateTimeConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDateTimeConfigureActivity.kt index 3af3a13a..9a7b3a11 100644 --- a/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDateTimeConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/clock/activities/WidgetDateTimeConfigureActivity.kt @@ -13,10 +13,8 @@ import com.simplemobiletools.clock.extensions.getFormattedTime import com.simplemobiletools.clock.helpers.MyWidgetDateTimeProvider import com.simplemobiletools.clock.helpers.getPassedSeconds import com.simplemobiletools.commons.dialogs.ColorPickerDialog -import com.simplemobiletools.commons.extensions.adjustAlpha -import com.simplemobiletools.commons.extensions.applyColorFilter -import com.simplemobiletools.commons.extensions.getProperPrimaryColor -import com.simplemobiletools.commons.extensions.setFillWithStroke +import com.simplemobiletools.commons.dialogs.WidgetLockedDialog +import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS import kotlinx.android.synthetic.main.widget_config_date_time.* import java.util.* @@ -27,6 +25,7 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() { private var mBgColor = 0 private var mTextColor = 0 private var mBgColorWithoutTransparency = 0 + private var mWidgetLockedDialog: WidgetLockedDialog? = null public override fun onCreate(savedInstanceState: Bundle?) { useDynamicTheme = false @@ -48,11 +47,23 @@ class WidgetDateTimeConfigureActivity : SimpleActivity() { val primaryColor = getProperPrimaryColor() config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor) + + if (!isCustomizingColors && !isOrWasThankYouInstalled()) { + mWidgetLockedDialog = WidgetLockedDialog(this) { + if (!isOrWasThankYouInstalled()) { + finish() + } + } + } } override fun onResume() { super.onResume() window.decorView.setBackgroundColor(0) + + if (mWidgetLockedDialog != null && isOrWasThankYouInstalled()) { + mWidgetLockedDialog?.dismissDialog() + } } private fun initVariables() {