Merge branch 'dev' into smb
|
@ -7,7 +7,7 @@ android:
|
|||
components:
|
||||
- platform-tools
|
||||
- tools
|
||||
- build-tools-25.0.2
|
||||
- build-tools-26.0.2
|
||||
- android-23
|
||||
- extra-google-m2repository
|
||||
- extra-android-m2repository
|
||||
|
|
|
@ -37,7 +37,7 @@ def generateGitBuild = { ->
|
|||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "25.0.2"
|
||||
buildToolsVersion "26.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "info.nightscout.androidaps"
|
||||
|
|
|
@ -4,7 +4,7 @@ package info.nightscout.androidaps;
|
|||
* Created by mike on 07.06.2016.
|
||||
*/
|
||||
public class Config {
|
||||
public static int SUPPORTEDNSVERSION = 1000; // 0.10.00
|
||||
public static int SUPPORTEDNSVERSION = 1002; // 0.10.00
|
||||
|
||||
// MAIN FUCTIONALITY
|
||||
public static final boolean APS = BuildConfig.APS;
|
||||
|
|
|
@ -54,11 +54,12 @@ public class Constants {
|
|||
|
||||
//Screen: Threshold for width/height to go into small width/height layout
|
||||
public static final int SMALL_WIDTH = 320;
|
||||
public static final int SMALL_HEIGHT = 320;
|
||||
public static final int SMALL_HEIGHT = 480;
|
||||
|
||||
//Autosens
|
||||
public static final double DEVIATION_TO_BE_EQUAL = 2.0;
|
||||
|
||||
// Pump
|
||||
public static final int PUMP_MAX_CONNECTION_TIME_IN_SECONDS = 60 - 1;
|
||||
public static final int PUMP_MAX_CONNECTION_TIME_IN_SECONDS = 120 - 1;
|
||||
public static final int MIN_WATCHDOG_INTERVAL_IN_SECONDS = 12 * 60;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.IobCobCalculator;
|
|||
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.Process;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
|
||||
|
@ -134,7 +135,7 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
IobCobCalculatorPlugin() {
|
||||
MainApp.bus().register(this);
|
||||
if (sHandlerThread == null) {
|
||||
sHandlerThread = new HandlerThread(IobCobCalculatorPlugin.class.getSimpleName());
|
||||
sHandlerThread = new HandlerThread(IobCobCalculatorPlugin.class.getSimpleName(), Process.THREAD_PRIORITY_LOWEST);
|
||||
sHandlerThread.start();
|
||||
sHandler = new Handler(sHandlerThread.getLooper());
|
||||
}
|
||||
|
|
|
@ -308,6 +308,15 @@ public class NSDeviceStatus {
|
|||
return Html.fromHtml(string.toString());
|
||||
}
|
||||
|
||||
public static long getOpenApsTimestamp() {
|
||||
|
||||
if (deviceStatusOpenAPSData.clockSuggested != 0) {
|
||||
return deviceStatusOpenAPSData.clockSuggested;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public Spanned getExtendedOpenApsStatus() {
|
||||
StringBuilder string = new StringBuilder();
|
||||
|
||||
|
|
|
@ -632,7 +632,14 @@ public class NSClientService extends Service {
|
|||
if (sgv.getMills() > latestDateInReceivedData)
|
||||
latestDateInReceivedData = sgv.getMills();
|
||||
}
|
||||
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
||||
// Was that sgv more less 15 mins ago ?
|
||||
boolean lessThan15MinAgo = false;
|
||||
if((System.currentTimeMillis()-latestDateInReceivedData)/(60 * 1000L) < 15L )
|
||||
lessThan15MinAgo = true;
|
||||
if(Notification.isAlarmForStaleData() && lessThan15MinAgo){
|
||||
MainApp.bus().post(new EventDismissNotification(Notification.NSALARM));
|
||||
}
|
||||
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
||||
}
|
||||
MainApp.bus().post(new EventNSClientNewLog("LAST", DateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||
} catch (JSONException e) {
|
||||
|
|
|
@ -35,6 +35,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
|||
static double amount;
|
||||
public static boolean bolusEnded = false;
|
||||
public static boolean running = true;
|
||||
public static boolean stopPressed = false;
|
||||
|
||||
public BolusProgressDialog() {
|
||||
super();
|
||||
|
@ -62,6 +63,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
|||
progressBar.setMax(100);
|
||||
statusView.setText(MainApp.sResources.getString(R.string.waitingforpump));
|
||||
setCancelable(false);
|
||||
stopPressed = false;
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -95,6 +97,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
|||
switch (view.getId()) {
|
||||
case R.id.overview_bolusprogress_stop:
|
||||
log.debug("Stop bolus delivery button pressed");
|
||||
stopPressed = true;
|
||||
stopPressedView.setVisibility(View.VISIBLE);
|
||||
stopButton.setVisibility(View.INVISIBLE);
|
||||
ConfigBuilderPlugin.getActivePump().stopBolusDelivering();
|
||||
|
|
|
@ -191,8 +191,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int screen_width = dm.widthPixels;
|
||||
int screen_height = dm.heightPixels;
|
||||
smallWidth = screen_width < Constants.SMALL_WIDTH;
|
||||
smallHeight = screen_height < Constants.SMALL_HEIGHT;
|
||||
smallWidth = screen_width <= Constants.SMALL_WIDTH;
|
||||
smallHeight = screen_height <= Constants.SMALL_HEIGHT;
|
||||
boolean landscape = screen_height < screen_width;
|
||||
|
||||
View view;
|
||||
|
|
|
@ -191,7 +191,7 @@ public class GraphData {
|
|||
basalsLineSeries = new LineGraphSeries<>(basalLine);
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.STROKE);
|
||||
paint.setStrokeWidth(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);
|
||||
|
@ -201,7 +201,7 @@ public class GraphData {
|
|||
absoluteBasalsLineSeries = new LineGraphSeries<>(absoluteBasalLine);
|
||||
Paint absolutePaint = new Paint();
|
||||
absolutePaint.setStyle(Paint.Style.STROKE);
|
||||
absolutePaint.setStrokeWidth(4);
|
||||
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity*2);
|
||||
absolutePaint.setColor(MainApp.sResources.getColor(R.color.basal));
|
||||
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
|
||||
|
||||
|
|
|
@ -30,7 +30,10 @@ import android.graphics.Path;
|
|||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import android.util.TypedValue;
|
||||
// Added by Rumen for scalable text
|
||||
import android.content.Context;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import com.jjoe64.graphview.GraphView;
|
||||
import com.jjoe64.graphview.series.BaseSeries;
|
||||
|
||||
|
@ -44,6 +47,13 @@ import java.util.Iterator;
|
|||
* @author jjoe64
|
||||
*/
|
||||
public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> extends BaseSeries<E> {
|
||||
// Default spSize
|
||||
int spSize = 12;
|
||||
// Convert the sp to pixels
|
||||
Context context = MainApp.instance().getApplicationContext();
|
||||
float scaledTextSize = spSize * context.getResources().getDisplayMetrics().scaledDensity;
|
||||
float scaledPxSize = context.getResources().getDisplayMetrics().scaledDensity * 1.5f;
|
||||
|
||||
/**
|
||||
* choose a predefined shape to render for
|
||||
* each data point.
|
||||
|
@ -189,31 +199,31 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
if (value.getShape() == Shape.BG) {
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
} else if (value.getShape() == Shape.PREDICTION) {
|
||||
mPaint.setColor(value.getColor());
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
mPaint.setColor(value.getSecondColor());
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize() / 3, mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize / 3, mPaint);
|
||||
} else if (value.getShape() == Shape.RECTANGLE) {
|
||||
canvas.drawRect(endX-value.getSize(), endY-value.getSize(), endX+value.getSize(), endY+value.getSize(), mPaint);
|
||||
canvas.drawRect(endX-scaledPxSize, endY-scaledPxSize, endX+scaledPxSize, endY+scaledPxSize, mPaint);
|
||||
} else if (value.getShape() == Shape.TRIANGLE) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
Point[] points = new Point[3];
|
||||
points[0] = new Point((int)endX, (int)(endY-value.getSize()));
|
||||
points[1] = new Point((int)(endX+value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
points[2] = new Point((int)(endX-value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
points[0] = new Point((int)endX, (int)(endY-scaledPxSize));
|
||||
points[1] = new Point((int)(endX+scaledPxSize), (int)(endY+scaledPxSize*0.67));
|
||||
points[2] = new Point((int)(endX-scaledPxSize), (int)(endY+scaledPxSize*0.67));
|
||||
drawArrows(points, canvas, mPaint);
|
||||
} else if (value.getShape() == Shape.BOLUS) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
Point[] points = new Point[3];
|
||||
points[0] = new Point((int)endX, (int)(endY-value.getSize()));
|
||||
points[1] = new Point((int)(endX+value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
points[2] = new Point((int)(endX-value.getSize()), (int)(endY+value.getSize()*0.67));
|
||||
points[0] = new Point((int)endX, (int)(endY-scaledPxSize));
|
||||
points[1] = new Point((int)(endX+scaledPxSize), (int)(endY+scaledPxSize*0.67));
|
||||
points[2] = new Point((int)(endX-scaledPxSize), (int)(endY+scaledPxSize*0.67));
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
drawArrows(points, canvas, mPaint);
|
||||
if (value.getLabel() != null) {
|
||||
|
@ -233,7 +243,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
Rect bounds = new Rect((int)endX, (int)endY + 3, (int) (xpluslength), (int) endY + 8);
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
canvas.drawRect(bounds, mPaint);
|
||||
mPaint.setTextSize((int) (value.getSize() * 2.5));
|
||||
mPaint.setTextSize((int) (scaledTextSize * 2.5));
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
|
||||
mPaint.setFakeBoldText(true);
|
||||
canvas.drawText(value.getLabel(), endX, endY, mPaint);
|
||||
|
@ -241,7 +251,8 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
} else if (value.getShape() == Shape.PROFILE) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
if (value.getLabel() != null) {
|
||||
mPaint.setTextSize((int) (value.getSize() * 3));
|
||||
//mPaint.setTextSize((int) (scaledPxSize * 3));
|
||||
mPaint.setTextSize((float) (scaledTextSize*1.2));
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
|
||||
Rect bounds = new Rect();
|
||||
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);
|
||||
|
@ -257,25 +268,26 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
} else if (value.getShape() == Shape.MBG) {
|
||||
mPaint.setStyle(Paint.Style.STROKE);
|
||||
mPaint.setStrokeWidth(5);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
float w = mPaint.getStrokeWidth();
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
} else if (value.getShape() == Shape.BGCHECK) {
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
if (value.getLabel() != null) {
|
||||
drawLabel45(endX, endY, value, canvas);
|
||||
}
|
||||
} else if (value.getShape() == Shape.ANNOUNCEMENT) {
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
if (value.getLabel() != null) {
|
||||
drawLabel45(endX, endY, value, canvas);
|
||||
}
|
||||
} else if (value.getShape() == Shape.GENERAL) {
|
||||
mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||
mPaint.setStrokeWidth(0);
|
||||
canvas.drawCircle(endX, endY, value.getSize(), mPaint);
|
||||
canvas.drawCircle(endX, endY, scaledPxSize, mPaint);
|
||||
if (value.getLabel() != null) {
|
||||
drawLabel45(endX, endY, value, canvas);
|
||||
}
|
||||
|
@ -283,7 +295,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
mPaint.setStrokeWidth(0);
|
||||
if (value.getLabel() != null) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
mPaint.setTextSize((int) (value.getSize() * 3));
|
||||
mPaint.setTextSize((int) (scaledTextSize * 3));
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
|
||||
Rect bounds = new Rect();
|
||||
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);
|
||||
|
@ -298,7 +310,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
mPaint.setStrokeWidth(0);
|
||||
if (value.getLabel() != null) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
mPaint.setTextSize((int) (value.getSize() * 3));
|
||||
mPaint.setTextSize(scaledTextSize);
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
|
||||
Rect bounds = new Rect();
|
||||
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);
|
||||
|
@ -313,7 +325,7 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
mPaint.setStrokeWidth(0);
|
||||
if (value.getLabel() != null) {
|
||||
mPaint.setStrokeWidth(0);
|
||||
mPaint.setTextSize((int) (value.getSize() * 3));
|
||||
mPaint.setTextSize(scaledTextSize * 3);
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
|
||||
Rect bounds = new Rect();
|
||||
mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds);
|
||||
|
@ -364,26 +376,26 @@ public class PointsWithLabelGraphSeries<E extends DataPointWithLabelInterface> e
|
|||
void drawLabel45(float endX, float endY, E value, Canvas canvas) {
|
||||
if (value.getLabel().startsWith("~")) {
|
||||
float px = endX;
|
||||
float py = endY + value.getSize();
|
||||
float py = endY + scaledPxSize;
|
||||
canvas.save();
|
||||
canvas.rotate(-45, px, py);
|
||||
mPaint.setTextSize((int) (value.getSize() * 2.5));
|
||||
mPaint.setTextSize((float) (scaledTextSize*0.8));
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
|
||||
mPaint.setFakeBoldText(true);
|
||||
mPaint.setTextAlign(Paint.Align.RIGHT);
|
||||
canvas.drawText(value.getLabel().substring(1), px - value.getSize(), py, mPaint);
|
||||
canvas.drawText(value.getLabel().substring(1), px - scaledPxSize, py, mPaint);
|
||||
mPaint.setTextAlign(Paint.Align.LEFT);
|
||||
canvas.restore();
|
||||
} else {
|
||||
float px = endX;
|
||||
float py = endY - value.getSize();
|
||||
float py = endY - scaledPxSize;
|
||||
canvas.save();
|
||||
canvas.rotate(-45, px, py);
|
||||
mPaint.setTextSize((int) (value.getSize() * 2.5));
|
||||
mPaint.setTextSize((float) (scaledTextSize*0.8));
|
||||
mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL));
|
||||
mPaint.setFakeBoldText(true);
|
||||
canvas.drawText(value.getLabel(), px + value.getSize(), py, mPaint);
|
||||
canvas.drawText(value.getLabel(), px + scaledPxSize, py, mPaint);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,8 @@ public class Notification {
|
|||
|
||||
public NSAlarm nsAlarm = null;
|
||||
public Integer soundId = null;
|
||||
public Notification() {
|
||||
}
|
||||
|
||||
public Notification(int id, Date date, String text, int level, Date validTo) {
|
||||
this.id = id;
|
||||
|
@ -175,9 +177,10 @@ public class Notification {
|
|||
return false;
|
||||
}
|
||||
|
||||
static boolean isAlarmForStaleData() {
|
||||
if (SP.getLong("snoozedTo", 0L) != 0L) {
|
||||
if (System.currentTimeMillis() < SP.getLong("snoozedTo", 0L)) {
|
||||
public static boolean isAlarmForStaleData(){
|
||||
long snoozedTo = SP.getLong("snoozedTo", 0L);
|
||||
if(snoozedTo != 0L){
|
||||
if(System.currentTimeMillis() < SP.getLong("snoozedTo", 0L)) {
|
||||
//log.debug("Alarm is snoozed for next "+(SP.getLong("snoozedTo", 0L)-System.currentTimeMillis())/1000+" seconds");
|
||||
return false;
|
||||
}
|
||||
|
@ -188,16 +191,17 @@ public class Notification {
|
|||
long bgReadingAgo = System.currentTimeMillis() - bgReading.date;
|
||||
int bgReadingAgoMin = (int) (bgReadingAgo / (1000 * 60));
|
||||
// Added for testing
|
||||
//bgReadingAgoMin = 20;
|
||||
log.debug("bgReadingAgoMin value is:" + bgReadingAgoMin);
|
||||
Double threshold = NSSettingsStatus.getInstance().getThreshold("alarmTimeagoWarnMins");
|
||||
// bgReadingAgoMin = 20;
|
||||
boolean openAPSEnabledAlerts = NSSettingsStatus.getInstance().openAPSEnabledAlerts();
|
||||
log.debug("OpenAPS Alerts enabled: " + openAPSEnabledAlerts);
|
||||
// if no thresshold from Ns get it loccally
|
||||
if (threshold == null) threshold = SP.getDouble(R.string.key_nsalarm_staledatavalue, 15D);
|
||||
// No threshold of OpenAPS Alarm so using the one for BG
|
||||
// Added OpenAPSEnabledAlerts to alarm check
|
||||
if ((bgReadingAgoMin > threshold && SP.getBoolean(R.string.key_nsalarm_staledata, false)) || (bgReadingAgoMin > threshold && openAPSEnabledAlerts)) {
|
||||
//log.debug("bgReadingAgoMin value is:"+bgReadingAgoMin);
|
||||
//log.debug("Stale alarm snoozed to: "+(System.currentTimeMillis() - snoozedTo)/60000L);
|
||||
Double threshold = NSSettingsStatus.getInstance().getThreshold("alarmTimeagoWarnMins");
|
||||
//log.debug("OpenAPS Alerts enabled: "+openAPSEnabledAlerts);
|
||||
// if no thresshold from Ns get it loccally
|
||||
if(threshold == null) threshold = SP.getDouble(R.string.key_nsalarm_staledatavalue,15D);
|
||||
// No threshold of OpenAPS Alarm so using the one for BG
|
||||
// Added OpenAPSEnabledAlerts to alarm check
|
||||
if((bgReadingAgoMin > threshold && SP.getBoolean(R.string.key_nsalarm_staledata, false))||(bgReadingAgoMin > threshold && openAPSEnabledAlerts)){
|
||||
return true;
|
||||
}
|
||||
//snoozing for threshold
|
||||
|
|
|
@ -9,10 +9,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
||||
|
@ -29,9 +25,6 @@ public class SerialIOThread extends Thread {
|
|||
private OutputStream mOutputStream = null;
|
||||
private BluetoothSocket mRfCommSocket;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledDisconnection = null;
|
||||
|
||||
private boolean mKeepRunning = true;
|
||||
private byte[] mReadBuff = new byte[0];
|
||||
|
||||
|
@ -64,7 +57,8 @@ public class SerialIOThread extends Thread {
|
|||
// process all messages we already got
|
||||
while (mReadBuff.length > 3) { // 3rd byte is packet size. continue only if we an determine packet size
|
||||
byte[] extractedBuff = cutMessageFromBuffer();
|
||||
if (extractedBuff == null) break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
if (extractedBuff == null)
|
||||
break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
|
||||
int command = (extractedBuff[5] & 0xFF) | ((extractedBuff[4] << 8) & 0xFF00);
|
||||
|
||||
|
@ -85,7 +79,6 @@ public class SerialIOThread extends Thread {
|
|||
synchronized (message) {
|
||||
message.notify();
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -177,23 +170,6 @@ public class SerialIOThread extends Thread {
|
|||
log.debug("Old firmware detected");
|
||||
}
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
|
||||
public void scheduleDisconnection() {
|
||||
class DisconnectRunnable implements Runnable {
|
||||
public void run() {
|
||||
disconnect("scheduleDisconnection");
|
||||
scheduledDisconnection = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution in 10 sec
|
||||
// cancel waiting task to prevent sending multiple disconnections
|
||||
if (scheduledDisconnection != null)
|
||||
scheduledDisconnection.cancel(false);
|
||||
Runnable task = new DisconnectRunnable();
|
||||
final int sec = 10;
|
||||
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void disconnect(String reason) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
@ -365,6 +366,9 @@ public class DanaRExecutionService extends Service {
|
|||
}
|
||||
|
||||
public boolean bolus(double amount, int carbs, final Treatment t) {
|
||||
if (!isConnected()) return false;
|
||||
if (BolusProgressDialog.stopPressed) return false;
|
||||
|
||||
bolusingTreatment = t;
|
||||
int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
|
||||
MessageBase start;
|
||||
|
@ -374,8 +378,6 @@ public class DanaRExecutionService extends Service {
|
|||
start = new MsgBolusStartWithSpeed(amount, preferencesSpeed);
|
||||
MsgBolusStop stop = new MsgBolusStop(amount, t);
|
||||
|
||||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(System.currentTimeMillis(), carbs));
|
||||
}
|
||||
|
@ -431,22 +433,26 @@ public class DanaRExecutionService extends Service {
|
|||
}
|
||||
|
||||
final Object o = new Object();
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusingInterrupted", new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (danaRPump.lastBolusTime.getTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old
|
||||
t.insulin = danaRPump.lastBolusAmount;
|
||||
log.debug("Used bolus amount from history: " + danaRPump.lastBolusAmount);
|
||||
} else {
|
||||
log.debug("Bolus amount in history too old: " + danaRPump.lastBolusTime.toLocaleString());
|
||||
synchronized(o) {
|
||||
ConfigBuilderPlugin.getCommandQueue().independentConnect("bolusingInterrupted", new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (danaRPump.lastBolusTime.getTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old
|
||||
t.insulin = danaRPump.lastBolusAmount;
|
||||
log.debug("Used bolus amount from history: " + danaRPump.lastBolusAmount);
|
||||
} else {
|
||||
log.debug("Bolus amount in history too old: " + danaRPump.lastBolusTime.toLocaleString());
|
||||
}
|
||||
synchronized (o) {
|
||||
o.notify();
|
||||
}
|
||||
}
|
||||
o.notify();
|
||||
});
|
||||
try {
|
||||
o.wait();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
try {
|
||||
o.wait();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null);
|
||||
|
|
|
@ -9,10 +9,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
@ -30,9 +26,6 @@ public class SerialIOThread extends Thread {
|
|||
private OutputStream mOutputStream = null;
|
||||
private BluetoothSocket mRfCommSocket;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledDisconnection = null;
|
||||
|
||||
private boolean mKeepRunning = true;
|
||||
private byte[] mReadBuff = new byte[0];
|
||||
|
||||
|
@ -65,7 +58,8 @@ public class SerialIOThread extends Thread {
|
|||
// process all messages we already got
|
||||
while (mReadBuff.length > 3) { // 3rd byte is packet size. continue only if we an determine packet size
|
||||
byte[] extractedBuff = cutMessageFromBuffer();
|
||||
if (extractedBuff == null) break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
if (extractedBuff == null)
|
||||
break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
|
||||
int command = (extractedBuff[5] & 0xFF) | ((extractedBuff[4] << 8) & 0xFF00);
|
||||
|
||||
|
@ -86,7 +80,6 @@ public class SerialIOThread extends Thread {
|
|||
synchronized (message) {
|
||||
message.notify();
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -178,23 +171,6 @@ public class SerialIOThread extends Thread {
|
|||
log.debug("Old firmware detected");
|
||||
}
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
|
||||
public void scheduleDisconnection() {
|
||||
class DisconnectRunnable implements Runnable {
|
||||
public void run() {
|
||||
disconnect("scheduleDisconnection");
|
||||
scheduledDisconnection = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution in 5 sec
|
||||
// cancel waiting task to prevent sending multiple disconnections
|
||||
if (scheduledDisconnection != null)
|
||||
scheduledDisconnection.cancel(false);
|
||||
Runnable task = new DisconnectRunnable();
|
||||
final int sec = 5;
|
||||
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void disconnect(String reason) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.comm.MessageBase;
|
||||
|
@ -358,12 +359,13 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
}
|
||||
|
||||
public boolean bolus(double amount, int carbs, final Treatment t) {
|
||||
if (!isConnected()) return false;
|
||||
if (BolusProgressDialog.stopPressed) return false;
|
||||
|
||||
bolusingTreatment = t;
|
||||
MsgBolusStart start = new MsgBolusStart(amount);
|
||||
MsgBolusStop stop = new MsgBolusStop(amount, t);
|
||||
|
||||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(System.currentTimeMillis(), carbs));
|
||||
}
|
||||
|
@ -387,48 +389,9 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
}
|
||||
waitMsec(300);
|
||||
|
||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||
bolusingEvent.t = t;
|
||||
bolusingEvent.percent = 99;
|
||||
|
||||
bolusingTreatment = null;
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null);
|
||||
|
||||
int speed = 12;
|
||||
|
||||
// try to find real amount if bolusing was interrupted or comm failed
|
||||
if (t.insulin != amount) {
|
||||
disconnect("bolusingInterrupted");
|
||||
long bolusDurationInMSec = (long) (amount * speed * 1000);
|
||||
long expectedEnd = bolusStart + bolusDurationInMSec + 3000;
|
||||
|
||||
while (System.currentTimeMillis() < expectedEnd) {
|
||||
long waitTime = expectedEnd - System.currentTimeMillis();
|
||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.waitingforestimatedbolusend), waitTime / 1000);
|
||||
MainApp.bus().post(bolusingEvent);
|
||||
SystemClock.sleep(1000);
|
||||
}
|
||||
|
||||
final Object o = new Object();
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusingInterrupted", new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (danaRPump.lastBolusTime.getTime() > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old
|
||||
t.insulin = danaRPump.lastBolusAmount;
|
||||
log.debug("Used bolus amount from history: " + danaRPump.lastBolusAmount);
|
||||
} else {
|
||||
log.debug("Bolus amount in history too old: " + danaRPump.lastBolusTime.toLocaleString());
|
||||
}
|
||||
o.notify();
|
||||
}
|
||||
});
|
||||
try {
|
||||
o.wait();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
|||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
|
@ -191,6 +192,9 @@ public class DanaRSService extends Service {
|
|||
|
||||
|
||||
public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) {
|
||||
if (!isConnected()) return false;
|
||||
if (BolusProgressDialog.stopPressed) return false;
|
||||
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.startingbolus)));
|
||||
bolusingTreatment = t;
|
||||
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
|
||||
|
@ -198,8 +202,6 @@ public class DanaRSService extends Service {
|
|||
DanaRS_Packet_Bolus_Set_Step_Bolus_Stop stop = new DanaRS_Packet_Bolus_Set_Step_Bolus_Stop(insulin, t); // initialize static variables
|
||||
DanaRS_Packet_Notify_Delivery_Complete complete = new DanaRS_Packet_Notify_Delivery_Complete(insulin, t); // initialize static variables
|
||||
|
||||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
// MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbtime, carbs); ####
|
||||
// bleComm.sendMessage(msg);
|
||||
|
|
|
@ -9,10 +9,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||
|
@ -30,9 +26,6 @@ public class SerialIOThread extends Thread {
|
|||
private OutputStream mOutputStream = null;
|
||||
private BluetoothSocket mRfCommSocket;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
private static ScheduledFuture<?> scheduledDisconnection = null;
|
||||
|
||||
private boolean mKeepRunning = true;
|
||||
private byte[] mReadBuff = new byte[0];
|
||||
|
||||
|
@ -65,7 +58,8 @@ public class SerialIOThread extends Thread {
|
|||
// process all messages we already got
|
||||
while (mReadBuff.length > 3) { // 3rd byte is packet size. continue only if we an determine packet size
|
||||
byte[] extractedBuff = cutMessageFromBuffer();
|
||||
if (extractedBuff == null) break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
if (extractedBuff == null)
|
||||
break; // message is not complete in buffer (wrong packet calls disconnection)
|
||||
|
||||
int command = (extractedBuff[5] & 0xFF) | ((extractedBuff[4] << 8) & 0xFF00);
|
||||
|
||||
|
@ -86,7 +80,6 @@ public class SerialIOThread extends Thread {
|
|||
synchronized (message) {
|
||||
message.notify();
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -178,23 +171,6 @@ public class SerialIOThread extends Thread {
|
|||
log.debug("Old firmware detected");
|
||||
}
|
||||
}
|
||||
scheduleDisconnection();
|
||||
}
|
||||
|
||||
public void scheduleDisconnection() {
|
||||
class DisconnectRunnable implements Runnable {
|
||||
public void run() {
|
||||
disconnect("scheduleDisconnection");
|
||||
scheduledDisconnection = null;
|
||||
}
|
||||
}
|
||||
// prepare task for execution in 10 sec
|
||||
// cancel waiting task to prevent sending multiple disconnections
|
||||
if (scheduledDisconnection != null)
|
||||
scheduledDisconnection.cancel(false);
|
||||
Runnable task = new DisconnectRunnable();
|
||||
final int sec = 10;
|
||||
scheduledDisconnection = worker.schedule(task, sec, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void disconnect(String reason) {
|
||||
|
|
|
@ -34,6 +34,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
|
@ -357,6 +358,9 @@ public class DanaRv2ExecutionService extends Service {
|
|||
}
|
||||
|
||||
public boolean bolus(final double amount, int carbs, long carbtime, final Treatment t) {
|
||||
if (!isConnected()) return false;
|
||||
if (BolusProgressDialog.stopPressed) return false;
|
||||
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.startingbolus)));
|
||||
bolusingTreatment = t;
|
||||
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
|
||||
|
@ -367,8 +371,6 @@ public class DanaRv2ExecutionService extends Service {
|
|||
start = new MsgBolusStartWithSpeed(amount, preferencesSpeed);
|
||||
MsgBolusStop stop = new MsgBolusStop(amount, t);
|
||||
|
||||
if (!isConnected()) return false;
|
||||
|
||||
if (carbs > 0) {
|
||||
MsgSetCarbsEntry msg = new MsgSetCarbsEntry(carbtime, carbs);
|
||||
mSerialIOThread.sendMessage(msg);
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -36,8 +37,11 @@ import info.nightscout.androidaps.db.DatabaseHelper;
|
|||
import info.nightscout.androidaps.db.TemporaryBasal;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Wear.ActionStringHandler;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||
|
@ -119,11 +123,6 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
double timestamp = 0;
|
||||
if (intent != null) {
|
||||
timestamp = intent.getDoubleExtra("timestamp", 0);
|
||||
}
|
||||
|
||||
String action = null;
|
||||
if (intent != null) {
|
||||
action = intent.getAction();
|
||||
|
@ -241,23 +240,21 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
} else if (lastBG.value < lowLine) {
|
||||
sgvLevel = -1;
|
||||
}
|
||||
DataMap dataMap = new DataMap();
|
||||
|
||||
int battery = getBatteryLevel(getApplicationContext());
|
||||
DataMap dataMap = new DataMap();
|
||||
dataMap.putString("sgvString", lastBG.valueToUnitsToString(units));
|
||||
dataMap.putDouble("timestamp", lastBG.date);
|
||||
dataMap.putLong("timestamp", lastBG.date);
|
||||
if (glucoseStatus == null) {
|
||||
dataMap.putString("slopeArrow", "");
|
||||
dataMap.putString("delta", "");
|
||||
dataMap.putString("avgDelta", "");
|
||||
dataMap.putString("delta", "--");
|
||||
dataMap.putString("avgDelta", "--");
|
||||
} else {
|
||||
dataMap.putString("slopeArrow", slopeArrow(glucoseStatus.delta));
|
||||
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.putString("battery", "" + battery);
|
||||
|
||||
dataMap.putLong("sgvLevel", sgvLevel);
|
||||
dataMap.putInt("batteryLevel", (battery >= 30) ? 1 : 0);
|
||||
dataMap.putDouble("sgvDouble", lastBG.value);
|
||||
dataMap.putDouble("high", highLine);
|
||||
dataMap.putDouble("low", lowLine);
|
||||
|
@ -272,10 +269,20 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
deltastring += "-";
|
||||
|
||||
}
|
||||
|
||||
boolean detailed = SP.getBoolean("wear_detailed_delta", false);
|
||||
if (units.equals(Constants.MGDL)) {
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMGDL));
|
||||
if (detailed) {
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMGDL));
|
||||
} else {
|
||||
deltastring += DecimalFormatter.to0Decimal(Math.abs(deltaMGDL));
|
||||
}
|
||||
} else {
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL));
|
||||
if (detailed){
|
||||
deltastring += DecimalFormatter.to2Decimal(Math.abs(deltaMMOL));
|
||||
} else {
|
||||
deltastring += DecimalFormatter.to1Decimal(Math.abs(deltaMMOL));
|
||||
}
|
||||
}
|
||||
return deltastring;
|
||||
}
|
||||
|
@ -470,7 +477,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
if (googleApiClient.isConnected()) {
|
||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(OPEN_SETTINGS_PATH);
|
||||
//unique content
|
||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putString("openSettings", "openSettings");
|
||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||
|
@ -483,7 +490,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
if (googleApiClient.isConnected()) {
|
||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(BOLUS_PROGRESS_PATH);
|
||||
//unique content
|
||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putString("bolusProgress", "bolusProgress");
|
||||
dataMapRequest.getDataMap().putString("progressstatus", status);
|
||||
dataMapRequest.getDataMap().putInt("progresspercent", progresspercent);
|
||||
|
@ -498,7 +505,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
if (googleApiClient.isConnected()) {
|
||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(ACTION_CONFIRMATION_REQUEST_PATH);
|
||||
//unique content
|
||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putString("actionConfirmationRequest", "actionConfirmationRequest");
|
||||
dataMapRequest.getDataMap().putString("title", title);
|
||||
dataMapRequest.getDataMap().putString("message", message);
|
||||
|
@ -514,14 +521,57 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
}
|
||||
|
||||
private void sendStatus() {
|
||||
|
||||
if (googleApiClient.isConnected()) {
|
||||
|
||||
String status = generateStatusString();
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
treatmentsInterface.updateTotalIOBTreatments();
|
||||
IobTotal bolusIob = treatmentsInterface.getLastCalculationTreatments().round();
|
||||
treatmentsInterface.updateTotalIOBTempBasals();
|
||||
IobTotal basalIob = treatmentsInterface.getLastCalculationTempBasals().round();
|
||||
|
||||
String iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||
String iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||
String cobString = generateCOBString();
|
||||
String tempBasal = generateBasalString(treatmentsInterface);
|
||||
|
||||
//bgi
|
||||
String bgiString = "";
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
|
||||
bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi);
|
||||
|
||||
String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString);
|
||||
|
||||
//batteries
|
||||
int phoneBattery = getBatteryLevel(getApplicationContext());
|
||||
String rigBattery = NSDeviceStatus.getInstance().getUploaderStatus().trim();
|
||||
|
||||
|
||||
long openApsStatus = -1;
|
||||
//OpenAPS status
|
||||
if(Config.APS){
|
||||
//we are AndroidAPS
|
||||
openApsStatus = LoopPlugin.lastRun != null && LoopPlugin.lastRun.lastEnact != null && LoopPlugin.lastRun.lastEnact.getTime() != 0 ? LoopPlugin.lastRun.lastEnact.getTime(): -1;
|
||||
} else {
|
||||
//NSClient or remote
|
||||
openApsStatus = NSDeviceStatus.getOpenApsTimestamp();
|
||||
}
|
||||
|
||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_STATUS_PATH);
|
||||
//unique content
|
||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putString("externalStatusString", status);
|
||||
dataMapRequest.getDataMap().putString("iobSum", iobSum);
|
||||
dataMapRequest.getDataMap().putString("iobDetail", iobDetail);
|
||||
dataMapRequest.getDataMap().putBoolean("detailedIob", mPrefs.getBoolean("wear_detailediob", false));
|
||||
dataMapRequest.getDataMap().putString("cob", cobString);
|
||||
dataMapRequest.getDataMap().putString("tempBasal", tempBasal);
|
||||
dataMapRequest.getDataMap().putString("battery", "" + phoneBattery);
|
||||
dataMapRequest.getDataMap().putString("rigBattery", rigBattery);
|
||||
dataMapRequest.getDataMap().putLong("openApsStatus", openApsStatus);
|
||||
dataMapRequest.getDataMap().putString("bgi", bgiString);
|
||||
dataMapRequest.getDataMap().putBoolean("showBgi", mPrefs.getBoolean("wear_showbgi", false));
|
||||
dataMapRequest.getDataMap().putInt("batteryLevel", (phoneBattery >= 30) ? 1 : 0);
|
||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||
} else {
|
||||
|
@ -536,7 +586,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
|
||||
PutDataMapRequest dataMapRequest = PutDataMapRequest.create(NEW_PREFERENCES_PATH);
|
||||
//unique content
|
||||
dataMapRequest.getDataMap().putDouble("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putLong("timestamp", System.currentTimeMillis());
|
||||
dataMapRequest.getDataMap().putBoolean("wearcontrol", wearcontrol);
|
||||
PutDataRequest putDataRequest = dataMapRequest.asPutDataRequest();
|
||||
Wearable.DataApi.putDataItem(googleApiClient, putDataRequest);
|
||||
|
@ -546,10 +596,10 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
}
|
||||
|
||||
@NonNull
|
||||
private String generateStatusString() {
|
||||
private String generateStatusString(Profile profile, String tempBasal, String iobSum, String iobDetail, String bgiString) {
|
||||
|
||||
String status = "";
|
||||
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (profile == null) {
|
||||
status = MainApp.sResources.getString(R.string.noprofile);
|
||||
return status;
|
||||
|
@ -564,38 +614,45 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
lastLoopStatus = true;
|
||||
}
|
||||
|
||||
//Temp basal
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (activeTemp != null) {
|
||||
status += activeTemp.toStringShort();
|
||||
|
||||
String iobString = "";
|
||||
if (mPrefs.getBoolean("wear_detailediob", false)) {
|
||||
iobString = iobSum + " " + iobDetail;
|
||||
} else {
|
||||
iobString = iobSum + "U";
|
||||
}
|
||||
|
||||
//IOB
|
||||
treatmentsInterface.updateTotalIOBTreatments();
|
||||
IobTotal bolusIob = treatmentsInterface.getLastCalculationTreatments().round();
|
||||
treatmentsInterface.updateTotalIOBTempBasals();
|
||||
IobTotal basalIob = treatmentsInterface.getLastCalculationTempBasals().round();
|
||||
status += DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||
status += tempBasal + " " + iobString;
|
||||
|
||||
if (mPrefs.getBoolean("wear_detailediob", true)) {
|
||||
status += "("
|
||||
+ DecimalFormatter.to2Decimal(bolusIob.iob) + "|"
|
||||
+ DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||
//add BGI if shown, otherwise return
|
||||
if (mPrefs.getBoolean("wear_showbgi", false)) {
|
||||
status += " " + bgiString;
|
||||
}
|
||||
if (!mPrefs.getBoolean("wear_showbgi", false)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf();
|
||||
|
||||
status += " " + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to2Decimal(bgi);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String generateBasalString(TreatmentsInterface treatmentsInterface) {
|
||||
|
||||
String basalStringResult = "-.--U/h";
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (activeTemp != null) {
|
||||
basalStringResult = activeTemp.toStringShort();
|
||||
}
|
||||
return basalStringResult;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private String generateCOBString() {
|
||||
|
||||
String cobStringResult = "--";
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||
if (autosensData != null) {
|
||||
cobStringResult = (int) autosensData.cob + "g";
|
||||
}
|
||||
return cobStringResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (googleApiClient != null && googleApiClient.isConnected()) {
|
||||
|
|
|
@ -77,11 +77,7 @@ public class CommandQueue {
|
|||
private QueueThread thread = null;
|
||||
|
||||
private PumpEnactResult executingNowError() {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = false;
|
||||
result.enacted = false;
|
||||
result.comment = MainApp.sResources.getString(R.string.executingrightnow);
|
||||
return result;
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.sResources.getString(R.string.executingrightnow));
|
||||
}
|
||||
|
||||
public boolean isRunning(Command.CommandType type) {
|
||||
|
@ -139,6 +135,13 @@ public class CommandQueue {
|
|||
}
|
||||
}
|
||||
|
||||
public static void independentConnect(String reason, Callback callback) {
|
||||
CommandQueue tempCommandQueue = new CommandQueue();
|
||||
tempCommandQueue.readStatus(reason, callback);
|
||||
QueueThread tempThread = new QueueThread(tempCommandQueue);
|
||||
tempThread.start();
|
||||
}
|
||||
|
||||
// returns true if command is queued
|
||||
public boolean bolus(DetailedBolusInfo detailedBolusInfo, Callback callback) {
|
||||
Command.CommandType type = detailedBolusInfo.isSMB ? Command.CommandType.SMB_BOLUS : Command.CommandType.BOLUS;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.queue;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
|
@ -16,6 +17,7 @@ import info.nightscout.androidaps.interfaces.PumpInterface;
|
|||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by mike on 09.11.2017.
|
||||
|
@ -61,8 +63,27 @@ public class QueueThread extends Thread {
|
|||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(new PumpEnactResult()));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.connectiontimedout)));
|
||||
pump.stopConnecting();
|
||||
queue.clear();
|
||||
return;
|
||||
|
||||
//BLUETOOTH-WATCHDOG
|
||||
boolean watchdog = SP.getBoolean(R.string.key_btwatchdog, false);
|
||||
long last_watchdog = SP.getLong(R.string.key_btwatchdog_lastbark, 0l);
|
||||
watchdog = watchdog && System.currentTimeMillis() - last_watchdog > (Constants.MIN_WATCHDOG_INTERVAL_IN_SECONDS * 1000);
|
||||
if(watchdog) {
|
||||
log.debug("BT watchdog - toggeling the phonest bluetooth");
|
||||
//write time
|
||||
SP.putLong(R.string.key_btwatchdog_lastbark, System.currentTimeMillis());
|
||||
//toggle BT
|
||||
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothAdapter.disable();
|
||||
SystemClock.sleep(1000);
|
||||
mBluetoothAdapter.enable();
|
||||
SystemClock.sleep(1000);
|
||||
//start over again once after watchdog barked
|
||||
connectionStartTime = System.currentTimeMillis();
|
||||
} else {
|
||||
queue.clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pump.isConnected()) {
|
||||
|
@ -76,8 +97,8 @@ public class QueueThread extends Thread {
|
|||
if (queue.performing() == null) {
|
||||
// Pickup 1st command and set performing variable
|
||||
if (queue.size() > 0) {
|
||||
log.debug("State: performing");
|
||||
queue.pickup();
|
||||
log.debug("State: performing " + queue.performing().status());
|
||||
MainApp.bus().post(new EventQueueChanged());
|
||||
queue.performing().execute();
|
||||
queue.resetPerforming();
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
@ -81,7 +82,7 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
|
||||
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
|
||||
|
||||
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
||||
if (Config.APS && SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
|
||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
|
@ -145,4 +146,4 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
|
||||
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public class DateUtil {
|
|||
*/
|
||||
private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ";
|
||||
private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||
private static String FORMAT_DATE_ISO_MSEC_UTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
|
||||
/**
|
||||
* Takes in an ISO date string of the following format:
|
||||
|
@ -42,15 +43,31 @@ public class DateUtil {
|
|||
throws Exception {
|
||||
SimpleDateFormat f = new SimpleDateFormat(FORMAT_DATE_ISO, Locale.getDefault());
|
||||
Date date;
|
||||
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC, Locale.getDefault());
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
date = f.parse(isoDateString);
|
||||
}
|
||||
return date;
|
||||
|
||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC, Locale.getDefault());
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
|
||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC_UTC, Locale.getDefault());
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
|
||||
throw new ParseException("Unparseable date: " + isoDateString, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,6 +89,7 @@ public class DateUtil {
|
|||
public static String toISOString(Date date) {
|
||||
return toISOString(date, FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
public static String toISOString(long date) {
|
||||
return toISOString(new Date(date), FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
@ -125,6 +143,7 @@ public class DateUtil {
|
|||
public static String dateAndTimeString(Date date) {
|
||||
return dateString(date) + " " + timeString(date);
|
||||
}
|
||||
|
||||
public static String dateAndTimeString(long mills) {
|
||||
return dateString(mills) + " " + timeString(mills);
|
||||
}
|
||||
|
@ -146,19 +165,19 @@ public class DateUtil {
|
|||
}
|
||||
|
||||
|
||||
public static String timeFrameString(long timeInMillis){
|
||||
long remainingTimeMinutes = timeInMillis/(1000*60);
|
||||
long remainingTimeHours = remainingTimeMinutes/60;
|
||||
remainingTimeMinutes = remainingTimeMinutes%60;
|
||||
return "(" + ((remainingTimeHours >0)?(remainingTimeHours + "h "):"") + remainingTimeMinutes + "')";
|
||||
public static String timeFrameString(long timeInMillis) {
|
||||
long remainingTimeMinutes = timeInMillis / (1000 * 60);
|
||||
long remainingTimeHours = remainingTimeMinutes / 60;
|
||||
remainingTimeMinutes = remainingTimeMinutes % 60;
|
||||
return "(" + ((remainingTimeHours > 0) ? (remainingTimeHours + "h ") : "") + remainingTimeMinutes + "')";
|
||||
}
|
||||
|
||||
public static String sinceString(long timestamp){
|
||||
return timeFrameString(System.currentTimeMillis()-timestamp);
|
||||
public static String sinceString(long timestamp) {
|
||||
return timeFrameString(System.currentTimeMillis() - timestamp);
|
||||
}
|
||||
|
||||
public static String untilString(long timestamp){
|
||||
return timeFrameString(timestamp- System.currentTimeMillis());
|
||||
public static String untilString(long timestamp) {
|
||||
return timeFrameString(timestamp - System.currentTimeMillis());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,11 @@ public class SP {
|
|||
}
|
||||
|
||||
static public long getLong(int resourceID, Long defaultValue) {
|
||||
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||
try {
|
||||
return sharedPreferences.getLong(MainApp.sResources.getString(resourceID), defaultValue);
|
||||
} catch (Exception e) {
|
||||
return SafeParse.stringToLong(sharedPreferences.getString(MainApp.sResources.getString(resourceID), defaultValue.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
static public long getLong(String key, Long defaultValue) {
|
||||
|
|
|
@ -276,7 +276,7 @@
|
|||
<string name="overview_bolusprogress_stop">Detener</string>
|
||||
<string name="overview_bolusprogress_stoppressed">Parar pulsado</string>
|
||||
<string name="waitingforpumpclicktorefresh">Esperando bomba. Click to refresh.</string>
|
||||
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar% .2fU</string>
|
||||
<string formatted="false" name="overview_bolusprogress_goingtodeliver">Va a entregar %.2fU</string>
|
||||
<string name="objectives_0_objective">Configuración de visualización y monitoreo, y el análisis de los basales y ratios</string>
|
||||
<string name="objectives_0_gate">Comprobar que los datos de BG están disponibles en Nightscout, y que los datos de la bomba de insulina se están subiendo</string>
|
||||
<string name="objectives_1_objective">Empezar con bucle abierto</string>
|
||||
|
|
|
@ -370,7 +370,7 @@
|
|||
<string name="overview">начало</string>
|
||||
<string name="overview_bolus_label">болюс</string>
|
||||
<string name="overview_bolusprogress_delivered">доставлено</string>
|
||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">будет доставлено %.2 fU е инс</string>
|
||||
<string name="overview_bolusprogress_goingtodeliver" formatted="false">будет доставлено %.2fU е инс</string>
|
||||
<string name="overview_bolusprogress_stop">стоп</string>
|
||||
<string name="overview_bolusprogress_stoped">остановлено</string>
|
||||
<string name="overview_bolusprogress_stoppressed">нажат стоп</string>
|
||||
|
|
|
@ -780,10 +780,17 @@
|
|||
<string name="key_missed_bg_readings_threshold" translatable="false">missed_bg_readings_threshold</string>
|
||||
<string name="urgent_alarm">Urgent Alarm</string>
|
||||
<string name="info">INFO</string>
|
||||
<string name="key_btwatchdog" translatable="false">bt_watchdog</string>
|
||||
<string name="key_btwatchdog_lastbark" translatable="false">bt_watchdog_last</string>
|
||||
<string name="bluetooth">Bluetooth</string>
|
||||
<string name="btwatchdog_title">BT Watchdog</string>
|
||||
<string name="btwatchdog_summary">Switches off the phone\'s bluetooth for one second if no connection to the pump is possible. This may help on some phones where the bluetooth stack freezes.</string>
|
||||
<string name="DexcomG5">DexcomG5 App (patched)</string>
|
||||
<string name="dexcomg5_nsupload_title">Upload BG data to NS</string>
|
||||
<string name="key_dexcomg5_nsupload">dexcomg5_nsupload</string>
|
||||
<string name="dexcomg5_upload">G5 upload settings</string>
|
||||
<string name="customapp">Customized APK for download</string>
|
||||
<string name="wear_detailed_delta_title">Show detailed delta</string>
|
||||
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -129,6 +129,16 @@
|
|||
android:summary="@string/do_not_track_profile_switch_summary"
|
||||
android:title="@string/do_not_track_profile_switch" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/bluetooth">
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_btwatchdog"
|
||||
android:title="@string/btwatchdog_title"
|
||||
android:summary="@string/btwatchdog_summary"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -4,24 +4,32 @@
|
|||
android:key="wearplugin"
|
||||
android:title="@string/wear_settings">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wearcontrol"
|
||||
android:summary="@string/wearcontrol_summary"
|
||||
android:title="@string/wearcontrol_title" />
|
||||
<PreferenceScreen
|
||||
android:title="@string/wear_settings">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="wear_detailediob"
|
||||
android:summary="@string/wear_detailedIOB_summary"
|
||||
android:title="@string/wear_detailedIOB_title" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wearcontrol"
|
||||
android:summary="@string/wearcontrol_summary"
|
||||
android:title="@string/wearcontrol_title" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wear_showbgi"
|
||||
android:summary="@string/wear_showbgi_summary"
|
||||
android:title="@string/wear_showbgi_title" />
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="wear_detailediob"
|
||||
android:summary="@string/wear_detailedIOB_summary"
|
||||
android:title="@string/wear_detailedIOB_title" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wear_detailed_delta"
|
||||
android:summary="@string/wear_detailed_delta_summary"
|
||||
android:title="@string/wear_detailed_delta_title" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wear_showbgi"
|
||||
android:summary="@string/wear_showbgi_summary"
|
||||
android:title="@string/wear_showbgi_title" />
|
||||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -19,6 +19,7 @@ public class DateUtilTest {
|
|||
public void fromISODateStringTest() throws Exception {
|
||||
assertEquals( 1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime());
|
||||
assertEquals( 1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime());
|
||||
assertEquals( 1512317365000L, DateUtil.fromISODateString("2017-12-03T16:09:25.000Z").getTime());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.3'
|
||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sun Mar 05 11:39:37 CET 2017
|
||||
#Sun Dec 03 18:20:55 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
|
||||
|
|
|
@ -23,7 +23,7 @@ def generateGitBuild = { ->
|
|||
|
||||
android {
|
||||
compileSdkVersion 23
|
||||
buildToolsVersion "25.0.2"
|
||||
buildToolsVersion "26.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "info.nightscout.androidaps"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".watchfaces.NOChart"
|
||||
android:allowEmbedded="true"
|
||||
|
@ -52,6 +53,7 @@
|
|||
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".watchfaces.Home"
|
||||
android:allowEmbedded="true"
|
||||
|
@ -70,6 +72,45 @@
|
|||
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".watchfaces.Home2"
|
||||
android:allowEmbedded="true"
|
||||
android:label="AAPSv2"
|
||||
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_graph_2" />
|
||||
|
||||
<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.Cockpit"
|
||||
android:allowEmbedded="true"
|
||||
android:label="AAPS(Cockpit)"
|
||||
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_cockpit" />
|
||||
|
||||
<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"
|
||||
|
|
|
@ -7,9 +7,9 @@ public class BgWatchData implements Comparable<BgWatchData>{
|
|||
public double sgv;
|
||||
public double high;
|
||||
public double low;
|
||||
public double timestamp;
|
||||
public long timestamp;
|
||||
|
||||
public BgWatchData(double aSgv, double aHigh, double aLow, double aTimestamp) {
|
||||
public BgWatchData(double aSgv, double aHigh, double aLow, long aTimestamp) {
|
||||
this.sgv = aSgv;
|
||||
this.high = aHigh;
|
||||
this.low = aLow;
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
|||
public boolean layoutSet = false;
|
||||
public BgGraphBuilder bgGraphBuilder;
|
||||
public LineChartView chart;
|
||||
public double datetime;
|
||||
public long datetime;
|
||||
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
||||
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
||||
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
||||
|
@ -281,7 +281,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
|||
wakeLock.acquire(50);
|
||||
sgvLevel = dataMap.getLong("sgvLevel");
|
||||
batteryLevel = dataMap.getInt("batteryLevel");
|
||||
datetime = dataMap.getDouble("timestamp");
|
||||
datetime = dataMap.getLong("timestamp");
|
||||
rawString = dataMap.getString("rawString");
|
||||
sgvString = dataMap.getString("sgvString");
|
||||
batteryString = dataMap.getString("battery");
|
||||
|
@ -604,14 +604,14 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
|
|||
double sgv = entry.getDouble("sgvDouble");
|
||||
double high = entry.getDouble("high");
|
||||
double low = entry.getDouble("low");
|
||||
double timestamp = entry.getDouble("timestamp");
|
||||
long timestamp = entry.getLong("timestamp");
|
||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||
}
|
||||
} else {
|
||||
double sgv = dataMap.getDouble("sgvDouble");
|
||||
double high = dataMap.getDouble("high");
|
||||
double low = dataMap.getDouble("low");
|
||||
double timestamp = dataMap.getDouble("timestamp");
|
||||
long timestamp = dataMap.getLong("timestamp");
|
||||
|
||||
final int size = bgDataList.size();
|
||||
if (size > 0) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.ustwo.clockwise.wearable.WatchFace;
|
|||
import com.ustwo.clockwise.common.WatchFaceTime;
|
||||
import com.ustwo.clockwise.common.WatchShape;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -43,16 +44,19 @@ import lecho.lib.hellocharts.view.LineChartView;
|
|||
|
||||
/**
|
||||
* Created by emmablack on 12/29/14.
|
||||
* Updated by andrew-warrington on 11/15/17.
|
||||
*/
|
||||
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, mDelta, mStatus;
|
||||
public TextView mTime, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mMonth, isAAPSv2, mHighLight, mLowLight;
|
||||
public long datetime;
|
||||
public RelativeLayout mRelativeLayout;
|
||||
public LinearLayout mLinearLayout;
|
||||
public LinearLayout mLinearLayout, mLinearLayout2, mDate;
|
||||
public long sgvLevel = 0;
|
||||
public int batteryLevel = 1;
|
||||
public int ageLevel = 1;
|
||||
public int loopLevel = 1;
|
||||
public int batteryLevel = 1;
|
||||
public int highColor = Color.YELLOW;
|
||||
public int lowColor = Color.RED;
|
||||
public int midColor = Color.WHITE;
|
||||
|
@ -60,31 +64,41 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
public int basalBackgroundColor = Color.BLUE;
|
||||
public int basalCenterColor = Color.BLUE;
|
||||
public boolean lowResMode = false;
|
||||
public int pointSize = 2;
|
||||
public boolean layoutSet = false;
|
||||
public boolean bIsRound = false;
|
||||
public int pointSize = 2;
|
||||
public int missed_readings_alert_id = 818;
|
||||
public BgGraphBuilder bgGraphBuilder;
|
||||
public LineChartView chart;
|
||||
public double datetime;
|
||||
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
||||
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
||||
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
||||
public PowerManager.WakeLock wakeLock;
|
||||
// related endTime manual layout
|
||||
public View layoutView;
|
||||
private final Point displaySize = new Point();
|
||||
private int specW, specH;
|
||||
|
||||
public final Point displaySize = new Point();
|
||||
public int specW, specH;
|
||||
private LocalBroadcastManager localBroadcastManager;
|
||||
private MessageReceiver messageReceiver;
|
||||
|
||||
protected SharedPreferences sharedPrefs;
|
||||
private String batteryString = "--";
|
||||
private String sgvString = "--";
|
||||
private String externalStatusString = "no status";
|
||||
private String avgDelta = "";
|
||||
private String delta = "";
|
||||
|
||||
public boolean detailedIOB = false;
|
||||
public boolean showBGI = false;
|
||||
public long openApsStatus;
|
||||
public String externalStatusString = "no status";
|
||||
public String sSgv = "---";
|
||||
public String sDirection = "--";
|
||||
public String sUploaderBattery = "--";
|
||||
public String sRigBattery = "--";
|
||||
public String sDelta = "--";
|
||||
public String sAvgDelta = "--";
|
||||
public String sBasalRate = "-.--U/h";
|
||||
public String sIOB1 = "IOB";
|
||||
public String sIOB2 = "-.--";
|
||||
public String sCOB1 = "Carb";
|
||||
public String sCOB2 = "--g";
|
||||
public String sBgi = "--";
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -107,6 +121,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
protected void onLayout(WatchShape shape, Rect screenBounds, WindowInsets screenInsets) {
|
||||
super.onLayout(shape, screenBounds, screenInsets);
|
||||
layoutView.onApplyWindowInsets(screenInsets);
|
||||
bIsRound = screenInsets.isRound();
|
||||
}
|
||||
|
||||
public void performViewSetup() {
|
||||
|
@ -121,22 +136,37 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
@Override
|
||||
public void onLayoutInflated(WatchViewStub stub) {
|
||||
mTime = (TextView) stub.findViewById(R.id.watch_time);
|
||||
mDay = (TextView) stub.findViewById(R.id.day);
|
||||
mMonth = (TextView) stub.findViewById(R.id.month);
|
||||
mDate = (LinearLayout) stub.findViewById(R.id.date_time);
|
||||
mLoop = (TextView) stub.findViewById(R.id.loop);
|
||||
mSgv = (TextView) stub.findViewById(R.id.sgv);
|
||||
mDirection = (TextView) stub.findViewById(R.id.direction);
|
||||
mTimestamp = (TextView) stub.findViewById(R.id.timestamp);
|
||||
mIOB1 = (TextView) stub.findViewById(R.id.iob_text);
|
||||
mIOB2 = (TextView) stub.findViewById(R.id.iobView);
|
||||
mCOB1 = (TextView) stub.findViewById(R.id.cob_text);
|
||||
mCOB2 = (TextView) stub.findViewById(R.id.cobView);
|
||||
mBgi = (TextView) stub.findViewById(R.id.bgiView);
|
||||
mStatus = (TextView) stub.findViewById(R.id.externaltstatus);
|
||||
mBasalRate = (TextView) stub.findViewById(R.id.tmpBasal);
|
||||
mUploaderBattery = (TextView) stub.findViewById(R.id.uploader_battery);
|
||||
mRigBattery = (TextView) stub.findViewById(R.id.rig_battery);
|
||||
mDelta = (TextView) stub.findViewById(R.id.delta);
|
||||
mAvgDelta = (TextView) stub.findViewById(R.id.avgdelta);
|
||||
isAAPSv2 = (TextView) stub.findViewById(R.id.AAPSv2);
|
||||
mHighLight = (TextView) stub.findViewById(R.id.highLight);
|
||||
mLowLight = (TextView) stub.findViewById(R.id.lowLight);
|
||||
mRelativeLayout = (RelativeLayout) stub.findViewById(R.id.main_layout);
|
||||
mLinearLayout = (LinearLayout) stub.findViewById(R.id.secondary_layout);
|
||||
mLinearLayout2 = (LinearLayout) stub.findViewById(R.id.tertiary_layout);
|
||||
chart = (LineChartView) stub.findViewById(R.id.chart);
|
||||
layoutSet = true;
|
||||
showAgoRawBattStatus();
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
|
||||
setDataFields();
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
ListenerService.requestData(this);
|
||||
wakeLock.acquire(50);
|
||||
}
|
||||
|
@ -164,9 +194,10 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if(localBroadcastManager != null && messageReceiver != null){
|
||||
localBroadcastManager.unregisterReceiver(messageReceiver);}
|
||||
if (sharedPrefs != null){
|
||||
if (localBroadcastManager != null && messageReceiver != null) {
|
||||
localBroadcastManager.unregisterReceiver(messageReceiver);
|
||||
}
|
||||
if (sharedPrefs != null) {
|
||||
sharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
super.onDestroy();
|
||||
|
@ -181,7 +212,8 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if(layoutSet) {
|
||||
if (layoutSet) {
|
||||
setupCharts();
|
||||
this.mRelativeLayout.draw(canvas);
|
||||
Log.d("onDraw", "draw");
|
||||
}
|
||||
|
@ -191,17 +223,10 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
protected void onTimeChanged(WatchFaceTime oldTime, WatchFaceTime newTime) {
|
||||
if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
|
||||
wakeLock.acquire(50);
|
||||
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
|
||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||
showAgoRawBattStatus();
|
||||
|
||||
if(ageLevel()<=0) {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
} else {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
}
|
||||
|
||||
setDataFields();
|
||||
missedReadingAlert();
|
||||
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
|
@ -212,108 +237,258 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
//data
|
||||
Bundle bundle = intent.getBundleExtra("data");
|
||||
if (layoutSet && bundle != null) {
|
||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||
wakeLock.acquire(50);
|
||||
sgvLevel = dataMap.getLong("sgvLevel");
|
||||
batteryLevel = dataMap.getInt("batteryLevel");
|
||||
datetime = dataMap.getDouble("timestamp");
|
||||
sgvString = dataMap.getString("sgvString");
|
||||
batteryString = dataMap.getString("battery");
|
||||
mSgv.setText(dataMap.getString("sgvString"));
|
||||
|
||||
if(ageLevel()<=0) {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
} else {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
}
|
||||
|
||||
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
|
||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||
|
||||
mDirection.setText(dataMap.getString("slopeArrow"));
|
||||
avgDelta = dataMap.getString("avgDelta");
|
||||
delta = dataMap.getString("delta");
|
||||
|
||||
|
||||
showAgoRawBattStatus();
|
||||
|
||||
|
||||
datetime = dataMap.getLong("timestamp");
|
||||
sSgv = dataMap.getString("sgvString");
|
||||
sDirection = dataMap.getString("slopeArrow");
|
||||
sDelta = dataMap.getString("delta");
|
||||
sAvgDelta = dataMap.getString("avgDelta");
|
||||
if (chart != null) {
|
||||
addToWatchSet(dataMap);
|
||||
setupCharts();
|
||||
}
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
invalidate();
|
||||
setColor();
|
||||
}
|
||||
//status
|
||||
|
||||
bundle = intent.getBundleExtra("status");
|
||||
if (layoutSet && bundle != null) {
|
||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||
wakeLock.acquire(50);
|
||||
sBasalRate = dataMap.getString("tempBasal");
|
||||
sUploaderBattery = dataMap.getString("battery");
|
||||
sRigBattery = dataMap.getString("rigBattery");
|
||||
detailedIOB = dataMap.getBoolean("detailedIob");
|
||||
sIOB1 = dataMap.getString("iobSum") + "U";
|
||||
sIOB2 = dataMap.getString("iobDetail");
|
||||
sCOB1 = "Carb";
|
||||
sCOB2 = dataMap.getString("cob");
|
||||
sBgi = dataMap.getString("bgi");
|
||||
showBGI = dataMap.getBoolean("showBgi");
|
||||
externalStatusString = dataMap.getString("externalStatusString");
|
||||
|
||||
showAgoRawBattStatus();
|
||||
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
invalidate();
|
||||
setColor();
|
||||
batteryLevel = dataMap.getInt("batteryLevel");
|
||||
openApsStatus = dataMap.getLong("openApsStatus");
|
||||
}
|
||||
//basals and temps
|
||||
|
||||
setDataFields();
|
||||
|
||||
bundle = intent.getBundleExtra("basals");
|
||||
if (layoutSet && bundle != null) {
|
||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||
wakeLock.acquire(500);
|
||||
|
||||
loadBasalsAndTemps(dataMap);
|
||||
}
|
||||
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
invalidate();
|
||||
setColor();
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
invalidate();
|
||||
setColor();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDataFields() {
|
||||
|
||||
setDateAndTime();
|
||||
|
||||
if (mSgv != null) {
|
||||
if (sharedPrefs.getBoolean("showBG", true)) {
|
||||
mSgv.setText(sSgv);
|
||||
mSgv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
//leave the textview there but invisible, as a height holder for the empty space above the white line
|
||||
mSgv.setVisibility(View.INVISIBLE);
|
||||
mSgv.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
strikeThroughSgvIfNeeded();
|
||||
|
||||
if (mDirection != null) {
|
||||
if (sharedPrefs.getBoolean("show_direction", true)) {
|
||||
mDirection.setText(sDirection);
|
||||
mDirection.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDirection.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mDelta != null) {
|
||||
if (sharedPrefs.getBoolean("showDelta", true)) {
|
||||
mDelta.setText(sDelta);
|
||||
mDelta.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDelta.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mAvgDelta != null) {
|
||||
if (sharedPrefs.getBoolean("showAvgDelta", true)) {
|
||||
mAvgDelta.setText(sAvgDelta);
|
||||
mAvgDelta.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mAvgDelta.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mCOB1 != null && mCOB2 != null) {
|
||||
mCOB2.setText(sCOB2);
|
||||
if (sharedPrefs.getBoolean("show_cob", true)) {
|
||||
mCOB1.setVisibility(View.VISIBLE);
|
||||
mCOB2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mCOB1.setVisibility(View.GONE);
|
||||
mCOB2.setVisibility(View.GONE);
|
||||
}
|
||||
//deal with cases where there is only the value shown for COB, and not the label
|
||||
} else if (mCOB2 != null) {
|
||||
mCOB2.setText(sCOB2);
|
||||
if (sharedPrefs.getBoolean("show_cob", true)) {
|
||||
mCOB2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mCOB2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mIOB1 != null && mIOB2 != null) {
|
||||
if (sharedPrefs.getBoolean("show_iob", true)) {
|
||||
mIOB1.setVisibility(View.VISIBLE);
|
||||
mIOB2.setVisibility(View.VISIBLE);
|
||||
if (detailedIOB) {
|
||||
mIOB1.setText(sIOB1);
|
||||
mIOB2.setText(sIOB2);
|
||||
} else {
|
||||
mIOB1.setText("IOB");
|
||||
mIOB2.setText(sIOB1);
|
||||
}
|
||||
} else {
|
||||
mIOB1.setVisibility(View.GONE);
|
||||
mIOB2.setVisibility(View.GONE);
|
||||
}
|
||||
//deal with cases where there is only the value shown for IOB, and not the label
|
||||
} else if (mIOB2 != null) {
|
||||
if (sharedPrefs.getBoolean("show_iob", true)) {
|
||||
mIOB2.setVisibility(View.VISIBLE);
|
||||
if (detailedIOB) {
|
||||
mIOB2.setText(sIOB2);
|
||||
} else {
|
||||
mIOB2.setText(sIOB1);
|
||||
}
|
||||
} else {
|
||||
mIOB2.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
if (mTimestamp != null) {
|
||||
if (sharedPrefs.getBoolean("showAgo", true)) {
|
||||
if (isAAPSv2 != null) {
|
||||
mTimestamp.setText(readingAge(true));
|
||||
} else {
|
||||
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||
mTimestamp.setText(readingAge(true));
|
||||
} else {
|
||||
mTimestamp.setText(readingAge(false));
|
||||
}
|
||||
}
|
||||
mTimestamp.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mTimestamp.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mUploaderBattery != null) {
|
||||
if (sharedPrefs.getBoolean("show_uploader_battery", true)) {
|
||||
if (isAAPSv2 != null) {
|
||||
mUploaderBattery.setText(sUploaderBattery + "%");
|
||||
mUploaderBattery.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||
mUploaderBattery.setText("U: " + sUploaderBattery + "%");
|
||||
} else {
|
||||
mUploaderBattery.setText("Uploader: " + sUploaderBattery + "%");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mUploaderBattery.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mRigBattery != null) {
|
||||
if (sharedPrefs.getBoolean("show_rig_battery", false)) {
|
||||
mRigBattery.setText(sRigBattery);
|
||||
mRigBattery.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mRigBattery.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mBasalRate != null) {
|
||||
if (sharedPrefs.getBoolean("show_temp_basal", true)) {
|
||||
mBasalRate.setText(sBasalRate);
|
||||
mBasalRate.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBasalRate.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mBgi != null) {
|
||||
if (showBGI) {
|
||||
mBgi.setText(sBgi);
|
||||
mBgi.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBgi.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mStatus != null) {
|
||||
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||
mStatus.setText(externalStatusString);
|
||||
mStatus.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mStatus.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (mLoop != null) {
|
||||
if (sharedPrefs.getBoolean("showExternalStatus", true)) {
|
||||
mLoop.setVisibility(View.VISIBLE);
|
||||
if (openApsStatus != -1) {
|
||||
int mins = (int) ((System.currentTimeMillis() - openApsStatus) / 1000 / 60);
|
||||
mLoop.setText(mins + "'");
|
||||
if (mins > 14) {
|
||||
loopLevel = 0;
|
||||
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||
} else {
|
||||
loopLevel = 1;
|
||||
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||
}
|
||||
} else {
|
||||
mLoop.setText("-'");
|
||||
}
|
||||
} else {
|
||||
mLoop.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showAgoRawBattStatus() {
|
||||
public void setDateAndTime() {
|
||||
|
||||
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
|
||||
mTime.setText(timeFormat.format(System.currentTimeMillis()));
|
||||
|
||||
boolean showAvgDelta = sharedPrefs.getBoolean("showAvgDelta", true);
|
||||
mDelta.setText(delta);
|
||||
if(showAvgDelta){
|
||||
mDelta.append(" " + avgDelta);
|
||||
}
|
||||
|
||||
|
||||
if( mTimestamp == null || mUploaderBattery == null|| mStatus == null){
|
||||
return;
|
||||
}
|
||||
|
||||
boolean showStatus = sharedPrefs.getBoolean("showExternalStatus", true);
|
||||
|
||||
if(showStatus){
|
||||
//use short forms
|
||||
mTimestamp.setText(readingAge(true));
|
||||
mUploaderBattery.setText("U: " + batteryString + "%");
|
||||
} else {
|
||||
mTimestamp.setText(readingAge(false));
|
||||
mUploaderBattery.setText("Uploader: " + batteryString + "%");
|
||||
}
|
||||
|
||||
|
||||
if (showStatus) {
|
||||
mStatus.setVisibility(View.VISIBLE);
|
||||
mStatus.setText("S: " + externalStatusString);
|
||||
} else {
|
||||
mStatus.setVisibility(View.GONE);
|
||||
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));
|
||||
mDate.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mDate.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,6 +502,18 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
}
|
||||
}
|
||||
|
||||
public void strikeThroughSgvIfNeeded() {
|
||||
if (mSgv !=null) {
|
||||
if (sharedPrefs.getBoolean("showBG", true)) {
|
||||
if (ageLevel() <= 0) {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
} else {
|
||||
mSgv.setPaintFlags(mSgv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onWatchModeChanged(WatchMode watchMode) {
|
||||
|
||||
if(lowResMode ^ isLowRes(watchMode)){ //if there was a change in lowResMode
|
||||
|
@ -339,25 +526,22 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
}
|
||||
|
||||
private boolean isLowRes(WatchMode watchMode) {
|
||||
return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN) || (watchMode == WatchMode.LOW_BIT_BURN_IN);
|
||||
return (watchMode == WatchMode.LOW_BIT) || (watchMode == WatchMode.LOW_BIT_BURN_IN); // || (watchMode == WatchMode.LOW_BIT_BURN_IN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key){
|
||||
setColor();
|
||||
|
||||
if(layoutSet){
|
||||
showAgoRawBattStatus();
|
||||
mRelativeLayout.measure(specW, specH);
|
||||
mRelativeLayout.layout(0, 0, mRelativeLayout.getMeasuredWidth(),
|
||||
mRelativeLayout.getMeasuredHeight());
|
||||
setDataFields();
|
||||
}
|
||||
invalidate();
|
||||
}
|
||||
protected abstract void setColorDark();
|
||||
|
||||
protected abstract void setColorDark();
|
||||
protected abstract void setColorBright();
|
||||
protected abstract void setColorLowRes();
|
||||
|
||||
|
||||
public void missedReadingAlert() {
|
||||
int minutes_since = (int) Math.floor(timeSince()/(1000*60));
|
||||
if(minutes_since >= 16 && ((minutes_since - 16) % 5) == 0) {
|
||||
|
@ -374,14 +558,14 @@ protected abstract void setColorDark();
|
|||
double sgv = entry.getDouble("sgvDouble");
|
||||
double high = entry.getDouble("high");
|
||||
double low = entry.getDouble("low");
|
||||
double timestamp = entry.getDouble("timestamp");
|
||||
long timestamp = entry.getLong("timestamp");
|
||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||
}
|
||||
} else {
|
||||
double sgv = dataMap.getDouble("sgvDouble");
|
||||
double high = dataMap.getDouble("high");
|
||||
double low = dataMap.getDouble("low");
|
||||
double timestamp = dataMap.getDouble("timestamp");
|
||||
long timestamp = dataMap.getLong("timestamp");
|
||||
|
||||
final int size = bgDataList.size();
|
||||
if (size > 0) {
|
||||
|
|
|
@ -30,8 +30,8 @@ public class BgGraphBuilder {
|
|||
private ArrayList<BasalWatchData> basalWatchDataList;
|
||||
public List<TempWatchData> tempWatchDataList;
|
||||
private int timespan;
|
||||
public double end_time;
|
||||
public double start_time;
|
||||
public long end_time;
|
||||
public long start_time;
|
||||
public double fuzzyTimeDenom = (1000 * 60 * 1);
|
||||
public Context context;
|
||||
public double highMark;
|
||||
|
@ -47,7 +47,7 @@ public class BgGraphBuilder {
|
|||
public int basalBackgroundColor;
|
||||
public boolean singleLine = false;
|
||||
|
||||
private double endHour;
|
||||
private long endHour;
|
||||
private List<PointValue> inRangeValues = new ArrayList<PointValue>();
|
||||
private List<PointValue> highValues = new ArrayList<PointValue>();
|
||||
private List<PointValue> lowValues = new ArrayList<PointValue>();
|
||||
|
@ -316,8 +316,8 @@ public class BgGraphBuilder {
|
|||
GregorianCalendar today = new GregorianCalendar(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH));
|
||||
SimpleDateFormat timeFormat = new SimpleDateFormat(is24? "HH" : "h a");
|
||||
timeFormat.setTimeZone(TimeZone.getDefault());
|
||||
double start_hour = today.getTime().getTime();
|
||||
double timeNow = System.currentTimeMillis();
|
||||
long start_hour = today.getTime().getTime();
|
||||
long timeNow = System.currentTimeMillis();
|
||||
for (int l = 0; l <= 24; l++) {
|
||||
if ((start_hour + (60000 * 60 * (l))) < timeNow) {
|
||||
if ((start_hour + (60000 * 60 * (l + 1))) >= timeNow) {
|
||||
|
@ -332,7 +332,7 @@ public class BgGraphBuilder {
|
|||
|
||||
//Add whole hours endTime the axis (as long as they are more than 15 mins away from the current time)
|
||||
for (int l = 0; l <= 24; l++) {
|
||||
double timestamp = endHour - (60000 * 60 * l);
|
||||
long timestamp = endHour - (60000 * 60 * l);
|
||||
if((timestamp - timeNow < 0) && (timestamp > start_time)) {
|
||||
if(Math.abs(timestamp - timeNow) > (1000 * 60 * 8 * timespan)){
|
||||
xAxisValues.add(new AxisValue(fuzz(timestamp), (timeFormat.format(timestamp)).toCharArray()));
|
||||
|
@ -350,7 +350,7 @@ public class BgGraphBuilder {
|
|||
return xAxis;
|
||||
}
|
||||
|
||||
public float fuzz(double value) {
|
||||
return (float) Math.round(value / fuzzyTimeDenom);
|
||||
public float fuzz(long value) {
|
||||
return (float) Math.round(value / fuzzyTimeDenom);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
|
||||
|
||||
private int batteryLevel = 0;
|
||||
private double datetime = 0;
|
||||
private long datetime = 0;
|
||||
private String direction = "";
|
||||
private String delta = "";
|
||||
private String avgDelta = "";
|
||||
|
@ -433,11 +433,11 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
}
|
||||
|
||||
|
||||
private synchronized double getDatetime() {
|
||||
private synchronized long getDatetime() {
|
||||
return datetime;
|
||||
}
|
||||
|
||||
private synchronized void setDatetime(double datetime) {
|
||||
private synchronized void setDatetime(long datetime) {
|
||||
this.datetime = datetime;
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
Log.d("CircleWatchface", "sgv string : " + getSgvString());
|
||||
setDelta(dataMap.getString("delta"));
|
||||
setAvgDelta(dataMap.getString("avgDelta"));
|
||||
setDatetime(dataMap.getDouble("timestamp"));
|
||||
setDatetime(dataMap.getLong("timestamp"));
|
||||
addToWatchSet(dataMap);
|
||||
|
||||
|
||||
|
@ -576,7 +576,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
double sgv = dataMap.getDouble("sgvDouble");
|
||||
double high = dataMap.getDouble("high");
|
||||
double low = dataMap.getDouble("low");
|
||||
double timestamp = dataMap.getDouble("timestamp");
|
||||
long timestamp = dataMap.getLong("timestamp");
|
||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||
} else if (!sharedPrefs.getBoolean("animation", false)) {
|
||||
// don't load history at once if animations are set (less resource consumption)
|
||||
|
@ -586,7 +586,7 @@ public class CircleWatchface extends WatchFace implements SharedPreferences.OnSh
|
|||
double sgv = entry.getDouble("sgvDouble");
|
||||
double high = entry.getDouble("high");
|
||||
double low = entry.getDouble("low");
|
||||
double timestamp = entry.getDouble("timestamp");
|
||||
long timestamp = entry.getLong("timestamp");
|
||||
bgDataList.add(new BgWatchData(sgv, high, low, timestamp));
|
||||
}
|
||||
} else
|
||||
|
|
|
@ -0,0 +1,126 @@
|
|||
package info.nightscout.androidaps.watchfaces;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.wearable.watchface.WatchFaceStyle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
|
||||
|
||||
/**
|
||||
* Created by andrew-warrington on 18/11/2017.
|
||||
*/
|
||||
|
||||
public class Cockpit extends BaseWatchFace {
|
||||
|
||||
private long sgvTapTime = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
layoutView = inflater.inflate(R.layout.activity_cockpit, null);
|
||||
performViewSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
|
||||
|
||||
if (mSgv != null) {
|
||||
|
||||
int extra = (mSgv.getRight() - mSgv.getLeft()) / 2;
|
||||
if (tapType == TAP_TYPE_TAP &&
|
||||
x + extra >= mSgv.getLeft() &&
|
||||
x - extra <= mSgv.getRight() &&
|
||||
y >= mSgv.getTop() &&
|
||||
y <= mSgv.getBottom()) {
|
||||
if (eventTime - sgvTapTime < 800) {
|
||||
Intent intent = new Intent(this, MainMenuActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
sgvTapTime = eventTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WatchFaceStyle getWatchFaceStyle() {
|
||||
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
|
||||
}
|
||||
|
||||
protected void setColorDark() {
|
||||
|
||||
mRelativeLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds);
|
||||
setTextSizes();
|
||||
|
||||
if (mHighLight != null && mLowLight != null) {
|
||||
if (sgvLevel == 1) {
|
||||
mHighLight.setBackgroundResource(R.drawable.airplane_led_yellow_lit);
|
||||
mLowLight.setBackgroundResource(R.drawable.airplane_led_grey_unlit);
|
||||
} else if (sgvLevel == 0) {
|
||||
mHighLight.setBackgroundResource(R.drawable.airplane_led_grey_unlit);
|
||||
mLowLight.setBackgroundResource(R.drawable.airplane_led_grey_unlit);
|
||||
} else if (sgvLevel == -1) {
|
||||
mHighLight.setBackgroundResource(R.drawable.airplane_led_grey_unlit);
|
||||
mLowLight.setBackgroundResource(R.drawable.airplane_led_red_lit);
|
||||
}
|
||||
}
|
||||
|
||||
if (loopLevel == 1) {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||
} else {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||
}
|
||||
|
||||
invalidate();
|
||||
|
||||
}
|
||||
|
||||
protected void setColorLowRes() {
|
||||
mRelativeLayout.setBackgroundResource(R.drawable.airplane_cockpit_outside_clouds_lowres);
|
||||
|
||||
}
|
||||
|
||||
protected void setColorBright() {
|
||||
setColorDark();
|
||||
}
|
||||
|
||||
protected void setTextSizes() {
|
||||
|
||||
if (mIOB2 != null) {
|
||||
if (detailedIOB) {
|
||||
if (bIsRound) {
|
||||
mIOB2.setTextSize(10);
|
||||
} else {
|
||||
mIOB2.setTextSize(9);
|
||||
}
|
||||
} else {
|
||||
if (bIsRound) {
|
||||
mIOB2.setTextSize(13);
|
||||
} else {
|
||||
mIOB2.setTextSize(12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((mUploaderBattery.getVisibility() != View.GONE) && (mRigBattery.getVisibility() != View.GONE)) {
|
||||
if (bIsRound) {
|
||||
mUploaderBattery.setTextSize(12);
|
||||
mRigBattery.setTextSize(12);
|
||||
} else {
|
||||
mUploaderBattery.setTextSize(10);
|
||||
mRigBattery.setTextSize(10);
|
||||
}
|
||||
} else {
|
||||
if (bIsRound) {
|
||||
mUploaderBattery.setTextSize(13);
|
||||
mRigBattery.setTextSize(13);
|
||||
} else {
|
||||
mUploaderBattery.setTextSize(12);
|
||||
mRigBattery.setTextSize(12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
package info.nightscout.androidaps.watchfaces;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.wearable.watchface.WatchFaceStyle;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import com.ustwo.clockwise.common.WatchMode;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
|
||||
|
||||
public class Home2 extends BaseWatchFace {
|
||||
|
||||
private long chartTapTime = 0;
|
||||
private long sgvTapTime = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||
layoutView = inflater.inflate(R.layout.activity_home_2, null);
|
||||
performViewSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTapCommand(int tapType, int x, int y, long eventTime) {
|
||||
|
||||
int extra = mSgv!=null?(mSgv.getRight() - mSgv.getLeft())/2:0;
|
||||
|
||||
if (tapType == TAP_TYPE_TAP&&
|
||||
x >=chart.getLeft() &&
|
||||
x <= chart.getRight()&&
|
||||
y >= chart.getTop() &&
|
||||
y <= chart.getBottom()){
|
||||
if (eventTime - chartTapTime < 800){
|
||||
changeChartTimeframe();
|
||||
}
|
||||
chartTapTime = eventTime;
|
||||
} else if (tapType == TAP_TYPE_TAP&&
|
||||
x + extra >=mSgv.getLeft() &&
|
||||
x - extra <= mSgv.getRight()&&
|
||||
y >= mSgv.getTop() &&
|
||||
y <= mSgv.getBottom()){
|
||||
if (eventTime - sgvTapTime < 800){
|
||||
Intent intent = new Intent(this, MainMenuActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
sgvTapTime = eventTime;
|
||||
}
|
||||
}
|
||||
|
||||
private void changeChartTimeframe() {
|
||||
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
|
||||
timeframe = (timeframe%5) + 1;
|
||||
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WatchFaceStyle getWatchFaceStyle(){
|
||||
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
|
||||
}
|
||||
|
||||
protected void setColorDark() {
|
||||
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_statusView));
|
||||
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
||||
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
||||
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mIOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mIOB2.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mCOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mCOB2.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mDay.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mMonth.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mLoop.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
|
||||
setTextSizes();
|
||||
|
||||
if (sgvLevel == 1) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
|
||||
} else if (sgvLevel == 0) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
} else if (sgvLevel == -1) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
|
||||
}
|
||||
|
||||
if (ageLevel == 1) {
|
||||
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
} else {
|
||||
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_TimestampOld));
|
||||
}
|
||||
|
||||
if (batteryLevel == 1) {
|
||||
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBattery));
|
||||
} else {
|
||||
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
|
||||
}
|
||||
mRigBattery.setTextColor(Color.BLACK);
|
||||
mDelta.setTextColor(Color.BLACK);
|
||||
mAvgDelta.setTextColor(Color.BLACK);
|
||||
mBasalRate.setTextColor(Color.BLACK);
|
||||
mBgi.setTextColor(Color.BLACK);
|
||||
|
||||
if (loopLevel == 1) {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||
} else {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||
}
|
||||
|
||||
if (chart != null) {
|
||||
highColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor);
|
||||
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor);
|
||||
midColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
|
||||
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_gridColor);
|
||||
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
|
||||
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
|
||||
pointSize = 2;
|
||||
setupCharts();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setColorLowRes() {
|
||||
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_statusView));
|
||||
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
||||
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
|
||||
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
|
||||
mLoop.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_Timestamp));
|
||||
mDelta.setTextColor(Color.BLACK);
|
||||
mAvgDelta.setTextColor(Color.BLACK);
|
||||
mRigBattery.setTextColor(Color.BLACK);
|
||||
mUploaderBattery.setTextColor(Color.BLACK);
|
||||
mBasalRate.setTextColor(Color.BLACK);
|
||||
mBgi.setTextColor(Color.BLACK);
|
||||
mIOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mIOB2.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mCOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mCOB2.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mDay.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mMonth.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
|
||||
if (chart != null) {
|
||||
highColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
|
||||
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
|
||||
midColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
|
||||
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_gridColor);
|
||||
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark_lowres);
|
||||
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light_lowres);
|
||||
pointSize = 2;
|
||||
setupCharts();
|
||||
}
|
||||
setTextSizes();
|
||||
}
|
||||
|
||||
protected void setColorBright() {
|
||||
|
||||
if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
|
||||
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_stripe_background));
|
||||
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
|
||||
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
|
||||
mTime.setTextColor(Color.BLACK);
|
||||
mIOB1.setTextColor(Color.BLACK);
|
||||
mIOB2.setTextColor(Color.BLACK);
|
||||
mCOB1.setTextColor(Color.BLACK);
|
||||
mCOB2.setTextColor(Color.BLACK);
|
||||
mDay.setTextColor(Color.BLACK);
|
||||
mMonth.setTextColor(Color.BLACK);
|
||||
mLoop.setTextColor(Color.BLACK);
|
||||
|
||||
setTextSizes();
|
||||
|
||||
if (sgvLevel == 1) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
|
||||
} else if (sgvLevel == 0) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_midColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_midColor));
|
||||
} else if (sgvLevel == -1) {
|
||||
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor));
|
||||
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor));
|
||||
}
|
||||
|
||||
if (ageLevel == 1) {
|
||||
mTimestamp.setTextColor(Color.BLACK);
|
||||
} else {
|
||||
mTimestamp.setTextColor(Color.RED);
|
||||
}
|
||||
|
||||
if (batteryLevel == 1) {
|
||||
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
} else {
|
||||
mUploaderBattery.setTextColor(Color.RED);
|
||||
}
|
||||
mRigBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mAvgDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mBasalRate.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
mBgi.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
|
||||
|
||||
if (loopLevel == 1) {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_green_25);
|
||||
} else {
|
||||
mLoop.setBackgroundResource(R.drawable.loop_red_25);
|
||||
}
|
||||
|
||||
if (chart != null) {
|
||||
highColor = ContextCompat.getColor(getApplicationContext(), R.color.light_highColor);
|
||||
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor);
|
||||
midColor = ContextCompat.getColor(getApplicationContext(), R.color.light_midColor);
|
||||
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.light_gridColor);
|
||||
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
|
||||
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
|
||||
pointSize = 2;
|
||||
setupCharts();
|
||||
}
|
||||
} else {
|
||||
setColorDark();
|
||||
}
|
||||
}
|
||||
|
||||
protected void setTextSizes() {
|
||||
|
||||
if (mIOB1 != null && mIOB2 != null) {
|
||||
|
||||
if (detailedIOB) {
|
||||
mIOB1.setTextSize(14);
|
||||
mIOB2.setTextSize(10);
|
||||
} else {
|
||||
mIOB1.setTextSize(10);
|
||||
mIOB2.setTextSize(14);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,7 +59,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
|
|||
public int ageLevel = 1;
|
||||
public boolean lowResMode = false;
|
||||
public boolean layoutSet = false;
|
||||
public double datetime;
|
||||
public long datetime;
|
||||
public ArrayList<BgWatchData> bgDataList = new ArrayList<>();
|
||||
public ArrayList<TempWatchData> tempWatchDataList = new ArrayList<>();
|
||||
public ArrayList<BasalWatchData> basalWatchDataList = new ArrayList<>();
|
||||
|
@ -252,7 +252,7 @@ public class NOChart extends WatchFace implements SharedPreferences.OnSharedPref
|
|||
wakeLock.acquire(50);
|
||||
sgvLevel = dataMap.getLong("sgvLevel");
|
||||
batteryLevel = dataMap.getInt("batteryLevel");
|
||||
datetime = dataMap.getDouble("timestamp");
|
||||
datetime = dataMap.getLong("timestamp");
|
||||
sgvString = dataMap.getString("sgvString");
|
||||
mSgv.setText(dataMap.getString("sgvString"));
|
||||
|
||||
|
|
BIN
wear/src/main/res/drawable/airplane_cockpit.png
Normal file
After Width: | Height: | Size: 651 KiB |
BIN
wear/src/main/res/drawable/airplane_cockpit_outside_clouds.png
Normal file
After Width: | Height: | Size: 651 KiB |
After Width: | Height: | Size: 651 KiB |
BIN
wear/src/main/res/drawable/airplane_led_grey_unlit.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
wear/src/main/res/drawable/airplane_led_red_lit.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
wear/src/main/res/drawable/airplane_led_yellow_lit.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
wear/src/main/res/drawable/loop_green_25.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
wear/src/main/res/drawable/loop_grey_25.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
wear/src/main/res/drawable/loop_red_25.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
wear/src/main/res/drawable/watchface_cockpit.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
wear/src/main/res/drawable/watchface_graph_2.png
Normal file
After Width: | Height: | Size: 475 KiB |
12
wear/src/main/res/layout/activity_cockpit.xml
Normal 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_cockpit"
|
||||
app:roundLayout="@layout/round_cockpit"
|
||||
tools:context=".watchfaces.Cockpit"
|
||||
tools:deviceIds="wear"/>
|
12
wear/src/main/res/layout/activity_home_2.xml
Normal 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_activity_home_2"
|
||||
app:roundLayout="@layout/round_activity_home_2"
|
||||
tools:context=".watchfaces.Home"
|
||||
tools:deviceIds="wear"/>
|
369
wear/src/main/res/layout/rect_activity_home_2.xml
Normal file
|
@ -0,0 +1,369 @@
|
|||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent" tools:context=".watchfaces.Home2" tools:deviceIds="wear_square"
|
||||
android:background="@color/black"
|
||||
android:id="@+id/main_layout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0.27"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:background="@drawable/loop_grey_25"
|
||||
android:gravity="center"
|
||||
android:text="--'"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sgv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="-2dp"
|
||||
android:gravity="bottom|right"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="-2dp"
|
||||
android:text="---"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="38sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:text="--"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:gravity="center"
|
||||
android:text="--'"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/secondary_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.10"
|
||||
android:background="@color/light_grey"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="1dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="2dp"
|
||||
android:paddingStart="2dp"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="+/-"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/avgdelta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="avg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader_battery"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rig_battery"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmpBasal"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1.7"
|
||||
android:gravity="center"
|
||||
android:text="-.--U/h"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgiView"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="bgi"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AAPSv2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text=""
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tertiary_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.22"
|
||||
android:background="@color/black"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="1dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cob_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="Carb"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="--g"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/watch_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="12:00"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="26sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/date_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="day"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/month"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="mth"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iob_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="IOB"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="--U"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<lecho.lib.hellocharts.view.LineChartView
|
||||
android:id="@+id/chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.41"
|
||||
android:gravity="center_horizontal|top" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
491
wear/src/main/res/layout/rect_cockpit.xml
Normal file
|
@ -0,0 +1,491 @@
|
|||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent" tools:context=".watchfaces.Cockpit" tools:deviceIds="wear_square"
|
||||
android:id="@+id/main_layout"
|
||||
android:background="@drawable/airplane_cockpit_outside_clouds">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/inside"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/airplane_cockpit"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.095">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/windows"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.2575">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.47" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/warnings"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.06"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highLight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/airplane_led_grey_unlit"
|
||||
android:gravity="center"
|
||||
android:text="H"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="8sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lowLight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/airplane_led_grey_unlit"
|
||||
android:gravity="center"
|
||||
android:text="L"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="8sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.47" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dashboard"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.0775">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/instruments"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.57"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.08"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel1"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.275"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.07" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sgv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:text="---"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="26sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.03" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.276"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.35" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.65"
|
||||
android:text="--'"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.0225"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel2"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.245"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1.01">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.020" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/watch_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.19"
|
||||
android:gravity="center"
|
||||
android:text="12:00"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmpBasal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.19"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="-.--U/h"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.18"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--U"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.185"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--g"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.185"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rig_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:paddingLeft="4dp"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.06" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.0225"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel3"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.275"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.07" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="0.5">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.333"
|
||||
android:gravity="center"
|
||||
android:text="--"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.167"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="+/-"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/avgdelta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="avg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.03" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.250"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loop"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/loop_grey_25"
|
||||
android:text="--'"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AAPSv2"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.4"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.08"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
384
wear/src/main/res/layout/round_activity_home_2.xml
Normal file
|
@ -0,0 +1,384 @@
|
|||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent" tools:context=".watchfaces.Home2" tools:deviceIds="wear_round"
|
||||
android:background="@color/black"
|
||||
android:id="@+id/main_layout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center"
|
||||
android:weightSum="1.1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.05">
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="0.27"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loop"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center"
|
||||
android:background="@drawable/loop_grey_25"
|
||||
android:gravity="center"
|
||||
android:text="--'"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sgv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:layout_marginBottom="-2dp"
|
||||
android:gravity="bottom|right"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingTop="-2dp"
|
||||
android:text="---"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="38sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="4dp"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:text="--"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:gravity="center"
|
||||
android:text="--'"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/secondary_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.10"
|
||||
android:background="@color/light_grey"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="1dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="5dp"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="+/-"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/avgdelta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="avg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader_battery"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rig_battery"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmpBasal"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1.7"
|
||||
android:gravity="center"
|
||||
android:text="-.--U/h"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgiView"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="bgi"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#000000"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AAPSv2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0"
|
||||
android:text=""
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tertiary_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.22"
|
||||
android:background="@color/black"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="1dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="7">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cob_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="Carb"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="--g"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/watch_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="12:00"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="30sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/date_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="day"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/month"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="mth"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:textAlignment="center">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iob_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="IOB"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="10sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:text="--U"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal"></LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<lecho.lib.hellocharts.view.LineChartView
|
||||
android:id="@+id/chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.41"
|
||||
android:gravity="center_horizontal|top" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.05">
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
491
wear/src/main/res/layout/round_cockpit.xml
Normal file
|
@ -0,0 +1,491 @@
|
|||
<?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:layout_width="match_parent"
|
||||
android:layout_height="match_parent" tools:context=".watchfaces.Cockpit" tools:deviceIds="wear_round"
|
||||
android:id="@+id/main_layout"
|
||||
android:background="@drawable/airplane_cockpit_outside_clouds">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/inside"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/airplane_cockpit"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.095">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/windows"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.2575">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.47" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/warnings"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.06"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/highLight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/airplane_led_grey_unlit"
|
||||
android:gravity="center"
|
||||
android:text="H"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="8sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/lowLight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/airplane_led_grey_unlit"
|
||||
android:gravity="center"
|
||||
android:text="L"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="8sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_weight="0.47" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dashboard"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0px"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.0775">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/instruments"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.57"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.08"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel1"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.275"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.07" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.5"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sgv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:text="---"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="34sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.03" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.276"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.35" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.65"
|
||||
android:text="--'"
|
||||
android:gravity="center"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.0225"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel2"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.245"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1.01">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.020" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/watch_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.19"
|
||||
android:gravity="center"
|
||||
android:text="12:00"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tmpBasal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.19"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="-.--U/h"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/iobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.18"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--U"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cobView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_weight="0.185"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--g"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.185"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploader_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rig_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:gravity="bottom|center_horizontal"
|
||||
android:paddingLeft="4dp"
|
||||
android:text="--%"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.06" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.0225"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/panel3"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.275"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:textAlignment="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.07" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="0.5">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="0.333"
|
||||
android:gravity="center"
|
||||
android:text="--"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.167"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:weightSum="2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/delta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="+/-"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/avgdelta"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="avg"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="13sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.03" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_weight="0.250"
|
||||
android:orientation="horizontal"
|
||||
android:weightSum="1">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loop"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/loop_grey_25"
|
||||
android:gravity="center"
|
||||
android:text="--'"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/AAPSv2"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.4"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.08"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
|
@ -20,8 +20,6 @@
|
|||
<item>5</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
<string-array name="input_design">
|
||||
<item>Default</item>
|
||||
<item>Quick righty</item>
|
||||
|
@ -38,6 +36,7 @@
|
|||
|
||||
|
||||
<string name="label_xdrip">AAPS</string>
|
||||
<string name="label_xdrip2">AAPSv2</string>
|
||||
<string name="label_xdrip_large">AAPS(Large)</string>
|
||||
<string name="label_xdrip_big_chart">AAPS(BigChart)</string>
|
||||
<string name="label_xdrip_no_chart">AAPS(NoChart)</string>
|
||||
|
|
|
@ -18,26 +18,34 @@
|
|||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/input_design"
|
||||
android:entryValues="@array/input_design_values"
|
||||
android:key="input_design"
|
||||
android:summary="Input Design"
|
||||
android:title="Input Design" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showExternalStatus"
|
||||
android:title="Show Loop Status"
|
||||
android:defaultValue="false"
|
||||
android:key="show_date"
|
||||
android:title="Show Date"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="highlight_basals"
|
||||
android:summary="Better visible basal rate and temp basals"
|
||||
android:title="Highlight Basals"
|
||||
android:defaultValue="true"
|
||||
android:key="show_iob"
|
||||
android:title="Show IOB"
|
||||
android:summary="Show insulin on board."
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="show_cob"
|
||||
android:title="Show COB"
|
||||
android:summary="Show carb on board."
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showDelta"
|
||||
android:summary="Show delta. (Circle WF)"
|
||||
android:title="Show Delta"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
|
||||
|
@ -51,19 +59,47 @@
|
|||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="dark"
|
||||
android:summary="Dark theme"
|
||||
android:title="Dark"
|
||||
android:key="show_uploader_battery"
|
||||
android:title="Show Phone Battery"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="show_rig_battery"
|
||||
android:title="Show Rig Battery"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="show_temp_basal"
|
||||
android:title="Show Basal Rate"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showExternalStatus"
|
||||
android:title="Show Loop Status"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showBG"
|
||||
android:summary="Show BG. (Circle WF)"
|
||||
android:title="Show BG"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="3"
|
||||
android:entries="@array/chart_timeframe"
|
||||
android:entryValues="@array/chart_timeframe_values"
|
||||
android:key="chart_timeframe"
|
||||
android:summary="Chart Timeframe"
|
||||
android:title="Chart Timeframe" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="show_direction"
|
||||
android:summary="Show direction arrow"
|
||||
android:title="Show Direction Arrow"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
|
@ -75,20 +111,36 @@
|
|||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showDelta"
|
||||
android:summary="Show delta. (Circle WF)"
|
||||
android:title="Show Delta"
|
||||
android:key="dark"
|
||||
android:summary="Dark theme"
|
||||
android:title="Dark"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="showBG"
|
||||
android:summary="Show BG. (Circle WF)"
|
||||
android:title="Show BG"
|
||||
android:defaultValue="false"
|
||||
android:key="highlight_basals"
|
||||
android:summary="Better visible basal rate and temp basals"
|
||||
android:title="Highlight Basals"
|
||||
app:wear_iconOff="@drawable/settings_off"
|
||||
app:wear_iconOn="@drawable/settings_on"/>
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="3"
|
||||
android:entries="@array/chart_timeframe"
|
||||
android:entryValues="@array/chart_timeframe_values"
|
||||
android:key="chart_timeframe"
|
||||
android:summary="Chart Timeframe"
|
||||
android:title="Chart Timeframe" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="1"
|
||||
android:entries="@array/input_design"
|
||||
android:entryValues="@array/input_design_values"
|
||||
android:key="input_design"
|
||||
android:summary="Input Design"
|
||||
android:title="Input Design" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="showBigNumbers"
|
||||
|
|