show direction next to BG
This commit is contained in:
parent
13f2fce31e
commit
fdb252b62d
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -149,7 +149,7 @@ public class DataService extends IntentService {
|
|||
BgReading bgReading = new BgReading();
|
||||
|
||||
bgReading.value = bundle.getDouble(Intents.EXTRA_BG_ESTIMATE);
|
||||
bgReading.slope = bundle.getDouble(Intents.EXTRA_BG_SLOPE);
|
||||
bgReading.direction = bundle.getString(Intents.EXTRA_BG_SLOPE_NAME);
|
||||
bgReading.battery_level = bundle.getInt(Intents.EXTRA_SENSOR_BATTERY);
|
||||
bgReading.timeIndex = bundle.getLong(Intents.EXTRA_TIMESTAMP);
|
||||
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class BgReading implements DataPointInterface {
|
|||
public double value;
|
||||
|
||||
@DatabaseField
|
||||
public double slope;
|
||||
public String direction;
|
||||
|
||||
@DatabaseField
|
||||
public double raw;
|
||||
|
@ -48,6 +48,7 @@ public class BgReading implements DataPointInterface {
|
|||
timeIndex = sgv.getMills();
|
||||
value = sgv.getMgdl();
|
||||
raw = sgv.getFiltered();
|
||||
direction = sgv.getDirection();
|
||||
}
|
||||
|
||||
public Double valueToUnits(String units) {
|
||||
|
@ -62,13 +63,48 @@ public class BgReading implements DataPointInterface {
|
|||
else return DecimalFormatter.to1Decimal(value * Constants.MGDL_TO_MMOLL);
|
||||
}
|
||||
|
||||
public String directionToSymbol() {
|
||||
String symbol = "";
|
||||
if (direction.compareTo("DoubleDown") == 0) {
|
||||
symbol = "\u21ca";
|
||||
} else if (direction.compareTo("SingleDown") == 0) {
|
||||
symbol = "\u2193";
|
||||
} else if (direction.compareTo("FortyFiveDown") == 0) {
|
||||
symbol = "\u2198";
|
||||
} else if (direction.compareTo("Flat") == 0) {
|
||||
symbol = "\u2192";
|
||||
} else if (direction.compareTo("FortyFiveUp") == 0) {
|
||||
symbol = "\u2197";
|
||||
} else if (direction.compareTo("SingleUp") == 0) {
|
||||
symbol = "\u2191";
|
||||
} else if (direction.compareTo("DoubleUp") == 0) {
|
||||
symbol = "\u21c8";
|
||||
} else if (isSlopeNameInvalid(direction)) {
|
||||
symbol = "??";
|
||||
}
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public static boolean isSlopeNameInvalid(String direction) {
|
||||
if (direction.compareTo("NOT_COMPUTABLE") == 0 ||
|
||||
direction.compareTo("NOT COMPUTABLE") == 0 ||
|
||||
direction.compareTo("OUT_OF_RANGE") == 0 ||
|
||||
direction.compareTo("OUT OF RANGE") == 0 ||
|
||||
direction.compareTo("NONE") == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BgReading{" +
|
||||
"timeIndex=" + timeIndex +
|
||||
", date=" + new Date(timeIndex) +
|
||||
", value=" + value +
|
||||
", slope=" + slope +
|
||||
", direction=" + direction +
|
||||
", raw=" + raw +
|
||||
", battery_level=" + battery_level +
|
||||
'}';
|
||||
|
|
|
@ -40,7 +40,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
public static final String DATABASE_TREATMENTS = "Treatments";
|
||||
public static final String DATABASE_DANARHISTORY = "DanaRHistory";
|
||||
|
||||
private static final int DATABASE_VERSION = 4;
|
||||
private static final int DATABASE_VERSION = 5;
|
||||
|
||||
public DatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
|
|
|
@ -96,6 +96,7 @@ public class OverviewFragment extends Fragment {
|
|||
}
|
||||
|
||||
TextView bgView;
|
||||
TextView arrowView;
|
||||
TextView timeAgoView;
|
||||
TextView deltaView;
|
||||
TextView runningTempView;
|
||||
|
@ -139,6 +140,7 @@ public class OverviewFragment extends Fragment {
|
|||
|
||||
View view = inflater.inflate(R.layout.overview_fragment, container, false);
|
||||
bgView = (TextView) view.findViewById(R.id.overview_bg);
|
||||
arrowView = (TextView) view.findViewById(R.id.overview_arrow);
|
||||
timeAgoView = (TextView) view.findViewById(R.id.overview_timeago);
|
||||
deltaView = (TextView) view.findViewById(R.id.overview_delta);
|
||||
runningTempView = (TextView) view.findViewById(R.id.overview_runningtemp);
|
||||
|
@ -566,6 +568,7 @@ public class OverviewFragment extends Fragment {
|
|||
// **** BG value ****
|
||||
if (lastBG != null && bgView != null) {
|
||||
bgView.setText(lastBG.valueToUnitsToString(profile.getUnits()));
|
||||
arrowView.setText(lastBG.directionToSymbol());
|
||||
DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData();
|
||||
if (glucoseStatus != null)
|
||||
deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units);
|
||||
|
|
|
@ -35,12 +35,24 @@
|
|||
android:textSize="80dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_arrow"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top|left"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="-5dp"
|
||||
android:paddingRight="-5dp"
|
||||
android:text="→"
|
||||
android:textSize="80dp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_vertical"
|
||||
android:gravity="top"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
@ -78,40 +90,48 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_runningtemp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/overview_basebasal"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<TextView
|
||||
android:id="@+id/overview_activeprofile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:textColor="@color/colorProfileSwitchButton"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:layout_weight="0.5"
|
||||
android:background="@drawable/pillborder"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_runningtemp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textStyle="normal|bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_basebasal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
@ -119,7 +139,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<com.jjoe64.graphview.GraphView
|
||||
|
@ -216,9 +235,9 @@
|
|||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_weight="0.5"
|
||||
android:drawableLeft="@drawable/bread"
|
||||
android:text="Quick wizard"
|
||||
android:textColor="@color/colorCancelTempButton"
|
||||
android:drawableLeft="@drawable/bread" />
|
||||
android:textColor="@color/colorCancelTempButton" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Loading…
Reference in a new issue