Refactoring

pull/198/head
M66B 4 years ago
parent 5a4f446a32
commit c87cf45e23

@ -40,7 +40,6 @@ import org.jsoup.nodes.Element;
import java.io.File; import java.io.File;
import java.io.Serializable; import java.io.Serializable;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
@ -324,12 +323,7 @@ public class EntityMessage implements Serializable {
boolean language_detection = prefs.getBoolean("language_detection", false); boolean language_detection = prefs.getBoolean("language_detection", false);
String l = (language_detection ? language : null); String l = (language_detection ? language : null);
DateFormat DF; DateFormat DF = Helper.getDateTimeInstance(context, l == null ? null : new Locale(l));
if (l == null)
DF = Helper.getDateTimeInstance(context);
else
DF = SimpleDateFormat.getDateTimeInstance(
SimpleDateFormat.MEDIUM, SimpleDateFormat.MEDIUM, new Locale(l));
Element p = document.createElement("p"); Element p = document.createElement("p");
if (extended) { if (extended) {

@ -995,10 +995,18 @@ public class Helper {
} }
static DateFormat getDateTimeInstance(Context context) { static DateFormat getDateTimeInstance(Context context) {
return Helper.getDateTimeInstance(context, SimpleDateFormat.MEDIUM, SimpleDateFormat.MEDIUM); return getDateTimeInstance(context, null);
}
static DateFormat getDateTimeInstance(Context context, Locale locale) {
return Helper.getDateTimeInstance(context, SimpleDateFormat.MEDIUM, SimpleDateFormat.MEDIUM, locale);
} }
static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle) { static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle) {
return getDateTimeInstance(context, dateStyle, timeStyle, null);
}
static DateFormat getDateTimeInstance(Context context, int dateStyle, int timeStyle, Locale locale) {
// TODO fix time format // TODO fix time format
return SimpleDateFormat.getDateTimeInstance(dateStyle, timeStyle); return SimpleDateFormat.getDateTimeInstance(dateStyle, timeStyle);
} }

Loading…
Cancel
Save