redesigning the app settings
This commit is contained in:
parent
06cc30a723
commit
006e367a1e
|
@ -85,11 +85,48 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupShowRecycleBinLast()
|
||||
setupEmptyRecycleBin()
|
||||
updateTextColors(settings_holder)
|
||||
setupSectionColors()
|
||||
setupClearCache()
|
||||
setupExportSettings()
|
||||
setupImportSettings()
|
||||
invalidateOptionsMenu()
|
||||
|
||||
arrayOf(
|
||||
settings_color_customization_label,
|
||||
settings_general_settings_label,
|
||||
settings_visibility_label,
|
||||
settings_videos_label,
|
||||
settings_thumbnails_label,
|
||||
settings_scrolling_label,
|
||||
settings_fullscreen_media_label,
|
||||
settings_deep_zoomable_images_label,
|
||||
settings_extended_details_label,
|
||||
settings_security_label,
|
||||
settings_file_operations_label,
|
||||
settings_bottom_actions_label,
|
||||
settings_recycle_bin_label,
|
||||
settings_migrating_label
|
||||
).forEach {
|
||||
it.setTextColor(getAdjustedPrimaryColor())
|
||||
}
|
||||
|
||||
arrayOf(
|
||||
settings_color_customization_holder,
|
||||
settings_general_settings_holder,
|
||||
settings_visibility_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(baseConfig.backgroundColor.getContrastColor())
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -105,17 +142,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupSectionColors() {
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
arrayListOf(
|
||||
visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label,
|
||||
file_operations_label, deep_zoomable_images_label, extended_details_label, bottom_actions_label, recycle_bin_label,
|
||||
migrating_label
|
||||
).forEach {
|
||||
it.setTextColor(adjustedPrimaryColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCustomizeColors() {
|
||||
settings_customize_colors_holder.setOnClickListener {
|
||||
startCustomizationActivity()
|
||||
|
@ -125,6 +151,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_change_date_time_format_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
|
||||
|
@ -445,6 +476,12 @@ 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() {
|
||||
|
@ -473,16 +510,15 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupShowExtendedDetails() {
|
||||
settings_show_extended_details.isChecked = config.showExtendedDetails
|
||||
updateExtendedDetailsButtons()
|
||||
settings_show_extended_details_holder.setOnClickListener {
|
||||
settings_show_extended_details.toggle()
|
||||
config.showExtendedDetails = settings_show_extended_details.isChecked
|
||||
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||
settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||
updateExtendedDetailsButtons()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupHideExtendedDetails() {
|
||||
settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||
settings_hide_extended_details.isChecked = config.hideExtendedDetails
|
||||
settings_hide_extended_details_holder.setOnClickListener {
|
||||
settings_hide_extended_details.toggle()
|
||||
|
@ -491,7 +527,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupManageExtendedDetails() {
|
||||
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||
settings_manage_extended_details_holder.setOnClickListener {
|
||||
ManageExtendedDetailsDialog(this) {
|
||||
if (config.extendedDetails == 0) {
|
||||
|
@ -501,6 +536,17 @@ 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() {
|
||||
settings_skip_delete_confirmation.isChecked = config.skipDeleteConfirmation
|
||||
settings_skip_delete_confirmation_holder.setOnClickListener {
|
||||
|
@ -534,20 +580,20 @@ class SettingsActivity : SimpleActivity() {
|
|||
)
|
||||
|
||||
private fun setupBottomActions() {
|
||||
settings_bottom_actions.isChecked = config.bottomActions
|
||||
settings_bottom_actions_holder.setOnClickListener {
|
||||
settings_bottom_actions.toggle()
|
||||
config.bottomActions = settings_bottom_actions.isChecked
|
||||
settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions)
|
||||
settings_bottom_actions_checkbox.isChecked = config.bottomActions
|
||||
updateManageBottomActionsButtons()
|
||||
settings_bottom_actions_checkbox_holder.setOnClickListener {
|
||||
settings_bottom_actions_checkbox.toggle()
|
||||
config.bottomActions = settings_bottom_actions_checkbox.isChecked
|
||||
updateManageBottomActionsButtons()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupManageBottomActions() {
|
||||
settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions)
|
||||
settings_manage_bottom_actions_holder.setOnClickListener {
|
||||
ManageBottomActionsDialog(this) {
|
||||
if (config.visibleBottomActions == 0) {
|
||||
settings_bottom_actions_holder.callOnClick()
|
||||
settings_bottom_actions_checkbox_holder.callOnClick()
|
||||
config.bottomActions = false
|
||||
config.visibleBottomActions = DEFAULT_BOTTOM_ACTIONS
|
||||
}
|
||||
|
@ -555,17 +601,22 @@ 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() {
|
||||
settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_show_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_show_recycle_bin_last_holder.beVisibleIf(config.useRecycleBin && config.showRecycleBinAtFolders)
|
||||
updateRecycleBinButtons()
|
||||
settings_use_recycle_bin.isChecked = config.useRecycleBin
|
||||
settings_use_recycle_bin_holder.setOnClickListener {
|
||||
settings_use_recycle_bin.toggle()
|
||||
config.useRecycleBin = settings_use_recycle_bin.isChecked
|
||||
settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_show_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
|
||||
settings_show_recycle_bin_last_holder.beVisibleIf(config.useRecycleBin && config.showRecycleBinAtFolders)
|
||||
updateRecycleBinButtons()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -574,7 +625,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
settings_show_recycle_bin_holder.setOnClickListener {
|
||||
settings_show_recycle_bin.toggle()
|
||||
config.showRecycleBinAtFolders = settings_show_recycle_bin.isChecked
|
||||
settings_show_recycle_bin_last_holder.beVisibleIf(config.useRecycleBin && config.showRecycleBinAtFolders)
|
||||
updateRecycleBinButtons()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -589,6 +640,18 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateRecycleBinButtons() {
|
||||
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() {
|
||||
ensureBackgroundThread {
|
||||
try {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue