Merge branch 'omnipod_eros_dev' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros_dev
This commit is contained in:
commit
37c1d30ecc
|
@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistor
|
|||
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
|
||||
/**
|
||||
* Created by andy on 5/19/18.
|
||||
|
@ -131,7 +132,7 @@ public class RileyLinkStatusHistory extends Fragment implements RefreshableInter
|
|||
RLHistoryItem item = historyList.get(position);
|
||||
|
||||
if (item != null) {
|
||||
holder.timeView.setText(StringUtil.toDateTimeString(item.getDateTime()));
|
||||
holder.timeView.setText(DateUtil.dateAndTimeAndSecondsString(item.getDateTime().toDateTime().getMillis()));
|
||||
holder.typeView.setText(item.getSource().getDesc());
|
||||
holder.valueView.setText(item.getDescription());
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.text.DecimalFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.utils.DateUtil;
|
||||
|
||||
/**
|
||||
* Created by geoff on 4/28/15.
|
||||
* modified by Andy
|
||||
|
@ -83,7 +85,8 @@ public class StringUtil {
|
|||
|
||||
|
||||
public static String toDateTimeString(LocalDateTime localDateTime) {
|
||||
return localDateTime.toString("dd.MM.yyyy HH:mm:ss");
|
||||
return DateUtil.dateAndTimeAndSecondsString(localDateTime.toDateTime().getMillis());
|
||||
//return localDateTime.toString("dd.MM.yyyy HH:mm:ss");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Calendar;
|
|||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -8,7 +11,9 @@ import org.junit.runner.RunWith;
|
|||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import info.AAPSMocker;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -89,6 +94,49 @@ public class DateUtilTest {
|
|||
Assert.assertEquals("(1h 1')", DateUtil.timeFrameString((T.hours(1).msecs() + T.mins(1).msecs())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void dateTimeFormat() {
|
||||
int style = DateFormat.SHORT;
|
||||
//Also try with style = DateFormat.FULL and DateFormat.SHORT
|
||||
Date date = new Date();
|
||||
DateFormat df;
|
||||
df = DateFormat.getDateInstance(style, Locale.UK);
|
||||
System.out.println("United Kingdom: " + df.format(date));
|
||||
df = DateFormat.getDateInstance(style, Locale.US);
|
||||
System.out.println("USA: " + df.format(date));
|
||||
df = DateFormat.getDateInstance(style, Locale.FRANCE);
|
||||
System.out.println("France: " + df.format(date));
|
||||
df = DateFormat.getDateInstance(style, Locale.ITALY);
|
||||
System.out.println("Italy: " + df.format(date));
|
||||
df = DateFormat.getDateInstance(style, Locale.JAPAN);
|
||||
System.out.println("Japan: " + df.format(date));
|
||||
df = DateFormat.getDateInstance(style, Locale.UK);
|
||||
System.out.println("United Kingdom: " + df.format(date));
|
||||
|
||||
int styles[] = { DateFormat.DEFAULT, DateFormat.FULL, DateFormat.LONG, DateFormat.MEDIUM, DateFormat.SHORT};
|
||||
|
||||
for (int styleX : styles) {
|
||||
df = DateFormat.getDateInstance(styleX, new Locale("en"));
|
||||
System.out.println("English: style=" + styleX + ", result=" + df.format(date));
|
||||
}
|
||||
|
||||
DateTimeFormatter dateTimeFormat = DateTimeFormat.shortDate();
|
||||
|
||||
LocalDateTime lcd = new LocalDateTime();
|
||||
|
||||
|
||||
System.out.println("English: LocalDateTime=" + dateTimeFormat.print(lcd));
|
||||
|
||||
|
||||
// public static final int DEFAULT = 2;
|
||||
// public static final int FULL = 0;
|
||||
// public static final int LONG = 1;
|
||||
// public static final int MEDIUM = 2;
|
||||
// public static final int SHORT = 3;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
public void prepareMock() {
|
||||
AAPSMocker.mockMainApp();
|
||||
|
|
Loading…
Reference in a new issue