From 63e0ee93a9672f1377808d93dbd8f0e109e32c04 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 8 Jan 2023 23:44:11 +0100 Subject: [PATCH] updating Settings UI --- .../pro/activities/SettingsActivity.kt | 62 +- app/src/main/res/layout/activity_settings.xml | 1357 ++++++++--------- 2 files changed, 625 insertions(+), 794 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 3cd0aabac..b4c34cc9e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -26,8 +26,12 @@ class SettingsActivity : SimpleActivity() { private var mRecycleBinContentSize = 0L 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) } override fun onResume() { @@ -90,7 +94,7 @@ class SettingsActivity : SimpleActivity() { setupImportSettings() arrayOf( - settings_color_customization_label, + settings_color_customization_section_label, settings_general_settings_label, settings_videos_label, settings_thumbnails_label, @@ -106,24 +110,6 @@ class SettingsActivity : SimpleActivity() { ).forEach { it.setTextColor(getProperPrimaryColor()) } - - arrayOf( - settings_color_customization_holder, - settings_general_settings_holder, - settings_videos_holder, - settings_thumbnails_holder, - settings_scrolling_holder, - settings_fullscreen_media_holder, - settings_deep_zoomable_images_holder, - settings_extended_details_holder, - settings_security_holder, - settings_file_operations_holder, - settings_bottom_actions_holder, - settings_recycle_bin_holder, - settings_migrating_holder - ).forEach { - it.background.applyColorFilter(getProperBackgroundColor().getContrastColor()) - } } override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) { @@ -135,7 +121,7 @@ class SettingsActivity : SimpleActivity() { } private fun setupCustomizeColors() { - settings_customize_colors_holder.setOnClickListener { + settings_color_customization_holder.setOnClickListener { startCustomizationActivity() } } @@ -153,11 +139,6 @@ class SettingsActivity : SimpleActivity() { private fun setupLanguage() { settings_language.text = Locale.getDefault().displayLanguage settings_language_holder.beVisibleIf(isTiramisuPlus()) - - if (settings_use_english_holder.isGone() && settings_language_holder.isGone()) { - settings_change_date_time_format_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } - settings_language_holder.setOnClickListener { launchChangeAppLanguageIntent() } @@ -514,12 +495,6 @@ class SettingsActivity : SimpleActivity() { settings_allow_rotating_with_gestures_holder.beVisibleIf(config.allowZoomingImages) settings_show_highest_quality_holder.beVisibleIf(config.allowZoomingImages) settings_allow_one_to_one_zoom_holder.beVisibleIf(config.allowZoomingImages) - - if (config.allowZoomingImages) { - settings_allow_zooming_images_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } else { - settings_allow_zooming_images_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme) - } } private fun setupShowHighestQuality() { @@ -577,12 +552,6 @@ class SettingsActivity : SimpleActivity() { private fun updateExtendedDetailsButtons() { settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails) settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails) - - if (config.showExtendedDetails) { - settings_show_extended_details_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } else { - settings_show_extended_details_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme) - } } private fun setupSkipDeleteConfirmation() { @@ -619,11 +588,11 @@ class SettingsActivity : SimpleActivity() { private fun setupBottomActions() { settings_bottom_actions_checkbox.isChecked = config.bottomActions - updateManageBottomActionsButtons() + settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions) settings_bottom_actions_checkbox_holder.setOnClickListener { settings_bottom_actions_checkbox.toggle() config.bottomActions = settings_bottom_actions_checkbox.isChecked - updateManageBottomActionsButtons() + settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions) } } @@ -639,15 +608,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun updateManageBottomActionsButtons() { - settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions) - if (config.bottomActions) { - settings_bottom_actions_checkbox_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } else { - settings_bottom_actions_checkbox_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme) - } - } - private fun setupUseRecycleBin() { updateRecycleBinButtons() settings_use_recycle_bin.isChecked = config.useRecycleBin @@ -682,12 +642,6 @@ class SettingsActivity : SimpleActivity() { settings_show_recycle_bin_last_holder.beVisibleIf(config.useRecycleBin && config.showRecycleBinAtFolders) settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin) settings_show_recycle_bin_holder.beVisibleIf(config.useRecycleBin) - - if (config.useRecycleBin) { - settings_use_recycle_bin_holder.background = resources.getDrawable(R.drawable.ripple_top_corners, theme) - } else { - settings_use_recycle_bin_holder.background = resources.getDrawable(R.drawable.ripple_all_corners, theme) - } } private fun setupEmptyRecycleBin() { diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index d9f70c3cf..176afb50c 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -6,27 +6,21 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - + android:layout_height="?attr/actionBarSize" + android:background="@color/color_primary" + app:title="@string/settings" + app:titleTextAppearance="@style/AppTheme.ActionBar.TitleTextStyle" /> + android:layout_marginTop="?attr/actionBarSize" + android:fillViewport="true" + android:scrollbars="none"> - + android:layout_height="wrap_content"> - + android:text="@string/customize_colors" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/use_english_language" /> - + - + - + + + + + + + + + + + + + + + + + android:layout_below="@+id/settings_file_loading_priority_label" + tools:text="@string/compromise" /> - + - + - + - + + + + + + + + + + + + + + + + + android:text="@string/show_hidden_items" /> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + android:layout_height="wrap_content"> - + android:text="@string/autoplay_videos" /> - + - + - + android:text="@string/remember_last_video_position" /> - + - + - + android:text="@string/loop_videos" /> - + - + - + android:text="@string/open_videos_on_separate_screen" /> - + - + - + android:text="@string/allow_video_gestures" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/crop_thumbnails" /> - + - + - + + + + + + + + + android:layout_below="@+id/settings_folder_thumbnail_style_label" + tools:text="Default" /> - + - - - - - - - - - - + - + android:layout_height="wrap_content"> - + android:text="@string/scroll_thumbnails_horizontally" /> - + - + - + android:text="@string/enable_pull_to_refresh" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/max_brightness" /> - + - + - + android:text="@string/black_background_at_fullscreen" /> - + - + - + android:text="@string/hide_system_ui_at_fullscreen" /> - + - + - + android:text="@string/allow_instant_change" /> - + - + - + android:text="@string/allow_photo_gestures" /> - + - + - + android:text="@string/allow_down_gesture" /> - + - + - + android:text="@string/show_notch" /> - + - + - + + + android:layout_below="@+id/settings_screen_rotation_label" + tools:text="@string/screen_rotation_system_setting" /> - + - - - - + - + android:layout_height="wrap_content"> - + android:text="@string/allow_deep_zooming_images" /> - + - + - + android:text="@string/allow_rotating_gestures" /> - + - + - + android:text="@string/show_highest_quality" /> - + - + - + android:text="@string/allow_one_to_one_zoom" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/show_extended_details" /> - + - + - + android:text="@string/hide_extended_details" /> - + - + - + android:text="@string/manage_extended_details" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/password_protect_whole_app" /> - + - + - + android:text="@string/password_protect_hidden_items" /> - + - + - + android:text="@string/password_protect_excluded" /> - + - + - + android:text="@string/password_protect_file_deletion" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/delete_empty_folders" /> - + - + - + android:text="@string/keep_last_modified" /> - + - + - + android:text="@string/skip_delete_confirmation" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/show_at_bottom" /> - + - + - + android:text="@string/manage_bottom_actions" /> - + - - + - + android:layout_height="wrap_content"> - + android:text="@string/move_items_into_recycle_bin" /> - + - + - + android:text="@string/show_recycle_bin" /> - + - + - + android:text="@string/show_recycle_bin_last" /> - + - + - + + + android:layout_below="@+id/settings_empty_recycle_bin_label" + tools:text="0 B" /> - + - - - - + - + android:layout_height="wrap_content"> - + + + android:layout_below="@+id/settings_clear_cache_label" + tools:text="0 B" /> - + - + - - - + android:text="@string/export_settings" /> - + - + - + android:text="@string/import_settings" /> - - - - +