Add setting for shorten label on very low res

This commit is contained in:
Philoul 2020-10-19 22:14:28 +02:00
parent 6fe1a4ab1f
commit ee79588449
4 changed files with 30 additions and 4 deletions

View file

@ -239,14 +239,29 @@ class ActionsFragment : DaggerFragment() {
actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility() actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility()
actions_temptarget?.visibility = (profile != null && config.APS).toVisibility() actions_temptarget?.visibility = (profile != null && config.APS).toVisibility()
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility() actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
val shortlabel = sp.getBoolean(R.string.key_short_cp_label,false)
if (shortlabel) {
careportal_pblabel?.text = resourceHelper.gs(R.string.pump)
careportal_sensoragelabel?.text = ""
careportal_insulinagelabel?.text = ""
careportal_canulaagelabel?.text = ""
careportal_pbagelabel?.text = ""
} else {
careportal_pblabel.text = resourceHelper.gs(R.string.careportal_pb_label)
careportal_sensoragelabel.text = resourceHelper.gs(R.string.careportal_age_label)
careportal_insulinagelabel.text =resourceHelper.gs(R.string.careportal_age_label)
careportal_canulaagelabel.text =resourceHelper.gs(R.string.careportal_age_label)
careportal_pbagelabel.text =resourceHelper.gs(R.string.careportal_age_label)
}
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_sensorlevel, careportal_pbage, careportal_batterylevel) statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_sensorlevel, careportal_pbage, careportal_batterylevel)
if (activeBgSource.sensorBatteryLevel == -1) if (activeBgSource.sensorBatteryLevel == -1)
careportal_senslevellabel?.text = "" careportal_senslevellabel?.text = ""
else else
careportal_senslevellabel?.text = resourceHelper.gs(R.string.careportal_level_label) careportal_senslevellabel?.text = if (shortlabel) "|" else resourceHelper.gs(R.string.careportal_level_label)
careportal_inslevellabel?.text = resourceHelper.gs(R.string.careportal_level_label) careportal_inslevellabel?.text = if (shortlabel) "|" else resourceHelper.gs(R.string.careportal_level_label)
careportal_pblevellabel?.text = resourceHelper.gs(R.string.careportal_level_label) careportal_pblevellabel?.text = if (shortlabel) "|" else resourceHelper.gs(R.string.careportal_level_label)
} else { } else {
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, null, careportal_pbage, null) statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, null, careportal_pbage, null)
careportal_senslevellabel?.text = "" careportal_senslevellabel?.text = ""

View file

@ -25,6 +25,7 @@
<TextView <TextView
android:id="@+id/careportal_sensoragelabel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
@ -97,6 +98,7 @@
<TextView <TextView
android:id="@+id/careportal_insulinagelabel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
@ -167,8 +169,8 @@
android:text="@string/careportal_canula_label" android:text="@string/careportal_canula_label"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/careportal_canulaagelabel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
@ -227,6 +229,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/careportal_pblabel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="25dp" android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_battery" android:drawableLeft="@drawable/ic_cp_age_battery"
@ -238,6 +241,7 @@
<TextView <TextView
android:id="@+id/careportal_pbagelabel"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"

View file

@ -403,6 +403,7 @@
<string name="wear_shortname">WEAR</string> <string name="wear_shortname">WEAR</string>
<string name="smscommunicator_shortname">SMS</string> <string name="smscommunicator_shortname">SMS</string>
<string name="short_tabtitles">Shorten tab titles</string> <string name="short_tabtitles">Shorten tab titles</string>
<string name="short_cp_label">Shorten Careportal labels in Actions tab</string>
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string> <string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string> <string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
<string name="key_advancedsettings" translatable="false">key_advancedsettings</string> <string name="key_advancedsettings" translatable="false">key_advancedsettings</string>
@ -1031,6 +1032,7 @@
<string name="loop_openmode_min_change">Minimal request change [%]</string> <string name="loop_openmode_min_change">Minimal request change [%]</string>
<string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string> <string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string> <string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<string name="key_short_cp_label" translatable="false">short_cplabel</string>
<string name="searching_for_devices">Searching for devices…</string> <string name="searching_for_devices">Searching for devices…</string>
<string name="pairing_completed">Pairing completed</string> <string name="pairing_completed">Pairing completed</string>
<string name="code_compare">Do the codes displayed on this device and on your pump match?</string> <string name="code_compare">Do the codes displayed on this device and on your pump match?</string>

View file

@ -282,6 +282,11 @@
android:key="@string/key_show_statuslights" android:key="@string/key_show_statuslights"
android:title="@string/show_statuslights" /> android:title="@string/show_statuslights" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_short_cp_label"
android:title="@string/short_cp_label" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference <info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="48" android:defaultValue="48"
android:dependency="@string/key_show_statuslights" android:dependency="@string/key_show_statuslights"