From a6fb0c18fa30b89011e1f4d954d4681a1823d876 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 9 Jan 2023 16:52:26 +0100 Subject: [PATCH] adding some widget config screen tweaks --- .../pro/activities/WidgetConfigureActivity.kt | 25 +++++++++---------- .../res/layout/activity_widget_config.xml | 19 +------------- app/src/main/res/values/colors.xml | 1 - 3 files changed, 13 insertions(+), 32 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt index 166ae2f9e..3cd69b0a1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/WidgetConfigureActivity.kt @@ -70,11 +70,6 @@ class WidgetConfigureActivity : SimpleActivity() { } } - override fun onResume() { - super.onResume() - setupToolbar(config_toolbar) - } - private fun initVariables() { mBgColor = config.widgetBgColor mBgAlpha = Color.alpha(mBgColor) / 255f @@ -83,14 +78,18 @@ class WidgetConfigureActivity : SimpleActivity() { config_bg_seekbar.apply { progress = (mBgAlpha * 100).toInt() - onSeekBarChangeListener { - mBgAlpha = it / 100f + onSeekBarChangeListener { progress -> + mBgAlpha = progress / 100f updateBackgroundColor() } } updateBackgroundColor() mTextColor = config.widgetTextColor + if (mTextColor == resources.getColor(R.color.default_widget_text_color) && config.isUsingSystemTheme) { + mTextColor = resources.getColor(R.color.you_primary_color, theme) + } + updateTextColor() } @@ -128,6 +127,12 @@ class WidgetConfigureActivity : SimpleActivity() { } } + private fun updateTextColor() { + config_folder_name.setTextColor(mTextColor) + config_text_color.setFillWithStroke(mTextColor, mTextColor) + config_save.setTextColor(getProperPrimaryColor().getContrastColor()) + } + private fun updateBackgroundColor() { mBgColor = mBgColorWithoutTransparency.adjustAlpha(mBgAlpha) config_image_holder.background.applyColorFilter(mBgColor) @@ -135,12 +140,6 @@ class WidgetConfigureActivity : SimpleActivity() { config_save.backgroundTintList = ColorStateList.valueOf(getProperPrimaryColor()) } - private fun updateTextColor() { - config_folder_name.setTextColor(mTextColor) - config_text_color.setFillWithStroke(mTextColor, mTextColor) - config_save.setTextColor(getProperPrimaryColor().getContrastColor()) - } - private fun pickBackgroundColor() { ColorPickerDialog(this, mBgColorWithoutTransparency) { wasPositivePressed, color -> if (wasPositivePressed) { diff --git a/app/src/main/res/layout/activity_widget_config.xml b/app/src/main/res/layout/activity_widget_config.xml index d674ade88..f9f9e8684 100644 --- a/app/src/main/res/layout/activity_widget_config.xml +++ b/app/src/main/res/layout/activity_widget_config.xml @@ -1,33 +1,16 @@ - - - - - - + android:layout_margin="@dimen/activity_margin"> - #454545 #BB000000 #66000000