Dark theme time format
When changing device language, dark theme does not change the AM/PM format to the proper new language setting Test: all settings tests Fixes: 149381251 Change-Id: I68763e24988837f917adad39f82b90e79573fd07
This commit is contained in:
@@ -25,13 +25,14 @@ import java.time.format.DateTimeFormatter;
|
|||||||
*/
|
*/
|
||||||
public class TimeFormatter {
|
public class TimeFormatter {
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
public static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm a");
|
private final DateTimeFormatter mFormatter;
|
||||||
public TimeFormatter(Context context) {
|
public TimeFormatter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mFormatter = DateTimeFormatter.ofPattern("hh:mm a");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String of(LocalTime time) {
|
public String of(LocalTime time) {
|
||||||
return is24HourFormat() ? time.toString() : formatter.format(time);
|
return is24HourFormat() ? time.toString() : mFormatter.format(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean is24HourFormat() {
|
public boolean is24HourFormat() {
|
||||||
|
Reference in New Issue
Block a user