From 7b8a2de6493e3464adb8cfadefbf29d084fd7d96 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 12 Feb 2023 23:02:23 +0100 Subject: [PATCH] redesigning the app settings --- app/build.gradle | 8 +- .../launcher/activities/MainActivity.kt | 1 - .../launcher/activities/SettingsActivity.kt | 37 ++-- app/src/main/res/layout/activity_settings.xml | 181 ++++++++---------- app/src/main/res/menu/menu_settings.xml | 6 +- 5 files changed, 104 insertions(+), 129 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index b23897d..dc00682 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,9 +63,9 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:0828fecd09' + implementation 'com.github.SimpleMobileTools:Simple-Commons:c457573200' - kapt "androidx.room:room-compiler:2.4.3" - implementation "androidx.room:room-runtime:2.4.3" - annotationProcessor "androidx.room:room-compiler:2.4.3" + kapt "androidx.room:room-compiler:2.5.0" + implementation "androidx.room:room-runtime:2.5.0" + annotationProcessor "androidx.room:room-compiler:2.5.0" } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt index f41eea9..37af6a5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/MainActivity.kt @@ -77,7 +77,6 @@ class MainActivity : SimpleActivity(), FlingListener { override fun onCreate(savedInstanceState: Bundle?) { useDynamicTheme = false - showTransparentNavigation = true super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt index 6279212..a611fe5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/activities/SettingsActivity.kt @@ -15,14 +15,19 @@ import kotlin.system.exitProcess class SettingsActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { + isMaterialActivity = true super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) + + updateMaterialActivityViews(settings_coordinator, settings_holder, useTransparentNavigation = true, useTopSearchMenu = false) + setupMaterialScrollListener(settings_nested_scrollview, settings_toolbar) setupOptionsMenu() } override fun onResume() { super.onResume() setupToolbar(settings_toolbar, NavigationIcon.Arrow) + refreshMenuItems() setupPurchaseThankYou() setupCustomizeColors() @@ -31,44 +36,38 @@ class SettingsActivity : SimpleActivity() { setupManageHiddenIcons() updateTextColors(settings_holder) - arrayOf(settings_color_customization_label, settings_general_settings_label).forEach { + arrayOf(settings_color_customization_section_label, settings_general_settings_label).forEach { it.setTextColor(getProperPrimaryColor()) } - - arrayOf( - settings_color_customization_holder, - settings_general_settings_holder - ).forEach { - it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) - } } private fun setupOptionsMenu() { settings_toolbar.setOnMenuItemClickListener { menuItem -> when (menuItem.itemId) { R.id.about -> launchAbout() + R.id.more_apps_from_us -> launchMoreAppsFromUsIntent() else -> return@setOnMenuItemClickListener false } return@setOnMenuItemClickListener true } } + private fun refreshMenuItems() { + settings_toolbar.menu.apply { + findItem(R.id.more_apps_from_us).isVisible = !resources.getBoolean(R.bool.hide_google_relations) + } + } + 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_language_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } - settings_purchase_thank_you_holder.setOnClickListener { launchPurchaseThankYouIntent() } } private fun setupCustomizeColors() { - settings_customize_colors_holder.setOnClickListener { + settings_color_customization_label.text = getCustomizeColorsString() + settings_color_customization_holder.setOnClickListener { startCustomizationActivity() } } @@ -92,12 +91,6 @@ class SettingsActivity : SimpleActivity() { } private fun setupManageHiddenIcons() { - if (settings_purchase_thank_you_holder.isGone() && settings_use_english_holder.isGone() && settings_language_holder.isGone()) { - settings_manage_hidden_icons_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme) - } else { - settings_manage_hidden_icons_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme) - } - settings_manage_hidden_icons_holder.setOnClickListener { startActivity(Intent(this, HiddenIconsActivity::class.java)) } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 928b27a..fe6b1e2 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -6,30 +6,22 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - + android:layout_height="?attr/actionBarSize" + android:background="@color/color_primary" + app:menu="@menu/menu_settings" + app:title="@string/settings" + app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> + android:scrollbars="none"> - + android:layout_height="wrap_content"> - + android:text="@string/customize_colors" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - + - + android:background="@drawable/ripple_top_corners"> - + + + + + + + android:text="@string/use_english_language" /> - + - + - + android:text="@string/language" /> - - - - - + android:layout_below="@+id/settings_language_label" + tools:text="English" /> - + - + - - - + android:text="@string/manage_hidden_icons" /> - - - - + diff --git a/app/src/main/res/menu/menu_settings.xml b/app/src/main/res/menu/menu_settings.xml index ed7bfec..26cbf36 100644 --- a/app/src/main/res/menu/menu_settings.xml +++ b/app/src/main/res/menu/menu_settings.xml @@ -2,10 +2,14 @@ + tools:ignore="AppCompatResource,AlwaysShowAction"> +