Merge pull request #10 from MilosKozak/master

dev
This commit is contained in:
LadyViktoria 2016-06-12 13:54:15 +02:00 committed by GitHub
commit fac5a03863
11 changed files with 589 additions and 135 deletions

View file

@ -1,6 +1,7 @@
package info.nightscout.androidaps.db;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -20,6 +21,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
@ -167,6 +169,17 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public double glucose = 0d;
public double delta = 0d;
public double avgdelta = 0d;
@Override
public String toString() {
Context context = MainApp.instance().getApplicationContext();
DecimalFormat formatNumber0decimalplaces = new DecimalFormat("0");
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
return context.getString(R.string.glucose) + " " + formatNumber0decimalplaces.format(glucose) + "\n" +
context.getString(R.string.delta) + " " + formatNumber0decimalplaces.format(delta) + "\n" +
context.getString(R.string.avgdelta) + " " + formatNumber2decimalplaces.format(avgdelta);
}
}
public GlucoseStatus getGlucoseStatusData() {

View file

@ -1,5 +1,13 @@
package info.nightscout.androidaps.plugins;
import android.content.Context;
import java.text.DecimalFormat;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
/**
* Created by mike on 09.06.2016.
*/
@ -8,4 +16,19 @@ public class APSResult {
public double rate;
public int duration;
public boolean changeRequested = false;
@Override
public String toString() {
Context context = MainApp.instance().getApplicationContext();
DecimalFormat formatNumber0decimalplaces = new DecimalFormat("0");
DecimalFormat formatNumber2decimalplaces = new DecimalFormat("0.00");
if (changeRequested)
return context.getString(R.string.rate) + " " + formatNumber2decimalplaces.format(rate) + " U/h\n" +
context.getString(R.string.duration) + " " + formatNumber0decimalplaces.format(duration) + " min\n" +
context.getString(R.string.reason) + " " + reason;
else
return MainApp.instance().getApplicationContext().getString(R.string.nochangerequested);
}
}

View file

@ -1,18 +1,51 @@
package info.nightscout.androidaps.plugins.LowSuspend;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.Date;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Pump;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.plugins.APSBase;
import info.nightscout.androidaps.plugins.APSResult;
import info.nightscout.androidaps.plugins.PluginBase;
import info.nightscout.client.data.NSProfile;
public class LowSuspendFragment extends Fragment implements View.OnClickListener, PluginBase, APSBase {
private static Logger log = LoggerFactory.getLogger(LowSuspendFragment.class);
Button run;
TextView lastRunView;
TextView glucoseStatusView;
TextView minBgView;
TextView resultView;
TextView requestView;
Date lastAPSRun = null;
APSResult lastAPSResult = null;
public class LowSuspendFragment extends Fragment implements PluginBase {
@Override
public int getType() {
@ -24,6 +57,16 @@ public class LowSuspendFragment extends Fragment implements PluginBase {
return true;
}
@Override
public APSResult getLastAPSResult() {
return lastAPSResult;
}
@Override
public Date getLastAPSRun() {
return lastAPSRun;
}
public static LowSuspendFragment newInstance() {
LowSuspendFragment fragment = new LowSuspendFragment();
return fragment;
@ -38,8 +81,17 @@ public class LowSuspendFragment extends Fragment implements PluginBase {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.lowsuspend_fragment, container, false);
View view = inflater.inflate(R.layout.lowsuspend_fragment, container, false);
run = (Button) view.findViewById(R.id.lowsuspend_run);
run.setOnClickListener(this);
lastRunView = (TextView) view.findViewById(R.id.lowsuspend_lastrun);
glucoseStatusView = (TextView) view.findViewById(R.id.lowsuspend_glucosestatus);
minBgView = (TextView) view.findViewById(R.id.lowsuspend_minbg);
resultView = (TextView) view.findViewById(R.id.lowsuspend_result);
requestView = (TextView) view.findViewById(R.id.lowsuspend_request);
return view;
}
private void registerBus() {
@ -50,4 +102,108 @@ public class LowSuspendFragment extends Fragment implements PluginBase {
}
MainApp.bus().register(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.lowsuspend_run:
invoke();
break;
}
}
@Subscribe
public void onStatusEvent(final EventNewBG ev) {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
invoke();
}
});
else
log.debug("EventNewBG: Activity is null");
}
@Override
public void invoke() {
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
DecimalFormat formatNumber1decimalplaces = new DecimalFormat("0.0");
NSProfile profile = MainApp.getNSProfile();
Pump pump = MainApp.getActivePump();
if (glucoseStatus == null) {
resultView.setText(getString(R.string.openapsma_noglucosedata));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_noglucosedata));
return;
}
if (profile == null) {
resultView.setText(getString(R.string.openapsma_noprofile));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_noprofile));
return;
}
if (pump == null) {
resultView.setText(getString(R.string.openapsma_nopump));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_nopump));
return;
}
String minBgDefault = "90";
if (!MainApp.getNSProfile().getUnits().equals(Constants.MGDL)) {
minBgDefault = "5";
}
double minBg = NSProfile.toMgdl(Double.parseDouble(SP.getString("min_bg", minBgDefault).replace(",", ".")), profile.getUnits());
boolean lowProjected = (glucoseStatus.glucose + 6.0 * glucoseStatus.avgdelta) < minBg;
boolean low = glucoseStatus.glucose < minBg;
APSResult request = new APSResult();
Double baseBasalRate = pump.getBaseBasalRate();
boolean isTempBasalInProgress = pump.isTempBasalInProgress();
Double tempBasalRate = pump.getTempBasalAbsoluteRate();
if (low && !lowProjected) {
if (!isTempBasalInProgress || tempBasalRate != 0d) {
request.changeRequested = true;
request.rate = 0d;
request.duration = 30;
request.reason = getString(R.string.lowsuspend_lowmessage);
} else {
request.changeRequested = false;
request.reason = getString(R.string.nochangerequested);
}
} else if (lowProjected) {
if (!isTempBasalInProgress || tempBasalRate != 0d) {
request.changeRequested = true;
request.rate = 0d;
request.duration = 30;
request.reason = getString(R.string.lowsuspend_lowprojectedmessage);
} else {
request.changeRequested = false;
request.reason = getString(R.string.nochangerequested);
}
} else if (tempBasalRate == 0d) {
request.changeRequested = true;
request.rate = baseBasalRate;
request.duration = 30;
request.reason = getString(R.string.lowsuspend_cancelmessage);
} else {
request.changeRequested = false;
request.reason = getString(R.string.nochangerequested);
}
glucoseStatusView.setText(glucoseStatus.toString());
minBgView.setText(formatNumber1decimalplaces.format(minBg) + " " + profile.getUnits());
resultView.setText(getString(R.string.lowsuspend_low) + " " + low + "\n" + getString(R.string.lowsuspend_lowprojected) + " " + lowProjected);
requestView.setText(request.toString());
lastRunView.setText(new Date().toLocaleString());
lastAPSResult = request;
lastAPSRun = new Date();
}
}

View file

@ -20,6 +20,7 @@ public class DetermineBasalResult extends APSResult {
snoozeBG = result.getDouble("snoozeBG");
if(result.contains("rate")) {
rate = result.getDouble("rate");
if (rate < 0d) rate = 0d;
changeRequested = true;
} else {
rate = -1;

View file

@ -49,6 +49,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
TextView profileView;
TextView mealDataView;
TextView resultView;
TextView requestView;
Date lastAPSRun = null;
APSResult lastAPSResult = null;
@ -98,6 +99,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
profileView = (TextView) view.findViewById(R.id.openapsma_profile);
mealDataView = (TextView) view.findViewById(R.id.openapsma_mealdata);
resultView = (TextView) view.findViewById(R.id.openapsma_result);
requestView = (TextView) view.findViewById(R.id.openapsma_request);
return view;
}
@ -151,9 +153,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
@Override
public void invoke() {
// private DatermineBasalResult openAps(int glucoseValue, int delta, double deltaAvg15min, StatusEvent status, LowSuspendStatus lowSuspendStatus, IobTotal iobTotal, CarbCalc.Meal mealdata) {
DetermineBasalAdapterJS determineBasalAdapterJS = null;
DetermineBasalAdapterJS determineBasalAdapterJS = null;
try {
determineBasalAdapterJS = new DetermineBasalAdapterJS(new ScriptReader(MainApp.instance().getBaseContext()));
} catch (IOException e) {
@ -166,17 +166,20 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
Pump pump = MainApp.getActivePump();
if (glucoseStatus == null) {
if (Config.logAPSResult) log.debug("No glucose data available");
resultView.setText(getString(R.string.openapsma_noglucosedata));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_noglucosedata));
return;
}
if (profile == null) {
if (Config.logAPSResult) log.debug("No profile available");
resultView.setText(getString(R.string.openapsma_noprofile));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_noprofile));
return;
}
if (pump == null) {
if (Config.logAPSResult) log.debug("No pump available");
resultView.setText(getString(R.string.openapsma_nopump));
if (Config.logAPSResult) log.debug(getString(R.string.openapsma_nopump));
return;
}
@ -217,6 +220,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();
resultView.setText(determineBasalResult.json.toString());
requestView.setText(determineBasalResult.toString());
lastRunView.setText(new Date().toLocaleString());
determineBasalAdapterJS.release();

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.Overview;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
@ -18,15 +19,17 @@ import com.squareup.otto.Subscribe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventTempBasalChange;
import info.nightscout.androidaps.plugins.PluginBase;
@ -36,7 +39,9 @@ import info.nightscout.client.data.NSProfile;
public class OverviewFragment extends Fragment implements PluginBase {
private static Logger log = LoggerFactory.getLogger(OverviewFragment.class);
TextView bg;
TextView bgView;
TextView timeAgoView;
TextView deltaView;
GraphView bgGraph;
@ -65,7 +70,9 @@ public class OverviewFragment extends Fragment implements PluginBase {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_fragment, container, false);
bg = (TextView) view.findViewById(R.id.overview_bg);
bgView = (TextView) view.findViewById(R.id.overview_bg);
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
deltaView = (TextView) view.findViewById(R.id.overview_delta);
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
updateData();
@ -82,18 +89,39 @@ public class OverviewFragment extends Fragment implements PluginBase {
}
private void updateData() {
BgReading bgReading = MainApp.getDbHelper().lastBg();
BgReading actualBG = MainApp.getDbHelper().actualBg();
BgReading lastBG = MainApp.getDbHelper().lastBg();
NSProfile profile = MainApp.getNSProfile();
if (profile != null && bgReading != null && bg != null) {
bg.setText(bgReading.valueToUnitsToString(profile.getUnits()));
BgReading.units = profile.getUnits();
} else
if (profile == null)
return;
String units = profile.getUnits();
// Skip if not initialized yet
if (bgGraph == null)
return;
if (profile != null && lastBG != null && bgView != null) {
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
deltaView.setText(NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
BgReading.units = profile.getUnits();
} else
return;
// **** BG value ****
Integer flag = bgView.getPaintFlags();
if (actualBG == null) {
flag |= Paint.STRIKE_THRU_TEXT_FLAG;
} else
flag &= ~Paint.STRIKE_THRU_TEXT_FLAG;
bgView.setPaintFlags(flag);
Long agoMsec = new Date().getTime() - lastBG.timestamp;
int agoMin = (int) (agoMsec / 60d / 60d / 1000d);
timeAgoView.setText(agoMin + " " + getString(R.string.minago));
// **** BG graph ****
// allign to hours
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(new Date().getTime());
@ -105,29 +133,30 @@ public class OverviewFragment extends Fragment implements PluginBase {
long toTime = calendar.getTimeInMillis();
long fromTime = toTime - hoursToFetch * 60 * 60 * 1000l;
Double lowLine = 80d; // TODO: make this customisable
Double highLine = 180d;
Double maxY = 400d; // TODO: add some scale support
String units = profile.getUnits();
if (units.equals(Constants.MMOL)) {
lowLine = 4d;
highLine = 10d;
maxY = 20d;
}
Double lowLine = NSProfile.toUnits(80d, 4d, units); // TODO: make this customisable
Double highLine = NSProfile.toUnits(180d, 10d, units);
Double maxY = NSProfile.toUnits(400d , 20d, units); // TODO: add some scale support
List<BgReading> bgReadingsArray = MainApp.getDbHelper().getDataFromTime(fromTime);
BgReading[] bgReadings = new BgReading[bgReadingsArray.size()];
bgReadings = bgReadingsArray.toArray(bgReadings);
List<BgReading> inRangeArray = new ArrayList<BgReading>();
List<BgReading> outOfRangeArray = new ArrayList<BgReading>();
if (bgReadings.length == 0)
if (bgReadingsArray.size() == 0)
return;
PointsGraphSeries<BgReading> series = new PointsGraphSeries<BgReading>(bgReadings);
bgGraph.addSeries(series);
series.setShape(PointsGraphSeries.Shape.POINT);
series.setSize(5);
series.setColor(Color.GREEN);
Iterator<BgReading> it = bgReadingsArray.iterator();
while (it.hasNext()) {
BgReading bg = it.next();
if (bg.valueToUnits(units) < lowLine || bg.valueToUnits(units) > highLine)
outOfRangeArray.add(bg);
else
inRangeArray.add(bg);
}
BgReading[] inRange = new BgReading[inRangeArray.size()];
BgReading[] outOfRange = new BgReading[outOfRangeArray.size()];
inRange = inRangeArray.toArray(inRange);
outOfRange = outOfRangeArray.toArray(outOfRange);
// targets
LineGraphSeries<DataPoint> seriesLow = new LineGraphSeries<DataPoint>(new DataPoint[]{
@ -145,6 +174,22 @@ public class OverviewFragment extends Fragment implements PluginBase {
bgGraph.addSeries(seriesHigh);
if (inRange.length > 0) {
PointsGraphSeries<BgReading> seriesInRage = new PointsGraphSeries<BgReading>(inRange);
bgGraph.addSeries(seriesInRage);
seriesInRage.setShape(PointsGraphSeries.Shape.POINT);
seriesInRage.setSize(5);
seriesInRage.setColor(Color.GREEN);
}
if (outOfRange.length > 0) {
PointsGraphSeries<BgReading> seriesOutOfRange = new PointsGraphSeries<BgReading>(outOfRange);
bgGraph.addSeries(seriesOutOfRange);
seriesOutOfRange.setShape(PointsGraphSeries.Shape.POINT);
seriesOutOfRange.setSize(5);
seriesOutOfRange.setColor(Color.RED);
}
// set manual x bounds to have nice steps
bgGraph.getViewport().setMaxX(toTime);
bgGraph.getViewport().setMinX(fromTime);
@ -152,8 +197,6 @@ public class OverviewFragment extends Fragment implements PluginBase {
bgGraph.getGridLabelRenderer().setLabelFormatter(new TimeAsXAxisLabelFormatter(getActivity(), "HH"));
bgGraph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space
String test = new SimpleDateFormat("HH").format(calendar.getTimeInMillis());
// set manual y bounds to have nice steps
bgGraph.getViewport().setMaxY(maxY);
bgGraph.getViewport().setMinY(0);

View file

@ -299,4 +299,21 @@ public class NSProfile {
if (units.equals(Constants.MGDL)) return value;
else return value * Constants.MMOLL_TO_MGDL;
}
public static Double fromMgdlToUnits(Double value, String units) {
if (units.equals(Constants.MGDL)) return value;
else return value * Constants.MGDL_TO_MMOLL;
}
public static Double toUnits(Double valueInMgdl, Double valueInMmol, String units) {
if (units.equals(Constants.MGDL)) return valueInMgdl;
else return valueInMmol;
}
public static String toUnitsString(Double valueInMgdl, Double valueInMmol, String units) {
DecimalFormat formatNumber0decimalplaces = new DecimalFormat("0");
DecimalFormat formatNumber1decimalplaces = new DecimalFormat("0.0");
if (units.equals(Constants.MGDL)) return formatNumber0decimalplaces.format(valueInMgdl);
else return formatNumber1decimalplaces.format(valueInMmol);
}
}

View file

@ -4,4 +4,124 @@
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.LowSuspend.LowSuspendFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/lowsuspend_run"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/openapsma_run" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_lastrun_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/lowsuspend_lastrun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_inputparameters_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_glucosestatus_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/lowsuspend_glucosestatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_minbg_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/lowsuspend_minbg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_result_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/lowsuspend_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_request_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/lowsuspend_request"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
</FrameLayout>

View file

@ -6,137 +6,167 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" >
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/openapsma_run"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/openapsma_run"
android:id="@+id/openapsma_run" />
android:text="@string/openapsma_run" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/openapsma_lastrun_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_lastrun"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#3e3d3d"
android:layout_margin="10dp">
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/openapsma_inputparameters_label" />
android:text="@string/openapsma_lastrun_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/openapsma_lastrun"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/openapsma_glucosestatus_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_glucosestatus"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/openapsma_currenttemp_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_currenttemp"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/openapsma_iobdata_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_iobdata"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/openapsma_profile_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_profile"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/openapsma_mealdata_label" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_mealdata"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_inputparameters_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_glucosestatus_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/openapsma_glucosestatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_currenttemp_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/openapsma_currenttemp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_iobdata_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/openapsma_iobdata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_profile_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/openapsma_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_mealdata_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/openapsma_mealdata"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d">
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/openapsma_result_label" />
android:text="@string/openapsma_result_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/openapsma_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/openapsma_result"
android:layout_marginLeft="10dp" />
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:background="#3e3d3d"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/openapsma_request_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/openapsma_request"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>

View file

@ -10,12 +10,41 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/overview_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
android:textSize="100dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/overview_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
android:textSize="100dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/overview_timeago"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/overview_delta"
android:layout_marginLeft="10dp" />
</LinearLayout>
</LinearLayout>
<com.jjoe64.graphview.GraphView
android:id="@+id/overview_bggraph"

View file

@ -69,5 +69,23 @@
<string name="openapsma_profile_label">Profile</string>
<string name="openapsma_mealdata_label">Meal data</string>
<string name="openapsma_result_label">Result</string>
<string name="openapsma_noglucosedata">No glucose data available</string>
<string name="openapsma_noprofile">No profile available</string>
<string name="openapsma_nopump">No pump available</string>
<string name="nochangerequested">No change requested</string>
<string name="openapsma_request_label">Request</string>
<string name="openapsma_minbg_label">Low target</string>
<string name="lowsuspend_lowmessage">LOW: Temp basal 0%</string>
<string name="lowsuspend_lowprojectedmessage">LOW PROJECTED: Temp basal 0%</string>
<string name="lowsuspend_cancelmessage">LowSuspend: Cancel low temp</string>
<string name="lowsuspend_low">Low:</string>
<string name="lowsuspend_lowprojected">Low projected:</string>
<string name="rate">Rate:</string>
<string name="duration">Duration:</string>
<string name="reason">Reason:</string>
<string name="glucose">Glucose:</string>
<string name="delta">Delta:</string>
<string name="avgdelta">Avg. delta:</string>
<string name="minago">min ago</string>
</resources>