From 48f7e7ab895d88752dc996cab44d0a3c9b8d80c3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 27 Dec 2022 17:06:12 +0100 Subject: [PATCH] updating the widget config screen --- .../activities/SettingsActivity.kt | 16 ++++++++++++---- .../WidgetRecordDisplayConfigureActivity.kt | 5 ++++- app/src/main/res/layout/activity_settings.xml | 17 +++++++++++++++++ .../layout/widget_record_display_config.xml | 18 +----------------- app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/integers.xml | 4 ---- 6 files changed, 35 insertions(+), 27 deletions(-) delete mode 100644 app/src/main/res/values/integers.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/SettingsActivity.kt index afad5aa..f84ec6f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/SettingsActivity.kt @@ -1,5 +1,6 @@ package com.simplemobiletools.voicerecorder.activities +import android.content.Intent import android.media.MediaRecorder import android.os.Bundle import com.simplemobiletools.commons.dialogs.ChangeDateTimeFormatDialog @@ -7,10 +8,7 @@ import com.simplemobiletools.commons.dialogs.FeatureLockedDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.NavigationIcon -import com.simplemobiletools.commons.helpers.isNougatPlus -import com.simplemobiletools.commons.helpers.isQPlus -import com.simplemobiletools.commons.helpers.isTiramisuPlus +import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.voicerecorder.R import com.simplemobiletools.voicerecorder.extensions.config @@ -39,6 +37,7 @@ class SettingsActivity : SimpleActivity() { setupPurchaseThankYou() setupCustomizeColors() + setupCustomizeWidgetColors() setupUseEnglish() setupLanguage() setupChangeDateTimeFormat() @@ -69,6 +68,15 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupCustomizeWidgetColors() { + settings_widget_color_customization_holder.setOnClickListener { + Intent(this, WidgetRecordDisplayConfigureActivity::class.java).apply { + putExtra(IS_CUSTOMIZING_COLORS, true) + startActivity(this) + } + } + } + private fun setupUseEnglish() { settings_use_english_holder.beVisibleIf((config.wasUseEnglishToggled || Locale.getDefault().language != "en") && !isTiramisuPlus()) settings_use_english.isChecked = config.useEnglish diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/WidgetRecordDisplayConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/WidgetRecordDisplayConfigureActivity.kt index 12d57c7..6cae951 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/WidgetRecordDisplayConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/activities/WidgetRecordDisplayConfigureActivity.kt @@ -58,7 +58,6 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() { override fun onResume() { super.onResume() window.decorView.setBackgroundColor(0) - setupToolbar(config_toolbar) if (mFeatureLockedDialog != null && isOrWasThankYouInstalled()) { mFeatureLockedDialog?.dismissDialog() @@ -67,6 +66,10 @@ class WidgetRecordDisplayConfigureActivity : SimpleActivity() { private fun initVariables() { mWidgetColor = config.widgetBgColor + if (mWidgetColor == resources.getColor(R.color.default_widget_bg_color) && config.isUsingSystemTheme) { + mWidgetColor = resources.getColor(R.color.you_primary_color, theme) + } + mWidgetAlpha = Color.alpha(mWidgetColor) / 255.toFloat() mWidgetColorWithoutTransparency = Color.rgb(Color.red(mWidgetColor), Color.green(mWidgetColor), Color.blue(mWidgetColor)) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 84faf82..50dc335 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -52,6 +52,23 @@ + + + + + + diff --git a/app/src/main/res/layout/widget_record_display_config.xml b/app/src/main/res/layout/widget_record_display_config.xml index a119049..4ae8d7d 100644 --- a/app/src/main/res/layout/widget_record_display_config.xml +++ b/app/src/main/res/layout/widget_record_display_config.xml @@ -1,25 +1,9 @@ - - - - - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d781ec5..9f8b27d 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,4 +1,4 @@ - + #FFF57C00 diff --git a/app/src/main/res/values/integers.xml b/app/src/main/res/values/integers.xml deleted file mode 100644 index 5b8ac01..0000000 --- a/app/src/main/res/values/integers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - -571114496 -