Merge pull request #41 from Philoul/Action_CarePortalInfo

Level informations added in Action>Careportal
This commit is contained in:
Milos Kozak 2020-11-08 17:47:14 +01:00 committed by GitHub
commit 6b629a1dda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 899 additions and 141 deletions

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.skins.SkinButtonsOn
import info.nightscout.androidaps.skins.SkinClassic
import info.nightscout.androidaps.skins.SkinInterface
import info.nightscout.androidaps.skins.SkinLargeDisplay
import info.nightscout.androidaps.skins.SkinLowRes
import javax.inject.Qualifier
@Module
@ -32,6 +33,12 @@ open class SkinsModule {
@IntKey(20)
fun bindsSkinLargeDisplay(skinLargeDisplay: SkinLargeDisplay): SkinInterface = skinLargeDisplay
@Provides
@Skin
@IntoMap
@IntKey(30)
fun bindsSkinLowRes(skinLowRes: SkinLowRes): SkinInterface = skinLowRes
@Qualifier
annotation class Skin
}

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.general.actions
import android.content.Intent
import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -9,6 +10,7 @@ import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.ErrorHelperActivity
@ -24,6 +26,7 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
@ -54,16 +57,30 @@ class ActionsFragment : DaggerFragment() {
@Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var skinProvider: SkinProvider
@Inject lateinit var config: Config
private var disposable: CompositeDisposable = CompositeDisposable()
private val pumpCustomActions = HashMap<String, CustomAction>()
private val pumpCustomButtons = ArrayList<SingleClickButton>()
private var smallWidth = false
private var smallHeight = false
private lateinit var dm: DisplayMetrics
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.actions_fragment, container, false)
//check screen width
dm = DisplayMetrics()
activity?.windowManager?.defaultDisplay?.getMetrics(dm)
val screenWidth = dm.widthPixels
val screenHeight = dm.heightPixels
smallWidth = screenWidth <= Constants.SMALL_WIDTH
smallHeight = screenHeight <= Constants.SMALL_HEIGHT
val landscape = screenHeight < screenWidth
return inflater.inflate(skinProvider.activeSkin().actionsLayout(landscape, smallWidth), container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -233,15 +250,24 @@ class ActionsFragment : DaggerFragment() {
actions_canceltempbasal?.visibility = View.GONE
}
}
val activeBgSource = activePlugin.activeBgSource
actions_historybrowser.visibility = (profile != null).toVisibility()
actions_fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized && !pump.isSuspended).toVisibility()
actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility()
actions_temptarget?.visibility = (profile != null && config.APS).toVisibility()
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, careportal_pbage, null)
if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_sensorlevel, careportal_pbage, careportal_batterylevel)
careportal_senslevellabel?.text = if (activeBgSource.sensorBatteryLevel == -1) "" else resourceHelper.gs(R.string.careportal_level_label)
} else {
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, null, careportal_sensorage, null, careportal_pbage, null)
careportal_senslevellabel?.text = ""
careportal_inslevellabel?.text = ""
careportal_pblevellabel?.text = ""
}
checkPumpCustomActions()
}
private fun checkPumpCustomActions() {

View file

@ -741,7 +741,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
// Status lights
overview_statuslights?.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility()
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, careportal_pbage, careportal_batterylevel)
statusLightHandler.updateStatusLights(careportal_canulaage, careportal_insulinage, careportal_reservoirlevel, careportal_sensorage, null, careportal_pbage, careportal_batterylevel)
// cob
var cobText: String = resourceHelper.gs(R.string.value_unavailable_short)

View file

@ -27,14 +27,20 @@ class StatusLightHandler @Inject constructor(
/**
* applies the extended statusLight subview on the overview fragment
*/
fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) {
fun updateStatusLights(careportal_canulaage: TextView?, careportal_insulinage: TextView?, careportal_reservoirlevel: TextView?, careportal_sensorage: TextView?, careportal_sensorbatterylevel: TextView?, careportal_pbage: TextView?, careportal_batterylevel: TextView?) {
val pump = activePlugin.activePump
val bgSource = activePlugin.activeBgSource
handleAge(careportal_canulaage, CareportalEvent.SITECHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
handleAge(careportal_insulinage, CareportalEvent.INSULINCHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
handleAge(careportal_sensorage, CareportalEvent.SENSORCHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
handleAge(careportal_pbage, CareportalEvent.PUMPBATTERYCHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
if (!config.NSCLIENT)
if (!config.NSCLIENT) {
handleLevel(careportal_reservoirlevel, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
if (bgSource.sensorBatteryLevel != -1)
handleLevel(careportal_sensorbatterylevel, R.string.key_statuslights_sbat_critical, 5.0, R.string.key_statuslights_sbat_warning, 20.0, bgSource.sensorBatteryLevel.toDouble(), "%")
else
careportal_sensorbatterylevel?.text = ""
}
if (!config.NSCLIENT && pump.model() != PumpType.AccuChekCombo)
handleLevel(careportal_batterylevel, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
}

View file

@ -41,6 +41,8 @@ class EversensePlugin @Inject constructor(
aapsLogger, resourceHelper, injector
), BgSourceInterface {
private var sensorBatteryLevel = -1
override fun advancedFilteringSupported(): Boolean {
return false
}
@ -53,7 +55,10 @@ class EversensePlugin @Inject constructor(
if (bundle.containsKey("glucoseLevel")) aapsLogger.debug(LTag.BGSOURCE, "glucoseLevel: " + bundle.getInt("glucoseLevel"))
if (bundle.containsKey("glucoseTrendDirection")) aapsLogger.debug(LTag.BGSOURCE, "glucoseTrendDirection: " + bundle.getString("glucoseTrendDirection"))
if (bundle.containsKey("glucoseTimestamp")) aapsLogger.debug(LTag.BGSOURCE, "glucoseTimestamp: " + dateUtil.dateAndTimeString(bundle.getLong("glucoseTimestamp")))
if (bundle.containsKey("batteryLevel")) aapsLogger.debug(LTag.BGSOURCE, "batteryLevel: " + bundle.getString("batteryLevel"))
if (bundle.containsKey("batteryLevel")) {
aapsLogger.debug(LTag.BGSOURCE, "batteryLevel: " + bundle.getString("batteryLevel"))
//sensorBatteryLevel = bundle.getString("batteryLevel").toInt() // TODO: Philoul: Line to check I don't have eversens so I don't know what kind of information is sent...
}
if (bundle.containsKey("signalStrength")) aapsLogger.debug(LTag.BGSOURCE, "signalStrength: " + bundle.getString("signalStrength"))
if (bundle.containsKey("transmitterVersionNumber")) aapsLogger.debug(LTag.BGSOURCE, "transmitterVersionNumber: " + bundle.getString("transmitterVersionNumber"))
if (bundle.containsKey("isXLVersion")) aapsLogger.debug(LTag.BGSOURCE, "isXLVersion: " + bundle.getBoolean("isXLVersion"))
@ -113,4 +118,8 @@ class EversensePlugin @Inject constructor(
}
}
}
override fun getSensorBatteryLevel(): Int {
return sensorBatteryLevel
}
}

View file

@ -31,6 +31,7 @@ class XdripPlugin @Inject constructor(
), BgSourceInterface {
private var advancedFiltering = false
private var sensorBatteryLevel = -1
override fun advancedFilteringSupported(): Boolean {
return advancedFiltering
@ -45,6 +46,7 @@ class XdripPlugin @Inject constructor(
bgReading.direction = bundle.getString(Intents.EXTRA_BG_SLOPE_NAME)
bgReading.date = bundle.getLong(Intents.EXTRA_TIMESTAMP)
bgReading.raw = bundle.getDouble(Intents.EXTRA_RAW)
//if (bundle.containsKey(Intents.EXTRA_SENSOR_BATTERY)) sensorBatteryLevel = bundle.getInt(Intents.EXTRA_SENSOR_BATTERY)
val source = bundle.getString(Intents.XDRIP_DATA_SOURCE_DESCRIPTION, "no Source specified")
setSource(source)
MainApp.getDbHelper().createIfNotExists(bgReading, "XDRIP")
@ -53,4 +55,8 @@ class XdripPlugin @Inject constructor(
private fun setSource(source: String) {
advancedFiltering = source.contains("G5 Native") || source.contains("G6 Native")
}
override fun getSensorBatteryLevel(): Int {
return sensorBatteryLevel
}
}

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.skins
import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
import info.nightscout.androidaps.R
interface SkinInterface {
@get:StringRes val description : Int
@ -9,4 +10,5 @@ interface SkinInterface {
val mainGraphHeight : Int // in dp
val secondaryGraphHeight : Int // in dp
@LayoutRes fun overviewLayout(isLandscape : Boolean, isTablet : Boolean, isSmallHeight : Boolean): Int
@LayoutRes fun actionsLayout(isLandscape : Boolean, isSmallWidth : Boolean): Int = R.layout.actions_fragment
}

View file

@ -0,0 +1,27 @@
package info.nightscout.androidaps.skins
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class SkinLowRes @Inject constructor(private val config: Config): SkinInterface {
override val description: Int get() = R.string.lowres_description
override val mainGraphHeight: Int get() = 200
override val secondaryGraphHeight: Int get() = 100
override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int =
when {
config.NSCLIENT && isTablet -> R.layout.overview_fragment_nsclient_tablet
config.NSCLIENT -> R.layout.overview_fragment_nsclient
isSmallHeight || isLandscape -> R.layout.overview_fragment_landscape
else -> R.layout.overview_fragment
}
override fun actionsLayout(isLandscape : Boolean, isSmallWidth : Boolean): Int =
when {
isLandscape || !isSmallWidth -> R.layout.actions_fragment
else -> R.layout.actions_fragment_lowres
}
}

View file

@ -0,0 +1,304 @@
<ScrollView 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".plugins.general.actions.ActionsFragment">
<LinearLayout
android:id="@+id/action_buttons_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/actions" />
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
app:columnCount="2">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_profileswitch"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_profileswitch"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_profileswitch"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="0" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_temptarget"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_temptarget"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_temporarytarget"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="0" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_settempbasal"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_starttempbasal"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_tempbasal_button"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_canceltempbasal"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cancelbasal"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/canceltemp"
android:visibility="gone"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_extendedbolus"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_startextbolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_extendedbolus_button"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_extendedbolus_cancel"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_cancelextbolus"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/overview_extendedbolus_cancel_button"
android:visibility="gone"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1" />
</androidx.gridlayout.widget.GridLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/careportal" />
<include
android:id="@+id/careportal_stats"
layout="@layout/careportal_stats_fragment_lowres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
app:columnCount="2">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_bgcheck"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_bgcheck"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_bgcheck"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="2" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_fill"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cp_pump_canula"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/primefill"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="2" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_cgmsensorinsert"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_cgm_insert"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_cgmsensorinsert"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="3" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_pumpbatterychange"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_pump_battery"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_pumpbatterychange"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="3" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_note"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_note"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_note"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="4" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_exercise"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_exercise"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_exercise"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="4" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_announcement"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_announcement"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_announcement"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="5" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_question"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_question"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_question"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="5" />
</androidx.gridlayout.widget.GridLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="15dp"
android:paddingEnd="15dp"
android:text="@string/tools" />
<androidx.gridlayout.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dip"
app:columnCount="2">
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_historybrowser"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_danarhistory"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/nav_historybrowser"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="6" />
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/actions_tddstats"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cp_stats"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/tdd"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="6" />
</androidx.gridlayout.widget.GridLayout>
</LinearLayout>
</ScrollView>

View file

@ -4,7 +4,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
tools:context=".plugins.general.careportal.CareportalFragment">
tools:context=".plugins.general.actions.ActionsFragment">
<ScrollView

View file

@ -2,203 +2,305 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
tools:context=".plugins.general.careportal.CareportalFragment">
tools:context=".plugins.general.actions.ActionsFragment">
<LinearLayout
android:layout_width="wrap_content"
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:stretchColumns="0,2,4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_sensor"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_cp_age_sensor"
android:paddingRight="5dp"
android:paddingRight="2dp"
android:paddingStart="15dp"
android:text="@string/careportal_sensorage_label"
android:text="@string/careportal_sensor_label"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:id="@+id/careportal_sensoragelabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingEnd="2dp"
android:paddingStart="2dp"
android:text=":"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_age_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_sensorage"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:paddingLeft="5dp"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:id="@+id/careportal_senslevellabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_cp_age_insulin"
android:paddingRight="5dp"
android:paddingStart="15dp"
android:text="@string/careportal_insulinage_label"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_level_label"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:id="@+id/careportal_sensorlevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingEnd="2dp"
android:paddingStart="2dp"
android:text=":"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="5"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_insulin"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingRight="2dp"
android:text="@string/careportal_insulin_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_insulinagelabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_age_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_insulinage"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:paddingLeft="5dp"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:id="@+id/careportal_inslevellabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_cp_age_canula"
android:paddingRight="5dp"
android:paddingStart="15dp"
android:text="@string/careportal_canulaage_label"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_level_label"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:id="@+id/careportal_reservoirlevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingEnd="2dp"
android:paddingStart="2dp"
android:text=":"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="5"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_canula"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingRight="2dp"
android:text="@string/careportal_canula_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_canulaagelabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_age_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_canulaage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="start"
android:paddingLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_cp_age_battery"
android:paddingRight="5dp"
android:paddingStart="15dp"
android:text="@string/careportal_pbage_label"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:textSize="14sp" />
<TextView
android:layout_width="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:gravity="center_horizontal"
android:paddingEnd="2dp"
android:paddingStart="2dp"
android:text=":"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:text=""
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="5"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/careportal_pblabel"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_battery"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingStart="15dp"
android:text="@string/careportal_pb_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_pbagelabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_age_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_pbage"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:paddingLeft="5dp"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/careportal_pblevellabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingStart="0dp"
android:paddingRight="0dp"
android:text="@string/careportal_level_label"
android:textSize="14sp" />
<View
<TextView
android:id="@+id/careportal_batterylevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
android:layout_height="wrap_content">
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="5"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
</TableLayout>
</FrameLayout>

View file

@ -0,0 +1,228 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
tools:context=".plugins.general.actions.ActionsFragment">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,2,4">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_sensor"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingStart="15dp"
android:text="@string/careportal_sensor_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_sensorage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_sensorlevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="3"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_insulin"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingRight="2dp"
android:text="@string/careportal_insulin_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_insulinage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_reservoirlevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="3"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_canula"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingRight="2dp"
android:text="@string/careportal_canula_label"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_canulaage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:text=""
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="3"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/careportal_pblabel"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:drawableLeft="@drawable/ic_cp_age_battery"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingStart="15dp"
android:text="@string/pump"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_pbage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/careportal_batterylevel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginRight="20dp"
android:paddingLeft="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_span="3"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:background="@color/listdelimiter" />
</TableRow>
</TableLayout>
</FrameLayout>

View file

@ -528,6 +528,10 @@
<string name="statuslights_sage_warning">Threshold warning sensor age [h]</string>
<string name="key_statuslights_sage_critical" translatable="false">statuslights_sage_critical</string>
<string name="statuslights_sage_critical">Threshold critical sensor age [h]</string>
<string name="key_statuslights_sbat_warning" translatable="false">statuslights_sbat_warning</string>
<string name="statuslights_sbat_warning">Threshold warning sensor battery level [%]</string>
<string name="key_statuslights_sbat_critical" translatable="false">statuslights_sbat_critical</string>
<string name="statuslights_sbat_critical">Threshold critical sensor battery level [%]</string>
<string name="key_statuslights_bage_warning" translatable="false">statuslights_bage_warning</string>
<string name="statuslights_bage_warning">Threshold warning battery age [h]</string>
<string name="key_statuslights_bage_critical" translatable="false">statuslights_bage_critical</string>
@ -566,6 +570,12 @@
<string name="careportal_insulinage_label">Insulin age</string>
<string name="doprofileswitch">Do Profile Switch</string>
<string name="careportal_pbage_label">Pump battery age</string>
<string name="careportal_sensor_label">Sensor</string>
<string name="careportal_canula_label">Canula</string>
<string name="careportal_insulin_label">Insulin</string>
<string name="careportal_pb_label">Pump battery</string>
<string name="careportal_age_label">age:</string>
<string name="careportal_level_label">level:</string>
<string name="ns_alarmoptions">Alarm options</string>
<string name="key_ns_announcements" translatable="false">ns_announcements</string>
<string name="key_ns_alarms" translatable="false">ns_alarms</string>
@ -1405,6 +1415,7 @@
<string name="copyexistingvalues">Copy NS settings (if exists)?</string>
<string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string>
<string name="classic_description">Original skin</string>
<string name="lowres_description">Low Resolution skin</string>
<string name="buttonson_description">Buttons are always displayed on bottom of screen</string>
<string name="largedisplay_description">Large display</string>
<string name="key_skin" translatable="false">skin</string>

View file

@ -360,6 +360,32 @@
validate:minNumber="24"
validate:testType="numericRange" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="25"
android:dependency="@string/key_show_statuslights"
android:inputType="numberSigned"
android:key="@string/key_statuslights_sbat_warning"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/statuslights_sbat_warning"
validate:maxNumber="100"
validate:minNumber="0"
validate:testType="numericRange" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="5"
android:dependency="@string/key_show_statuslights"
android:inputType="numberSigned"
android:key="@string/key_statuslights_sbat_critical"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/statuslights_sbat_critical"
validate:maxNumber="100"
validate:minNumber="0"
validate:testType="numericRange" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="216"
android:dependency="@string/key_show_statuslights"

View file

@ -9,4 +9,8 @@ public interface BgSourceInterface {
boolean advancedFilteringSupported();
void handleNewData(Intent intent);
default int getSensorBatteryLevel() {
return -1;
}
}