require Simple Thank You for the widget
This commit is contained in:
parent
1956b270bc
commit
aa10aab692
2 changed files with 23 additions and 2 deletions
|
@ -2,4 +2,6 @@
|
||||||
<resources>
|
<resources>
|
||||||
<bool name="default_vibrate_on_press">true</bool>
|
<bool name="default_vibrate_on_press">true</bool>
|
||||||
<bool name="show_donate_in_about">true</bool>
|
<bool name="show_donate_in_about">true</bool>
|
||||||
|
<bool name="avoid_showing_rating_prompt">true</bool>
|
||||||
|
<bool name="pretend_thank_you_installed">true</bool>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.simplemobiletools.calculator.R
|
||||||
import com.simplemobiletools.calculator.extensions.config
|
import com.simplemobiletools.calculator.extensions.config
|
||||||
import com.simplemobiletools.calculator.helpers.MyWidgetProvider
|
import com.simplemobiletools.calculator.helpers.MyWidgetProvider
|
||||||
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
|
||||||
|
import com.simplemobiletools.commons.dialogs.WidgetLockedDialog
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
import com.simplemobiletools.commons.helpers.IS_CUSTOMIZING_COLORS
|
||||||
import kotlinx.android.synthetic.main.activity_main.*
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
@ -23,6 +24,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
private var mBgColor = 0
|
private var mBgColor = 0
|
||||||
private var mTextColor = 0
|
private var mTextColor = 0
|
||||||
private var mBgColorWithoutTransparency = 0
|
private var mBgColorWithoutTransparency = 0
|
||||||
|
private var mWidgetLockedDialog: WidgetLockedDialog? = null
|
||||||
|
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
useDynamicTheme = false
|
useDynamicTheme = false
|
||||||
|
@ -31,10 +33,10 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
setContentView(R.layout.widget_config)
|
setContentView(R.layout.widget_config)
|
||||||
initVariables()
|
initVariables()
|
||||||
|
|
||||||
val mIsCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
val isCustomizingColors = intent.extras?.getBoolean(IS_CUSTOMIZING_COLORS) ?: false
|
||||||
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
mWidgetId = intent.extras?.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID) ?: AppWidgetManager.INVALID_APPWIDGET_ID
|
||||||
|
|
||||||
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !mIsCustomizingColors) {
|
if (mWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID && !isCustomizingColors) {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +46,23 @@ class WidgetConfigureActivity : SimpleActivity() {
|
||||||
|
|
||||||
val primaryColor = getProperPrimaryColor()
|
val primaryColor = getProperPrimaryColor()
|
||||||
config_bg_seekbar.setColors(mTextColor, primaryColor, primaryColor)
|
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() {
|
private fun initVariables() {
|
||||||
|
|
Loading…
Reference in a new issue