From 5b36b77c000dd9c52069232935eb4131da6c6b6f Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Feb 2019 22:27:21 +0100 Subject: [PATCH] adding a setting item for changing date/time format --- .../pro/activities/SettingsActivity.kt | 16 ++++++++++---- app/src/main/res/layout/activity_settings.xml | 22 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 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 bac8fc9b5..5724fac5f 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 @@ -3,10 +3,7 @@ package com.simplemobiletools.gallery.pro.activities import android.content.Intent import android.os.Bundle import android.text.TextUtils -import com.simplemobiletools.commons.dialogs.ConfirmationDialog -import com.simplemobiletools.commons.dialogs.FilePickerDialog -import com.simplemobiletools.commons.dialogs.RadioGroupDialog -import com.simplemobiletools.commons.dialogs.SecurityDialog +import com.simplemobiletools.commons.dialogs.* import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.RadioItem @@ -38,6 +35,7 @@ class SettingsActivity : SimpleActivity() { private fun setupSettingItems() { setupCustomizeColors() setupUseEnglish() + setupChangeDateTimeFormat() setupManageIncludedFolders() setupManageExcludedFolders() setupManageHiddenFolders() @@ -113,6 +111,12 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupChangeDateTimeFormat() { + settings_change_date_time_format_holder.setOnClickListener { + ChangeDateTimeFormatDialog(this) {} + } + } + private fun setupManageIncludedFolders() { settings_manage_included_folders_holder.setOnClickListener { startActivity(Intent(this, IncludedFoldersActivity::class.java)) @@ -587,6 +591,8 @@ class SettingsActivity : SimpleActivity() { put(WAS_USE_ENGLISH_TOGGLED, config.wasUseEnglishToggled) put(WIDGET_BG_COLOR, config.widgetBgColor) put(WIDGET_TEXT_COLOR, config.widgetTextColor) + put(DATE_FORMAT, config.dateFormat) + put(USE_24_HOUR_FORMAT, config.use24HourFormat) put(INCLUDED_FOLDERS, TextUtils.join(",", config.includedFolders)) put(EXCLUDED_FOLDERS, TextUtils.join(",", config.excludedFolders)) put(SHOW_HIDDEN_MEDIA, config.showHiddenMedia) @@ -708,6 +714,8 @@ class SettingsActivity : SimpleActivity() { WAS_USE_ENGLISH_TOGGLED -> config.wasUseEnglishToggled = value.toBoolean() WIDGET_BG_COLOR -> config.widgetBgColor = value.toInt() WIDGET_TEXT_COLOR -> config.widgetTextColor = value.toInt() + DATE_FORMAT -> config.dateFormat = value.toString() + USE_24_HOUR_FORMAT -> config.use24HourFormat = value.toBoolean() INCLUDED_FOLDERS -> config.addIncludedFolders(value.toStringSet()) EXCLUDED_FOLDERS -> config.addExcludedFolders(value.toStringSet()) SHOW_HIDDEN_MEDIA -> config.showHiddenMedia = value.toBoolean() diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ae00c6d43..b990c6223 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -58,6 +58,28 @@ + + + + + +