DroidWorksStudio / mLauncher

Minimal Launcher app for Android. Customized olauncher as I just started learning kotlin .
GNU General Public License v3.0
217 stars 22 forks source link

[Enhancement] Default (or option) to remove AM/PM #496

Closed dessalines closed 2 months ago

dessalines commented 2 months ago

Checklist

Feature description

OLauncher looks like it removes the AM/PM by default. It looks cleaner, and makes sense to do. You could make this optional / a setting, but IMO its not necessary. Not even the android top bar shows AM/PM.

Screenshot_2024-05-05-09-41-51-29_2e107026da42866a5d7a260dd4baceed

Additional information

NA

Terms and Conditions

Gitbot-Actions commented 2 months ago

👋 Thanks for reporting!

We will get back to you soon about this issue.

HeCodes2Much commented 2 months ago

just a quick question. are using 12 or 24 hour clock?

dessalines commented 2 months ago

12 hour, but notably OLauncher also uses the 12-hour, but still removes the AM/PM.

HeCodes2Much commented 2 months ago

ya just having a look and they don't seem to support format24Hour on there clock at all.

<TextClock
    android:id="@+id/clock"
    style="@style/TextDefault"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="sans-serif-light"
    android:format12Hour="h:mm"
    android:textSize="@dimen/time_size"
    tools:text="02:34" />

<TextView
    android:id="@+id/date"
    style="@style/TextDefault"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:format12Hour="EEE, dd MMM"
    android:format24Hour="EEE, dd MMM"
    android:paddingHorizontal="3dp"
    android:textSize="@dimen/date_size"
    tools:text="Thu, 30 Dec" />
HeCodes2Much commented 2 months ago

I could add a toggle for this in the settings as myself i like to see the AP/PM as I use a 12 hour clock.

HeCodes2Much commented 2 months ago

Ok so i added a toggle and the toggle does nothing they both display the same as that is timezone dependent some timezones show ap/pm and some dont. the a doesnt seem to make any difference at all. i would need to also add a toggle for using timezone or not for this to work.

Any ideas would be helpful.

val best12 = if (prefs.showTimeFormat) {
    DateFormat.getBestDateTimePattern(timezone, "hhmma")
} else {
    DateFormat.getBestDateTimePattern(timezone, "hhmm")
}
dessalines commented 2 months ago

You'll probably have to do this based on locale, not timezone, and just use SimpleDateFormat, as this answer recommends:

https://stackoverflow.com/a/63135372

Here's another more recent answer:

https://stackoverflow.com/a/75970629

HeCodes2Much commented 2 months ago

I have found a better way as both of them examples are using java I use Kotlin

val best12 = DateFormat.getBestDateTimePattern(timezone, if (prefs.showTimeFormat) "hhmma" else "hhmm").let {
    if (!prefs.showTimeFormat) it.removeSuffix(" a") else it
}
lumnn commented 3 weeks ago

I'm on version 1.6.2 and it always shows me time in 12hr format, regardless of am/pm toggle. System wide I have 24hr clock