require Simple Thank You for widgets

This commit is contained in:
tibbi 2022-05-20 15:24:42 +02:00
parent 807bf5d4c1
commit e809269e58
2 changed files with 38 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import android.graphics.Color
import android.os.Bundle
import android.widget.SeekBar
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import com.simplemobiletools.flashlight.R
@ -19,6 +20,7 @@ class WidgetBrightDisplayConfigureActivity : SimpleActivity() {
private var mWidgetId = 0
private var mWidgetColor = 0
private var mWidgetColorWithoutTransparency = 0
private var mWidgetLockedDialog: WidgetLockedDialog? = null
public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
@ -39,6 +41,23 @@ class WidgetBrightDisplayConfigureActivity : SimpleActivity() {
val primaryColor = getProperPrimaryColor()
config_widget_seekbar.setColors(getProperTextColor(), 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() {

View File

@ -7,6 +7,7 @@ import android.graphics.Color
import android.os.Bundle
import android.widget.SeekBar
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
import com.simplemobiletools.flashlight.R
@ -20,6 +21,7 @@ class WidgetTorchConfigureActivity : SimpleActivity() {
private var mWidgetId = 0
private var mWidgetColor = 0
private var mWidgetColorWithoutTransparency = 0
private var mWidgetLockedDialog: WidgetLockedDialog? = null
public override fun onCreate(savedInstanceState: Bundle?) {
useDynamicTheme = false
@ -40,6 +42,23 @@ class WidgetTorchConfigureActivity : SimpleActivity() {
val primaryColor = getProperPrimaryColor()
config_widget_seekbar.setColors(getProperTextColor(), 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() {