UserEntryPresentationHelper interface

This commit is contained in:
Milos Kozak 2022-11-28 13:54:33 +01:00
parent ae6cc2823d
commit 1eb9620b95
40 changed files with 298 additions and 326 deletions

View file

@ -15,6 +15,7 @@ import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.configuration.activities.SingleFragmentActivity import info.nightscout.configuration.activities.SingleFragmentActivity
import info.nightscout.core.events.EventNewNotification import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.nsclient.NSAlarm import info.nightscout.interfaces.nsclient.NSAlarm
import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.ActivityNames
@ -169,10 +170,16 @@ class ActivityNamesImpl @Inject constructor(
} }
override fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long) { override fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long) {
rxBus.send(EventNewNotification(Notification(id, System.currentTimeMillis(), text, level,validTo))) rxBus.send(EventNewNotification(Notification(id, System.currentTimeMillis(), text, level, validTo)))
} }
override fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm) { override fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm) {
rxBus.send(EventNewNotification(NotificationWithAction(injector, nsAlarm))) rxBus.send(EventNewNotification(NotificationWithAction(injector, nsAlarm)))
} }
override fun showToastAndNotification(ctx: Context?, string: String?, soundID: Int) {
ToastUtils.showToastInUiThread(ctx, string)
ToastUtils.playSound(ctx, soundID)
addNotification(Notification.TOAST_ALARM, string!!, Notification.URGENT)
}
} }

View file

@ -1,18 +0,0 @@
package info.nightscout.core.toast
import android.content.Context
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.bus.RxBus
fun ToastUtils.showToastAdNotification(
ctx: Context?, rxBus: RxBus,
string: String?, soundID: Int
) {
showToastInUiThread(ctx, string)
playSound(ctx, soundID)
val notification = Notification(Notification.TOAST_ALARM, string!!, Notification.URGENT)
rxBus.send(EventNewNotification(notification))
}

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="PrivateResource"
android:insetLeft="16dp"
android:insetTop="16dp"
android:insetRight="16dp"
android:insetBottom="16dp">
<shape
android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/background_floating_material_dark" />
<stroke android:color="@color/errorAlertBackground" android:width="3dp" />
</shape></inset>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="PrivateResource"
android:insetLeft="16dp"
android:insetTop="16dp"
android:insetRight="16dp"
android:insetBottom="16dp">
<shape
android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/background_floating_material_dark" />
<stroke android:color="@color/warningAlertBackground" android:width="3dp" />
</shape></inset>

View file

@ -1,4 +0,0 @@
<vector android:height="28.8dp" android:viewportHeight="512"
android:viewportWidth="640" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?attr/colorControlNormal" android:pathData="M512.1,191l-8.2,14.3c-3,5.3 -9.4,7.5 -15.1,5.4 -11.8,-4.4 -22.6,-10.7 -32.1,-18.6 -4.6,-3.8 -5.8,-10.5 -2.8,-15.7l8.2,-14.3c-6.9,-8 -12.3,-17.3 -15.9,-27.4h-16.5c-6,0 -11.2,-4.3 -12.2,-10.3 -2,-12 -2.1,-24.6 0,-37.1 1,-6 6.2,-10.4 12.2,-10.4h16.5c3.6,-10.1 9,-19.4 15.9,-27.4l-8.2,-14.3c-3,-5.2 -1.9,-11.9 2.8,-15.7 9.5,-7.9 20.4,-14.2 32.1,-18.6 5.7,-2.1 12.1,0.1 15.1,5.4l8.2,14.3c10.5,-1.9 21.2,-1.9 31.7,0L552,6.3c3,-5.3 9.4,-7.5 15.1,-5.4 11.8,4.4 22.6,10.7 32.1,18.6 4.6,3.8 5.8,10.5 2.8,15.7l-8.2,14.3c6.9,8 12.3,17.3 15.9,27.4h16.5c6,0 11.2,4.3 12.2,10.3 2,12 2.1,24.6 0,37.1 -1,6 -6.2,10.4 -12.2,10.4h-16.5c-3.6,10.1 -9,19.4 -15.9,27.4l8.2,14.3c3,5.2 1.9,11.9 -2.8,15.7 -9.5,7.9 -20.4,14.2 -32.1,18.6 -5.7,2.1 -12.1,-0.1 -15.1,-5.4l-8.2,-14.3c-10.4,1.9 -21.2,1.9 -31.7,0zM501.6,132.2c38.5,29.6 82.4,-14.3 52.8,-52.8 -38.5,-29.7 -82.4,14.3 -52.8,52.8zM386.3,286.1l33.7,16.8c10.1,5.8 14.5,18.1 10.5,29.1 -8.9,24.2 -26.4,46.4 -42.6,65.8 -7.4,8.9 -20.2,11.1 -30.3,5.3l-29.1,-16.8c-16,13.7 -34.6,24.6 -54.9,31.7v33.6c0,11.6 -8.3,21.6 -19.7,23.6 -24.6,4.2 -50.4,4.4 -75.9,0 -11.5,-2 -20,-11.9 -20,-23.6L158,418c-20.3,-7.2 -38.9,-18 -54.9,-31.7L74,403c-10,5.8 -22.9,3.6 -30.3,-5.3 -16.2,-19.4 -33.3,-41.6 -42.2,-65.7 -4,-10.9 0.4,-23.2 10.5,-29.1l33.3,-16.8c-3.9,-20.9 -3.9,-42.4 0,-63.4L12,205.8c-10.1,-5.8 -14.6,-18.1 -10.5,-29 8.9,-24.2 26,-46.4 42.2,-65.8 7.4,-8.9 20.2,-11.1 30.3,-5.3l29.1,16.8c16,-13.7 34.6,-24.6 54.9,-31.7L158,57.1c0,-11.5 8.2,-21.5 19.6,-23.5 24.6,-4.2 50.5,-4.4 76,-0.1 11.5,2 20,11.9 20,23.6v33.6c20.3,7.2 38.9,18 54.9,31.7l29.1,-16.8c10,-5.8 22.9,-3.6 30.3,5.3 16.2,19.4 33.2,41.6 42.1,65.8 4,10.9 0.1,23.2 -10,29.1l-33.7,16.8c3.9,21 3.9,42.5 0,63.5zM268.7,307.2c59.2,-77 -28.7,-164.9 -105.7,-105.7 -59.2,77 28.7,164.9 105.7,105.7zM512.1,489.9l-8.2,14.3c-3,5.3 -9.4,7.5 -15.1,5.4 -11.8,-4.4 -22.6,-10.7 -32.1,-18.6 -4.6,-3.8 -5.8,-10.5 -2.8,-15.7l8.2,-14.3c-6.9,-8 -12.3,-17.3 -15.9,-27.4h-16.5c-6,0 -11.2,-4.3 -12.2,-10.3 -2,-12 -2.1,-24.6 0,-37.1 1,-6 6.2,-10.4 12.2,-10.4h16.5c3.6,-10.1 9,-19.4 15.9,-27.4l-8.2,-14.3c-3,-5.2 -1.9,-11.9 2.8,-15.7 9.5,-7.9 20.4,-14.2 32.1,-18.6 5.7,-2.1 12.1,0.1 15.1,5.4l8.2,14.3c10.5,-1.9 21.2,-1.9 31.7,0l8.2,-14.3c3,-5.3 9.4,-7.5 15.1,-5.4 11.8,4.4 22.6,10.7 32.1,18.6 4.6,3.8 5.8,10.5 2.8,15.7l-8.2,14.3c6.9,8 12.3,17.3 15.9,27.4h16.5c6,0 11.2,4.3 12.2,10.3 2,12 2.1,24.6 0,37.1 -1,6 -6.2,10.4 -12.2,10.4h-16.5c-3.6,10.1 -9,19.4 -15.9,27.4l8.2,14.3c3,5.2 1.9,11.9 -2.8,15.7 -9.5,7.9 -20.4,14.2 -32.1,18.6 -5.7,2.1 -12.1,-0.1 -15.1,-5.4l-8.2,-14.3c-10.4,1.9 -21.2,1.9 -31.7,0zM501.6,431c38.5,29.6 82.4,-14.3 52.8,-52.8 -38.5,-29.6 -82.4,14.3 -52.8,52.8z"/>
</vector>

View file

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19.744,9.7c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581L13.03,4.714c-0.387,-0.786 -1.675,-0.786 -2.061,0L9.181,8.336L5.183,8.918C4.751,8.98 4.39,9.284 4.255,9.7c-0.135,0.416 -0.023,0.873 0.291,1.178l2.894,2.819L6.757,17.68c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133L12,17.013l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C19.766,10.573 19.881,10.116 19.744,9.7zM18.689,10.261l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35l-3.162,-3.081c-0.063,-0.061 -0.085,-0.153 -0.058,-0.236c0.027,-0.083 0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959l4.369,0.634c0.087,0.013 0.158,0.073 0.185,0.156S18.753,10.2 18.689,10.261z"
android:fillColor="?attr/profileColor"/>
</vector>

View file

@ -1,85 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M51.787,23.533c-0.01,-10.925 -8.888,-19.787 -19.813,-19.777c-10.925,0.01 -19.787,8.889 -19.777,19.814l0.016,16.897c0.01,10.925 8.888,19.787 19.813,19.777c10.925,-0.01 19.787,-8.889 19.777,-19.814l-0.016,-16.897Z"
android:fillColor="#ebeae3"/>
<path
android:pathData="M46.353,25.52c-0.007,-7.925 -6.447,-14.353 -14.372,-14.346c-7.925,0.008 -14.353,6.448 -14.346,14.373l0.015,16.092c0.006,6.181 5.029,11.195 11.21,11.19l6.318,-0.006c6.182,-0.006 11.196,-5.029 11.19,-11.211l-0.015,-16.092Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="31.4229"
android:startX="17.6405"
android:endY="30.819769"
android:endX="58.322098"
android:type="linear">
<item android:offset="0" android:color="#FFFFFFFF"/>
<item android:offset="1" android:color="#FFB3B3B3"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M22.928,44.362l-0.021,-22.414c-0.004,-4.01 3.249,-7.27 7.26,-7.273l3.634,-0.004c4.011,-0.003 7.27,3.25 7.274,7.261l0.02,22.413c-0.638,2.068 -1.683,3.934 -3.208,5.56l-11.85,0.011c-1.578,-1.46 -2.517,-3.384 -3.119,-5.554l0.01,-0Z"
android:strokeWidth="0.56"
android:fillColor="#00000000"
android:strokeColor="#000"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.826,46.02l-2.759,0.002l-0.001,-0.899c-0,-0.158 0.008,-0.279 0.026,-0.362c0.022,-0.117 0.065,-0.216 0.129,-0.295c0.063,-0.079 0.152,-0.143 0.266,-0.191c0.114,-0.048 0.239,-0.073 0.376,-0.073c0.235,0 0.434,0.064 0.596,0.193c0.163,0.129 0.244,0.362 0.245,0.699l0,0.611l1.122,-0.001l0,0.316ZM27.378,45.706l-0,-0.616c-0,-0.204 -0.044,-0.349 -0.132,-0.434c-0.088,-0.086 -0.212,-0.129 -0.371,-0.129c-0.116,0.001 -0.214,0.026 -0.297,0.076c-0.082,0.051 -0.136,0.117 -0.162,0.2c-0.017,0.053 -0.025,0.151 -0.025,0.294l0.001,0.61l0.986,-0.001Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.48,43.896c-0.458,0.001 -0.816,-0.105 -1.076,-0.317c-0.259,-0.213 -0.389,-0.487 -0.389,-0.823c-0,-0.22 0.06,-0.418 0.182,-0.595c0.122,-0.177 0.291,-0.311 0.509,-0.404c0.217,-0.093 0.464,-0.14 0.74,-0.14c0.28,-0 0.531,0.048 0.752,0.146c0.221,0.097 0.388,0.235 0.502,0.414c0.114,0.179 0.171,0.371 0.171,0.578c-0,0.225 -0.063,0.425 -0.188,0.602c-0.125,0.177 -0.297,0.311 -0.514,0.402c-0.217,0.091 -0.446,0.137 -0.689,0.137ZM27.486,43.571c0.332,-0 0.594,-0.078 0.786,-0.232c0.191,-0.155 0.286,-0.349 0.286,-0.582c-0,-0.237 -0.097,-0.432 -0.29,-0.585c-0.194,-0.154 -0.468,-0.23 -0.823,-0.23c-0.225,0 -0.421,0.033 -0.588,0.099c-0.168,0.066 -0.298,0.162 -0.39,0.288c-0.092,0.127 -0.138,0.268 -0.138,0.425c0,0.224 0.089,0.416 0.267,0.576c0.178,0.161 0.474,0.241 0.89,0.241Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.853,39.51l0.092,-0.316c0.3,0.066 0.529,0.185 0.687,0.357c0.157,0.171 0.236,0.381 0.236,0.629c0.001,0.257 -0.06,0.466 -0.181,0.627c-0.121,0.161 -0.296,0.284 -0.526,0.368c-0.229,0.084 -0.476,0.127 -0.739,0.127c-0.288,0 -0.538,-0.047 -0.752,-0.142c-0.215,-0.094 -0.377,-0.229 -0.488,-0.404c-0.112,-0.175 -0.167,-0.368 -0.168,-0.578c0,-0.238 0.07,-0.439 0.211,-0.602c0.14,-0.162 0.338,-0.276 0.593,-0.34l0.085,0.311c-0.201,0.055 -0.347,0.135 -0.439,0.24c-0.091,0.106 -0.137,0.238 -0.137,0.397c0,0.183 0.051,0.336 0.153,0.459c0.102,0.123 0.238,0.21 0.41,0.259c0.171,0.05 0.348,0.075 0.53,0.075c0.234,-0.001 0.439,-0.03 0.614,-0.089c0.175,-0.06 0.306,-0.152 0.392,-0.276c0.087,-0.125 0.13,-0.26 0.13,-0.405c-0,-0.177 -0.059,-0.326 -0.177,-0.449c-0.118,-0.122 -0.294,-0.205 -0.526,-0.248Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.82,38.199l-2.434,0.002l0,0.785l-0.325,0l-0.002,-1.889l0.326,0l0,0.789l2.434,-0.003l0.001,0.316Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.174,36.055l0.043,-0.302c0.205,0.047 0.363,0.135 0.477,0.264c0.113,0.129 0.169,0.294 0.169,0.494c0.001,0.253 -0.089,0.453 -0.269,0.601c-0.18,0.148 -0.433,0.222 -0.758,0.223c-0.336,-0 -0.597,-0.075 -0.783,-0.224c-0.186,-0.149 -0.279,-0.343 -0.279,-0.582c-0,-0.231 0.09,-0.419 0.272,-0.566c0.182,-0.146 0.438,-0.22 0.768,-0.22c0.02,0 0.05,0.001 0.091,0.002l0.001,1.287c0.219,-0.011 0.387,-0.065 0.504,-0.161c0.117,-0.097 0.175,-0.217 0.175,-0.361c-0,-0.107 -0.033,-0.199 -0.098,-0.275c-0.066,-0.076 -0.17,-0.136 -0.313,-0.18ZM27.627,37.016l-0.001,-0.964c-0.168,0.013 -0.294,0.05 -0.378,0.111c-0.131,0.093 -0.196,0.214 -0.196,0.363c0,0.134 0.053,0.247 0.157,0.339c0.104,0.091 0.244,0.142 0.418,0.151Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.084,34.259l0.043,-0.288c0.23,0.031 0.41,0.112 0.54,0.241c0.13,0.129 0.195,0.288 0.195,0.477c0,0.236 -0.089,0.426 -0.268,0.57c-0.179,0.144 -0.435,0.216 -0.769,0.216c-0.216,0 -0.405,-0.031 -0.567,-0.092c-0.161,-0.062 -0.283,-0.156 -0.364,-0.282c-0.081,-0.126 -0.122,-0.263 -0.122,-0.412c0,-0.187 0.055,-0.341 0.164,-0.46c0.11,-0.119 0.266,-0.196 0.468,-0.23l0.051,0.285c-0.134,0.027 -0.235,0.075 -0.303,0.144c-0.067,0.069 -0.101,0.152 -0.101,0.249c-0,0.148 0.061,0.268 0.184,0.36c0.122,0.092 0.316,0.137 0.581,0.137c0.268,-0 0.463,-0.045 0.585,-0.134c0.122,-0.089 0.182,-0.205 0.182,-0.348c0,-0.115 -0.041,-0.21 -0.122,-0.287c-0.082,-0.077 -0.208,-0.126 -0.377,-0.146Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.816,33.72l-2.76,0.002l-0,-0.292l0.99,-0.001c-0.183,-0.136 -0.275,-0.309 -0.275,-0.517c-0,-0.128 0.029,-0.239 0.087,-0.333c0.058,-0.094 0.139,-0.162 0.242,-0.203c0.102,-0.04 0.252,-0.061 0.448,-0.061l1.267,-0.001l-0,0.292l-1.267,0.002c-0.17,-0 -0.293,0.032 -0.37,0.095c-0.077,0.063 -0.116,0.153 -0.116,0.269c0.001,0.087 0.027,0.168 0.079,0.245c0.052,0.076 0.123,0.13 0.212,0.163c0.089,0.032 0.212,0.048 0.369,0.048l1.094,-0.001l-0,0.293Z"
android:fillType="nonZero"/>
<path
android:fillColor="#FF000000"
android:pathData="M27.844,29.206l0.092,-0.315c0.3,0.066 0.529,0.185 0.687,0.356c0.157,0.172 0.236,0.382 0.237,0.63c-0,0.257 -0.061,0.466 -0.182,0.627c-0.121,0.161 -0.296,0.283 -0.525,0.368c-0.23,0.084 -0.477,0.126 -0.74,0.126c-0.288,0.001 -0.538,-0.047 -0.752,-0.141c-0.214,-0.095 -0.377,-0.23 -0.488,-0.405c-0.112,-0.175 -0.167,-0.367 -0.167,-0.577c-0.001,-0.239 0.069,-0.439 0.21,-0.602c0.14,-0.163 0.338,-0.276 0.593,-0.34l0.085,0.31c-0.201,0.056 -0.347,0.136 -0.439,0.241c-0.091,0.105 -0.137,0.237 -0.137,0.397c0,0.183 0.051,0.336 0.153,0.459c0.102,0.123 0.238,0.209 0.41,0.259c0.171,0.05 0.348,0.074 0.53,0.074c0.234,-0 0.439,-0.03 0.614,-0.089c0.175,-0.059 0.306,-0.151 0.393,-0.276c0.086,-0.125 0.129,-0.26 0.129,-0.405c-0,-0.176 -0.059,-0.326 -0.177,-0.448c-0.118,-0.123 -0.294,-0.205 -0.526,-0.249Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M28.811,27.895l-2.434,0.002l0,0.786l-0.325,-0l-0.002,-1.889l0.326,-0l0,0.788l2.434,-0.002l0.001,0.315Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.982,26.833l-0.341,-0l-0.001,-0.899l0.341,-0l0.001,0.899Z"
android:fillType="nonZero"/>
<path
android:fillColor="#FF000000"
android:pathData="M28.808,24.589l0,0.292l-2.159,0.002c0.078,0.07 0.156,0.163 0.234,0.277c0.077,0.114 0.136,0.217 0.175,0.308l-0.328,0c-0.089,-0.163 -0.197,-0.306 -0.324,-0.429c-0.127,-0.122 -0.25,-0.209 -0.369,-0.259l-0,-0.189l2.771,-0.002Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.446,23.84c-0.326,0.001 -0.589,-0.028 -0.788,-0.086c-0.199,-0.058 -0.352,-0.144 -0.46,-0.258c-0.108,-0.114 -0.162,-0.258 -0.163,-0.431c0,-0.128 0.03,-0.241 0.09,-0.337c0.059,-0.097 0.145,-0.176 0.257,-0.239c0.113,-0.063 0.249,-0.113 0.411,-0.149c0.161,-0.035 0.378,-0.054 0.652,-0.054c0.324,-0 0.585,0.028 0.784,0.086c0.199,0.057 0.353,0.143 0.461,0.257c0.109,0.114 0.163,0.259 0.164,0.433c-0,0.23 -0.095,0.41 -0.286,0.542c-0.23,0.157 -0.604,0.236 -1.122,0.236ZM27.446,23.54c0.453,-0.001 0.754,-0.047 0.904,-0.139c0.15,-0.091 0.225,-0.204 0.225,-0.339c-0,-0.134 -0.075,-0.247 -0.226,-0.338c-0.151,-0.092 -0.452,-0.137 -0.904,-0.137c-0.454,0 -0.756,0.046 -0.905,0.138c-0.15,0.092 -0.224,0.206 -0.224,0.343c0,0.134 0.066,0.241 0.198,0.321c0.168,0.101 0.479,0.151 0.932,0.151Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.445,21.989c-0.327,0 -0.589,-0.029 -0.788,-0.087c-0.199,-0.057 -0.353,-0.143 -0.461,-0.258c-0.108,-0.114 -0.162,-0.258 -0.162,-0.431c-0,-0.128 0.029,-0.24 0.089,-0.337c0.059,-0.096 0.145,-0.176 0.258,-0.239c0.112,-0.063 0.249,-0.112 0.41,-0.148c0.161,-0.036 0.379,-0.054 0.652,-0.054c0.324,-0.001 0.585,0.028 0.784,0.085c0.199,0.057 0.353,0.143 0.462,0.257c0.108,0.115 0.163,0.259 0.163,0.433c0,0.23 -0.095,0.411 -0.286,0.542c-0.229,0.157 -0.603,0.236 -1.121,0.237ZM27.444,21.688c0.453,-0 0.755,-0.046 0.905,-0.138c0.15,-0.092 0.225,-0.205 0.224,-0.339c0,-0.135 -0.075,-0.248 -0.226,-0.339c-0.15,-0.091 -0.452,-0.137 -0.904,-0.137c-0.454,0.001 -0.756,0.047 -0.905,0.139c-0.149,0.091 -0.224,0.205 -0.224,0.342c0,0.134 0.066,0.242 0.198,0.322c0.169,0.1 0.479,0.15 0.932,0.15Z"
android:fillType="nonZero"/>
<path
android:fillColor="@android:color/black"
android:pathData="M27.307,19.687c-0.051,0.121 -0.125,0.211 -0.22,0.27c-0.095,0.059 -0.21,0.088 -0.343,0.088c-0.2,0 -0.369,-0.062 -0.506,-0.186c-0.137,-0.125 -0.206,-0.291 -0.206,-0.498c0,-0.208 0.07,-0.375 0.21,-0.502c0.14,-0.127 0.31,-0.191 0.511,-0.191c0.128,0 0.239,0.029 0.334,0.087c0.095,0.058 0.168,0.146 0.219,0.264c0.056,-0.147 0.145,-0.258 0.267,-0.334c0.123,-0.077 0.27,-0.115 0.441,-0.115c0.236,-0.001 0.434,0.071 0.595,0.215c0.161,0.144 0.241,0.334 0.241,0.569c0.001,0.235 -0.08,0.425 -0.241,0.569c-0.161,0.144 -0.362,0.217 -0.603,0.217c-0.18,0 -0.33,-0.039 -0.451,-0.118c-0.121,-0.078 -0.204,-0.19 -0.248,-0.335ZM26.733,19.746c0.13,-0 0.237,-0.037 0.32,-0.109c0.083,-0.073 0.124,-0.167 0.124,-0.283c-0,-0.113 -0.041,-0.205 -0.124,-0.277c-0.082,-0.072 -0.183,-0.108 -0.302,-0.108c-0.124,0 -0.229,0.037 -0.313,0.112c-0.085,0.074 -0.127,0.166 -0.127,0.277c-0,0.111 0.041,0.204 0.124,0.278c0.083,0.073 0.182,0.11 0.298,0.11ZM28.007,19.839c0.097,0 0.191,-0.02 0.281,-0.059c0.09,-0.04 0.16,-0.099 0.21,-0.177c0.049,-0.078 0.074,-0.162 0.074,-0.252c-0,-0.14 -0.052,-0.255 -0.157,-0.346c-0.104,-0.091 -0.236,-0.136 -0.397,-0.136c-0.163,-0 -0.298,0.047 -0.405,0.141c-0.106,0.093 -0.16,0.211 -0.159,0.352c-0,0.137 0.053,0.251 0.158,0.342c0.106,0.09 0.237,0.135 0.395,0.135Z"
android:fillType="nonZero"/>
</vector>

View file

@ -1,12 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M30.342,24.318c1.366,3.679 4.175,6.646 7.729,8.193c-0.101,0.988 -0.53,1.949 -1.287,2.705l-19.957,19.958c-1.746,1.746 -4.582,1.746 -6.329,-0l-3.26,-3.26c-1.746,-1.747 -1.746,-4.583 0,-6.329l19.958,-19.957c0.868,-0.869 2.007,-1.306 3.146,-1.31ZM16.307,44.823c1.159,0 2.1,0.932 2.1,2.079c-0,1.147 -0.941,2.078 -2.1,2.078c-1.159,0 -2.099,-0.931 -2.099,-2.078c-0,-1.147 0.94,-2.079 2.099,-2.079Z"
android:fillColor="?attr/colorControlNormal"/>
<path
android:pathData="M58.682,18.101c0.003,0.104 0.004,0.208 0.004,0.312c-0,7.953 -6.336,14.41 -14.14,14.41c-7.804,-0 -14.139,-6.457 -14.139,-14.41c-0,-7.952 6.335,-14.409 14.139,-14.409c3.386,0 6.495,1.215 8.93,3.241l-10.873,6.475l0,7.107l6.258,3.309l0.078,0.13l0.076,-0.048l0.091,0.048l0.024,-0.121l9.552,-6.044Z"
android:fillColor="?attr/colorControlNormal"/>
</vector>

View file

@ -5,7 +5,6 @@
<string name="settings_protection">Settings protection</string> <string name="settings_protection">Settings protection</string>
<string name="application_protection">Application protection</string> <string name="application_protection">Application protection</string>
<string name="bolus_protection">Bolus protection</string> <string name="bolus_protection">Bolus protection</string>
<string name="master_password">Master password</string>
<string name="settings_password">Settings password</string> <string name="settings_password">Settings password</string>
<string name="settings_pin">Settings PIN</string> <string name="settings_pin">Settings PIN</string>
<string name="application_password">Application password</string> <string name="application_password">Application password</string>
@ -14,13 +13,10 @@
<string name="bolus_pin">Bolus PIN</string> <string name="bolus_pin">Bolus PIN</string>
<string name="protection_timeout_title">Password and PIN retention [s]</string> <string name="protection_timeout_title">Password and PIN retention [s]</string>
<string name="protection_timeout_summary">Time before the password or PIN should be entered</string> <string name="protection_timeout_summary">Time before the password or PIN should be entered</string>
<string name="unlock_settings">Unlock settings</string>
<string name="biometric">Biometric</string> <string name="biometric">Biometric</string>
<string name="custom_password">Custom password</string> <string name="custom_password">Custom password</string>
<string name="custom_pin">Custom PIN</string> <string name="custom_pin">Custom PIN</string>
<string name="noprotection">No protection</string> <string name="noprotection">No protection</string>
<string name="protection">Protection</string>
<string name="master_password_missing">Master password is not set!\n\nPlease set your Master password in Preferences (%1$s &#8594; %2$s)</string>
<string name="unsecure_fallback_biometric">Unsecure Fallback</string> <string name="unsecure_fallback_biometric">Unsecure Fallback</string>
<string name="unsecure_fallback_descriotion_biometric">In order to be effective, biometric protection needs a master password set for fallback.\n\nPlease set a master password!</string> <string name="unsecure_fallback_descriotion_biometric">In order to be effective, biometric protection needs a master password set for fallback.\n\nPlease set a master password!</string>
@ -34,15 +30,4 @@
<string name="password_hint">Enter password here</string> <string name="password_hint">Enter password here</string>
<string name="pin_hint">Enter PIN here</string> <string name="pin_hint">Enter PIN here</string>
<string name="key_master_password" translatable="false">master_password</string>
<string name="key_settings_password" translatable="false">settings_password</string>
<string name="key_settings_pin" translatable="false">settings_pin</string>
<string name="key_application_password" translatable="false">application_password</string>
<string name="key_application_pin" translatable="false">application_pin</string>
<string name="key_bolus_password" translatable="false">bolus_password</string>
<string name="key_bolus_pin" translatable="false">bolus_pin</string>
<string name="key_settings_protection" translatable="false">settings_protection</string>
<string name="key_application_protection" translatable="false">application_protection</string>
<string name="key_bolus_protection" translatable="false">bolus_protection</string>
<string name="key_protection_timeout" translatable="false">protection_timeout</string>
</resources> </resources>

View file

@ -74,7 +74,6 @@
<string name="loopsuspended">Loop suspended</string> <string name="loopsuspended">Loop suspended</string>
<string name="trend_arrow">Trend arrow</string> <string name="trend_arrow">Trend arrow</string>
<string name="a11y_autosens_label">Auto sens</string> <string name="a11y_autosens_label">Auto sens</string>
<string name="value_unavailable_short">n/a</string>
<string name="required">req</string> <string name="required">req</string>
<string name="a11y_arrow_double_down">falling rapidly</string> <string name="a11y_arrow_double_down">falling rapidly</string>
<string name="a11y_arrow_single_down">falling</string> <string name="a11y_arrow_single_down">falling</string>
@ -116,7 +115,6 @@
<string name="closedloop">Closed Loop</string> <string name="closedloop">Closed Loop</string>
<string name="openloop">Open Loop</string> <string name="openloop">Open Loop</string>
<string name="lowglucosesuspend">Low Glucose Suspend</string> <string name="lowglucosesuspend">Low Glucose Suspend</string>
<string name="confirm">Confirm</string>
<string name="dia">DIA</string> <string name="dia">DIA</string>
<string name="ic_short">IC</string> <string name="ic_short">IC</string>
<string name="isf_short">ISF</string> <string name="isf_short">ISF</string>
@ -194,7 +192,6 @@
<string name="wear">Wear</string> <string name="wear">Wear</string>
<string name="automation">Automation</string> <string name="automation">Automation</string>
<string name="custom">Custom</string> <string name="custom">Custom</string>
<string name="pump">Pump</string>
<string name="loop">Loop</string> <string name="loop">Loop</string>
<string name="ns">NS</string> <string name="ns">NS</string>
<string name="record">Record</string> <string name="record">Record</string>
@ -208,7 +205,6 @@
<string name="success">Success</string> <string name="success">Success</string>
<string name="percent">Percent</string> <string name="percent">Percent</string>
<string name="absolute">Absolute</string> <string name="absolute">Absolute</string>
<string name="configbuilder_insulin">Insulin</string>
<string name="waitingforpumpresult">Waiting for result</string> <string name="waitingforpumpresult">Waiting for result</string>
<string name="smb_shortname">SMB</string> <string name="smb_shortname">SMB</string>
@ -234,34 +230,6 @@
<string name="mute5min">Mute for 5 minutes</string> <string name="mute5min">Mute for 5 minutes</string>
<!-- Maintenance -->
<string name="exported_ago" comment="at placeholder we add pluralized number of hours/minutes">exported %1$s ago</string>
<string name="exported_at" comment="at placeholder we add export date">exported at %1$s</string>
<string name="exported_less_than_hour_ago">exported less than hour ago</string>
<string name="in_directory" comment="placeholder is for exported file path">in directory: %1$s</string>
<string name="preferences_import_list_title">Select file to import</string>
<string name="metadata_warning_different_flavour">Preferences were created with different variant of AAPS (%1$s) while you have: %2$s.\n\nSome settings may be missing or invalid - after importing please check and update your preferences.</string>
<string name="metadata_warning_different_device">Preferences were created on a different device. It is OK if you are importing from older/different phone, but make sure imported preferences are correct!</string>
<string name="metadata_warning_outdated_format">You are using the outdated legacy format from old versions of AAPS, which is not secure! Only use it as a last resort, if you do not have an export in current, JSON format.</string>
<string name="metadata_warning_old_export">Imported preferences are already %1$s days old! Maybe you have more up-to-date preferences or you choose the wrong file? Remember to export preferences regularly!</string>
<string name="metadata_warning_date_format">Invalid date-time format!</string>
<string name="metadata_warning_different_version">Preferences from different minor version of application. It is OK if you are importing after upgrade, but check after import if preferences are still correct!</string>
<string name="metadata_urgent_different_version">Preferences from different major version of application. Major versions differ significantly and may have incompatible preferences! Make sure after import that preferences are still correct!</string>
<string name="prefdecrypt_settings_tampered">Settings file tampered</string>
<string name="prefdecrypt_settings_secure">Settings file is secure</string>
<string name="prefdecrypt_settings_unencrypted">Using not secure, unencrypted settings format</string>
<string name="prefdecrypt_wrong_json">JSON format error, missing required field (format, content, metadata or security)</string>
<string name="prefdecrypt_wrong_password">Decryption error, the given password cannot decrypt the file</string>
<string name="prefdecrypt_issue_missing_file_hash">File checksum (hash) missing, cannot verify the authenticity of settings!</string>
<string name="prefdecrypt_issue_modified">File was modified after export!</string>
<string name="prefdecrypt_issue_parsing">Decryption error, parsing preferences failed!</string>
<string name="prefdecrypt_issue_wrong_pass">Decryption error, the provided password is invalid or settings file was modified! It may happen that the imported file was exported with a different Master password.</string>
<string name="prefdecrypt_issue_wrong_format">Missing encryption configuration, settings format is invalid!</string>
<string name="prefdecrypt_issue_wrong_algorithm">Unsupported or not specified encryption algorithm!</string>
<!-- Permissions -->
<string name="alert_dialog_storage_permission_text">Please reboot your phone or restart AAPS from the System Settings \notherwise Android APS will not have logging (important to track and verify that the algorithms are working correctly)!</string>
<!-- User Entry --> <!-- User Entry -->
<string name="uel_bolus">BOLUS</string> <string name="uel_bolus">BOLUS</string>
<string name="uel_bolus_calculator">BOLUS CALCULATOR</string> <string name="uel_bolus_calculator">BOLUS CALCULATOR</string>
@ -352,7 +320,6 @@
<string name="ue_action">Action</string> <string name="ue_action">Action</string>
<string name="ue_timestamp">Timestamp</string> <string name="ue_timestamp">Timestamp</string>
<string name="ue_none">No Unit</string> <string name="ue_none">No Unit</string>
<string name="ue_export_to_csv">Export User Entries to Excel (csv)</string>
<string name="ue_csv_header" translatable="false">"%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"</string> <string name="ue_csv_header" translatable="false">"%1$s;%2$s;%3$s;%4$s;%5$s;%6$s;%7$s;%8$s;%9$s;%10$s;%11$s;%12$s;%13$s;%14$s;%15$s;%16$s;%17$s"</string>
<string name="uel_loop_change">LOOP CHANGED</string> <string name="uel_loop_change">LOOP CHANGED</string>
<string name="uel_loop_removed">LOOP REMOVED</string> <string name="uel_loop_removed">LOOP REMOVED</string>
@ -373,7 +340,6 @@
<string name="valueoutofrange">»%1$s« is out of hard limits</string> <string name="valueoutofrange">»%1$s« is out of hard limits</string>
<string name="value_out_of_hard_limits">»%1$s« %2$.2f is out of hard limits</string> <string name="value_out_of_hard_limits">»%1$s« %2$.2f is out of hard limits</string>
<string name="basal_value">Basal value</string> <string name="basal_value">Basal value</string>
<string name="nsclient_version_does_not_match">AAPSClient version doesn\'t match AAPS version. Please update.</string>
<!-- Command Queue + readStatus reasons --> <!-- Command Queue + readStatus reasons -->
<string name="bolus_u_min">BOLUS %1$.2f U</string> <string name="bolus_u_min">BOLUS %1$.2f U</string>
@ -467,9 +433,6 @@
<string name="urgent_alarm">Urgent Alarm</string> <string name="urgent_alarm">Urgent Alarm</string>
<string name="info">INFO</string> <string name="info">INFO</string>
<!-- SmsCommunicator -->
<string name="smscommunicator_missingsmspermission">Missing SMS permission</string>
<!-- BolusWizard --> <!-- BolusWizard -->
<string name="key_usebolusadvisor" translatable="false">use_bolus_advisor</string> <string name="key_usebolusadvisor" translatable="false">use_bolus_advisor</string>
<string name="bolus_advisor">Bolus advisor</string> <string name="bolus_advisor">Bolus advisor</string>
@ -511,17 +474,4 @@
<string name="max_carbs_title">Max allowed carbs [g]</string> <string name="max_carbs_title">Max allowed carbs [g]</string>
<string name="patient_type">Patient type</string> <string name="patient_type">Patient type</string>
<plurals name="days">
<item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item>
</plurals>
<plurals name="hours">
<item quantity="one">%1$d hour</item>
<item quantity="other">%1$d hours</item>
</plurals>
<plurals name="minutes">
<item quantity="one">%1$d minute</item>
<item quantity="other">%1$d minutes</item>
</plurals>
</resources> </resources>

View file

@ -67,4 +67,5 @@ interface ActivityNames {
fun addNotificationWithSound(id: Int, text: String, level: Int, @RawRes soundId: Int) fun addNotificationWithSound(id: Int, text: String, level: Int, @RawRes soundId: Int)
fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long) fun addNotificationValidTo(id: Int, date: Long, text: String, level: Int, validTo: Long)
fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm) fun addNotificationWithAction(injector: HasAndroidInjector, nsAlarm: NSAlarm)
fun showToastAndNotification(ctx: Context?, string: String?, @RawRes soundID: Int)
} }

View file

@ -0,0 +1,19 @@
package info.nightscout.interfaces.userEntry
import android.text.Spanned
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.ColorGroup
import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.entities.ValueWithUnit
interface UserEntryPresentationHelper {
@ColorRes fun colorId(colorGroup: ColorGroup): Int
@DrawableRes fun iconId(source: Sources): Int
fun actionToColoredString(action: Action): Spanned
fun listToPresentationString(list: List<ValueWithUnit?>): String
fun userEntriesToCsv(userEntries: List<UserEntry>): String
}

View file

@ -0,0 +1,9 @@
<vector android:height="28.8dp"
android:viewportHeight="512"
android:viewportWidth="640"
android:width="36dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M512.1,191l-8.2,14.3c-3,5.3 -9.4,7.5 -15.1,5.4 -11.8,-4.4 -22.6,-10.7 -32.1,-18.6 -4.6,-3.8 -5.8,-10.5 -2.8,-15.7l8.2,-14.3c-6.9,-8 -12.3,-17.3 -15.9,-27.4h-16.5c-6,0 -11.2,-4.3 -12.2,-10.3 -2,-12 -2.1,-24.6 0,-37.1 1,-6 6.2,-10.4 12.2,-10.4h16.5c3.6,-10.1 9,-19.4 15.9,-27.4l-8.2,-14.3c-3,-5.2 -1.9,-11.9 2.8,-15.7 9.5,-7.9 20.4,-14.2 32.1,-18.6 5.7,-2.1 12.1,0.1 15.1,5.4l8.2,14.3c10.5,-1.9 21.2,-1.9 31.7,0L552,6.3c3,-5.3 9.4,-7.5 15.1,-5.4 11.8,4.4 22.6,10.7 32.1,18.6 4.6,3.8 5.8,10.5 2.8,15.7l-8.2,14.3c6.9,8 12.3,17.3 15.9,27.4h16.5c6,0 11.2,4.3 12.2,10.3 2,12 2.1,24.6 0,37.1 -1,6 -6.2,10.4 -12.2,10.4h-16.5c-3.6,10.1 -9,19.4 -15.9,27.4l8.2,14.3c3,5.2 1.9,11.9 -2.8,15.7 -9.5,7.9 -20.4,14.2 -32.1,18.6 -5.7,2.1 -12.1,-0.1 -15.1,-5.4l-8.2,-14.3c-10.4,1.9 -21.2,1.9 -31.7,0zM501.6,132.2c38.5,29.6 82.4,-14.3 52.8,-52.8 -38.5,-29.7 -82.4,14.3 -52.8,52.8zM386.3,286.1l33.7,16.8c10.1,5.8 14.5,18.1 10.5,29.1 -8.9,24.2 -26.4,46.4 -42.6,65.8 -7.4,8.9 -20.2,11.1 -30.3,5.3l-29.1,-16.8c-16,13.7 -34.6,24.6 -54.9,31.7v33.6c0,11.6 -8.3,21.6 -19.7,23.6 -24.6,4.2 -50.4,4.4 -75.9,0 -11.5,-2 -20,-11.9 -20,-23.6L158,418c-20.3,-7.2 -38.9,-18 -54.9,-31.7L74,403c-10,5.8 -22.9,3.6 -30.3,-5.3 -16.2,-19.4 -33.3,-41.6 -42.2,-65.7 -4,-10.9 0.4,-23.2 10.5,-29.1l33.3,-16.8c-3.9,-20.9 -3.9,-42.4 0,-63.4L12,205.8c-10.1,-5.8 -14.6,-18.1 -10.5,-29 8.9,-24.2 26,-46.4 42.2,-65.8 7.4,-8.9 20.2,-11.1 30.3,-5.3l29.1,16.8c16,-13.7 34.6,-24.6 54.9,-31.7L158,57.1c0,-11.5 8.2,-21.5 19.6,-23.5 24.6,-4.2 50.5,-4.4 76,-0.1 11.5,2 20,11.9 20,23.6v33.6c20.3,7.2 38.9,18 54.9,31.7l29.1,-16.8c10,-5.8 22.9,-3.6 30.3,5.3 16.2,19.4 33.2,41.6 42.1,65.8 4,10.9 0.1,23.2 -10,29.1l-33.7,16.8c3.9,21 3.9,42.5 0,63.5zM268.7,307.2c59.2,-77 -28.7,-164.9 -105.7,-105.7 -59.2,77 28.7,164.9 105.7,105.7zM512.1,489.9l-8.2,14.3c-3,5.3 -9.4,7.5 -15.1,5.4 -11.8,-4.4 -22.6,-10.7 -32.1,-18.6 -4.6,-3.8 -5.8,-10.5 -2.8,-15.7l8.2,-14.3c-6.9,-8 -12.3,-17.3 -15.9,-27.4h-16.5c-6,0 -11.2,-4.3 -12.2,-10.3 -2,-12 -2.1,-24.6 0,-37.1 1,-6 6.2,-10.4 12.2,-10.4h16.5c3.6,-10.1 9,-19.4 15.9,-27.4l-8.2,-14.3c-3,-5.2 -1.9,-11.9 2.8,-15.7 9.5,-7.9 20.4,-14.2 32.1,-18.6 5.7,-2.1 12.1,0.1 15.1,5.4l8.2,14.3c10.5,-1.9 21.2,-1.9 31.7,0l8.2,-14.3c3,-5.3 9.4,-7.5 15.1,-5.4 11.8,4.4 22.6,10.7 32.1,18.6 4.6,3.8 5.8,10.5 2.8,15.7l-8.2,14.3c6.9,8 12.3,17.3 15.9,27.4h16.5c6,0 11.2,4.3 12.2,10.3 2,12 2.1,24.6 0,37.1 -1,6 -6.2,10.4 -12.2,10.4h-16.5c-3.6,10.1 -9,19.4 -15.9,27.4l8.2,14.3c3,5.2 1.9,11.9 -2.8,15.7 -9.5,7.9 -20.4,14.2 -32.1,18.6 -5.7,2.1 -12.1,-0.1 -15.1,-5.4l-8.2,-14.3c-10.4,1.9 -21.2,1.9 -31.7,0zM501.6,431c38.5,29.6 82.4,-14.3 52.8,-52.8 -38.5,-29.6 -82.4,14.3 -52.8,52.8z" />
</vector>

View file

@ -3,7 +3,7 @@
android:height="24dp" android:height="24dp"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="?attr/colorControlNormal" android:fillColor="?attr/colorControlNormal"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/> android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
</vector> </vector>

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M19.744,9.7c-0.135,-0.417 -0.494,-0.72 -0.928,-0.783l-3.997,-0.581L13.03,4.714c-0.387,-0.786 -1.675,-0.786 -2.061,0L9.181,8.336L5.183,8.918C4.751,8.98 4.39,9.284 4.255,9.7c-0.135,0.416 -0.023,0.873 0.291,1.178l2.894,2.819L6.757,17.68c-0.074,0.432 0.103,0.868 0.457,1.125c0.2,0.146 0.437,0.22 0.676,0.22c0.183,0 0.367,-0.044 0.535,-0.133L12,17.013l3.576,1.879c0.39,0.203 0.855,0.173 1.212,-0.087c0.353,-0.257 0.531,-0.694 0.456,-1.125l-0.683,-3.983l2.893,-2.819C19.766,10.573 19.881,10.116 19.744,9.7zM18.689,10.261l-3.16,3.081l0.746,4.35c0.014,0.087 -0.021,0.174 -0.092,0.225c-0.04,0.03 -0.087,0.044 -0.135,0.044c-0.036,0 -0.073,-0.008 -0.108,-0.027l-3.907,-2.053l-3.907,2.053c-0.075,0.044 -0.17,0.036 -0.242,-0.017c-0.07,-0.051 -0.106,-0.138 -0.091,-0.225l0.746,-4.35l-3.162,-3.081c-0.063,-0.061 -0.085,-0.153 -0.058,-0.236c0.027,-0.083 0.099,-0.143 0.185,-0.156l4.369,-0.634l1.954,-3.959c0.078,-0.158 0.334,-0.158 0.412,0l1.953,3.959l4.369,0.634c0.087,0.013 0.158,0.073 0.185,0.156S18.753,10.2 18.689,10.261z"
android:fillColor="?attr/profileColor" />
</vector>

View file

@ -0,0 +1,88 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M51.787,23.533c-0.01,-10.925 -8.888,-19.787 -19.813,-19.777c-10.925,0.01 -19.787,8.889 -19.777,19.814l0.016,16.897c0.01,10.925 8.888,19.787 19.813,19.777c10.925,-0.01 19.787,-8.889 19.777,-19.814l-0.016,-16.897Z"
android:fillColor="#ebeae3" />
<path android:pathData="M46.353,25.52c-0.007,-7.925 -6.447,-14.353 -14.372,-14.346c-7.925,0.008 -14.353,6.448 -14.346,14.373l0.015,16.092c0.006,6.181 5.029,11.195 11.21,11.19l6.318,-0.006c6.182,-0.006 11.196,-5.029 11.19,-11.211l-0.015,-16.092Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="31.4229"
android:startX="17.6405"
android:endY="30.819769"
android:endX="58.322098"
android:type="linear">
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="1"
android:color="#FFB3B3B3" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M22.928,44.362l-0.021,-22.414c-0.004,-4.01 3.249,-7.27 7.26,-7.273l3.634,-0.004c4.011,-0.003 7.27,3.25 7.274,7.261l0.02,22.413c-0.638,2.068 -1.683,3.934 -3.208,5.56l-11.85,0.011c-1.578,-1.46 -2.517,-3.384 -3.119,-5.554l0.01,-0Z"
android:strokeWidth="0.56"
android:fillColor="#00000000"
android:strokeColor="#000" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.826,46.02l-2.759,0.002l-0.001,-0.899c-0,-0.158 0.008,-0.279 0.026,-0.362c0.022,-0.117 0.065,-0.216 0.129,-0.295c0.063,-0.079 0.152,-0.143 0.266,-0.191c0.114,-0.048 0.239,-0.073 0.376,-0.073c0.235,0 0.434,0.064 0.596,0.193c0.163,0.129 0.244,0.362 0.245,0.699l0,0.611l1.122,-0.001l0,0.316ZM27.378,45.706l-0,-0.616c-0,-0.204 -0.044,-0.349 -0.132,-0.434c-0.088,-0.086 -0.212,-0.129 -0.371,-0.129c-0.116,0.001 -0.214,0.026 -0.297,0.076c-0.082,0.051 -0.136,0.117 -0.162,0.2c-0.017,0.053 -0.025,0.151 -0.025,0.294l0.001,0.61l0.986,-0.001Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.48,43.896c-0.458,0.001 -0.816,-0.105 -1.076,-0.317c-0.259,-0.213 -0.389,-0.487 -0.389,-0.823c-0,-0.22 0.06,-0.418 0.182,-0.595c0.122,-0.177 0.291,-0.311 0.509,-0.404c0.217,-0.093 0.464,-0.14 0.74,-0.14c0.28,-0 0.531,0.048 0.752,0.146c0.221,0.097 0.388,0.235 0.502,0.414c0.114,0.179 0.171,0.371 0.171,0.578c-0,0.225 -0.063,0.425 -0.188,0.602c-0.125,0.177 -0.297,0.311 -0.514,0.402c-0.217,0.091 -0.446,0.137 -0.689,0.137ZM27.486,43.571c0.332,-0 0.594,-0.078 0.786,-0.232c0.191,-0.155 0.286,-0.349 0.286,-0.582c-0,-0.237 -0.097,-0.432 -0.29,-0.585c-0.194,-0.154 -0.468,-0.23 -0.823,-0.23c-0.225,0 -0.421,0.033 -0.588,0.099c-0.168,0.066 -0.298,0.162 -0.39,0.288c-0.092,0.127 -0.138,0.268 -0.138,0.425c0,0.224 0.089,0.416 0.267,0.576c0.178,0.161 0.474,0.241 0.89,0.241Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.853,39.51l0.092,-0.316c0.3,0.066 0.529,0.185 0.687,0.357c0.157,0.171 0.236,0.381 0.236,0.629c0.001,0.257 -0.06,0.466 -0.181,0.627c-0.121,0.161 -0.296,0.284 -0.526,0.368c-0.229,0.084 -0.476,0.127 -0.739,0.127c-0.288,0 -0.538,-0.047 -0.752,-0.142c-0.215,-0.094 -0.377,-0.229 -0.488,-0.404c-0.112,-0.175 -0.167,-0.368 -0.168,-0.578c0,-0.238 0.07,-0.439 0.211,-0.602c0.14,-0.162 0.338,-0.276 0.593,-0.34l0.085,0.311c-0.201,0.055 -0.347,0.135 -0.439,0.24c-0.091,0.106 -0.137,0.238 -0.137,0.397c0,0.183 0.051,0.336 0.153,0.459c0.102,0.123 0.238,0.21 0.41,0.259c0.171,0.05 0.348,0.075 0.53,0.075c0.234,-0.001 0.439,-0.03 0.614,-0.089c0.175,-0.06 0.306,-0.152 0.392,-0.276c0.087,-0.125 0.13,-0.26 0.13,-0.405c-0,-0.177 -0.059,-0.326 -0.177,-0.449c-0.118,-0.122 -0.294,-0.205 -0.526,-0.248Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.82,38.199l-2.434,0.002l0,0.785l-0.325,0l-0.002,-1.889l0.326,0l0,0.789l2.434,-0.003l0.001,0.316Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.174,36.055l0.043,-0.302c0.205,0.047 0.363,0.135 0.477,0.264c0.113,0.129 0.169,0.294 0.169,0.494c0.001,0.253 -0.089,0.453 -0.269,0.601c-0.18,0.148 -0.433,0.222 -0.758,0.223c-0.336,-0 -0.597,-0.075 -0.783,-0.224c-0.186,-0.149 -0.279,-0.343 -0.279,-0.582c-0,-0.231 0.09,-0.419 0.272,-0.566c0.182,-0.146 0.438,-0.22 0.768,-0.22c0.02,0 0.05,0.001 0.091,0.002l0.001,1.287c0.219,-0.011 0.387,-0.065 0.504,-0.161c0.117,-0.097 0.175,-0.217 0.175,-0.361c-0,-0.107 -0.033,-0.199 -0.098,-0.275c-0.066,-0.076 -0.17,-0.136 -0.313,-0.18ZM27.627,37.016l-0.001,-0.964c-0.168,0.013 -0.294,0.05 -0.378,0.111c-0.131,0.093 -0.196,0.214 -0.196,0.363c0,0.134 0.053,0.247 0.157,0.339c0.104,0.091 0.244,0.142 0.418,0.151Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.084,34.259l0.043,-0.288c0.23,0.031 0.41,0.112 0.54,0.241c0.13,0.129 0.195,0.288 0.195,0.477c0,0.236 -0.089,0.426 -0.268,0.57c-0.179,0.144 -0.435,0.216 -0.769,0.216c-0.216,0 -0.405,-0.031 -0.567,-0.092c-0.161,-0.062 -0.283,-0.156 -0.364,-0.282c-0.081,-0.126 -0.122,-0.263 -0.122,-0.412c0,-0.187 0.055,-0.341 0.164,-0.46c0.11,-0.119 0.266,-0.196 0.468,-0.23l0.051,0.285c-0.134,0.027 -0.235,0.075 -0.303,0.144c-0.067,0.069 -0.101,0.152 -0.101,0.249c-0,0.148 0.061,0.268 0.184,0.36c0.122,0.092 0.316,0.137 0.581,0.137c0.268,-0 0.463,-0.045 0.585,-0.134c0.122,-0.089 0.182,-0.205 0.182,-0.348c0,-0.115 -0.041,-0.21 -0.122,-0.287c-0.082,-0.077 -0.208,-0.126 -0.377,-0.146Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.816,33.72l-2.76,0.002l-0,-0.292l0.99,-0.001c-0.183,-0.136 -0.275,-0.309 -0.275,-0.517c-0,-0.128 0.029,-0.239 0.087,-0.333c0.058,-0.094 0.139,-0.162 0.242,-0.203c0.102,-0.04 0.252,-0.061 0.448,-0.061l1.267,-0.001l-0,0.292l-1.267,0.002c-0.17,-0 -0.293,0.032 -0.37,0.095c-0.077,0.063 -0.116,0.153 -0.116,0.269c0.001,0.087 0.027,0.168 0.079,0.245c0.052,0.076 0.123,0.13 0.212,0.163c0.089,0.032 0.212,0.048 0.369,0.048l1.094,-0.001l-0,0.293Z"
android:fillType="nonZero" />
<path
android:fillColor="#FF000000"
android:pathData="M27.844,29.206l0.092,-0.315c0.3,0.066 0.529,0.185 0.687,0.356c0.157,0.172 0.236,0.382 0.237,0.63c-0,0.257 -0.061,0.466 -0.182,0.627c-0.121,0.161 -0.296,0.283 -0.525,0.368c-0.23,0.084 -0.477,0.126 -0.74,0.126c-0.288,0.001 -0.538,-0.047 -0.752,-0.141c-0.214,-0.095 -0.377,-0.23 -0.488,-0.405c-0.112,-0.175 -0.167,-0.367 -0.167,-0.577c-0.001,-0.239 0.069,-0.439 0.21,-0.602c0.14,-0.163 0.338,-0.276 0.593,-0.34l0.085,0.31c-0.201,0.056 -0.347,0.136 -0.439,0.241c-0.091,0.105 -0.137,0.237 -0.137,0.397c0,0.183 0.051,0.336 0.153,0.459c0.102,0.123 0.238,0.209 0.41,0.259c0.171,0.05 0.348,0.074 0.53,0.074c0.234,-0 0.439,-0.03 0.614,-0.089c0.175,-0.059 0.306,-0.151 0.393,-0.276c0.086,-0.125 0.129,-0.26 0.129,-0.405c-0,-0.176 -0.059,-0.326 -0.177,-0.448c-0.118,-0.123 -0.294,-0.205 -0.526,-0.249Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M28.811,27.895l-2.434,0.002l0,0.786l-0.325,-0l-0.002,-1.889l0.326,-0l0,0.788l2.434,-0.002l0.001,0.315Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.982,26.833l-0.341,-0l-0.001,-0.899l0.341,-0l0.001,0.899Z"
android:fillType="nonZero" />
<path
android:fillColor="#FF000000"
android:pathData="M28.808,24.589l0,0.292l-2.159,0.002c0.078,0.07 0.156,0.163 0.234,0.277c0.077,0.114 0.136,0.217 0.175,0.308l-0.328,0c-0.089,-0.163 -0.197,-0.306 -0.324,-0.429c-0.127,-0.122 -0.25,-0.209 -0.369,-0.259l-0,-0.189l2.771,-0.002Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.446,23.84c-0.326,0.001 -0.589,-0.028 -0.788,-0.086c-0.199,-0.058 -0.352,-0.144 -0.46,-0.258c-0.108,-0.114 -0.162,-0.258 -0.163,-0.431c0,-0.128 0.03,-0.241 0.09,-0.337c0.059,-0.097 0.145,-0.176 0.257,-0.239c0.113,-0.063 0.249,-0.113 0.411,-0.149c0.161,-0.035 0.378,-0.054 0.652,-0.054c0.324,-0 0.585,0.028 0.784,0.086c0.199,0.057 0.353,0.143 0.461,0.257c0.109,0.114 0.163,0.259 0.164,0.433c-0,0.23 -0.095,0.41 -0.286,0.542c-0.23,0.157 -0.604,0.236 -1.122,0.236ZM27.446,23.54c0.453,-0.001 0.754,-0.047 0.904,-0.139c0.15,-0.091 0.225,-0.204 0.225,-0.339c-0,-0.134 -0.075,-0.247 -0.226,-0.338c-0.151,-0.092 -0.452,-0.137 -0.904,-0.137c-0.454,0 -0.756,0.046 -0.905,0.138c-0.15,0.092 -0.224,0.206 -0.224,0.343c0,0.134 0.066,0.241 0.198,0.321c0.168,0.101 0.479,0.151 0.932,0.151Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.445,21.989c-0.327,0 -0.589,-0.029 -0.788,-0.087c-0.199,-0.057 -0.353,-0.143 -0.461,-0.258c-0.108,-0.114 -0.162,-0.258 -0.162,-0.431c-0,-0.128 0.029,-0.24 0.089,-0.337c0.059,-0.096 0.145,-0.176 0.258,-0.239c0.112,-0.063 0.249,-0.112 0.41,-0.148c0.161,-0.036 0.379,-0.054 0.652,-0.054c0.324,-0.001 0.585,0.028 0.784,0.085c0.199,0.057 0.353,0.143 0.462,0.257c0.108,0.115 0.163,0.259 0.163,0.433c0,0.23 -0.095,0.411 -0.286,0.542c-0.229,0.157 -0.603,0.236 -1.121,0.237ZM27.444,21.688c0.453,-0 0.755,-0.046 0.905,-0.138c0.15,-0.092 0.225,-0.205 0.224,-0.339c0,-0.135 -0.075,-0.248 -0.226,-0.339c-0.15,-0.091 -0.452,-0.137 -0.904,-0.137c-0.454,0.001 -0.756,0.047 -0.905,0.139c-0.149,0.091 -0.224,0.205 -0.224,0.342c0,0.134 0.066,0.242 0.198,0.322c0.169,0.1 0.479,0.15 0.932,0.15Z"
android:fillType="nonZero" />
<path
android:fillColor="@android:color/black"
android:pathData="M27.307,19.687c-0.051,0.121 -0.125,0.211 -0.22,0.27c-0.095,0.059 -0.21,0.088 -0.343,0.088c-0.2,0 -0.369,-0.062 -0.506,-0.186c-0.137,-0.125 -0.206,-0.291 -0.206,-0.498c0,-0.208 0.07,-0.375 0.21,-0.502c0.14,-0.127 0.31,-0.191 0.511,-0.191c0.128,0 0.239,0.029 0.334,0.087c0.095,0.058 0.168,0.146 0.219,0.264c0.056,-0.147 0.145,-0.258 0.267,-0.334c0.123,-0.077 0.27,-0.115 0.441,-0.115c0.236,-0.001 0.434,0.071 0.595,0.215c0.161,0.144 0.241,0.334 0.241,0.569c0.001,0.235 -0.08,0.425 -0.241,0.569c-0.161,0.144 -0.362,0.217 -0.603,0.217c-0.18,0 -0.33,-0.039 -0.451,-0.118c-0.121,-0.078 -0.204,-0.19 -0.248,-0.335ZM26.733,19.746c0.13,-0 0.237,-0.037 0.32,-0.109c0.083,-0.073 0.124,-0.167 0.124,-0.283c-0,-0.113 -0.041,-0.205 -0.124,-0.277c-0.082,-0.072 -0.183,-0.108 -0.302,-0.108c-0.124,0 -0.229,0.037 -0.313,0.112c-0.085,0.074 -0.127,0.166 -0.127,0.277c-0,0.111 0.041,0.204 0.124,0.278c0.083,0.073 0.182,0.11 0.298,0.11ZM28.007,19.839c0.097,0 0.191,-0.02 0.281,-0.059c0.09,-0.04 0.16,-0.099 0.21,-0.177c0.049,-0.078 0.074,-0.162 0.074,-0.252c-0,-0.14 -0.052,-0.255 -0.157,-0.346c-0.104,-0.091 -0.236,-0.136 -0.397,-0.136c-0.163,-0 -0.298,0.047 -0.405,0.141c-0.106,0.093 -0.16,0.211 -0.159,0.352c-0,0.137 0.053,0.251 0.158,0.342c0.106,0.09 0.237,0.135 0.395,0.135Z"
android:fillType="nonZero" />
</vector>

View file

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M30.342,24.318c1.366,3.679 4.175,6.646 7.729,8.193c-0.101,0.988 -0.53,1.949 -1.287,2.705l-19.957,19.958c-1.746,1.746 -4.582,1.746 -6.329,-0l-3.26,-3.26c-1.746,-1.747 -1.746,-4.583 0,-6.329l19.958,-19.957c0.868,-0.869 2.007,-1.306 3.146,-1.31ZM16.307,44.823c1.159,0 2.1,0.932 2.1,2.079c-0,1.147 -0.941,2.078 -2.1,2.078c-1.159,0 -2.099,-0.931 -2.099,-2.078c-0,-1.147 0.94,-2.079 2.099,-2.079Z"
android:fillColor="?attr/colorControlNormal" />
<path
android:pathData="M58.682,18.101c0.003,0.104 0.004,0.208 0.004,0.312c-0,7.953 -6.336,14.41 -14.14,14.41c-7.804,-0 -14.139,-6.457 -14.139,-14.41c-0,-7.952 6.335,-14.409 14.139,-14.409c3.386,0 6.495,1.215 8.93,3.241l-10.873,6.475l0,7.107l6.258,3.309l0.078,0.13l0.076,-0.048l0.091,0.048l0.024,-0.121l9.552,-6.044Z"
android:fillColor="?attr/colorControlNormal" />
</vector>

View file

@ -34,6 +34,16 @@
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="statuslights">Status lights</string> <string name="statuslights">Status lights</string>
<string name="do_ns_upload_title">Upload BG data to NS</string> <string name="do_ns_upload_title">Upload BG data to NS</string>
<string name="configbuilder_insulin">Insulin</string>
<string name="value_unavailable_short">n/a</string>
<string name="master_password">Master password</string>
<string name="ue_export_to_csv">Export User Entries to Excel (csv)</string>
<string name="confirm">Confirm</string>
<string name="pump">Pump</string>
<!-- Protection-->
<string name="unlock_settings">Unlock settings</string>
<!-- Pumps --> <!-- Pumps -->
<string name="battery_label">Battery</string> <string name="battery_label">Battery</string>
@ -114,4 +124,20 @@
<!-- Preferences --> <!-- Preferences -->
<string name="nav_plugin_preferences">Plugin preferences</string> <string name="nav_plugin_preferences">Plugin preferences</string>
<!-- SmsCommunicator -->
<string name="smscommunicator_missingsmspermission">Missing SMS permission</string>
<plurals name="days">
<item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item>
</plurals>
<plurals name="hours">
<item quantity="one">%1$d hour</item>
<item quantity="other">%1$d hours</item>
</plurals>
<plurals name="minutes">
<item quantity="one">%1$d minute</item>
<item quantity="other">%1$d minutes</item>
</plurals>
</resources> </resources>

View file

@ -132,5 +132,16 @@
<string name="key_ns_receive_cgm" translatable="false">ns_receive_cgm</string> <string name="key_ns_receive_cgm" translatable="false">ns_receive_cgm</string>
<string name="key_ns_create_announcements_from_carbs_req" translatable="false">ns_create_announcements_from_carbs_req</string> <string name="key_ns_create_announcements_from_carbs_req" translatable="false">ns_create_announcements_from_carbs_req</string>
<string name="key_do_ns_upload" translatable="false">dexcomg5_nsupload</string> <string name="key_do_ns_upload" translatable="false">dexcomg5_nsupload</string>
<string name="key_master_password" translatable="false">master_password</string>
<string name="key_settings_password" translatable="false">settings_password</string>
<string name="key_settings_pin" translatable="false">settings_pin</string>
<string name="key_application_password" translatable="false">application_password</string>
<string name="key_application_pin" translatable="false">application_pin</string>
<string name="key_bolus_password" translatable="false">bolus_password</string>
<string name="key_bolus_pin" translatable="false">bolus_pin</string>
<string name="key_settings_protection" translatable="false">settings_protection</string>
<string name="key_application_protection" translatable="false">application_protection</string>
<string name="key_bolus_protection" translatable="false">bolus_protection</string>
<string name="key_protection_timeout" translatable="false">protection_timeout</string>
</resources> </resources>

View file

@ -3,12 +3,10 @@ package info.nightscout.implementation
import android.content.Context import android.content.Context
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.main.R import info.nightscout.core.main.R
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
@ -23,11 +21,11 @@ import kotlin.math.min
@Singleton @Singleton
class HardLimitsImpl @Inject constructor( class HardLimitsImpl @Inject constructor(
private val aapsLogger: AAPSLogger, private val aapsLogger: AAPSLogger,
private val rxBus: RxBus, private val activityNames: ActivityNames,
private val sp: SP, private val sp: SP,
private val rh: ResourceHelper, private val rh: ResourceHelper,
private val context: Context, private val context: Context,
private val repository: AppRepository private val repository: AppRepository,
) : HardLimits { ) : HardLimits {
private val disposable = CompositeDisposable() private val disposable = CompositeDisposable()
@ -102,7 +100,7 @@ class HardLimitsImpl @Inject constructor(
msg += rh.gs(R.string.valuelimitedto, value, newValue) msg += rh.gs(R.string.valuelimitedto, value, newValue)
aapsLogger.error(msg) aapsLogger.error(msg)
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe() disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe()
ToastUtils.showToastAdNotification(context, rxBus, msg, R.raw.error) activityNames.showToastAndNotification(context, msg, R.raw.error)
} }
return newValue return newValue
} }

View file

@ -39,6 +39,7 @@ import info.nightscout.implementation.stats.DexcomTirCalculatorImpl
import info.nightscout.implementation.stats.TddCalculatorImpl import info.nightscout.implementation.stats.TddCalculatorImpl
import info.nightscout.implementation.stats.TirCalculatorImpl import info.nightscout.implementation.stats.TirCalculatorImpl
import info.nightscout.implementation.storage.FileStorage import info.nightscout.implementation.storage.FileStorage
import info.nightscout.implementation.userEntry.UserEntryPresentationHelperImpl
import info.nightscout.interfaces.BolusTimer import info.nightscout.interfaces.BolusTimer
import info.nightscout.interfaces.CarbTimer import info.nightscout.interfaces.CarbTimer
import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.LocalAlertUtils
@ -68,6 +69,7 @@ import info.nightscout.interfaces.stats.TddCalculator
import info.nightscout.interfaces.stats.TirCalculator import info.nightscout.interfaces.stats.TirCalculator
import info.nightscout.interfaces.storage.Storage import info.nightscout.interfaces.storage.Storage
import info.nightscout.interfaces.ui.IconsProvider import info.nightscout.interfaces.ui.IconsProvider
import info.nightscout.interfaces.userEntry.UserEntryPresentationHelper
import info.nightscout.interfaces.utils.HardLimits import info.nightscout.interfaces.utils.HardLimits
import info.nightscout.interfaces.utils.TrendCalculator import info.nightscout.interfaces.utils.TrendCalculator
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
@ -121,5 +123,6 @@ abstract class ImplementationModule {
@Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction @Binds fun bindsProfileFunction(profileFunctionImpl: ProfileFunctionImpl): ProfileFunction
@Binds fun bindsStorage(fileStorage: FileStorage): Storage @Binds fun bindsStorage(fileStorage: FileStorage): Storage
@Binds fun bindsReceiverStatusStore(receiverStatusStoreImpl: ReceiverStatusStoreImpl): ReceiverStatusStore @Binds fun bindsReceiverStatusStore(receiverStatusStoreImpl: ReceiverStatusStoreImpl): ReceiverStatusStore
@Binds fun bindsUserEntryPresentationHelper(userEntryPresentationHelperImpl: UserEntryPresentationHelperImpl): UserEntryPresentationHelper
} }
} }

View file

@ -1,4 +1,4 @@
package info.nightscout.androidaps.utils.userEntry package info.nightscout.implementation.userEntry
import android.text.Spanned import android.text.Spanned
import dagger.Reusable import dagger.Reusable
@ -13,6 +13,7 @@ import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.Translator import info.nightscout.interfaces.Translator
import info.nightscout.interfaces.profile.Profile import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.userEntry.UserEntryPresentationHelper
import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.interfaces.utils.DecimalFormatter
import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
@ -20,14 +21,14 @@ import info.nightscout.shared.utils.DateUtil
import javax.inject.Inject import javax.inject.Inject
@Reusable @Reusable
class UserEntryPresentationHelper @Inject constructor( class UserEntryPresentationHelperImpl @Inject constructor(
private val translator: Translator, private val translator: Translator,
private val profileFunction: ProfileFunction, private val profileFunction: ProfileFunction,
private val rh: ResourceHelper, private val rh: ResourceHelper,
private val dateUtil: DateUtil private val dateUtil: DateUtil
) { ) : UserEntryPresentationHelper {
fun colorId(colorGroup: ColorGroup): Int = when (colorGroup) { override fun colorId(colorGroup: ColorGroup): Int = when (colorGroup) {
ColorGroup.InsulinTreatment -> R.color.iob ColorGroup.InsulinTreatment -> R.color.iob
ColorGroup.BasalTreatment -> R.color.basal ColorGroup.BasalTreatment -> R.color.basal
ColorGroup.CarbTreatment -> R.color.carbs ColorGroup.CarbTreatment -> R.color.carbs
@ -40,7 +41,7 @@ class UserEntryPresentationHelper @Inject constructor(
else -> R.color.defaultText else -> R.color.defaultText
} }
fun iconId(source: Sources): Int = when (source) { override fun iconId(source: Sources): Int = when (source) {
Sources.TreatmentDialog -> R.drawable.icon_insulin_carbs Sources.TreatmentDialog -> R.drawable.icon_insulin_carbs
Sources.InsulinDialog -> R.drawable.ic_bolus Sources.InsulinDialog -> R.drawable.ic_bolus
Sources.CarbDialog -> R.drawable.ic_cp_bolus_carbs Sources.CarbDialog -> R.drawable.ic_cp_bolus_carbs
@ -109,14 +110,14 @@ class UserEntryPresentationHelper @Inject constructor(
Sources.Unknown -> R.drawable.ic_generic_icon Sources.Unknown -> R.drawable.ic_generic_icon
} }
fun actionToColoredString(action: Action): Spanned = when (action) { override fun actionToColoredString(action: Action): Spanned = when (action) {
Action.TREATMENT -> HtmlHelper.fromHtml(coloredAction(Action.BOLUS) + " + " + coloredAction(Action.CARBS)) Action.TREATMENT -> HtmlHelper.fromHtml(coloredAction(Action.BOLUS) + " + " + coloredAction(Action.CARBS))
else -> HtmlHelper.fromHtml(coloredAction(action)) else -> HtmlHelper.fromHtml(coloredAction(action))
} }
private fun coloredAction(action: Action): String = "<font color='${rh.gc(colorId(action.colorGroup))}'>${translator.translate(action)}</font>" private fun coloredAction(action: Action): String = "<font color='${rh.gc(colorId(action.colorGroup))}'>${translator.translate(action)}</font>"
fun listToPresentationString(list: List<ValueWithUnit?>) = override fun listToPresentationString(list: List<ValueWithUnit?>) =
list.joinToString(separator = " ", transform = this::toPresentationString) list.joinToString(separator = " ", transform = this::toPresentationString)
private fun toPresentationString(valueWithUnit: ValueWithUnit?): String = when (valueWithUnit) { private fun toPresentationString(valueWithUnit: ValueWithUnit?): String = when (valueWithUnit) {
@ -148,28 +149,29 @@ class UserEntryPresentationHelper @Inject constructor(
null -> "" null -> ""
} }
fun userEntriesToCsv(userEntries: List<UserEntry>): String { override fun userEntriesToCsv(userEntries: List<UserEntry>): String {
return getCsvHeader() + userEntries.joinToString("\n") { entry -> getCsvEntry(entry) } return getCsvHeader() + userEntries.joinToString("\n") { entry -> getCsvEntry(entry) }
} }
private fun getCsvHeader() = rh.gs(R.string.ue_csv_header, private fun getCsvHeader() = rh.gs(
csvString(R.string.ue_timestamp), R.string.ue_csv_header,
csvString(R.string.date), csvString(R.string.ue_timestamp),
csvString(R.string.ue_utc_offset), csvString(R.string.date),
csvString(R.string.ue_action), csvString(R.string.ue_utc_offset),
csvString(R.string.event_type), csvString(R.string.ue_action),
csvString(R.string.ue_source), csvString(R.string.event_type),
csvString(R.string.careportal_note), csvString(R.string.ue_source),
csvString(R.string.ue_string), csvString(R.string.careportal_note),
csvString(R.string.event_time_label), csvString(R.string.ue_string),
csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol), csvString(R.string.event_time_label),
csvString(R.string.shortgram), csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol),
csvString(R.string.insulin_unit_shortname), csvString(R.string.shortgram),
csvString(R.string.profile_ins_units_per_hour), csvString(R.string.insulin_unit_shortname),
csvString(R.string.shortpercent), csvString(R.string.profile_ins_units_per_hour),
csvString(R.string.shorthour), csvString(R.string.shortpercent),
csvString(R.string.shortminute), csvString(R.string.shorthour),
csvString(R.string.ue_none) csvString(R.string.shortminute),
csvString(R.string.ue_none)
) + "\n" ) + "\n"
private fun getCsvEntry(entry: UserEntry): String { private fun getCsvEntry(entry: UserEntry): String {

View file

@ -7,8 +7,8 @@ import android.os.Bundle
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import dagger.android.support.DaggerAppCompatActivity import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.configuration.R
import info.nightscout.configuration.maintenance.PrefsFileContract import info.nightscout.configuration.maintenance.PrefsFileContract
import info.nightscout.core.main.R
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.core.ui.locale.LocaleHelper
import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.maintenance.ImportExportPrefs

View file

@ -1,7 +1,6 @@
package info.nightscout.configuration.configBuilder package info.nightscout.configuration.configBuilder
import info.nightscout.core.events.EventNewNotification import info.nightscout.configuration.R
import info.nightscout.core.main.R
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.ConfigBuilder import info.nightscout.interfaces.ConfigBuilder
import info.nightscout.interfaces.aps.Sensitivity import info.nightscout.interfaces.aps.Sensitivity
@ -12,6 +11,7 @@ import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.pump.PumpSync import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.pump.defs.PumpType
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNSClientNewLog import info.nightscout.rx.events.EventNSClientNewLog
import info.nightscout.rx.logging.AAPSLogger import info.nightscout.rx.logging.AAPSLogger
@ -33,7 +33,8 @@ class RunningConfigurationImpl @Inject constructor(
private val config: Config, private val config: Config,
private val rh: ResourceHelper, private val rh: ResourceHelper,
private val rxBus: RxBus, private val rxBus: RxBus,
private val pumpSync: PumpSync private val pumpSync: PumpSync,
private val activityNames: ActivityNames
) : RunningConfiguration { ) : RunningConfiguration {
private var counter = 0 private var counter = 0
@ -73,7 +74,7 @@ class RunningConfigurationImpl @Inject constructor(
configuration.version?.let { configuration.version?.let {
rxBus.send(EventNSClientNewLog("VERSION", "Received AndroidAPS version $it")) rxBus.send(EventNSClientNewLog("VERSION", "Received AndroidAPS version $it"))
if (config.VERSION_NAME.startsWith(it).not()) if (config.VERSION_NAME.startsWith(it).not())
rxBus.send(EventNewNotification(Notification(Notification.NSCLIENT_VERSION_DOES_NOT_MATCH, rh.gs(R.string.nsclient_version_does_not_match), Notification.NORMAL))) activityNames.addNotification(Notification.NSCLIENT_VERSION_DOES_NOT_MATCH, rh.gs(R.string.nsclient_version_does_not_match), Notification.NORMAL)
} }
configuration.insulin?.let { configuration.insulin?.let {
val insulin = Insulin.InsulinType.fromInt(it) val insulin = Insulin.InsulinType.fromInt(it)

View file

@ -20,7 +20,6 @@ import androidx.work.Worker
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import androidx.work.workDataOf import androidx.work.workDataOf
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import info.nightscout.configuration.R import info.nightscout.configuration.R
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
import info.nightscout.configuration.maintenance.dialogs.PrefImportSummaryDialog import info.nightscout.configuration.maintenance.dialogs.PrefImportSummaryDialog
@ -49,6 +48,7 @@ import info.nightscout.interfaces.maintenance.PrefsStatus
import info.nightscout.interfaces.protection.PasswordCheck import info.nightscout.interfaces.protection.PasswordCheck
import info.nightscout.interfaces.storage.Storage import info.nightscout.interfaces.storage.Storage
import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.userEntry.UserEntryPresentationHelper
import info.nightscout.interfaces.utils.MidnightTime import info.nightscout.interfaces.utils.MidnightTime
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit import info.nightscout.rx.events.EventAppExit

View file

@ -5,8 +5,8 @@ import android.os.Environment
import dagger.Lazy import dagger.Lazy
import dagger.Reusable import dagger.Reusable
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.configuration.R
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
import info.nightscout.core.main.R
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefFileListProvider
import info.nightscout.interfaces.maintenance.PrefMetadata import info.nightscout.interfaces.maintenance.PrefMetadata

View file

@ -11,10 +11,10 @@ import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerAppCompatActivity import dagger.android.support.DaggerAppCompatActivity
import info.nightscout.configuration.R
import info.nightscout.configuration.databinding.MaintenanceImportListActivityBinding import info.nightscout.configuration.databinding.MaintenanceImportListActivityBinding
import info.nightscout.configuration.databinding.MaintenanceImportListItemBinding import info.nightscout.configuration.databinding.MaintenanceImportListItemBinding
import info.nightscout.configuration.maintenance.PrefsFileContract import info.nightscout.configuration.maintenance.PrefsFileContract
import info.nightscout.core.main.R
import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.core.ui.locale.LocaleHelper
import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefFileListProvider
import info.nightscout.interfaces.maintenance.PrefsFile import info.nightscout.interfaces.maintenance.PrefsFile
@ -87,8 +87,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_FLAVOUR]?.let { prefFile.metadata[PrefsMetadataKey.AAPS_FLAVOUR]?.let {
metaVariantFormat.text = it.value metaVariantFormat.text = it.value
val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor val colorAttr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
metaVariantFormat.setTextColor(rh.gac( metaVariantFormat.context, colorattr)) metaVariantFormat.setTextColor(rh.gac(metaVariantFormat.context, colorAttr))
} }
prefFile.metadata[PrefsMetadataKey.CREATED_AT]?.let { prefFile.metadata[PrefsMetadataKey.CREATED_AT]?.let {
@ -97,8 +97,8 @@ class PrefImportListActivity : DaggerAppCompatActivity() {
prefFile.metadata[PrefsMetadataKey.AAPS_VERSION]?.let { prefFile.metadata[PrefsMetadataKey.AAPS_VERSION]?.let {
metaAppVersion.text = it.value metaAppVersion.text = it.value
val colorattr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor val colorAttr = if (it.status == PrefsStatus.OK) R.attr.metadataTextOkColor else R.attr.metadataTextWarningColor
metaAppVersion.setTextColor(rh.gac( metaVariantFormat.context, colorattr)) metaAppVersion.setTextColor(rh.gac(metaVariantFormat.context, colorAttr))
} }
prefFile.metadata[PrefsMetadataKey.DEVICE_NAME]?.let { prefFile.metadata[PrefsMetadataKey.DEVICE_NAME]?.let {

View file

@ -1,6 +1,6 @@
package info.nightscout.configuration.maintenance.formats package info.nightscout.configuration.maintenance.formats
import info.nightscout.core.main.R import info.nightscout.configuration.R
import info.nightscout.core.utils.CryptoUtil import info.nightscout.core.utils.CryptoUtil
import info.nightscout.core.utils.hexStringToByteArray import info.nightscout.core.utils.hexStringToByteArray
import info.nightscout.core.utils.toHex import info.nightscout.core.utils.toHex

View file

@ -83,6 +83,7 @@
<string name="description_config_builder">Used for configuring the active plugins</string> <string name="description_config_builder">Used for configuring the active plugins</string>
<string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string> <string name="allow_hardware_pump_text">Attention: If you activate and connect to a hardware pump, AAPS will copy the basal settings from the profile to the pump, overwriting the existing basal rate stored on the pump. Make sure you have the correct basal setting in AAPS. If you are not sure or don\'t want to overwrite the basal settings on your pump, press cancel and repeat switching to the pump at a later time.</string>
<string name="a11y_open_settings">open settings</string> <string name="a11y_open_settings">open settings</string>
<string name="nsclient_version_does_not_match">AAPSClient version doesn\'t match AAPS version. Please update.</string>
<!--ImportExport--> <!--ImportExport-->
<string name="nav_preferences">Preferences</string> <string name="nav_preferences">Preferences</string>
@ -110,6 +111,8 @@
<string name="goto_main_try_again">Please go back to main screen and try again.</string> <string name="goto_main_try_again">Please go back to main screen and try again.</string>
<string name="restartingapp">Exiting application to apply settings.</string> <string name="restartingapp">Exiting application to apply settings.</string>
<string name="ue_exported">User Entries exported</string> <string name="ue_exported">User Entries exported</string>
<string name="protection">Protection</string>
<string name="master_password_missing">Master password is not set!\n\nPlease set your Master password in Preferences (%1$s &#8594; %2$s)</string>
<!-- Maintenance--> <!-- Maintenance-->
@ -136,4 +139,32 @@
<string name="nav_resetdb">Reset Databases</string> <string name="nav_resetdb">Reset Databases</string>
<string name="resettodefaults">Reset to defaults</string> <string name="resettodefaults">Reset to defaults</string>
<!-- Maintenance -->
<string name="exported_ago" comment="at placeholder we add pluralized number of hours/minutes">exported %1$s ago</string>
<string name="exported_at" comment="at placeholder we add export date">exported at %1$s</string>
<string name="exported_less_than_hour_ago">exported less than hour ago</string>
<string name="in_directory" comment="placeholder is for exported file path">in directory: %1$s</string>
<string name="preferences_import_list_title">Select file to import</string>
<string name="metadata_warning_different_flavour">Preferences were created with different variant of AAPS (%1$s) while you have: %2$s.\n\nSome settings may be missing or invalid - after importing please check and update your preferences.</string>
<string name="metadata_warning_different_device">Preferences were created on a different device. It is OK if you are importing from older/different phone, but make sure imported preferences are correct!</string>
<string name="metadata_warning_outdated_format">You are using the outdated legacy format from old versions of AAPS, which is not secure! Only use it as a last resort, if you do not have an export in current, JSON format.</string>
<string name="metadata_warning_old_export">Imported preferences are already %1$s days old! Maybe you have more up-to-date preferences or you choose the wrong file? Remember to export preferences regularly!</string>
<string name="metadata_warning_date_format">Invalid date-time format!</string>
<string name="metadata_warning_different_version">Preferences from different minor version of application. It is OK if you are importing after upgrade, but check after import if preferences are still correct!</string>
<string name="metadata_urgent_different_version">Preferences from different major version of application. Major versions differ significantly and may have incompatible preferences! Make sure after import that preferences are still correct!</string>
<string name="prefdecrypt_settings_tampered">Settings file tampered</string>
<string name="prefdecrypt_settings_secure">Settings file is secure</string>
<string name="prefdecrypt_settings_unencrypted">Using not secure, unencrypted settings format</string>
<string name="prefdecrypt_wrong_json">JSON format error, missing required field (format, content, metadata or security)</string>
<string name="prefdecrypt_wrong_password">Decryption error, the given password cannot decrypt the file</string>
<string name="prefdecrypt_issue_missing_file_hash">File checksum (hash) missing, cannot verify the authenticity of settings!</string>
<string name="prefdecrypt_issue_modified">File was modified after export!</string>
<string name="prefdecrypt_issue_parsing">Decryption error, parsing preferences failed!</string>
<string name="prefdecrypt_issue_wrong_pass">Decryption error, the provided password is invalid or settings file was modified! It may happen that the imported file was exported with a different Master password.</string>
<string name="prefdecrypt_issue_wrong_format">Missing encryption configuration, settings format is invalid!</string>
<string name="prefdecrypt_issue_wrong_algorithm">Unsupported or not specified encryption algorithm!</string>
<!-- Permissions -->
<string name="alert_dialog_storage_permission_text">Please reboot your phone or restart AAPS from the System Settings \notherwise Android APS will not have logging (important to track and verify that the algorithms are working correctly)!</string>
</resources> </resources>

View file

@ -34,18 +34,6 @@ dependencies {
// Actions // Actions
api "androidx.gridlayout:gridlayout:$gridlayout_version" api "androidx.gridlayout:gridlayout:$gridlayout_version"
// NSClient, Tidepool
api("io.socket:socket.io-client:1.0.0") {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
api "com.squareup.okhttp3:okhttp:$okhttp3_version"
api "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
//api "com.squareup.retrofit2:retrofit:$retrofit2_version"
api "com.squareup.retrofit2:adapter-rxjava3:$retrofit2_version"
api "com.squareup.retrofit2:converter-gson:$retrofit2_version"
//SmsCommunicator //SmsCommunicator
api 'com.eatthepath:java-otp:0.4.0' api 'com.eatthepath:java-otp:0.4.0'
api 'com.github.kenglxn.QRGen:android:2.6.0' api 'com.github.kenglxn.QRGen:android:2.6.0'

View file

@ -3,7 +3,7 @@ package info.nightscout.plugins.skins
import info.nightscout.plugins.R import info.nightscout.plugins.R
import info.nightscout.plugins.di.SkinsModule import info.nightscout.plugins.di.SkinsModule
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import okhttp3.internal.toImmutableMap import java.util.Collections
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@ -19,4 +19,9 @@ class SkinProvider @Inject constructor(
val list: List<SkinInterface> val list: List<SkinInterface>
get() = allSkins.toImmutableMap().toList().sortedBy { it.first }.map { it.second } get() = allSkins.toImmutableMap().toList().sortedBy { it.first }.map { it.second }
/** Returns an immutable copy of this. */
private fun Map<Int, SkinInterface>.toImmutableMap(): Map<Int, SkinInterface> =
if (isEmpty()) emptyMap()
else Collections.unmodifiableMap(LinkedHashMap(this))
} }

View file

@ -20,16 +20,12 @@ dependencies {
implementation project(':database:entities') implementation project(':database:entities')
implementation project(':database:impl') implementation project(':database:impl')
implementation project(':core:core-main') implementation project(':core:core-main')
implementation project(':core:graph')
implementation project(':core:graphview')
implementation project(':core:interfaces') implementation project(':core:interfaces')
implementation project(':core:ns-sdk') implementation project(':core:ns-sdk')
implementation project(':core:ui') implementation project(':core:ui')
implementation project(':core:utils') implementation project(':core:utils')
implementation project(':core:validators') implementation project(':core:validators')
api "androidx.appcompat:appcompat:$appcompat_version"
api "com.google.android.material:material:$material_version"
// NSClient, Tidepool // NSClient, Tidepool
api("io.socket:socket.io-client:1.0.0") { api("io.socket:socket.io-client:1.0.0") {
@ -42,17 +38,5 @@ dependencies {
api "com.squareup.retrofit2:adapter-rxjava3:$retrofit2_version" api "com.squareup.retrofit2:adapter-rxjava3:$retrofit2_version"
api "com.squareup.retrofit2:converter-gson:$retrofit2_version" api "com.squareup.retrofit2:converter-gson:$retrofit2_version"
api "com.google.code.gson:gson:$gson_version"
//SmsCommunicator
api 'com.eatthepath:java-otp:0.4.0'
api 'com.github.kenglxn.QRGen:android:2.6.0'
// Overview
api 'com.google.android.flexbox:flexbox:3.0.0'
// Food
api "androidx.work:work-runtime-ktx:$work_version"
// DataLayerListenerService
api "com.google.android.gms:play-services-wearable:$play_services_wearable_version"
} }

View file

@ -5,7 +5,6 @@ import android.os.SystemClock
import androidx.work.Worker import androidx.work.Worker
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.events.EventNewNotification
import info.nightscout.database.entities.Bolus import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.BolusCalculatorResult import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.Carbs import info.nightscout.database.entities.Carbs
@ -40,6 +39,7 @@ import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.nsclient.StoreDataForDb import info.nightscout.interfaces.nsclient.StoreDataForDb
import info.nightscout.interfaces.pump.VirtualPump import info.nightscout.interfaces.pump.VirtualPump
import info.nightscout.interfaces.source.NSClientSource import info.nightscout.interfaces.source.NSClientSource
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.R
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNSClientNewLog import info.nightscout.rx.events.EventNSClientNewLog
@ -72,7 +72,8 @@ class StoreDataForDbImpl @Inject constructor(
private val config: Config, private val config: Config,
private val nsClientSource: NSClientSource, private val nsClientSource: NSClientSource,
private val xDripBroadcast: XDripBroadcast, private val xDripBroadcast: XDripBroadcast,
private val virtualPump: VirtualPump private val virtualPump: VirtualPump,
private val activityNames: ActivityNames
) : StoreDataForDb { ) : StoreDataForDb {
override val glucoseValues: MutableList<TransactionGlucoseValue> = mutableListOf() override val glucoseValues: MutableList<TransactionGlucoseValue> = mutableListOf()
@ -528,7 +529,7 @@ class StoreDataForDbImpl @Inject constructor(
it.enteredBy != sp.getString("careportal_enteredby", "AndroidAPS") it.enteredBy != sp.getString("careportal_enteredby", "AndroidAPS")
) { ) {
if (sp.getBoolean(R.string.key_ns_announcements, config.NSCLIENT)) if (sp.getBoolean(R.string.key_ns_announcements, config.NSCLIENT))
rxBus.send(EventNewNotification(Notification(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60))) activityNames.addNotificationValidFor(Notification.NS_ANNOUNCEMENT, it.note ?: "", Notification.ANNOUNCEMENT, 60)
} }
} }
if (therapyEvents.isNotEmpty()) if (therapyEvents.isNotEmpty())

View file

@ -12,17 +12,17 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreference import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.nsclient.NSAlarm
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.sync.DataSyncSelector import info.nightscout.interfaces.sync.DataSyncSelector
import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.NsClient
import info.nightscout.interfaces.sync.Sync import info.nightscout.interfaces.sync.Sync
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.HtmlHelper.fromHtml import info.nightscout.interfaces.utils.HtmlHelper.fromHtml
import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.R
import info.nightscout.plugins.sync.nsShared.NSClientFragment import info.nightscout.plugins.sync.nsShared.NSClientFragment
@ -30,7 +30,6 @@ import info.nightscout.plugins.sync.nsShared.events.EventNSClientResend
import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus
import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI
import info.nightscout.plugins.sync.nsclient.data.AlarmAck import info.nightscout.plugins.sync.nsclient.data.AlarmAck
import info.nightscout.interfaces.nsclient.NSAlarm
import info.nightscout.plugins.sync.nsclient.services.NSClientService import info.nightscout.plugins.sync.nsclient.services.NSClientService
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
@ -61,7 +60,8 @@ class NSClientPlugin @Inject constructor(
private val sp: SP, private val sp: SP,
private val nsClientReceiverDelegate: NsClientReceiverDelegate, private val nsClientReceiverDelegate: NsClientReceiverDelegate,
private val config: Config, private val config: Config,
private val dataSyncSelector: DataSyncSelector private val dataSyncSelector: DataSyncSelector,
private val activityNames: ActivityNames
) : NsClient, Sync, PluginBase( ) : NsClient, Sync, PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.SYNC) .mainType(PluginType.SYNC)
@ -185,7 +185,7 @@ class NSClientPlugin @Inject constructor(
} }
return fromHtml(newTextLog.toString()) return fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) { } catch (e: OutOfMemoryError) {
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error) activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error)
} }
return fromHtml("") return fromHtml("")
} }

View file

@ -2,7 +2,6 @@ package info.nightscout.plugins.sync.nsclient.data
import android.content.Context import android.content.Context
import info.nightscout.androidaps.annotations.OpenForTesting import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.core.events.EventNewNotification
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.database.entities.UserEntry import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Action
@ -11,6 +10,7 @@ import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.notifications.Notification import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.nsclient.NSSettingsStatus import info.nightscout.interfaces.nsclient.NSSettingsStatus
import info.nightscout.interfaces.profile.DefaultValueHelper import info.nightscout.interfaces.profile.DefaultValueHelper
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.JsonHelper import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.R
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
@ -123,7 +123,8 @@ class NSSettingsStatusImpl @Inject constructor(
private val defaultValueHelper: DefaultValueHelper, private val defaultValueHelper: DefaultValueHelper,
private val sp: SP, private val sp: SP,
private val config: Config, private val config: Config,
private val uel: UserEntryLogger private val uel: UserEntryLogger,
private val activityNames: ActivityNames
) : NSSettingsStatus { ) : NSSettingsStatus {
// ***** PUMP STATUS ****** // ***** PUMP STATUS ******
@ -150,8 +151,7 @@ class NSSettingsStatusImpl @Inject constructor(
data = status data = status
aapsLogger.debug(LTag.NSCLIENT, "Got versions: Nightscout: ${getVersion()}") aapsLogger.debug(LTag.NSCLIENT, "Got versions: Nightscout: ${getVersion()}")
if (getVersionNum() < config.SUPPORTEDNSVERSION) { if (getVersionNum() < config.SUPPORTEDNSVERSION) {
val notification = Notification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL) activityNames.addNotification(Notification.OLD_NS, rh.gs(R.string.unsupported_ns_version), Notification.NORMAL)
rxBus.send(EventNewNotification(notification))
} else { } else {
rxBus.send(EventDismissNotification(Notification.OLD_NS)) rxBus.send(EventDismissNotification(Notification.OLD_NS))
} }

View file

@ -12,16 +12,16 @@ import androidx.work.OneTimeWorkRequest
import androidx.work.WorkInfo import androidx.work.WorkInfo
import androidx.work.WorkManager import androidx.work.WorkManager
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.nsclient.NSAlarm
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.sync.NsClient import info.nightscout.interfaces.sync.NsClient
import info.nightscout.interfaces.sync.Sync import info.nightscout.interfaces.sync.Sync
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.R
import info.nightscout.plugins.sync.nsShared.NSClientFragment import info.nightscout.plugins.sync.nsShared.NSClientFragment
@ -29,7 +29,6 @@ import info.nightscout.plugins.sync.nsShared.events.EventNSClientResend
import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus import info.nightscout.plugins.sync.nsShared.events.EventNSClientStatus
import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI import info.nightscout.plugins.sync.nsShared.events.EventNSClientUpdateGUI
import info.nightscout.plugins.sync.nsclient.NsClientReceiverDelegate import info.nightscout.plugins.sync.nsclient.NsClientReceiverDelegate
import info.nightscout.interfaces.nsclient.NSAlarm
import info.nightscout.plugins.sync.nsclient.data.AlarmAck import info.nightscout.plugins.sync.nsclient.data.AlarmAck
import info.nightscout.plugins.sync.nsclient.services.NSClientService import info.nightscout.plugins.sync.nsclient.services.NSClientService
import info.nightscout.plugins.sync.nsclientV3.workers.LoadBgWorker import info.nightscout.plugins.sync.nsclientV3.workers.LoadBgWorker
@ -71,7 +70,8 @@ class NSClientV3Plugin @Inject constructor(
private val sp: SP, private val sp: SP,
private val nsClientReceiverDelegate: NsClientReceiverDelegate, private val nsClientReceiverDelegate: NsClientReceiverDelegate,
private val config: Config, private val config: Config,
private val dateUtil: DateUtil private val dateUtil: DateUtil,
private val activityNames: ActivityNames
) : NsClient, Sync, PluginBase( ) : NsClient, Sync, PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.SYNC) .mainType(PluginType.SYNC)
@ -225,7 +225,7 @@ class NSClientV3Plugin @Inject constructor(
} }
return HtmlHelper.fromHtml(newTextLog.toString()) return HtmlHelper.fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) { } catch (e: OutOfMemoryError) {
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error) activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error)
} }
return HtmlHelper.fromHtml("") return HtmlHelper.fromHtml("")
} }

View file

@ -5,15 +5,14 @@ import android.text.Spanned
import androidx.preference.Preference import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.interfaces.Constants import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.receivers.ReceiverStatusStore
import info.nightscout.interfaces.sync.Sync import info.nightscout.interfaces.sync.Sync
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.interfaces.utils.HtmlHelper import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.plugins.sync.R import info.nightscout.plugins.sync.R
import info.nightscout.plugins.sync.tidepool.comm.TidepoolUploader import info.nightscout.plugins.sync.tidepool.comm.TidepoolUploader
@ -51,7 +50,8 @@ class TidepoolPlugin @Inject constructor(
private val uploadChunk: UploadChunk, private val uploadChunk: UploadChunk,
private val sp: SP, private val sp: SP,
private val rateLimit: RateLimit, private val rateLimit: RateLimit,
private val receiverStatusStore: ReceiverStatusStore private val receiverStatusStore: ReceiverStatusStore,
private val activityNames: ActivityNames
) : Sync, PluginBase( ) : Sync, PluginBase(
PluginDescription() PluginDescription()
.mainType(PluginType.SYNC) .mainType(PluginType.SYNC)
@ -172,7 +172,7 @@ class TidepoolPlugin @Inject constructor(
} }
textLog = HtmlHelper.fromHtml(newTextLog.toString()) textLog = HtmlHelper.fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) { } catch (e: OutOfMemoryError) {
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error) activityNames.showToastAndNotification(context, "Out of memory!\nStop using this phone !!!", R.raw.error)
} }
} }

View file

@ -12,8 +12,6 @@ import androidx.lifecycle.Lifecycle
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
@ -21,8 +19,10 @@ import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.maintenance.ImportExportPrefs
import info.nightscout.interfaces.profile.ProfileFunction import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.userEntry.UserEntryPresentationHelper
import info.nightscout.rx.AapsSchedulers import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPreferenceChange import info.nightscout.rx.events.EventPreferenceChange