mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
Apply it to the Launcher clock / date display
This commit is contained in:
parent
86e9f9c597
commit
32ca93fce1
4 changed files with 22 additions and 3 deletions
|
@ -105,8 +105,13 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
||||||
if (home_background_image != null && getSavedTheme(this) == "custom")
|
if (home_background_image != null && getSavedTheme(this) == "custom")
|
||||||
home_background_image.setImageBitmap(background)
|
home_background_image.setImageBitmap(background)
|
||||||
|
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
// Applying the date / time format (changeable in settings)
|
||||||
val timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
|
val dFormat = launcherPreferences.getInt(PREF_DATE_FORMAT, 0)
|
||||||
|
val upperFMT = resources.getStringArray(R.array.settings_time_formats_upper)
|
||||||
|
val lowerFMT = resources.getStringArray(R.array.settings_time_formats_lower)
|
||||||
|
|
||||||
|
val dateFormat = SimpleDateFormat(upperFMT[dFormat], Locale.getDefault())
|
||||||
|
val timeFormat = SimpleDateFormat(lowerFMT[dFormat], Locale.getDefault())
|
||||||
|
|
||||||
clockTimer = fixedRateTimer("clockTimer", true, 0L, 100) {
|
clockTimer = fixedRateTimer("clockTimer", true, 0L, 100) {
|
||||||
this@HomeActivity.runOnUiThread {
|
this@HomeActivity.runOnUiThread {
|
||||||
|
|
|
@ -185,7 +185,6 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
|
||||||
|
|
||||||
settings_launcher_format_spinner.setSelection(launcherPreferences.getInt(PREF_DATE_FORMAT, 0))
|
settings_launcher_format_spinner.setSelection(launcherPreferences.getInt(PREF_DATE_FORMAT, 0))
|
||||||
|
|
||||||
|
|
||||||
settings_launcher_format_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
settings_launcher_format_spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||||
launcherPreferences.edit()
|
launcherPreferences.edit()
|
||||||
|
|
|
@ -153,6 +153,7 @@
|
||||||
android:id="@+id/settings_launcher_format_spinner"
|
android:id="@+id/settings_launcher_format_spinner"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:entries="@array/settings_launcher_time_formats"
|
||||||
android:spinnerMode="dropdown"
|
android:spinnerMode="dropdown"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_time_format"
|
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_time_format"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
@ -58,6 +58,20 @@
|
||||||
<item>german</item>
|
<item>german</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="settings_time_formats_upper">
|
||||||
|
<item>yyyy-MM-dd</item>
|
||||||
|
<item>HH:mm:ss</item>
|
||||||
|
<item>HH:mm:ss</item>
|
||||||
|
<item>HH:mm:ss</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="settings_time_formats_lower">
|
||||||
|
<item>HH:mm:ss</item>
|
||||||
|
<item>yyyy-MM-dd</item>
|
||||||
|
<item> </item>
|
||||||
|
<item>dd.MM.yyyy</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string>
|
<string name="settings_footer_repo">https://github.com/finnmglas/Launcher#en</string>
|
||||||
<string name="settings_footer_web">https://www.finnmglas.com</string>
|
<string name="settings_footer_web">https://www.finnmglas.com</string>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue