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

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

Loading…
Cancel
Save