Merge branch 'master' of https://github.com/MilosKozak/AndroidAPS
This commit is contained in:
commit
750cea7bcf
23 changed files with 81 additions and 80 deletions
|
@ -37,7 +37,7 @@
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -43,8 +43,8 @@ android {
|
||||||
applicationId "info.nightscout.androidaps"
|
applicationId "info.nightscout.androidaps"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 1020
|
versionCode 1100
|
||||||
versionName "1.0.20"
|
versionName "1.1"
|
||||||
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
buildConfigField "String", "BUILDVERSION", generateGitBuild()
|
||||||
}
|
}
|
||||||
lintOptions {
|
lintOptions {
|
||||||
|
|
|
@ -346,7 +346,6 @@ public class DataService extends IntentService {
|
||||||
handleAddedTreatment(trstr);
|
handleAddedTreatment(trstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -368,7 +367,6 @@ public class DataService extends IntentService {
|
||||||
handleChangedTreatment(trstr);
|
handleChangedTreatment(trstr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -392,7 +390,6 @@ public class DataService extends IntentService {
|
||||||
removeTreatmentFromDb(_id);
|
removeTreatmentFromDb(_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scheduleTreatmentChange();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -471,6 +468,7 @@ public class DataService extends IntentService {
|
||||||
int updated = MainApp.getDbHelper().getDaoTreatments().update(stored);
|
int updated = MainApp.getDbHelper().getDaoTreatments().update(stored);
|
||||||
if (Config.logIncommingData)
|
if (Config.logIncommingData)
|
||||||
log.debug("Records updated: " + updated);
|
log.debug("Records updated: " + updated);
|
||||||
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Config.logIncommingData)
|
if (Config.logIncommingData)
|
||||||
|
@ -494,6 +492,7 @@ public class DataService extends IntentService {
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +546,7 @@ public class DataService extends IntentService {
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
scheduleTreatmentChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleDanaRHistoryRecords(JSONObject trJson) throws JSONException, SQLException {
|
public void handleDanaRHistoryRecords(JSONObject trJson) throws JSONException, SQLException {
|
||||||
|
|
|
@ -6,14 +6,13 @@ import com.j256.ormlite.table.DatabaseTable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
||||||
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPBASALS)
|
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPBASALS)
|
||||||
|
@ -190,16 +189,15 @@ public class TempBasal {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
DateFormat formatDateToJustTime = new SimpleDateFormat("HH:mm");
|
|
||||||
String extended = isExtended ? "E " : "";
|
String extended = isExtended ? "E " : "";
|
||||||
|
|
||||||
if (isAbsolute) {
|
if (isAbsolute) {
|
||||||
return extended + DecimalFormatter.to2Decimal(absolute) + "U/h @" +
|
return extended + DecimalFormatter.to2Decimal(absolute) + "U/h @" +
|
||||||
formatDateToJustTime.format(timeStart) +
|
DateUtil.timeString(timeStart) +
|
||||||
" " + getRealDuration() + "/" + duration + "min";
|
" " + getRealDuration() + "/" + duration + "min";
|
||||||
} else { // percent
|
} else { // percent
|
||||||
return percent + "% @" +
|
return percent + "% @" +
|
||||||
formatDateToJustTime.format(timeStart) +
|
DateUtil.timeString(timeStart) +
|
||||||
" " + getRealDuration() + "/" + duration + "min";
|
" " + getRealDuration() + "/" + duration + "min";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,8 @@ import java.util.List;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.Iob;
|
import info.nightscout.androidaps.data.Iob;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension.DataPointWithLabelInterface;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.DataPointWithLabelInterface;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -197,10 +196,8 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
eventTime = new Date();
|
eventTime = new Date();
|
||||||
dateButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventdate);
|
dateButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventdate);
|
||||||
timeButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventtime);
|
timeButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventtime);
|
||||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
dateButton.setText(DateUtil.dateString(eventTime));
|
||||||
DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT);
|
timeButton.setText(DateUtil.timeString(eventTime));
|
||||||
dateButton.setText(df.format(eventTime));
|
|
||||||
timeButton.setText(tf.format(eventTime));
|
|
||||||
dateButton.setOnClickListener(this);
|
dateButton.setOnClickListener(this);
|
||||||
timeButton.setOnClickListener(this);
|
timeButton.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -330,8 +327,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
eventTime.setYear(year - 1900);
|
eventTime.setYear(year - 1900);
|
||||||
eventTime.setMonth(monthOfYear);
|
eventTime.setMonth(monthOfYear);
|
||||||
eventTime.setDate(dayOfMonth);
|
eventTime.setDate(dayOfMonth);
|
||||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
dateButton.setText(DateUtil.dateString(eventTime));
|
||||||
dateButton.setText(df.format(eventTime));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -339,8 +335,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
eventTime.setHours(hourOfDay);
|
eventTime.setHours(hourOfDay);
|
||||||
eventTime.setMinutes(minute);
|
eventTime.setMinutes(minute);
|
||||||
eventTime.setSeconds(second);
|
eventTime.setSeconds(second);
|
||||||
DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT);
|
timeButton.setText(DateUtil.timeString(eventTime));
|
||||||
timeButton.setText(tf.format(eventTime));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -32,6 +31,7 @@ import info.nightscout.androidaps.plugins.DanaR.Dialogs.ProfileViewDialog;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.History.DanaRHistoryActivity;
|
import info.nightscout.androidaps.plugins.DanaR.History.DanaRHistoryActivity;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.SetWarnColor;
|
import info.nightscout.utils.SetWarnColor;
|
||||||
|
|
||||||
|
@ -188,8 +188,6 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
|
|
||||||
// GUI functions
|
// GUI functions
|
||||||
private void updateGUI() {
|
private void updateGUI() {
|
||||||
final DateFormat formatTime = DateFormat.getTimeInstance(DateFormat.SHORT);
|
|
||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null && basaBasalRateView != null)
|
if (activity != null && basaBasalRateView != null)
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@ -200,14 +198,14 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
||||||
if (DanaRPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
if (DanaRPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastConnection.getTime();
|
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastConnection.getTime();
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
lastConnectionView.setText(formatTime.format(DanaRPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
lastConnectionView.setText(DateUtil.timeString(DanaRPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
}
|
}
|
||||||
if (DanaRPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
if (DanaRPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastBolusTime.getTime();
|
Long agoMsec = new Date().getTime() - DanaRPlugin.getDanaRPump().lastBolusTime.getTime();
|
||||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||||
if (agoHours < 6) // max 6h back
|
if (agoHours < 6) // max 6h back
|
||||||
lastBolusView.setText(formatTime.format(DanaRPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
lastBolusView.setText(DateUtil.timeString(DanaRPlugin.getDanaRPump().lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
||||||
else lastBolusView.setText("");
|
else lastBolusView.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -46,6 +45,7 @@ import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
|
@ -274,9 +274,8 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
||||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
|
||||||
DanaRHistoryRecord record = historyList.get(position);
|
DanaRHistoryRecord record = historyList.get(position);
|
||||||
holder.time.setText(df.format(new Date(record.getRecordDate())));
|
holder.time.setText(DateUtil.dateAndTimeString(record.getRecordDate()));
|
||||||
holder.value.setText(DecimalFormatter.to2Decimal(record.getRecordValue()));
|
holder.value.setText(DecimalFormatter.to2Decimal(record.getRecordValue()));
|
||||||
holder.stringvalue.setText(record.getStringRecordValue());
|
holder.stringvalue.setText(record.getStringRecordValue());
|
||||||
holder.bolustype.setText(record.getBolusType());
|
holder.bolustype.setText(record.getBolusType());
|
||||||
|
@ -306,11 +305,10 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
holder.alarm.setVisibility(View.GONE);
|
holder.alarm.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
case RecordTypes.RECORD_TYPE_DAILY:
|
case RecordTypes.RECORD_TYPE_DAILY:
|
||||||
df = DateFormat.getDateInstance(DateFormat.SHORT);
|
|
||||||
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
|
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
|
||||||
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
|
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
|
||||||
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
|
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
|
||||||
holder.time.setText(df.format(new Date(record.getRecordDate())));
|
holder.time.setText(DateUtil.dateString(record.getRecordDate()));
|
||||||
holder.time.setVisibility(View.VISIBLE);
|
holder.time.setVisibility(View.VISIBLE);
|
||||||
holder.value.setVisibility(View.GONE);
|
holder.value.setVisibility(View.GONE);
|
||||||
holder.stringvalue.setVisibility(View.GONE);
|
holder.stringvalue.setVisibility(View.GONE);
|
||||||
|
|
|
@ -6,12 +6,12 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
import info.nightscout.androidaps.db.DanaRHistoryRecord;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
|
|
||||||
public class MsgHistoryAll extends MessageBase {
|
public class MsgHistoryAll extends MessageBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(MsgHistoryAll.class);
|
private static Logger log = LoggerFactory.getLogger(MsgHistoryAll.class);
|
||||||
|
@ -150,8 +150,7 @@ public class MsgHistoryAll extends MessageBase {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
ev.message = DateUtil.dateAndTimeString(danaRHistoryRecord.getRecordDate());
|
||||||
ev.message = df.format(new Date(danaRHistoryRecord.getRecordDate()));
|
|
||||||
ev.message += " " + messageType;
|
ev.message += " " + messageType;
|
||||||
MainApp.bus().post(ev);
|
MainApp.bus().post(ev);
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -32,6 +31,7 @@ import info.nightscout.androidaps.plugins.DanaR.Dialogs.ProfileViewDialog;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRNewStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.History.DanaRHistoryActivity;
|
import info.nightscout.androidaps.plugins.DanaRKorean.History.DanaRHistoryActivity;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.SetWarnColor;
|
import info.nightscout.utils.SetWarnColor;
|
||||||
|
|
||||||
|
@ -185,7 +185,6 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
|
|
||||||
// GUI functions
|
// GUI functions
|
||||||
private void updateGUI() {
|
private void updateGUI() {
|
||||||
final DateFormat formatTime = DateFormat.getTimeInstance(DateFormat.SHORT);
|
|
||||||
|
|
||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity != null && basaBasalRateView != null)
|
if (activity != null && basaBasalRateView != null)
|
||||||
|
@ -197,7 +196,7 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
||||||
if (DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
if (DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime() != 0) {
|
||||||
Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime();
|
Long agoMsec = new Date().getTime() - DanaRKoreanPlugin.getDanaRPump().lastConnection.getTime();
|
||||||
int agoMin = (int) (agoMsec / 60d / 1000d);
|
int agoMin = (int) (agoMsec / 60d / 1000d);
|
||||||
lastConnectionView.setText(formatTime.format(DanaRKoreanPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
lastConnectionView.setText(DateUtil.timeString(DanaRKoreanPlugin.getDanaRPump().lastConnection) + " (" + String.format(MainApp.sResources.getString(R.string.minago), agoMin) + ")");
|
||||||
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
SetWarnColor.setColor(lastConnectionView, agoMin, 16d, 31d);
|
||||||
}
|
}
|
||||||
// if (DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
// if (DanaRKoreanPlugin.getDanaRPump().lastBolusTime.getTime() != 0) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -47,6 +46,7 @@ import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatu
|
||||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||||
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
|
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
|
@ -273,9 +273,8 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
public void onBindViewHolder(HistoryViewHolder holder, int position) {
|
||||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
|
||||||
DanaRHistoryRecord record = historyList.get(position);
|
DanaRHistoryRecord record = historyList.get(position);
|
||||||
holder.time.setText(df.format(new Date(record.getRecordDate())));
|
holder.time.setText(DateUtil.dateAndTimeString(record.getRecordDate()));
|
||||||
holder.value.setText(DecimalFormatter.to2Decimal(record.getRecordValue()));
|
holder.value.setText(DecimalFormatter.to2Decimal(record.getRecordValue()));
|
||||||
holder.stringvalue.setText(record.getStringRecordValue());
|
holder.stringvalue.setText(record.getStringRecordValue());
|
||||||
holder.bolustype.setText(record.getBolusType());
|
holder.bolustype.setText(record.getBolusType());
|
||||||
|
@ -305,11 +304,10 @@ public class DanaRHistoryActivity extends Activity {
|
||||||
holder.alarm.setVisibility(View.GONE);
|
holder.alarm.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
case RecordTypes.RECORD_TYPE_DAILY:
|
case RecordTypes.RECORD_TYPE_DAILY:
|
||||||
df = DateFormat.getDateInstance(DateFormat.SHORT);
|
|
||||||
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
|
holder.dailybasal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBasal()) + "U");
|
||||||
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
|
holder.dailybolus.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()) + "U");
|
||||||
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
|
holder.dailytotal.setText(DecimalFormatter.to2Decimal(record.getRecordDailyBolus()+ record.getRecordDailyBasal()) + "U");
|
||||||
holder.time.setText(df.format(new Date(record.getRecordDate())));
|
holder.time.setText(DateUtil.dateString(record.getRecordDate()));
|
||||||
holder.time.setVisibility(View.VISIBLE);
|
holder.time.setVisibility(View.VISIBLE);
|
||||||
holder.value.setVisibility(View.GONE);
|
holder.value.setVisibility(View.GONE);
|
||||||
holder.stringvalue.setVisibility(View.GONE);
|
holder.stringvalue.setVisibility(View.GONE);
|
||||||
|
|
|
@ -15,7 +15,6 @@ import android.widget.Spinner;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@ -62,15 +61,14 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
||||||
int posFrom = 0;
|
int posFrom = 0;
|
||||||
int posTo = 95;
|
int posTo = 95;
|
||||||
ArrayList<CharSequence> timeList = new ArrayList<>();
|
ArrayList<CharSequence> timeList = new ArrayList<>();
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int t = 0; t < 24 * 60 * 60; t += 15 * 60) {
|
for (int t = 0; t < 24 * 60 * 60; t += 15 * 60) {
|
||||||
timeList.add(df.format(DateUtil.toDate(t)));
|
timeList.add(DateUtil.timeString(DateUtil.toDate(t)));
|
||||||
if (entry.validFrom() == t) posFrom = pos;
|
if (entry.validFrom() == t) posFrom = pos;
|
||||||
if (entry.validTo() == t) posTo = pos;
|
if (entry.validTo() == t) posTo = pos;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
timeList.add(df.format(DateUtil.toDate(24 * 60 * 60 - 60)));
|
timeList.add(DateUtil.timeString(DateUtil.toDate(24 * 60 * 60 - 60)));
|
||||||
|
|
||||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
|
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
|
||||||
android.R.layout.simple_spinner_item, timeList);
|
android.R.layout.simple_spinner_item, timeList);
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -73,9 +72,10 @@ import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension.PointsWithLabelGraphSeries;
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLabelGraphSeries;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.BolusWizard;
|
import info.nightscout.utils.BolusWizard;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
@ -822,11 +822,10 @@ public class OverviewFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(NotificationsViewHolder holder, int position) {
|
public void onBindViewHolder(NotificationsViewHolder holder, int position) {
|
||||||
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
|
|
||||||
Notification notification = notificationsList.get(position);
|
Notification notification = notificationsList.get(position);
|
||||||
holder.dismiss.setTag(notification);
|
holder.dismiss.setTag(notification);
|
||||||
holder.text.setText(notification.text);
|
holder.text.setText(notification.text);
|
||||||
holder.time.setText(df.format(notification.date));
|
holder.time.setText(DateUtil.timeString(notification.date));
|
||||||
if (notification.level == Notification.URGENT)
|
if (notification.level == Notification.URGENT)
|
||||||
holder.cv.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.notificationUrgent));
|
holder.cv.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.notificationUrgent));
|
||||||
else if (notification.level == Notification.NORMAL)
|
else if (notification.level == Notification.NORMAL)
|
||||||
|
|
|
@ -15,17 +15,15 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import com.squareup.otto.Subscribe;
|
import com.squareup.otto.Subscribe;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.AgreementActivity;
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.EditQuickWizardDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.EditQuickWizardDialog;
|
||||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.QuickWizard;
|
import info.nightscout.androidaps.plugins.Overview.QuickWizard;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventQuickWizardChange;
|
import info.nightscout.androidaps.plugins.Overview.events.EventQuickWizardChange;
|
||||||
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
||||||
public class QuickWizardListActivity extends AppCompatActivity implements View.OnClickListener {
|
public class QuickWizardListActivity extends AppCompatActivity implements View.OnClickListener {
|
||||||
|
@ -54,9 +52,8 @@ public class QuickWizardListActivity extends AppCompatActivity implements View.O
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(QuickWizardEntryViewHolder holder, int position) {
|
public void onBindViewHolder(QuickWizardEntryViewHolder holder, int position) {
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
holder.from.setText(DateUtil.timeString(qvData.get(position).validFromDate()));
|
||||||
holder.from.setText(df.format(qvData.get(position).validFromDate()));
|
holder.to.setText(DateUtil.timeString(qvData.get(position).validToDate()));
|
||||||
holder.to.setText(df.format(qvData.get(position).validToDate()));
|
|
||||||
holder.buttonText.setText(qvData.get(position).buttonText());
|
holder.buttonText.setText(qvData.get(position).buttonText());
|
||||||
holder.carbs.setText(DecimalFormatter.to0Decimal(qvData.get(position).carbs()) + " g");
|
holder.carbs.setText(DecimalFormatter.to0Decimal(qvData.get(position).carbs()) + " g");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension;
|
package info.nightscout.androidaps.plugins.Overview.graphExtensions;
|
||||||
/**
|
/**
|
||||||
* GraphView
|
* GraphView
|
||||||
* Copyright (C) 2014 Jonas Gehring
|
* Copyright (C) 2014 Jonas Gehring
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension;
|
package info.nightscout.androidaps.plugins.Overview.graphExtensions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GraphView
|
* GraphView
|
||||||
|
@ -25,7 +25,6 @@ package info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.Point;
|
import android.graphics.Point;
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.Overview;
|
package info.nightscout.androidaps.plugins.Overview.graphExtensions;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
|
@ -15,13 +15,13 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
|
@ -89,15 +89,14 @@ public class SmsCommunicatorFragment extends Fragment {
|
||||||
int messagesToShow = 40;
|
int messagesToShow = 40;
|
||||||
|
|
||||||
int start = Math.max(0, getPlugin().messages.size() - messagesToShow);
|
int start = Math.max(0, getPlugin().messages.size() - messagesToShow);
|
||||||
DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
|
|
||||||
|
|
||||||
String logText = "";
|
String logText = "";
|
||||||
for (int x = start; x < getPlugin().messages.size(); x++) {
|
for (int x = start; x < getPlugin().messages.size(); x++) {
|
||||||
SmsCommunicatorPlugin.Sms sms = getPlugin().messages.get(x);
|
SmsCommunicatorPlugin.Sms sms = getPlugin().messages.get(x);
|
||||||
if (sms.received) {
|
if (sms.received) {
|
||||||
logText += df.format(sms.date) + " <<< " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
logText += DateUtil.timeString(sms.date) + " <<< " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
||||||
} else if (sms.sent) {
|
} else if (sms.sent) {
|
||||||
logText += df.format(sms.date) + " >>> " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
logText += DateUtil.timeString(sms.date) + " >>> " + (sms.processed ? "● " : "○ ") + sms.phoneNumber + " <b>" + sms.text + "</b><br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logView.setText(Html.fromHtml(logText));
|
logView.setText(Html.fromHtml(logText));
|
||||||
|
|
|
@ -17,7 +17,6 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -27,6 +26,7 @@ import info.nightscout.androidaps.db.TempBasal;
|
||||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,13 +61,11 @@ public class TempBasalsFragment extends Fragment implements FragmentBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(TempBasalsViewHolder holder, int position) {
|
public void onBindViewHolder(TempBasalsViewHolder holder, int position) {
|
||||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
|
|
||||||
DateFormat enddf = DateFormat.getTimeInstance(DateFormat.SHORT);
|
|
||||||
TempBasal tempBasal = tempBasalList.get(position);
|
TempBasal tempBasal = tempBasalList.get(position);
|
||||||
if (tempBasal.timeEnd != null) {
|
if (tempBasal.timeEnd != null) {
|
||||||
holder.date.setText(df.format(tempBasal.timeStart) + " - " + enddf.format(tempBasalList.get(position).timeEnd));
|
holder.date.setText(DateUtil.dateAndTimeString(tempBasal.timeStart) + " - " + DateUtil.timeString(tempBasalList.get(position).timeEnd));
|
||||||
} else {
|
} else {
|
||||||
holder.date.setText(df.format(tempBasal.timeStart));
|
holder.date.setText(DateUtil.dateAndTimeString(tempBasal.timeStart));
|
||||||
}
|
}
|
||||||
holder.duration.setText(DecimalFormatter.to0Decimal(tempBasal.duration) + " min");
|
holder.duration.setText(DecimalFormatter.to0Decimal(tempBasal.duration) + " min");
|
||||||
if (tempBasal.isAbsolute) {
|
if (tempBasal.isAbsolute) {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.squareup.otto.Subscribe;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -35,6 +34,7 @@ import info.nightscout.androidaps.db.Treatment;
|
||||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.ToastUtils;
|
import info.nightscout.utils.ToastUtils;
|
||||||
|
|
||||||
|
@ -76,8 +76,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
|
||||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return;
|
return;
|
||||||
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
|
holder.date.setText(DateUtil.dateAndTimeString(treatments.get(position).created_at));
|
||||||
holder.date.setText(df.format(treatments.get(position).created_at));
|
|
||||||
holder.insulin.setText(DecimalFormatter.to2Decimal(treatments.get(position).insulin) + " U");
|
holder.insulin.setText(DecimalFormatter.to2Decimal(treatments.get(position).insulin) + " U");
|
||||||
holder.carbs.setText(DecimalFormatter.to0Decimal(treatments.get(position).carbs) + " g");
|
holder.carbs.setText(DecimalFormatter.to0Decimal(treatments.get(position).carbs) + " g");
|
||||||
Iob iob = treatments.get(position).iobCalc(new Date(), profile.getDia());
|
Iob iob = treatments.get(position).iobCalc(new Date(), profile.getDia());
|
||||||
|
|
|
@ -176,7 +176,9 @@ public class PersistentNotificationPlugin implements PluginBase{
|
||||||
if(fragmentEnabled){
|
if(fragmentEnabled){
|
||||||
MainApp.bus().register(this);
|
MainApp.bus().register(this);
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
MainApp.bus().unregister(this);
|
MainApp.bus().unregister(this);
|
||||||
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.utils;
|
package info.nightscout.utils;
|
||||||
|
|
||||||
|
import android.text.format.DateUtils;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -9,6 +11,8 @@ import java.util.TimeZone;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DateUtil. A simple wrapper around SimpleDateFormat to ease the handling of iso date string <-> date obj
|
* The Class DateUtil. A simple wrapper around SimpleDateFormat to ease the handling of iso date string <-> date obj
|
||||||
* with TZ
|
* with TZ
|
||||||
|
@ -81,4 +85,30 @@ public class DateUtil {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String dateString(Date date) {
|
||||||
|
//return DateUtils.formatDateTime(MainApp.instance(), date.getTime(), DateUtils.FORMAT_SHOW_DATE); this provide month name not number
|
||||||
|
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||||
|
return df.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dateString(long mills) {
|
||||||
|
//return DateUtils.formatDateTime(MainApp.instance(), mills, DateUtils.FORMAT_SHOW_DATE); this provide month name not number
|
||||||
|
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||||
|
return df.format(mills);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String timeString(Date date) {
|
||||||
|
return DateUtils.formatDateTime(MainApp.instance(), date.getTime(), DateUtils.FORMAT_SHOW_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String timeString(long mills) {
|
||||||
|
return DateUtils.formatDateTime(MainApp.instance(), mills, DateUtils.FORMAT_SHOW_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String dateAndTimeString(Date date) {
|
||||||
|
return dateString(date) + " " + timeString(date);
|
||||||
|
}
|
||||||
|
public static String dateAndTimeString(long mills) {
|
||||||
|
return dateString(mills) + " " + timeString(mills);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -23,9 +23,7 @@ import org.json.JSONObject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -224,10 +222,9 @@ public class TimeListEdit {
|
||||||
public void fillSpinner(Spinner spinner, int secondsFromMidnight, int previous, int next) {
|
public void fillSpinner(Spinner spinner, int secondsFromMidnight, int previous, int next) {
|
||||||
int posInList = 0;
|
int posInList = 0;
|
||||||
ArrayList<CharSequence> timeList = new ArrayList<>();
|
ArrayList<CharSequence> timeList = new ArrayList<>();
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for (int t = previous + ONEHOURINSECONDS; t < next; t += ONEHOURINSECONDS) {
|
for (int t = previous + ONEHOURINSECONDS; t < next; t += ONEHOURINSECONDS) {
|
||||||
timeList.add(df.format(DateUtil.toDate(t)));
|
timeList.add(DateUtil.timeString(DateUtil.toDate(t)));
|
||||||
if (secondsFromMidnight == t) posInList = pos;
|
if (secondsFromMidnight == t) posInList = pos;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
@ -332,10 +329,9 @@ public class TimeListEdit {
|
||||||
}
|
}
|
||||||
|
|
||||||
void log() {
|
void log() {
|
||||||
DateFormat df = new SimpleDateFormat("HH:mm");
|
|
||||||
for (int i = 0; i < data1.length(); i++) {
|
for (int i = 0; i < data1.length(); i++) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
log.debug(i + ": @" + df.format(DateUtil.toDate(secondFromMidnight(i))) + " " + value1(i) + (data2 != null ? " " + value2(i) : ""));
|
log.debug(i + ": @" + DateUtil.timeString(DateUtil.toDate(secondFromMidnight(i))) + " " + value1(i) + (data2 != null ? " " + value2(i) : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue