Merge pull request #13 from jotomo/combo-scripter-v2

jan 4
This commit is contained in:
Simon Pauwels 2018-01-04 18:29:02 +01:00 committed by GitHub
commit 30f590dca6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 1393 additions and 243 deletions

View file

@ -141,6 +141,10 @@ Known issues:
- AAPS might be unresponsive for 10-30s or so when starting and calculating sensitivity.
AAPS might also be unresponsive when doing background work, e.g. after receiving a new
glucose reading.
- Since the pump's date & time can't be updated automatically at this time, daylight saving changes
will cause an alert asking to update the pump clock. A usable workaround should be to disable
the automatic update of the phone's clock for the night and then enabling it again in the morning
when also updating the pump.
Reporting bugs:
- Note the precise time the problem occurred and describe the circumstances and steps that caused

View file

@ -0,0 +1,7 @@
Follow this link to get the source PSD file for the Steampunk graphics. The file could not be included in the repository as it exceeds Github's 25 mb limit.
Note, the source image size is 1600x1600. The image size should be reduced to 400x400 prior to export of final PNG.
https://drive.google.com/drive/folders/1MrdgnQz3wOniDvRSMhAsqHBYb2WmE5i0
Graphics created by (Github): andrew-warrington

View file

@ -112,12 +112,16 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
runOnUiThread(new Runnable() {
@Override
public void run() {
recreate();
try { // activity may be destroyed
setUpTabs(true);
} catch (IllegalStateException e) {
log.error("Unhandled exception", e);
if(ev.recreate) {
recreate();
}else {
try { // activity may be destroyed
setUpTabs(true);
} catch (IllegalStateException e) {
log.error("Unhandled exception", e);
}
}
boolean lockScreen = BuildConfig.NSCLIENTOLNY && SP.getBoolean("lockscreen", false);
if (lockScreen)
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.EditTextPreference;
@ -58,8 +59,9 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
if (key.equals("language")) {
String lang = sharedPreferences.getString("language", "en");
LocaleHelper.setLocale(getApplicationContext(), lang);
recreate();
MainApp.bus().post(new EventRefreshGui());
MainApp.bus().post(new EventRefreshGui(true));
//recreate() does not update language so better close settings
finish();
}
if (key.equals("short_tabtitles")) {
MainApp.bus().post(new EventRefreshGui());

View file

@ -4,4 +4,11 @@ package info.nightscout.androidaps.events;
* Created by mike on 13.06.2016.
*/
public class EventRefreshGui extends Event {
public boolean recreate = false;
public EventRefreshGui(boolean recreate) {
this.recreate = recreate;
}
public EventRefreshGui(){
this(false);
}
}

View file

@ -533,7 +533,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
if (options.eventType == R.id.careportal_combobolus) {
Double enteredInsulin = SafeParse.stringToDouble(editInsulin.getText());
data.put("enteredinsulin", enteredInsulin);
data.put("insulin", enteredInsulin * SafeParse.stringToDouble(editInsulin.getText()) / 100);
data.put("insulin", enteredInsulin * SafeParse.stringToDouble(editSplit.getText()) / 100);
data.put("relative", enteredInsulin * (100 - SafeParse.stringToDouble(editSplit.getText())) / 100 / SafeParse.stringToDouble(editDuration.getText()) * 60);
}
} catch (JSONException e) {

View file

@ -11,6 +11,7 @@ import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
@ -179,6 +180,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
Handler sLoopHandler = new Handler();
Runnable sRefreshLoop = null;
final Object updateSync = new Object();
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
private static ScheduledFuture<?> scheduledUpdate = null;
@ -902,9 +905,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
@SuppressLint("SetTextI18n")
public void updateGUI(String from) {
public void updateGUI(final String from) {
log.debug("updateGUI entered from: " + from);
Date updateGUIStart = new Date();
final Date updateGUIStart = new Date();
if (getActivity() == null)
return;
@ -926,7 +929,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
BgReading actualBG = DatabaseHelper.actualBg();
BgReading lastBG = DatabaseHelper.lastBg();
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
Profile profile = MainApp.getConfigBuilder().getProfile();
String units = profile.getUnits();
@ -938,8 +941,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
return;
}
double lowLine = SP.getDouble("low_mark", 0d);
double highLine = SP.getDouble("high_mark", 0d);
final double lowLine = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
final double highLine = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
//Start with updating the BG as it is unaffected by loop.
// **** BG value ****
@ -1143,16 +1146,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
if (lowLine < 1) {
lowLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
}
if (highLine < 1) {
highLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
}
// **** BG value ****
if (lastBG == null) { //left this here as it seems you want to exit at this point if it is null...
return;
}
Integer flag = bgView.getPaintFlags();
@ -1171,24 +1166,24 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
final IobTotal basalIob = MainApp.getConfigBuilder().getLastCalculationTempBasals().round();
if (shorttextmode) {
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + " U";
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U";
iobView.setText(iobtext);
iobView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + " U\n"
+ getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + " U\n"
+ getString(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + " U\n";
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U\n"
+ getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + "U\n"
+ getString(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + "U\n";
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.iob), iobtext, null);
}
});
} else if (MainApp.sResources.getBoolean(R.bool.isTablet)) {
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + " U ("
+ getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + " U "
+ getString(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + " U)";
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U ("
+ getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusIob.iob) + "U "
+ getString(R.string.basal) + ": " + DecimalFormatter.to2Decimal(basalIob.basaliob) + "U)";
iobView.setText(iobtext);
} else {
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + " U ("
String iobtext = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob) + "U ("
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "/"
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
iobView.setText(iobtext);
@ -1203,7 +1198,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
cobView.setText(cobText);
}
boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
final boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class) != null && MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
showPredictionView.setVisibility(View.VISIBLE);
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
@ -1247,105 +1242,121 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
// ****** GRAPH *******
// allign to hours
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.add(Calendar.HOUR, 1);
new Thread(new Runnable() {
@Override
public void run() {
// allign to hours
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.add(Calendar.HOUR, 1);
int hoursToFetch;
long toTime;
long fromTime;
long endTime;
if (showPrediction) {
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
predHours = Math.min(2, predHours);
predHours = Math.max(0, predHours);
hoursToFetch = rangeToDisplay - predHours;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime + predHours * 60 * 60 * 1000L;
} else {
hoursToFetch = rangeToDisplay;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime;
}
int hoursToFetch;
final long toTime;
final long fromTime;
final long endTime;
if (showPrediction) {
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
predHours = Math.min(2, predHours);
predHours = Math.max(0, predHours);
hoursToFetch = rangeToDisplay - predHours;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime + predHours * 60 * 60 * 1000L;
} else {
hoursToFetch = rangeToDisplay;
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
endTime = toTime;
}
long now = System.currentTimeMillis();
final long now = System.currentTimeMillis();
// 2nd graph
// remove old data
iobGraph.getSeries().clear();
// ------------------ 1st graph
Profiler.log(log, from + " - 1st graph - START", updateGUIStart);
GraphData secondGraphData = new GraphData();
final GraphData graphData = new GraphData(bgGraph);
boolean useIobForScale = false;
boolean useCobForScale = false;
boolean useDevForScale = false;
boolean useRatioForScale = false;
// **** In range Area ****
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
if (showIobView.isChecked()) {
useIobForScale = true;
} else if (showCobView.isChecked()) {
useCobForScale = true;
} else if (showDeviationsView.isChecked()) {
useDevForScale = true;
} else if (showRatiosView.isChecked()) {
useRatioForScale = true;
}
// **** BG ****
if (showPrediction)
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, (DetermineBasalResultAMA) finalLastRun.constraintsProcessed);
else
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, null);
if (showIobView.isChecked())
secondGraphData.addIob(iobGraph, fromTime, now, useIobForScale, 1d);
if (showCobView.isChecked())
secondGraphData.addCob(iobGraph, fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
if (showDeviationsView.isChecked())
secondGraphData.addDeviations(iobGraph, fromTime, now, useDevForScale, 1d);
if (showRatiosView.isChecked())
secondGraphData.addRatio(iobGraph, fromTime, now, useRatioForScale, 1d);
// set manual x bounds to have nice steps
graphData.formatAxis(fromTime, endTime);
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
iobGraph.setVisibility(View.VISIBLE);
} else {
iobGraph.setVisibility(View.GONE);
}
// Treatments
graphData.addTreatments(fromTime, endTime);
// remove old data from graph
bgGraph.getSeries().clear();
// add basal data
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
graphData.addBasals(fromTime, now, lowLine / graphData.maxY / 1.2d);
}
GraphData graphData = new GraphData();
// **** NOW line ****
graphData.addNowLine(now);
// **** In range Area ****
graphData.addInRangeArea(bgGraph, fromTime, endTime, lowLine, highLine);
// ------------------ 2nd graph
Profiler.log(log, from + " - 2nd graph - START", updateGUIStart);
// **** BG ****
if (showPrediction)
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, (DetermineBasalResultAMA) finalLastRun.constraintsProcessed);
else
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, null);
final GraphData secondGraphData = new GraphData(iobGraph);
// set manual x bounds to have nice steps
graphData.formatAxis(bgGraph, fromTime, endTime);
secondGraphData.formatAxis(iobGraph, fromTime, endTime);
boolean useIobForScale = false;
boolean useCobForScale = false;
boolean useDevForScale = false;
boolean useRatioForScale = false;
// Treatments
graphData.addTreatments(bgGraph, fromTime, endTime);
if (showIobView.isChecked()) {
useIobForScale = true;
} else if (showCobView.isChecked()) {
useCobForScale = true;
} else if (showDeviationsView.isChecked()) {
useDevForScale = true;
} else if (showRatiosView.isChecked()) {
useRatioForScale = true;
}
// add basal data
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
graphData.addBasals(bgGraph, fromTime, now, lowLine / graphData.maxY / 1.2d);
}
if (showIobView.isChecked())
secondGraphData.addIob(fromTime, now, useIobForScale, 1d);
if (showCobView.isChecked())
secondGraphData.addCob(fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
if (showDeviationsView.isChecked())
secondGraphData.addDeviations(fromTime, now, useDevForScale, 1d);
if (showRatiosView.isChecked())
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
// **** NOW line ****
graphData.addNowLine(bgGraph, now);
secondGraphData.addNowLine(iobGraph, now);
// **** NOW line ****
// set manual x bounds to have nice steps
secondGraphData.formatAxis(fromTime, endTime);
secondGraphData.addNowLine(now);
// finaly enforce drawing of graphs
bgGraph.onDataChanged(false, false);
iobGraph.onDataChanged(false, false);
// do GUI update
FragmentActivity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
iobGraph.setVisibility(View.VISIBLE);
} else {
iobGraph.setVisibility(View.GONE);
}
// finally enforce drawing of graphs
graphData.performUpdate();
secondGraphData.performUpdate();
Profiler.log(log, from + " - onDataChanged", updateGUIStart);
}
});
}
}
}).start();
Profiler.log(log, from, updateGUIStart);
}
@ -1431,6 +1442,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
}
}
}
void updateNotifications() {

View file

@ -45,15 +45,18 @@ import info.nightscout.utils.Round;
public class GraphData {
public GraphData() {
units = MainApp.getConfigBuilder().getProfileUnits();
}
private GraphView graph;
public double maxY = 0;
private List<BgReading> bgReadingsArray;
private String units;
private List<Series> series = new ArrayList<>();
public void addBgReadings(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine, DetermineBasalResultAMA amaResult) {
public GraphData(GraphView graph) {
units = MainApp.getConfigBuilder().getProfileUnits();
this.graph = graph;
}
public void addBgReadings(long fromTime, long toTime, double lowLine, double highLine, DetermineBasalResultAMA amaResult) {
double maxBgValue = 0d;
bgReadingsArray = MainApp.getDbHelper().getBgreadingsDataFromTime(fromTime, true);
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
@ -81,20 +84,18 @@ public class GraphData {
DataPointWithLabelInterface[] bg = new DataPointWithLabelInterface[bgListArray.size()];
bg = bgListArray.toArray(bg);
if (bg.length > 0) {
addSeriesWithoutInvalidate(bgGraph, new PointsWithLabelGraphSeries<>(bg));
}
maxY = maxBgValue;
// set manual y bounds to have nice steps
bgGraph.getViewport().setMaxY(maxY);
bgGraph.getViewport().setMinY(0);
bgGraph.getViewport().setYAxisBoundsManual(true);
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
graph.getViewport().setMaxY(maxY);
graph.getViewport().setMinY(0);
graph.getViewport().setYAxisBoundsManual(true);
graph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
addSeries(new PointsWithLabelGraphSeries<>(bg));
}
public void addInRangeArea(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine) {
public void addInRangeArea(long fromTime, long toTime, double lowLine, double highLine) {
AreaGraphSeries<DoubleDataPoint> inRangeAreaSeries;
DoubleDataPoint[] inRangeAreaDataPoints = new DoubleDataPoint[]{
@ -102,14 +103,15 @@ public class GraphData {
new DoubleDataPoint(toTime, lowLine, highLine)
};
inRangeAreaSeries = new AreaGraphSeries<>(inRangeAreaDataPoints);
addSeriesWithoutInvalidate(bgGraph, inRangeAreaSeries);
inRangeAreaSeries.setColor(0);
inRangeAreaSeries.setDrawBackground(true);
inRangeAreaSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.inrangebackground));
addSeries(inRangeAreaSeries);
}
// scale in % of vertical size (like 0.3)
public void addBasals(GraphView bgGraph, long fromTime, long toTime, double scale) {
public void addBasals(long fromTime, long toTime, double scale) {
LineGraphSeries<ScaledDataPoint> basalsLineSeries;
LineGraphSeries<ScaledDataPoint> absoluteBasalsLineSeries;
LineGraphSeries<ScaledDataPoint> baseBasalsSeries;
@ -194,7 +196,7 @@ public class GraphData {
basalsLineSeries = new LineGraphSeries<>(basalLine);
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity*2);
paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
paint.setPathEffect(new DashPathEffect(new float[]{2, 4}, 0));
paint.setColor(MainApp.sResources.getColor(R.color.basal));
basalsLineSeries.setCustomPaint(paint);
@ -204,19 +206,19 @@ public class GraphData {
absoluteBasalsLineSeries = new LineGraphSeries<>(absoluteBasalLine);
Paint absolutePaint = new Paint();
absolutePaint.setStyle(Paint.Style.STROKE);
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity*2);
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
absolutePaint.setColor(MainApp.sResources.getColor(R.color.basal));
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
basalScale.setMultiplier(maxY * scale / maxBasalValueFound);
addSeriesWithoutInvalidate(bgGraph, baseBasalsSeries);
addSeriesWithoutInvalidate(bgGraph, tempBasalsSeries);
addSeriesWithoutInvalidate(bgGraph, basalsLineSeries);
addSeriesWithoutInvalidate(bgGraph, absoluteBasalsLineSeries);
addSeries(baseBasalsSeries);
addSeries(tempBasalsSeries);
addSeries(basalsLineSeries);
addSeries(absoluteBasalsLineSeries);
}
public void addTreatments(GraphView bgGraph, long fromTime, long endTime) {
public void addTreatments(long fromTime, long endTime) {
List<DataPointWithLabelInterface> filteredTreatments = new ArrayList<>();
List<Treatment> treatments = MainApp.getConfigBuilder().getTreatmentsFromHistory();
@ -262,9 +264,7 @@ public class GraphData {
DataPointWithLabelInterface[] treatmentsArray = new DataPointWithLabelInterface[filteredTreatments.size()];
treatmentsArray = filteredTreatments.toArray(treatmentsArray);
if (treatmentsArray.length > 0) {
addSeriesWithoutInvalidate(bgGraph, new PointsWithLabelGraphSeries<>(treatmentsArray));
}
addSeries(new PointsWithLabelGraphSeries<>(treatmentsArray));
}
double getNearestBg(long date) {
@ -279,7 +279,7 @@ public class GraphData {
}
// scale in % of vertical size (like 0.3)
public void addIob(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
public void addIob(long fromTime, long toTime, boolean useForScale, double scale) {
FixedLineGraphSeries<ScaledDataPoint> iobSeries;
List<ScaledDataPoint> iobArray = new ArrayList<>();
Double maxIobValueFound = 0d;
@ -310,11 +310,11 @@ public class GraphData {
iobScale.setMultiplier(maxY * scale / maxIobValueFound);
addSeriesWithoutInvalidate(graph, iobSeries);
addSeries(iobSeries);
}
// scale in % of vertical size (like 0.3)
public void addCob(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
public void addCob(long fromTime, long toTime, boolean useForScale, double scale) {
FixedLineGraphSeries<ScaledDataPoint> cobSeries;
List<ScaledDataPoint> cobArray = new ArrayList<>();
Double maxCobValueFound = 0d;
@ -349,11 +349,11 @@ public class GraphData {
cobScale.setMultiplier(maxY * scale / maxCobValueFound);
addSeriesWithoutInvalidate(graph, cobSeries);
addSeries(cobSeries);
}
// scale in % of vertical size (like 0.3)
public void addDeviations(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
public void addDeviations(long fromTime, long toTime, boolean useForScale, double scale) {
class DeviationDataPoint extends ScaledDataPoint {
public int color;
@ -396,11 +396,11 @@ public class GraphData {
devScale.setMultiplier(maxY * scale / maxDevValueFound);
addSeriesWithoutInvalidate(graph, devSeries);
addSeries(devSeries);
}
// scale in % of vertical size (like 0.3)
public void addRatio(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
public void addRatio(long fromTime, long toTime, boolean useForScale, double scale) {
LineGraphSeries<DataPoint> ratioSeries;
List<DataPoint> ratioArray = new ArrayList<>();
Double maxRatioValueFound = 0d;
@ -426,11 +426,11 @@ public class GraphData {
ratioScale.setMultiplier(maxY * scale / maxRatioValueFound);
addSeriesWithoutInvalidate(graph, ratioSeries);
addSeries(ratioSeries);
}
// scale in % of vertical size (like 0.3)
public void addNowLine(GraphView graph, long now) {
public void addNowLine(long now) {
LineGraphSeries<DataPoint> seriesNow;
DataPoint[] nowPoints = new DataPoint[]{
new DataPoint(now, 0),
@ -447,10 +447,10 @@ public class GraphData {
paint.setColor(Color.WHITE);
seriesNow.setCustomPaint(paint);
addSeriesWithoutInvalidate(graph, seriesNow);
addSeries(seriesNow);
}
public void formatAxis(GraphView graph, long fromTime, long endTime) {
public void formatAxis(long fromTime, long endTime) {
graph.getViewport().setMaxX(endTime);
graph.getViewport().setMinX(fromTime);
graph.getViewport().setXAxisBoundsManual(true);
@ -458,11 +458,23 @@ public class GraphData {
graph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space
}
private void addSeriesWithoutInvalidate(GraphView bgGraph, Series s) {
if (!s.isEmpty()) {
s.onGraphViewAttached(bgGraph);
bgGraph.getSeries().add(s);
}
private void addSeries(Series s) {
series.add(s);
}
public void performUpdate() {
// clear old data
graph.getSeries().clear();
// add precalculated series
for (Series s: series) {
if (!s.isEmpty()) {
s.onGraphViewAttached(graph);
graph.getSeries().add(s);
}
}
// draw it
graph.onDataChanged(false, false);
}
}

View file

@ -243,6 +243,7 @@ public class WatchUpdaterService extends WearableListenerService implements
DataMap dataMap = new DataMap();
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
dataMap.putString("glucoseUnits", units);
dataMap.putLong("timestamp", lastBG.date);
if (glucoseStatus == null) {
dataMap.putString("slopeArrow", "");
@ -253,7 +254,6 @@ public class WatchUpdaterService extends WearableListenerService implements
dataMap.putString("delta", deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units));
dataMap.putString("avgDelta", deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units));
}
dataMap.putLong("sgvLevel", sgvLevel);
dataMap.putDouble("sgvDouble", lastBG.value);
dataMap.putDouble("high", highLine);

View file

@ -9,8 +9,12 @@ import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.interfaces.PluginBase;
/**
@ -22,6 +26,8 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
Context context;
private static Logger log = LoggerFactory.getLogger(TabPageAdapter.class);
public TabPageAdapter(FragmentManager fm, Context context) {
super(fm);
this.context = context;
@ -40,6 +46,8 @@ public class TabPageAdapter extends FragmentStatePagerAdapter {
super.finishUpdate(container);
} catch (NullPointerException nullPointerException){
System.out.println("Catch the NullPointerException in FragmentStatePagerAdapter.finishUpdate");
} catch (IllegalStateException e){
log.error(e.getMessage());
}
}

View file

@ -97,11 +97,10 @@
<string name="vitualpump_label">VIRTUELLE PUMPE</string>
<string name="virtualpump_sqlerror">SQL Error</string>
<string name="virtualpump_extendedbolus_label">Verlängerter Bolus</string>
<string name="pump_tempbasal_label">TBR</string>
<string name="visible">Sichtbar</string>
<string name="pump_basebasalrate_label">Basis-Basalrate</string>
<string name="treatments_wizard_total_label">GESAMT</string>
<string name="unsupportedclientver">Nicht unterstützte Version des Nightscout-Clients</string>
<string name="pump_basebasalrate_label">Basis Basalrate</string>
<string name="treatments_wizard_bg_label">BZ</string>
<string name="treatments_wizard_bolusiob_label">Bolus-IOB</string>
<string name="treatments_wizard_carbs_label">Kohlenhydrate</string>
@ -306,7 +305,7 @@
<string name="simpleprofile_shortname">SP</string>
<string name="profileviewer_shortname">PROF</string>
<string name="overview_shortname">HOME</string>
<string name="objectives_shortname">OBJ</string>
<string name="objectives_shortname">ZIEL</string>
<string name="oaps_shortname">OAPS</string>
<string name="loop_shortname">LOOP</string>
<string name="localprofile_shortname">LP</string>
@ -333,11 +332,11 @@
<string name="danar_bluetooth_status">Bluetooth-Status</string>
<string name="danar_stats_cumulative_tdd">Kumulative TDD</string>
<string name="danar_stats_date">Datum</string>
<string name="danar_stats_expweight">Exponentiell Gewichtete TDD</string>
<string name="danar_stats_expweight">Exponentiell gewichtete TDD</string>
<string name="danar_stats_olddata_Message">Veraltete Daten, bitte klicke auf \"Reload\"</string>
<string name="xdripstatus_shortname">xds</string>
<string name="xdripstatus">xDrip Statuszeile (Uhr)</string>
<string name="xdripstatus_settings">xDrip Status (Uhr)</string>
<string name="xdripstatus">xDrip+ Statuszeile (Uhr)</string>
<string name="xdripstatus_settings">xDrip+ Status (Uhr)</string>
<string name="xdripnotinstalled">xDrip+ nicht installiert</string>
<string name="wear_showbgi_title">Zeige BGI</string>
<string name="wear_showbgi_summary">Füge BGI zur Statuszeile hinzu</string>
@ -450,7 +449,7 @@
<string name="nav_show_logcat">Logs anzeigen</string>
<string name="nosuccess">nicht erfolgreich - bitte Telefon prüfen</string>
<string name="notavailable">Nicht verfügbar</string>
<string name="nowritepermission">NSClient hat keine Schreibrechte. Falscher API-Key?</string>
<string name="nowritepermission">Nightscout-Client hat keine Schreibrechte. Falscher API-Key?</string>
<string name="ns_alarmoptions">Alarm-Optionen</string>
<string name="ns_localbroadcasts">Aktiviere Broadcasts für andere Apps (z. B. xDrip+).</string>
<string name="ns_localbroadcasts_title">Aktiviere lokale Broadcasts.</string>
@ -603,7 +602,7 @@
<string name="objectives_4_objective">Fein-Einstellung des Closed-Loops, Erhöhen von max IOB über 0 und langsames Heruntersetzen des Zielbereichs</string>
<string name="objectives_5_gate">Eine Woche erfolgreiches Loopen am Tag mit regelmäßiger Kohlenhydrat-Eingabe</string>
<string name="objectives_5_objective">Passe, falls notwendig, Basal und Faktoren an und aktiviere dann die Autosense-Funktion</string>
<string name="objectives_6_objective">Aktiviere zusätzliche Funktionen wie z. B. den Mahlzeitenassistent</string>
<string name="objectives_6_objective">Aktiviere zusätzliche Funktionen, wie z. B. den Mahlzeitenassistent</string>
<string name="nsalarm_urgentstaledata">Stark veraltete Daten</string>
<string name="nsalarm_urgent_staledatavalue_label">Stark veraltete Daten seit [Min.]</string>
<string name="nl_lang">Dutch</string>
@ -671,8 +670,8 @@
<string name="enable_missed_bg_readings_alert">Alarm, wenn keine Glukose-Daten empfangen werden</string>
<string name="enable_pump_unreachable_alert">Alarm, wenn die Pumpe nicht erreichbar ist</string>
<string name="pump_unreachable_threshold">Pumpe ist nicht erreichbar Grenze [Min.]</string>
<string name="combo_refresh">Aktualisieren</string>
<string name="treatments_wizard_tt_label">TZ</string>
<string name="alert_dialog_storage_permission_text">Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Andernfalls wird AndroidAPS nicht protokolliert (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert)</string>
<string name="tempbasal">TBR</string>
<string name="danar_history">Pumpen-Speicher</string>
<string name="enablesuperbolus_summary">Aktiviere die SuperBolus-Funktion im Wizard. Nicht aktivieren, wenn du nicht weißt, welche Auswirkungen dieser Bolus hat! ES KANN ZU EINER ÜBERDOSIERUNG AN INSULIN KOMMEN!</string>
@ -701,6 +700,66 @@
<string name="dexcomg5_xdripupload_summary">Wähle in xDrip+ 640g/Eversense als Daten-Quelle</string>
<string name="nsclientbg">Nightscout-Client BZ</string>
<string name="minimalbasalvaluereplaced">Basal-Wert wurde durch den kleinst möglichen Wert ersetzt</string>
<string name="apsselected">APS ausgewählt</string>
<string name="loopenabled">Loop aktiviert</string>
<string name="nsclienthaswritepermission">Nightscout-Client hat Schreibrechte</string>
<string name="maxiobset">Maximales IOB richtig gesetzt</string>
<string name="closedmodeenabled">Closed mode aktiviert</string>
<string name="objectives_7_objective">Aktiviere zusätzliche Funktionen wie z. B. den SMB</string>
<string name="btwatchdog_title">BT Watchdog</string>
<string name="DexcomG5">DexcomG5 App (patched)</string>
<string name="combo_pump_activity_label">Aktivität</string>
<string name="combo_tbr_remaining">%d%% (%d Min. verbleibend)</string>
<string name="combo_no_pump_connection">Keine Verbindung zur Pumpe seit %d Min.</string>
<string name="bolusstopped">Bolusabgabe gestoppt</string>
<string name="bolusstopping">Bolusabgabe wird abgebrochen</string>
<string name="pump_errors_history">Fehlerprotokol</string>
<string name="combo_pump_state_label">Status</string>
<string name="combo_pump_state_disconnected">Keine Verbindung zur Pumpe</string>
<string name="combo_pump_state_suspended_by_user">Durch Benutzer gestoppt</string>
<string name="combo_pump_state_suspended_due_to_error">Wegen Fehler gestoppt</string>
<string name="combo_pump_state_running">Normaler Betrieb</string>
<string name="combo_tdds">TDDS</string>
<string name="combo_programming_bolus">Bolusabgabe wird vorbereitet</string>
<string name="combo_pump_action_cancelling_tbr">TBR wird abgebrochen</string>
<string name="combo_pump_action_setting_tbr">TBR wird gesetzt (%d%% / %d Min.)</string>
<string name="combo_pump_action_bolusing">Bolus (%.1f IE) wird abgegeben</string>
<string name="alert_dialog_storage_permission_text">Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Andernfalls wird AndroidAPS nicht protokolliert (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert)</string>
<string name="pump_tempbasal_label">TBR</string>
<string name="combo_last_bolus">%.1f IE (%s, %s)</string>
<string name="raise_urgent_alarms_as_android_notification">Nutze System-Benachrichtigungen für Alarme</string>
<string name="bolus_frequency_exceeded">Ein gleich großer Bolus wurde in der letzten Minute angefordert. Dies ist nicht zulässig, um ungewollte Doppelboli zu verhindern und vor eventuellen Bugs zu schützen.</string>
<string name="combo_activity_reading_pump_history">Historie wird gelesen</string>
<string name="combo_activity_setting_basal_profile">Basalratenprofil wird aktualisiert</string>
<string name="combo_error_bolus_recovery_progress">Verbindung wird wieder hergestellt</string>
<string name="combo_error_bolus_verification_failed">Der abgegebene Bolus konnte nicht bestätigt werden. Bitte prüfe auf der Pumpe, ob ein Bolus abgegeben wurde und erstelle einen Eintrag im Careportal falls nötig.</string>
<string name="combo_error_no_bolus_delivered">Die Bolusabgabe ist fehlgeschlagen: Es wurde scheinbar kein Bolus abgegeben. Bitte prüfe auf der Pumpe, ob ein Bolus abgegeben wurde. Um doppelte Boli durch Programmfehler zu vermeiden, werden Boli nicht automatisch wiederholt.</string>
<string name="combo_error_partial_bolus_delivered">Wegen eines Fehlers wurden nur %.2f IE von den angeforderten %.2f IE abgegeben. Bitte prüfe den abgegebenen Bolus auf der Pumpe.</string>
<string name="combo_history">Historie</string>
<string name="combo_pump_action_refreshing">Status wird aktualisiert</string>
<string name="combo_pump_action_initializing">Die Pumpe wird initialisiert</string>
<string name="combo_pump_connected_now">Jetzt</string>
<string name="combo_pump_never_connected">Nie</string>
<string name="combo_pump_tbr_cancelled_warrning">Der Alarm \"TBR ABBRUCH\" wurde bestätigt</string>
<string name="combo_warning">Warnung</string>
<string name="combo_reservoir_empty">Leer</string>
<string name="combo_reservoir_low">Niedrig</string>
<string name="combo_reservoir_normal">Normal</string>
<string name="combo_tdd_average">Durchschnitt: %3.1f IE</string>
<string name="combo_tdd_maximum">Maximum: %3.1f IE</string>
<string name="combo_tdd_minimum">Minimum: %3.1f IE</string>
<string name="combo_pump_unsupported_operation">Diese Aktion wird von der Pumpe nicht unterstützt</string>
<string name="combo_pump_alerts">Alarme</string>
<string name="combo_pump_battery_low_warrning">Die Batterie in der Pumpe ist fast leer</string>
<string name="combo_pump_cartridge_low_warrning">Das Reservoir in der Pumpe ist fast leer</string>
<string name="combo_is_in_error_state">Die Pumpe zeigt einen Fehler an E%d: %s</string>
<string name="combo_force_disabled_notification">Unsichere Verwendung: In der Pumpe ist nicht das erste Basalratenprofil gewählt. Der Loop wird deaktiviert bis dies korrigiert ist.</string>
<string name="combo_low_suspend_forced_notification">Unsichere Verwendung: Ein erweiterter oder Multiwave-Bolus ist aktiv. Der Loop wird für die nächsten 6 Stunden kein zusätzliches Insulin abgeben.</string>
<string name="combo_no_alert_data_note">Um die Fehlerhistorie der Pumpe zu lesen, drücke lange auf ALARME.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe, der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst eine Taste gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
<string name="combo_notification_check_time_date">Bitte aktualisiere die Uhrzeit der Pumpe</string>
<string name="combo_no_tdd_data_note">Um die TDD-Statistik der Pumpe zu lesen, drücken Sie den TDDS Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
<string name="combo_read_full_history_warning">Dies wird den gesamten Speicher und den Status der Pumpe auslesen sowie alle Einträge in „Meine Daten“ und die Basalrate. Boli und TBR werden unter Behandlungen gespeichert, sofern sie nicht bereits vorhanden sind. Dies kann zu doppelten Einträgen führen, wenn die Uhrzeit der Pumpe abweicht. Das Auslesen des Speichers ist normaler Weise für das Loopen unnötig und nur für besondere Umstände vorgesehen. Wenn Du es dennoch tun willst, drücke noch einmal länger den Button. ACHTUNG: Dies kann einen Fehler auslösen, der dazu führt, dass die Pumpe keine Verbindungsversuche mehr akzeptiert. Erst die Betätigung einer Taste an der Pumpe beendet diesen Zustand. Nach Möglichkeit sollte daher das Auslesen vermieden werden.</string>
<string name="combo_read_full_history_confirmation">Möchtest Du wirklich den gesamten Speicher der Pumpe auslesen und die möglichen Konsequenzen des Vorgangs tragen?</string>
<string name="yes">Ja</string>
<string name="no">Nein</string>
<string name="overview_editquickwizard_usebg">BZ Berechnung</string>
@ -719,64 +778,4 @@
<string name="openapsama_bolussnooze_dia_divisor_summary">Standarwert: 2\nBolus snooze (\"Bolus-Schlummer\") bremst den Loop nach einem Mahleiten-Bolus, damit dieser nicht mit niedrigen TBR reagiert, wenn Du gerade gegessen hast. Beispiel: Der Standardwert 2 bewirkt, dass bei einem 3 Stunden DIA der Bolus snooze während 1.5 Stunden nach dem Bolus linear ausläuft (3 h Dia / 2 = 1.5 h Bolus snooze).</string>
<string name="openapsama_min_5m_carbimpact_summary">Standardwert: 3.0\nDies ist eine Einstellung für die Standard-Kohlenhydrat-Absorptionswirkung pro 5 Minuten. Der Standardwert ist 3mg/dl/5min. Dies wirkt sich darauf aus, wie schnell der COB-Wert fällt und wieviel KH-Absorption bei der Berechnung des vorhergesagten BZ angenommen wird, wenn der BZ stärker als erwartet fällt oder nicht so stark wie erwartet steigt.</string>
<string name="openapsama_link_to_preferncejson_doc_txt">Achtung! Normalerweise musst Du diese Werte nicht ändern. Bitte KLICKE HIER und LESE den Text. Verändere Werte erst, wenn Du den Inhalt des Textes verstanden hast.</string>
<string name="apsselected">APS ausgewählt</string>
<string name="loopenabled">Loop aktiviert</string>
<string name="nsclienthaswritepermission">Nightscout-Client hat Schreibrechte</string>
<string name="maxiobset">Maximales IOB richtig gesetzt</string>
<string name="closedmodeenabled">Closed mode aktiviert</string>
<string name="virtualpump_lastconnection_label">Letzte Verbindung</string>
<string name="virtualpump_basebasalrate_label">Basis-Basalrate</string>
<string name="virtualpump_reservoir_label">Reservoir</string>
<string name="danar_lastbolus">Letzter Bolus:</string>
<string name="objectives_7_objective">Aktiviere zusätzliche Funktionen wie z. B. den SMB</string>
<string name="btwatchdog_title">BT Watchdog</string>
<string name="DexcomG5">DexcomG5 App (patched)</string>
<string name="combo_refresh">Aktualisieren</string>
<string name="combo_pump_activity_label">Aktivität</string>
<string name="combo_tbr_remaining">%d%% (%d Min. verbleibend)</string>
<string name="combo_no_pump_connection">Keine Verbindung zur Pumpe seit %d min</string>
<string name="bolusstopped">Bolusabgabe gestopped</string>
<string name="bolusstopping">Bolusabgabe wird abgebrochen</string>
<string name="pump_errors_history">Fehlerprotokol</string>
<string name="combo_pump_state_label">Status</string>
<string name="combo_pump_state_disconnected">Keine Verbindung zur Pumpe</string>
<string name="combo_pump_state_suspended_by_user">Durch Benutzer gestoppt</string>
<string name="combo_pump_state_suspended_due_to_error">Wegen Fehler gestoppt</string>
<string name="combo_pump_state_running">Normaler Betrieb</string>
<string name="combo_tdds">TDDS</string>
<string name="combo_programming_bolus">Bolusabgabe wird vorbereitet</string>
<string name="combo_pump_action_cancelling_tbr">TBR wird abgebrochen</string>
<string name="combo_pump_action_setting_tbr">TBR wird gesetzt (%d%% / %d min)</string>
<string name="combo_pump_action_bolusing">Bolus (%.1f E) wird abgegeben</string>
<string name="combo_activity_reading_pump_history">Historik wird gelesen</string>
<string name="combo_activity_setting_basal_profile">Basalratenprofil wird aktualisiert</string>
<string name="combo_error_bolus_recovery_progress">Verbindung wurde unterbrochen, es wird versucht fortzusetzen</string>
<string name="combo_error_bolus_verification_failed">Der abgegebene Bolus konnte nicht bestätigt werden. Bitte prüfen Sie auf der Pumpe ob ein Bolus abgegeben wurde und erstellen Sie einen Eintrag im Careportal Reiter falls nötig.</string>
<string name="combo_error_no_bolus_delivered">Die Bolusabgabe ist fehlgeschlagen, es wurde scheinbar kein Bolus abgegeben. Bitte prüfen Sie auf der Pumpe ob ein Bolus abgegeben wurde. Um dopplte Boli durch Programmfehler zu vermeiden werden Boli nicht automatisch erneut versucht.</string>
<string name="combo_error_partial_bolus_delivered">Wegen eines Fehlers wurden nur %.2f IE von den angeforderten %.2f IE abgegeben. Bitte prüfen Sie den abgegeben Bolus auf der Pumpe.</string>
<string name="combo_history">Historik</string>
<string name="combo_pump_action_refreshing">Status wird aktualisiert</string>
<string name="combo_pump_action_initializing">Die Pumpe wird initialisiert</string>
<string name="combo_pump_connected_now">Jetzt</string>
<string name="combo_pump_never_connected">Nie</string>
<string name="combo_pump_tbr_cancelled_warrning">Ein TBR ABGEBROCHEN Alarm wurde bestätigt</string>
<string name="combo_warning">Warnung</string>
<string name="combo_reservoir_empty">Leer</string>
<string name="combo_reservoir_low">Niedrig</string>
<string name="combo_reservoir_normal">Normal</string>
<string name="combo_tdd_average">Durchschnitt: %3.1f IE</string>
<string name="combo_tdd_maximum">Maximum: %3.1f IE</string>
<string name="combo_tdd_minimum">Minimum: %3.1f IE</string>
<string name="combo_pump_unsupported_operation">Diese Aktion wird von der Pumpe nicht unterstützt</string>
<string name="combo_pump_alerts">Alarme</string>
<string name="combo_pump_battery_low_warrning">Die Batterie in der Pumpe ist fast leer</string>
<string name="combo_pump_cartridge_low_warrning">Das Reservoir in der Pumpe ist fast leer</string>
<string name="combo_is_in_error_state">Die Pumpe zeigt einen Fehler an E%d: %s</string>
<string name="combo_force_disabled_notification">Unsichere Verwendung: die Pumpe hat nicht das erste Basalratenprofil als aktiv gesetzt. Der Loop wird deaktiviert bis dies korrigiert ist.</string>
<string name="combo_low_suspend_forced_notification">Unsichere Verwendung: ein erweiterter- oder Multiwave-Bolus ist aktiv. Der Loop wird für die nächsten 6 Stunden kein zusätzliches Insulin abgeben.</string>
<string name="combo_no_alert_data_note">Um die Fehlerhistorik der Pumpe zu lesen, drücken Sie den ALARME Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
<string name="combo_notification_check_time_date">Bitte aktualisieren Sie die Uhr auf der Pumpe</string>
<string name="combo_no_tdd_data_note">Um die TDD-Statistik der Pumpe zu lesen, drücken Sie den TDDS Knopf lange.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
<string name="combo_read_full_history_confirmation">Sind Sie sich sicher, dass Sie diese Aktion ausführen möchen und verstehen Sie die Konsequenzen die sich daraus ergeben?</string>
<string name="combo_read_full_history_warning">Diese Aktion wird die gesamte Historik und die Basalrate aus der Pumpe auslesen. Boli und temporäre Basalrate werden zu den Behandlungen hinzugefügt wenn diese noch nicht vorhanden sind. Dies kann zu doppelten Einträge und somit zu falschen IOB-Werten führen, da die Uhr der Pumpe ungenau ist. Diese Aktion sollte NIE durchgeführt werden wenn die Pumpe im Loop verwendet wird. Wenn Sie diese Aktion trotzdem durchführen möchten, drücken Sie lange erneut auf den diesen Knopf.\nWARNUNG: Es gibt einen bekannten Fehler in der Pumpe der dazu führt, dass die Pumpe nach dieser Aktion erst wieder Verbindungen annimmt, wenn auf der Pumpe selbst ein Konpf gedrückt wird. Aus diesem Grund sollte diese Aktion nicht durchgeführt werden.</string>
</resources>

View file

@ -111,6 +111,25 @@
</intent-filter>
</service>
<service
android:name=".watchfaces.Steampunk"
android:allowEmbedded="true"
android:label="AAPS(Steampunk)"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_steampunk" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<service
android:name=".watchfaces.LargeHome"
android:allowEmbedded="true"

View file

@ -21,6 +21,7 @@ import android.view.Display;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -44,15 +45,17 @@ import lecho.lib.hellocharts.view.LineChartView;
/**
* Created by emmablack on 12/29/14.
* Updated by andrew-warrington on 11/15/17.
* Updated by andrew-warrington on 02-Jan-2018.
*/
public abstract class BaseWatchFace extends WatchFace implements SharedPreferences.OnSharedPreferenceChangeListener {
public final static IntentFilter INTENT_FILTER;
public static final long[] vibratePattern = {0,400,300,400,300,400};
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight;
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
public long datetime;
public RelativeLayout mRelativeLayout;
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap;
public long sgvLevel = 0;
public int ageLevel = 1;
public int loopLevel = 1;
@ -85,6 +88,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public boolean detailedIOB = false;
public boolean showBGI = false;
public boolean forceSquareCanvas = false; //set to true by the Steampunk watch face.
public long openApsStatus;
public String externalStatusString = "no status";
public String sSgv = "---";
@ -99,21 +103,24 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public String sCOB1 = "Carb";
public String sCOB2 = "--g";
public String sBgi = "--";
public String sMinute = "0";
public String sHour = "0";
public String sUnits = "-";
@Override
public void onCreate() {
super.onCreate();
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getSize(displaySize);
wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Clock");
specW = View.MeasureSpec.makeMeasureSpec(displaySize.x,
View.MeasureSpec.EXACTLY);
specH = View.MeasureSpec.makeMeasureSpec(displaySize.y,
View.MeasureSpec.EXACTLY);
sharedPrefs = PreferenceManager
.getDefaultSharedPreferences(this);
specW = View.MeasureSpec.makeMeasureSpec(displaySize.x, View.MeasureSpec.EXACTLY);
if (forceSquareCanvas) {
specH = specW;
} else {
specH = View.MeasureSpec.makeMeasureSpec(displaySize.y, View.MeasureSpec.EXACTLY);
}
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
sharedPrefs.registerOnSharedPreferenceChangeListener(this);
}
@ -160,10 +167,17 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout);
mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout);
mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout);
mGlucoseDial = (ImageView) stub.findViewById(R.id.glucose_dial);
mDeltaGauge = (ImageView) stub.findViewById(R.id.delta_pointer);
mHourHand = (ImageView) stub.findViewById(R.id.hour_hand);
mMinuteHand = (ImageView) stub.findViewById(R.id.minute_hand);
mChartTap = (LinearLayout) stub.findViewById(R.id.chart_zoom_tap);
mMainMenuTap = (LinearLayout) stub.findViewById(R.id.main_menu_tap);
chart = (LineChartView) stub.findViewById(R.id.chart);
layoutSet = true;
setDataFields();
setColor();
}
}
);
@ -214,7 +228,14 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
protected void onDraw(Canvas canvas) {
if (layoutSet) {
setupCharts();
this.mRelativeLayout.draw(canvas);
mRelativeLayout.measure(specW, specH);
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
mRelativeLayout.draw(canvas);
Log.d("onDraw", "draw");
}
}
@ -225,11 +246,16 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
wakeLock.acquire(50);
setDataFields();
setColor();
missedReadingAlert();
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
mRelativeLayout.getMeasuredHeight());
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
invalidate();
}
}
@ -247,6 +273,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
sDirection = dataMap.getString("slopeArrow");
sDelta = dataMap.getString("delta");
sAvgDelta = dataMap.getString("avgDelta");
sUnits = dataMap.getString("glucoseUnits");
if (chart != null) {
addToWatchSet(dataMap);
setupCharts();
@ -273,6 +300,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
}
setDataFields();
setColor();
bundle = intent.getBundleExtra("basals");
if (layoutSet && bundle != null) {
@ -282,10 +310,12 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
}
mRelativeLayout.measure(specW, specH);
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
mRelativeLayout.getMeasuredHeight());
if (forceSquareCanvas) {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.x); //force a square for Steampunk watch face.
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
invalidate();
setColor();
}
}
@ -476,15 +506,22 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public void setDateAndTime() {
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
mTime.setText(timeFormat.format(System.currentTimeMillis()));
if (mTime != null) {
mTime.setText(timeFormat.format(System.currentTimeMillis()));
}
Date now = new Date();
SimpleDateFormat sdfHour = new SimpleDateFormat("HH");
SimpleDateFormat sdfMinute = new SimpleDateFormat("mm");
sHour = sdfHour.format(now);
sMinute = sdfMinute.format(now);
if (mDate != null && mDay != null && mMonth != null) {
if (sharedPrefs.getBoolean("show_date", false)) {
Date today = new Date();
SimpleDateFormat sdfDay = new SimpleDateFormat("dd");
SimpleDateFormat sdfMonth = new SimpleDateFormat("MMM");
mDay.setText(sdfDay.format(today));
mMonth.setText(sdfMonth.format(today));
mDay.setText(sdfDay.format(now));
mMonth.setText(sdfMonth.format(now));
mDate.setVisibility(View.VISIBLE);
} else {
mDate.setVisibility(View.GONE);
@ -534,6 +571,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
if(layoutSet){
setDataFields();
setColor();
}
invalidate();
}

View file

@ -146,7 +146,7 @@ public class BgGraphBuilder {
for (TempWatchData twd: tempWatchDataList) {
if(twd.endTime > start_time) {
lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?3:2));
lines.add(tempValuesLine(twd, (float) minChart, factor, false, highlight?(pointSize+1):pointSize));
if(highlight){
lines.add(tempValuesLine(twd, (float) minChart, factor, true, 1));
}

View file

@ -0,0 +1,243 @@
package info.nightscout.androidaps.watchfaces;
import android.content.Intent;
import android.support.v4.content.ContextCompat;
import android.support.wearable.watchface.WatchFaceStyle;
import android.view.LayoutInflater;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
/**
* Created by andrew-warrington on 01/12/2017.
*/
public class Steampunk extends BaseWatchFace {
private long chartTapTime = 0;
private long mainMenuTapTime = 0;
private float lastEndDegrees = 0f;
private float deltaRotationAngle = 0f;
@Override
public void onCreate() {
forceSquareCanvas = true;
super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_steampunk, null);
performViewSetup();
}
@Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
if (tapType == TAP_TYPE_TAP&&
x >= mChartTap.getLeft() &&
x <= mChartTap.getRight()&&
y >= mChartTap.getTop() &&
y <= mChartTap.getBottom()){
if (eventTime - chartTapTime < 800){
changeChartTimeframe();
}
chartTapTime = eventTime;
} else if (tapType == TAP_TYPE_TAP&&
x >= mMainMenuTap.getLeft() &&
x <= mMainMenuTap.getRight()&&
y >= mMainMenuTap.getTop() &&
y <= mMainMenuTap.getBottom()){
if (eventTime - mainMenuTapTime < 800){
Intent intent = new Intent(this, MainMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
mainMenuTapTime = eventTime;
}
}
@Override
protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
}
protected void setColorDark() {
if (mLinearLayout2 != null) {
if (ageLevel() <= 0) {
mLinearLayout2.setBackgroundResource(R.drawable.redline);
mTimestamp.setTextColor(getResources().getColor(R.color.red_600));
} else {
mLinearLayout2.setBackgroundResource(0);
mTimestamp.setTextColor(getResources().getColor(R.color.black_86p));
}
}
if (mLoop != null) {
if (loopLevel == 0) {
mLoop.setTextColor(getResources().getColor(R.color.red_600));
} else {
mLoop.setTextColor(getResources().getColor(R.color.black_86p));
}
}
if (!sSgv.equals("---")) {
float rotationAngle = 0f; //by default, show ? on the dial (? is at 0 degrees on the dial)
if (!sUnits.equals("-")) {
//ensure the glucose dial is the correct units
if (sUnits.equals("mmol")) {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mmol);
} else {
mGlucoseDial.setImageResource(R.drawable.steampunk_dial_mgdl);
}
//convert the Sgv to degrees of rotation
if (sUnits.equals("mmol")) {
rotationAngle = Float.valueOf(sSgv) * 18f; //convert to mg/dL, which is equivalent to degrees
} else {
rotationAngle = Float.valueOf(sSgv); //if glucose a value is received, use it to determine the amount of rotation of the dial.
}
}
if (rotationAngle > 330) rotationAngle = 330; //if the glucose value is higher than 330 then show "HIGH" on the dial. ("HIGH" is at 330 degrees on the dial)
if (rotationAngle != 0 && rotationAngle < 30) rotationAngle = 30; //if the glucose value is lower than 30 show "LOW" on the dial. ("LOW" is at 30 degrees on the dial)
//rotate glucose dial
RotateAnimation rotate = new RotateAnimation(
lastEndDegrees, rotationAngle - lastEndDegrees,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setFillAfter(true);
rotate.setInterpolator(new LinearInterpolator());
rotate.setDuration(1);
mGlucoseDial.startAnimation(rotate);
lastEndDegrees = rotationAngle; //store the final angle as a starting point for the next rotation.
}
//set the delta gauge and rotate the delta pointer
float deltaIsNegative = 1f; //by default go clockwise
if (!sAvgDelta.equals("--")) { //if a legitimate delta value is received, then...
if (sAvgDelta.substring(0,1).equals("-")) deltaIsNegative = -1f; //if the delta is negative, go counter-clockwise
//ensure the delta gauge is the right units and granularity
if (!sUnits.equals("-")) {
if (sUnits.equals("mmol")) {
if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_10);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 30f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_05);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 60f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mmol_03);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 100f); //get rid of the sign so it can be converted to float.
}
} else {
if (sharedPrefs.getString("delta_granularity", "2").equals("1")) { //low
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_20);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 1.5f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("2")) { //medium
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_10);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 3f); //get rid of the sign so it can be converted to float.
}
if (sharedPrefs.getString("delta_granularity", "2").equals("3")) { //high
mLinearLayout.setBackgroundResource(R.drawable.steampunk_gauge_mgdl_5);
deltaRotationAngle = (Float.valueOf(sAvgDelta.substring(1)) * 6f); //get rid of the sign so it can be converted to float.
}
}
}
if (deltaRotationAngle > 40) deltaRotationAngle = 40f;
mDeltaGauge.setRotation(deltaRotationAngle * deltaIsNegative);
}
//rotate the minute hand.
mMinuteHand.setRotation(Float.valueOf(sMinute) * 6f);
//rotate the hour hand.
mHourHand.setRotation((Float.valueOf(sHour) * 30f) + (Float.valueOf(sMinute) * 0.5f));
setTextSizes();
if (mLoop != null) {
mLoop.setBackgroundResource(0);
}
if (chart != null) {
highColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.black);
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.grey_steampunk);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
pointSize = 1;
setupCharts();
}
invalidate();
}
protected void setColorLowRes() {
setColorDark();
}
protected void setColorBright() {
setColorDark();
}
protected void setTextSizes() {
float fontSmall = 10f;
float fontMedium = 11f;
float fontLarge = 12f;
if (bIsRound) {
fontSmall = 11f;
fontMedium = 12f;
fontLarge = 13f;
}
//top row. large font unless text too big (i.e. detailedIOB)
mCOB2.setTextSize(fontLarge);
mBasalRate.setTextSize(fontLarge);
if (sIOB2.length() < 7) {
mIOB2.setTextSize(fontLarge);
} else {
mIOB2.setTextSize(fontSmall);
}
//bottom row. font medium unless text too long (i.e. longer than 9' timestamp)
if (mTimestamp.getText().length() < 3 || mLoop.getText().length() < 3) { //always resize these fields together, for symmetry.
mTimestamp.setTextSize(fontMedium);
mLoop.setTextSize(fontMedium);
} else {
mTimestamp.setTextSize(fontSmall);
mLoop.setTextSize(fontSmall);
}
//if both batteries are shown, make them smaller.
if (sharedPrefs.getBoolean("show_uploader_battery", true) && sharedPrefs.getBoolean("show_rig_battery", false)) {
mUploaderBattery.setTextSize(fontSmall);
mRigBattery.setTextSize(fontSmall);
} else {
mUploaderBattery.setTextSize(fontMedium);
mRigBattery.setTextSize(fontMedium);
}
}
private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.wearable.view.WatchViewStub
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect_steampunk"
app:roundLayout="@layout/round_steampunk"
tools:context=".watchfaces.Cockpit"
tools:deviceIds="wear"/>

View file

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:deviceIds="wear_square">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/glucose_dial"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/steampunk_dial_mgdl" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/delta_pointer"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.69"
android:gravity="center"
android:src="@drawable/steampunk_pointer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.7"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.05"
android:gravity="center"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.26"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.16"
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="7dp"
android:rotation="-28"
android:text="--g"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.24"
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="12dp"
android:rotation="-1"
android:text="-.--U/h"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="6dp"
android:rotation="28"
android:text="0.00U"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.27"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03"
android:orientation="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.15"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.21"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingEnd="8dp"
android:paddingTop="8dp"
android:rotation="-24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.12"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/rig_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingTop="8dp"
android:rotation="24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="10sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.64"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/cover_plate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steampunk_cover_plate"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/hour_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:rotation="0"
android:src="@drawable/steampunk_hour_hand" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/minute_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:src="@drawable/steampunk_minute_hand" />
</LinearLayout>
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -0,0 +1,381 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.Steampunk"
tools:deviceIds="wear_round">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/glucose_dial"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:src="@drawable/steampunk_dial_mgdl" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/delta_pointer"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.69"
android:gravity="center"
android:src="@drawable/steampunk_pointer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.7"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.05"
android:gravity="center"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.26"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/cobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="7dp"
android:rotation="-28"
android:text="--g"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.27"
android:orientation="horizontal">
<TextView
android:id="@+id/tmpBasal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="14dp"
android:rotation="0"
android:text="-.--U/h"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/iobView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="6dp"
android:rotation="28"
android:text="0.00U"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.27"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03"
android:orientation="vertical" />
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.15"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.21"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingEnd="8dp"
android:paddingTop="8dp"
android:rotation="-24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.12"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/rig_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingTop="8dp"
android:rotation="24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.64"
android:orientation="horizontal"></LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/cover_plate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steampunk_cover_plate"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/hour_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:rotation="0"
android:src="@drawable/steampunk_hour_hand" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/minute_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:src="@drawable/steampunk_minute_hand" />
</LinearLayout>
<TextView
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
</RelativeLayout>

View file

@ -61,6 +61,7 @@
<color name="grey_50">#FAFAFA</color>
<color name="grey_300">#E0E0E0</color>
<color name="grey_500">#9E9E9E</color>
<color name="grey_steampunk">#333333</color>
<!-- Grey -->
<!-- Blue Grey -->

View file

@ -20,6 +20,18 @@
<item>5</item>
</string-array>
<string-array name="delta_granularity">
<item>Low</item>
<item>Medium</item>
<item>High</item>
</string-array>
<string-array name="delta_granularity_values">
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="input_design">
<item>Default</item>
<item>Quick righty</item>

View file

@ -141,6 +141,14 @@
android:summary="Input Design"
android:title="Input Design" />
<ListPreference
android:defaultValue="2"
android:entries="@array/delta_granularity"
android:entryValues="@array/delta_granularity_values"
android:key="delta_granularity"
android:summary="Delta Granularity (Steampunk)"
android:title="Delta Granularity (Steampunk)" />
<CheckBoxPreference
android:defaultValue="false"
android:key="showBigNumbers"