adding a setting item for changing date/time format

This commit is contained in:
tibbi 2019-02-21 22:27:21 +01:00
parent e7ee126577
commit 5b36b77c00
2 changed files with 34 additions and 4 deletions

View file

@ -3,10 +3,7 @@ package com.simplemobiletools.gallery.pro.activities
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.*
import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.dialogs.SecurityDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
@ -38,6 +35,7 @@ class SettingsActivity : SimpleActivity() {
private fun setupSettingItems() { private fun setupSettingItems() {
setupCustomizeColors() setupCustomizeColors()
setupUseEnglish() setupUseEnglish()
setupChangeDateTimeFormat()
setupManageIncludedFolders() setupManageIncludedFolders()
setupManageExcludedFolders() setupManageExcludedFolders()
setupManageHiddenFolders() setupManageHiddenFolders()
@ -113,6 +111,12 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupChangeDateTimeFormat() {
settings_change_date_time_format_holder.setOnClickListener {
ChangeDateTimeFormatDialog(this) {}
}
}
private fun setupManageIncludedFolders() { private fun setupManageIncludedFolders() {
settings_manage_included_folders_holder.setOnClickListener { settings_manage_included_folders_holder.setOnClickListener {
startActivity(Intent(this, IncludedFoldersActivity::class.java)) startActivity(Intent(this, IncludedFoldersActivity::class.java))
@ -587,6 +591,8 @@ class SettingsActivity : SimpleActivity() {
put(WAS_USE_ENGLISH_TOGGLED, config.wasUseEnglishToggled) put(WAS_USE_ENGLISH_TOGGLED, config.wasUseEnglishToggled)
put(WIDGET_BG_COLOR, config.widgetBgColor) put(WIDGET_BG_COLOR, config.widgetBgColor)
put(WIDGET_TEXT_COLOR, config.widgetTextColor) 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(INCLUDED_FOLDERS, TextUtils.join(",", config.includedFolders))
put(EXCLUDED_FOLDERS, TextUtils.join(",", config.excludedFolders)) put(EXCLUDED_FOLDERS, TextUtils.join(",", config.excludedFolders))
put(SHOW_HIDDEN_MEDIA, config.showHiddenMedia) put(SHOW_HIDDEN_MEDIA, config.showHiddenMedia)
@ -708,6 +714,8 @@ class SettingsActivity : SimpleActivity() {
WAS_USE_ENGLISH_TOGGLED -> config.wasUseEnglishToggled = value.toBoolean() WAS_USE_ENGLISH_TOGGLED -> config.wasUseEnglishToggled = value.toBoolean()
WIDGET_BG_COLOR -> config.widgetBgColor = value.toInt() WIDGET_BG_COLOR -> config.widgetBgColor = value.toInt()
WIDGET_TEXT_COLOR -> config.widgetTextColor = 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()) INCLUDED_FOLDERS -> config.addIncludedFolders(value.toStringSet())
EXCLUDED_FOLDERS -> config.addExcludedFolders(value.toStringSet()) EXCLUDED_FOLDERS -> config.addExcludedFolders(value.toStringSet())
SHOW_HIDDEN_MEDIA -> config.showHiddenMedia = value.toBoolean() SHOW_HIDDEN_MEDIA -> config.showHiddenMedia = value.toBoolean()

View file

@ -58,6 +58,28 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_change_date_time_format_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_change_date_time_format"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:text="@string/change_date_and_time_format"/>
</RelativeLayout>
<View <View
android:id="@+id/visibility_divider" android:id="@+id/visibility_divider"
android:layout_width="match_parent" android:layout_width="match_parent"