Merge pull request #112 from Philoul/Overview_Info_Layout

Move Ago below Arrow
This commit is contained in:
Milos Kozak 2020-12-11 21:15:58 +01:00 committed by GitHub
commit 24034b46b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 66 deletions

View file

@ -582,10 +582,12 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
overview_delta_large?.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) overview_delta_large?.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)
overview_delta_large?.setTextColor(color) overview_delta_large?.setTextColor(color)
overview_delta?.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) overview_delta?.text = Profile.toSignedUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units)
overview_avgdelta?.text = "${Profile.toSignedUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units)}\n${Profile.toSignedUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units)}" overview_avgdelta?.text = "${Profile.toSignedUnitsString(glucoseStatus.short_avgdelta, glucoseStatus.short_avgdelta * Constants.MGDL_TO_MMOLL, units)}"
overview_long_avgdelta?.text = "${Profile.toSignedUnitsString(glucoseStatus.long_avgdelta, glucoseStatus.long_avgdelta * Constants.MGDL_TO_MMOLL, units)}"
} else { } else {
overview_delta?.text = "Δ " + resourceHelper.gs(R.string.notavailable) overview_delta?.text = "Δ " + resourceHelper.gs(R.string.notavailable)
overview_avgdelta?.text = "" overview_avgdelta?.text = ""
overview_long_avgdelta?.text = ""
} }
// strike through if BG is old // strike through if BG is old
@ -610,16 +612,19 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
loopPlugin.isEnabled() && loopPlugin.isSuperBolus -> { loopPlugin.isEnabled() && loopPlugin.isSuperBolus -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_superbolus) overview_apsmode?.setImageResource(R.drawable.ic_loop_superbolus)
overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper) overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper)
overview_apsmode_text?.visibility = View.VISIBLE
} }
loopPlugin.isDisconnected -> { loopPlugin.isDisconnected -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_disconnected) overview_apsmode?.setImageResource(R.drawable.ic_loop_disconnected)
overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper) overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper)
overview_apsmode_text?.visibility = View.VISIBLE
} }
loopPlugin.isEnabled() && loopPlugin.isSuspended -> { loopPlugin.isEnabled() && loopPlugin.isSuspended -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_paused) overview_apsmode?.setImageResource(R.drawable.ic_loop_paused)
overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper) overview_apsmode_text?.text = DateUtil.age(loopPlugin.minutesToEndOfSuspend() * 60000L, true, resourceHelper)
overview_apsmode_text?.visibility = View.VISIBLE
} }
pump.isSuspended -> { pump.isSuspended -> {
@ -630,27 +635,27 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
} else { } else {
R.drawable.ic_loop_paused R.drawable.ic_loop_paused
}) })
overview_apsmode_text?.text = "" overview_apsmode_text?.visibility = View.GONE
} }
loopPlugin.isEnabled() && closedLoopEnabled.value() && loopPlugin.isLGS -> { loopPlugin.isEnabled() && closedLoopEnabled.value() && loopPlugin.isLGS -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_lgs) overview_apsmode?.setImageResource(R.drawable.ic_loop_lgs)
overview_apsmode_text?.text = "" overview_apsmode_text?.visibility = View.GONE
} }
loopPlugin.isEnabled() && closedLoopEnabled.value() -> { loopPlugin.isEnabled() && closedLoopEnabled.value() -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_closed) overview_apsmode?.setImageResource(R.drawable.ic_loop_closed)
overview_apsmode_text?.text = "" overview_apsmode_text?.visibility = View.GONE
} }
loopPlugin.isEnabled() && !closedLoopEnabled.value() -> { loopPlugin.isEnabled() && !closedLoopEnabled.value() -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_open) overview_apsmode?.setImageResource(R.drawable.ic_loop_open)
overview_apsmode_text?.text = "" overview_apsmode_text?.visibility = View.GONE
} }
else -> { else -> {
overview_apsmode?.setImageResource(R.drawable.ic_loop_disabled) overview_apsmode?.setImageResource(R.drawable.ic_loop_disabled)
overview_apsmode_text?.text = "" overview_apsmode_text?.visibility = View.GONE
} }
} }
} else { } else {

View file

@ -27,97 +27,122 @@
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/overview_bg" app:layout_constraintBottom_toBottomOf="@+id/overview_bg"
app:layout_constraintEnd_toStartOf="@+id/overview_arrow" app:layout_constraintEnd_toStartOf="@+id/overview_arrows_llayout"
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" />
<ImageView
android:id="@+id/overview_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
app:layout_constraintEnd_toStartOf="@+id/overview_deltas_llayout"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/overview_delta_large"
app:layout_constraintTop_toTopOf="@+id/overview_delta_large"
android:paddingTop="18dp"
app:srcCompat="@drawable/ic_flat" />
<LinearLayout <LinearLayout
android:id="@+id/overview_deltas_llayout" android:id="@+id/overview_arrows_llayout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="@+id/overview_bg" app:layout_constraintBottom_toBottomOf="@+id/overview_bg"
app:layout_constraintEnd_toStartOf="@+id/overview_apsmode_llayout" app:layout_constraintEnd_toStartOf="@+id/overview_deltas_llayout"
app:layout_constraintStart_toEndOf="@+id/overview_arrow" app:layout_constraintStart_toEndOf="@+id/overview_delta_large"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/overview_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
app:layout_constraintHorizontal_bias="0.0"
app:srcCompat="@drawable/ic_flat" />
<TextView <TextView
android:id="@+id/overview_timeago" android:id="@+id/overview_timeago"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
app:layout_constraintTop_toTopOf="@+id/overview_long_avgdelta"
android:text="n/a" android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" /> android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<LinearLayout </LinearLayout>
<TableLayout
android:id="@+id/overview_deltas_llayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@+id/overview_apsmode_llayout"
app:layout_constraintStart_toEndOf="@+id/overview_arrows_llayout"
app:layout_constraintBottom_toBottomOf="@+id/overview_arrows_llayout">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="Δ: "
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<LinearLayout <TextView
android:layout_width="wrap_content" android:id="@+id/overview_delta"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical"> android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView </TableRow>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="Δ: "
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView <TableRow
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end" android:orientation="horizontal">
android:textAlignment="textEnd"
android:text="15m Δ: \n40m Δ: "
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="15m Δ: "
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<LinearLayout <TextView
android:layout_width="wrap_content" android:id="@+id/overview_avgdelta"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:orientation="vertical"> android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView </TableRow>
android:id="@+id/overview_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView <TableRow
android:id="@+id/overview_avgdelta" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:orientation="horizontal">
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="40m Δ: "
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout> <TextView
android:id="@+id/overview_long_avgdelta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textAlignment="textEnd"
android:text="n/a"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
</LinearLayout> </TableRow>
</TableLayout>
<LinearLayout <LinearLayout
android:id="@+id/overview_apsmode_llayout" android:id="@+id/overview_apsmode_llayout"