From b9dd06849506d2e039697adfaf858b711f44e933 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 20 Apr 2022 21:58:44 +0200 Subject: [PATCH] use the new design at Settings --- .../camera/activities/SettingsActivity.kt | 69 ++- app/src/main/res/layout/activity_settings.xml | 519 ++++++++---------- 2 files changed, 287 insertions(+), 301 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index 988793c7..39a66073 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -38,8 +38,28 @@ class SettingsActivity : SimpleActivity() { setupSavePhotosFolder() setupPhotoQuality() updateTextColors(settings_holder) - setupSectionColors() invalidateOptionsMenu() + + val properPrimaryColor = getProperPrimaryColor() + arrayListOf( + settings_color_customization_label, + settings_general_settings_label, + settings_shutter_label, + settings_startup_label, + settings_saving_label + ).forEach { + it.setTextColor(properPrimaryColor) + } + + arrayOf( + settings_color_customization_holder, + settings_general_settings_holder, + settings_shutter_holder, + settings_startup_holder, + settings_saving_holder + ).forEach { + it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) + } } override fun onCreateOptionsMenu(menu: Menu): Boolean { @@ -56,15 +76,14 @@ class SettingsActivity : SimpleActivity() { return true } - private fun setupSectionColors() { - val properPrimaryColor = getProperPrimaryColor() - arrayListOf(shutter_label, startup_label, saving_label).forEach { - it.setTextColor(properPrimaryColor) - } - } - private fun setupPurchaseThankYou() { settings_purchase_thank_you_holder.beGoneIf(isOrWasThankYouInstalled()) + + // make sure the corners at ripple fit the stroke rounded corners + if (settings_purchase_thank_you_holder.isGone()) { + settings_use_english_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) + } + settings_purchase_thank_you_holder.setOnClickListener { launchPurchaseThankYouIntent() } @@ -80,6 +99,11 @@ class SettingsActivity : SimpleActivity() { private fun setupUseEnglish() { settings_use_english_holder.beVisibleIf(config.wasUseEnglishToggled || Locale.getDefault().language != "en") settings_use_english.isChecked = config.useEnglish + + if (settings_use_english_holder.isGone() && settings_purchase_thank_you_holder.isGone()) { + settings_keep_settings_visible_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) + } + settings_use_english_holder.setOnClickListener { settings_use_english.toggle() config.useEnglish = settings_use_english.isChecked @@ -91,9 +115,9 @@ class SettingsActivity : SimpleActivity() { val licenses = LICENSE_GLIDE val faqItems = arrayListOf( - FAQItem(R.string.faq_1_title, R.string.faq_1_text), - FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), - FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons) + FAQItem(R.string.faq_1_title, R.string.faq_1_text), + FAQItem(R.string.faq_2_title_commons, R.string.faq_2_text_commons), + FAQItem(R.string.faq_6_title_commons, R.string.faq_6_text_commons) ) startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true) @@ -187,17 +211,18 @@ class SettingsActivity : SimpleActivity() { updatePhotoQuality(config.photoQuality) settings_photo_quality_holder.setOnClickListener { val items = arrayListOf( - RadioItem(100, "100%"), - RadioItem(95, "95%"), - RadioItem(90, "90%"), - RadioItem(85, "85%"), - RadioItem(80, "80%"), - RadioItem(75, "75%"), - RadioItem(70, "70%"), - RadioItem(65, "65%"), - RadioItem(60, "60%"), - RadioItem(55, "55%"), - RadioItem(50, "50%")) + RadioItem(100, "100%"), + RadioItem(95, "95%"), + RadioItem(90, "90%"), + RadioItem(85, "85%"), + RadioItem(80, "80%"), + RadioItem(75, "75%"), + RadioItem(70, "70%"), + RadioItem(65, "65%"), + RadioItem(60, "60%"), + RadioItem(55, "55%"), + RadioItem(50, "50%") + ) RadioGroupDialog(this@SettingsActivity, items, config.photoQuality) { config.photoQuality = it as Int diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index c3a5795b..448e4e1b 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1,6 +1,6 @@ @@ -11,347 +11,308 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:text="@string/color_customization" /> - - - - - + android:layout_margin="@dimen/medium_margin" + android:background="@drawable/section_holder_stroke" + android:orientation="vertical"> - - - - - - - + android:background="@drawable/ripple_all_corners"> - + - + + + + android:text="@string/general_settings" /> - - - - - + android:layout_margin="@dimen/medium_margin" + android:background="@drawable/section_holder_stroke" + android:orientation="vertical"> - + android:background="@drawable/ripple_top_corners"> - + - + - + + + + + + + + + + + + + + + + + + + + android:text="@string/shutter" /> - - - - - + android:layout_margin="@dimen/medium_margin" + android:background="@drawable/section_holder_stroke" + android:orientation="vertical"> - + android:background="@drawable/ripple_top_corners"> - + - + - + + + + + + + + android:text="@string/startup" /> - - - - - + android:layout_margin="@dimen/medium_margin" + android:background="@drawable/section_holder_stroke" + android:orientation="vertical"> - + android:background="@drawable/ripple_top_corners"> - + - + - + + + + + + + + android:text="@string/saving_label" /> - - - - - + android:layout_margin="@dimen/medium_margin" + android:background="@drawable/section_holder_stroke" + android:orientation="vertical"> - + android:background="@drawable/ripple_top_corners"> - + - + - + android:background="@drawable/ripple_background"> - + - + - - - + android:background="@drawable/ripple_background"> - + + + + + + + android:background="@drawable/ripple_bottom_corners"> - + + + + + +