Update Overview Layout for Arrow icons
Add a directionToIcon function in BGReading Move arrow icons to core
This commit is contained in:
parent
6d63bdca07
commit
adc71aae08
|
@ -179,7 +179,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
if (smallWidth) overview_arrow?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 35f)
|
|
||||||
overview_pumpstatus?.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder))
|
overview_pumpstatus?.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder))
|
||||||
|
|
||||||
overview_notifications?.setHasFixedSize(false)
|
overview_notifications?.setHasFixedSize(false)
|
||||||
|
@ -567,8 +566,8 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
|
|
||||||
overview_bg?.text = lastBG.valueToUnitsToString(units)
|
overview_bg?.text = lastBG.valueToUnitsToString(units)
|
||||||
overview_bg?.setTextColor(color)
|
overview_bg?.setTextColor(color)
|
||||||
overview_arrow?.text = lastBG.directionToSymbol(databaseHelper)
|
overview_arrow?.setImageResource(lastBG.directionToIcon(databaseHelper))
|
||||||
overview_arrow?.setTextColor(color)
|
overview_arrow?.setColorFilter(color)
|
||||||
|
|
||||||
val glucoseStatus = GlucoseStatus(injector).glucoseStatusData
|
val glucoseStatus = GlucoseStatus(injector).glucoseStatusData
|
||||||
if (glucoseStatus != null) {
|
if (glucoseStatus != null) {
|
||||||
|
|
|
@ -17,21 +17,18 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
<ImageView
|
||||||
android:id="@+id/overview_arrow"
|
android:id="@+id/overview_arrow"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_gravity="center_vertical"
|
||||||
android:paddingStart="-2dp"
|
|
||||||
android:paddingEnd="0dp"
|
|
||||||
android:text="→"
|
|
||||||
android:textSize="42sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/overview_deltas_llayout"
|
app:layout_constraintEnd_toStartOf="@+id/overview_deltas_llayout"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toEndOf="@+id/overview_bg"
|
app:layout_constraintStart_toEndOf="@+id/overview_bg"
|
||||||
app:layout_constraintTop_toTopOf="@+id/overview_bg" />
|
app:layout_constraintTop_toTopOf="@+id/overview_bg"
|
||||||
|
android:paddingTop="18dp"
|
||||||
|
android:src="@drawable/ic_flat" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/overview_deltas_llayout"
|
android:id="@+id/overview_deltas_llayout"
|
||||||
|
|
|
@ -113,6 +113,32 @@ public class BgReading implements DataPointWithLabelInterface {
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int directionToIcon(DatabaseHelperInterface databaseHelper) {
|
||||||
|
int symbol = 0;
|
||||||
|
if (direction == null)
|
||||||
|
direction = calculateDirection(databaseHelper);
|
||||||
|
|
||||||
|
if (direction.compareTo("DoubleDown") == 0) {
|
||||||
|
symbol = R.drawable.ic_doubledown;
|
||||||
|
} else if (direction.compareTo("SingleDown") == 0) {
|
||||||
|
symbol = R.drawable.ic_singledown;
|
||||||
|
} else if (direction.compareTo("FortyFiveDown") == 0) {
|
||||||
|
symbol = R.drawable.ic_fortyfivedown;;
|
||||||
|
} else if (direction.compareTo("Flat") == 0) {
|
||||||
|
symbol = R.drawable.ic_flat;;
|
||||||
|
} else if (direction.compareTo("FortyFiveUp") == 0) {
|
||||||
|
symbol = R.drawable.ic_fortyfiveup;
|
||||||
|
} else if (direction.compareTo("SingleUp") == 0) {
|
||||||
|
symbol = R.drawable.ic_singleup;
|
||||||
|
} else if (direction.compareTo("DoubleUp") == 0) {
|
||||||
|
symbol = R.drawable.ic_doubleup;
|
||||||
|
} else if (isSlopeNameInvalid(direction)) {
|
||||||
|
symbol = R.drawable.ic_invalid;
|
||||||
|
}
|
||||||
|
return symbol;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isSlopeNameInvalid(String direction) {
|
private static boolean isSlopeNameInvalid(String direction) {
|
||||||
return direction.compareTo("NOT_COMPUTABLE") == 0 ||
|
return direction.compareTo("NOT_COMPUTABLE") == 0 ||
|
||||||
direction.compareTo("NOT COMPUTABLE") == 0 ||
|
direction.compareTo("NOT COMPUTABLE") == 0 ||
|
||||||
|
|
Loading…
Reference in a new issue