|
|
|
@ -2416,8 +2416,7 @@ public class Helper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static DateFormat getTimeInstance(Context context, int style) {
|
|
|
|
static DateFormat getTimeInstance(Context context, int style) {
|
|
|
|
if (context != null &&
|
|
|
|
if (context != null)
|
|
|
|
(style == SimpleDateFormat.SHORT || style == SimpleDateFormat.MEDIUM))
|
|
|
|
|
|
|
|
return new SimpleDateFormat(getTimePattern(context, style));
|
|
|
|
return new SimpleDateFormat(getTimePattern(context, style));
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return SimpleDateFormat.getTimeInstance(style);
|
|
|
|
return SimpleDateFormat.getTimeInstance(style);
|
|
|
|
@ -2436,8 +2435,7 @@ public class Helper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle) {
|
|
|
|
static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle) {
|
|
|
|
if (context != null &&
|
|
|
|
if (context != null) {
|
|
|
|
(timeStyle == SimpleDateFormat.SHORT || timeStyle == SimpleDateFormat.MEDIUM)) {
|
|
|
|
|
|
|
|
DateFormat dateFormat = getDateInstance(context, dateStyle);
|
|
|
|
DateFormat dateFormat = getDateInstance(context, dateStyle);
|
|
|
|
if (dateFormat instanceof SimpleDateFormat) {
|
|
|
|
if (dateFormat instanceof SimpleDateFormat) {
|
|
|
|
String datePattern = ((SimpleDateFormat) dateFormat).toPattern();
|
|
|
|
String datePattern = ((SimpleDateFormat) dateFormat).toPattern();
|
|
|
|
@ -2455,6 +2453,8 @@ public class Helper {
|
|
|
|
String skeleton = (is24Hour ? "Hm" : "hm");
|
|
|
|
String skeleton = (is24Hour ? "Hm" : "hm");
|
|
|
|
if (style == SimpleDateFormat.MEDIUM)
|
|
|
|
if (style == SimpleDateFormat.MEDIUM)
|
|
|
|
skeleton += "s";
|
|
|
|
skeleton += "s";
|
|
|
|
|
|
|
|
else if (style == SimpleDateFormat.LONG)
|
|
|
|
|
|
|
|
skeleton += "sz";
|
|
|
|
return android.text.format.DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
|
|
|
|
return android.text.format.DateFormat.getBestDateTimePattern(Locale.getDefault(), skeleton);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|