Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da916a5c authored by Tony Huang's avatar Tony Huang
Browse files

Fix Night Light only display 12-hr time format on secondary label

Night Light only display 12-hr time format on secondary label
currently, add a new pattern for 24-hr format for user use
24-hr format.

Fixes: 79608379
Test: atest SystemUITests and visual check
Change-Id: Id5aef489b241b4cc48fce46ad4fdd2e6c98370f3
parent 35f12ed1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.provider.Settings;
import android.service.quicksettings.Tile;
import androidx.annotation.StringRes;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Log;
import android.widget.Switch;

@@ -48,6 +49,7 @@ public class NightDisplayTile extends QSTileImpl<BooleanState>
     */
    private static final String PATTERN_HOUR = "h a";
    private static final String PATTERN_HOUR_MINUTE = "h:mm a";
    private static final String PATTERN_HOUR_NINUTE_24 = "HH:mm";


    private ColorDisplayController mController;
@@ -145,6 +147,7 @@ public class NightDisplayTile extends QSTileImpl<BooleanState>
                // Choose between just showing the hour or also showing the minutes (based on the
                // user-selected toggle time). This helps reduce how much space the label takes.
                toggleTimeFormat = DateTimeFormatter.ofPattern(
                        DateFormat.is24HourFormat(mContext) ? PATTERN_HOUR_NINUTE_24 :
                        toggleTime.getMinute() == 0 ? PATTERN_HOUR : PATTERN_HOUR_MINUTE);

                return mContext.getString(toggleTimeStringRes, toggleTime.format(toggleTimeFormat));