Merge branch 'dev' into wear/extract-simple-ui

This commit is contained in:
Milos Kozak 2022-12-29 09:01:17 +01:00 committed by GitHub
commit c235f18ad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 1647 additions and 3731 deletions

View file

@ -15,5 +15,5 @@ Reporting bugs
upper-right corner).
- Obtain the app's log files, which can be found on the phone in
_/storage/emulated/0/Android/data/info.nightscout.androidaps/_
See https://androidaps.readthedocs.io/en/latest/Usage/Accessing-logfiles.html
See https://wiki.aaps.app/en/latest/Usage/Accessing-logfiles.html
- Open an issue at https://github.com/nightscout/AndroidAPS/issues/new

View file

@ -7,9 +7,9 @@ General rules
=============
* There are plenty of ways you can help, some of them are listed on wiki:
https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/How-can-I-help.html
https://wiki.aaps.app/en/latest/EN/Getting-Started/How-can-I-help.html
* If you wish to help with documentation or translating:
https://androidaps.readthedocs.io/en/latest/EN/translations.html
https://wiki.aaps.app/en/latest/EN/translations.html
Development guidelines
======================

View file

@ -6,5 +6,5 @@ Reporting bugs
upper-right corner).
- Obtain the app's log files, which can be found on the phone in
_/storage/emulated/0/Android/data/info.nightscout.androidaps/_
See https://androidaps.readthedocs.io/en/latest/EN/Usage/Accessing-logfiles.html
See https://wiki.aaps.app/en/latest/EN/Usage/Accessing-logfiles.html
- Open an issue at https://github.com/nightscout/AndroidAPS/issues/new

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.workflow
import info.nightscout.interfaces.workflow.WorkerClasses
import info.nightscout.plugins.general.food.FoodPlugin
import info.nightscout.plugins.profile.ProfilePlugin
import info.nightscout.source.NSClientSourcePlugin
import javax.inject.Inject
@ -10,5 +9,4 @@ class WorkerClassesImpl @Inject constructor(): WorkerClasses{
override val nsClientSourceWorker = NSClientSourcePlugin.NSClientSourceWorker::class.java
override val nsProfileWorker = ProfilePlugin.NSProfileWorker::class.java
override val foodWorker = FoodPlugin.FoodWorker::class.java
}

View file

@ -7,7 +7,6 @@ import info.nightscout.core.pump.toHtml
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.plugins.aps.loop.extensions.json
import info.nightscout.pump.virtual.extensions.toText
import info.nightscout.plugins.sync.nsShared.extensions.log
import org.json.JSONObject
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
@ -109,15 +108,6 @@ class PumpEnactResultTest : TestBaseWithProfile() {
Assertions.assertEquals(true, per.queued)
}
@Test fun logTest() {
val per = PumpEnactResult(injector)
Assertions.assertEquals(
"Success: false Enacted: false Comment: Duration: -1 Absolute: -1.0 Percent: -1 IsPercent: false IsTempCancel: false bolusDelivered: 0.0 Queued: false",
per.log()
)
}
@Test fun toStringTest() {
var per = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
Assertions.assertEquals(

1
connectwsa.bat Normal file
View file

@ -0,0 +1 @@
adb connect 127.0.0.1:58526

View file

@ -27,11 +27,11 @@ interface StoreDataForDb {
val temporaryBasals: MutableList<TemporaryBasal>
val profileSwitches: MutableList<ProfileSwitch>
val offlineEvents: MutableList<OfflineEvent>
val foods: MutableList<Food>
val nsIdGlucoseValues: MutableList<GlucoseValue>
val nsIdBoluses: MutableList<Bolus>
val nsIdCarbs: MutableList<Carbs>
val nsIdFoods: MutableList<Food>
val nsIdTemporaryTargets: MutableList<TemporaryTarget>
val nsIdEffectiveProfileSwitches: MutableList<EffectiveProfileSwitch>
val nsIdBolusCalculatorResults: MutableList<BolusCalculatorResult>
@ -41,8 +41,10 @@ interface StoreDataForDb {
val nsIdProfileSwitches: MutableList<ProfileSwitch>
val nsIdOfflineEvents: MutableList<OfflineEvent>
val nsIdDeviceStatuses: MutableList<DeviceStatus>
val nsIdFoods: MutableList<Food>
fun storeTreatmentsToDb()
fun storeGlucoseValuesToDb()
fun storeFoodsToDb()
fun scheduleNsIdUpdate()
}

View file

@ -16,7 +16,7 @@ interface NsClient : Sync {
fun textLog(): Spanned
fun clearLog()
enum class Collection { ENTRIES, TREATMENTS}
enum class Collection { ENTRIES, TREATMENTS, FOODS }
/**
* NSC v3 does first load of all data
* next loads are using srvModified property for sync

View file

@ -5,5 +5,4 @@ import androidx.work.ListenableWorker
interface WorkerClasses {
val nsClientSourceWorker: Class<out ListenableWorker>
val nsProfileWorker: Class<out ListenableWorker>
val foodWorker: Class<out ListenableWorker>
}

View file

@ -4,14 +4,17 @@ import android.content.Context
import info.nightscout.sdk.exceptions.DateHeaderOutOfToleranceException
import info.nightscout.sdk.exceptions.InvalidAccessTokenException
import info.nightscout.sdk.exceptions.InvalidFormatNightscoutException
import info.nightscout.sdk.exceptions.UnsuccessfullNightscoutException
import info.nightscout.sdk.exceptions.UnknownResponseNightscoutException
import info.nightscout.sdk.exceptions.UnsuccessfullNightscoutException
import info.nightscout.sdk.interfaces.NSAndroidClient
import info.nightscout.sdk.localmodel.Status
import info.nightscout.sdk.localmodel.entry.NSSgvV3
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.sdk.localmodel.treatment.CreateUpdateResponse
import info.nightscout.sdk.localmodel.treatment.NSTreatment
import info.nightscout.sdk.mapper.toLocal
import info.nightscout.sdk.mapper.toNSFood
import info.nightscout.sdk.mapper.toRemoteFood
import info.nightscout.sdk.mapper.toRemoteTreatment
import info.nightscout.sdk.mapper.toSgv
import info.nightscout.sdk.mapper.toTreatment
@ -19,6 +22,7 @@ import info.nightscout.sdk.networking.NetworkStackBuilder
import info.nightscout.sdk.remotemodel.LastModified
import info.nightscout.sdk.remotemodel.RemoteDeviceStatus
import info.nightscout.sdk.remotemodel.RemoteEntry
import info.nightscout.sdk.remotemodel.RemoteFood
import info.nightscout.sdk.remotemodel.RemoteTreatment
import info.nightscout.sdk.utils.retry
import info.nightscout.sdk.utils.toNotNull
@ -140,9 +144,9 @@ class NSAndroidClientImpl(
}
}
override suspend fun getTreatmentsNewerThan(from: Long, limit: Long): List<NSTreatment> = callWrapper(dispatcher) {
override suspend fun getTreatmentsNewerThan(createdAt: String, limit: Long): List<NSTreatment> = callWrapper(dispatcher) {
val response = api.getTreatmentsNewerThan(from, limit)
val response = api.getTreatmentsNewerThan(createdAt, limit)
if (response.isSuccessful) {
return@callWrapper response.body()?.result?.map(RemoteTreatment::toTreatment).toNotNull()
} else {
@ -154,7 +158,8 @@ class NSAndroidClientImpl(
val response = api.getTreatmentsModifiedSince(from, limit)
val eTagString = response.headers()["ETag"]
val eTag = eTagString?.substring(3, eTagString.length - 1)?.toLong() ?: throw UnsuccessfullNightscoutException()
val eTag = eTagString?.substring(3, eTagString.length - 1)?.toLong()
?: throw UnsuccessfullNightscoutException()
if (response.isSuccessful) {
return@callWrapper NSAndroidClient.ReadResponse(eTag, response.body()?.result?.map(RemoteTreatment::toTreatment).toNotNull())
} else {
@ -207,6 +212,64 @@ class NSAndroidClientImpl(
}
}
override suspend fun getFoods(limit: Long): List<NSFood> = callWrapper(dispatcher) {
val response = api.getFoods(limit)
if (response.isSuccessful) {
return@callWrapper response.body()?.result?.map(RemoteFood::toNSFood).toNotNull()
} else {
throw UnsuccessfullNightscoutException()
}
}
/*
override suspend fun getFoodsModifiedSince(from: Long, limit: Long): NSAndroidClient.ReadResponse<List<NSFood>> = callWrapper(dispatcher) {
val response = api.getFoodsModifiedSince(from, limit)
val eTagString = response.headers()["ETag"]
val eTag = eTagString?.substring(3, eTagString.length - 1)?.toLong() ?: throw UnsuccessfullNightscoutException()
if (response.isSuccessful) {
return@callWrapper NSAndroidClient.ReadResponse(eTag, response.body()?.result?.map(RemoteFood::toNSFood).toNotNull())
} else {
throw UnsuccessfullNightscoutException()
}
}
*/
override suspend fun createFood(nsFood: NSFood): CreateUpdateResponse = callWrapper(dispatcher) {
val remoteFood = nsFood.toRemoteFood()
remoteFood.app = "AAPS"
val response = api.createFood(remoteFood)
if (response.isSuccessful) {
return@callWrapper CreateUpdateResponse(
response = response.code(),
identifier = response.body()?.result?.identifier ?: throw UnknownResponseNightscoutException(),
isDeduplication = response.body()?.result?.isDeduplication ?: false,
deduplicatedIdentifier = response.body()?.result?.deduplicatedIdentifier,
lastModified = response.body()?.result?.lastModified
)
} else {
throw UnsuccessfullNightscoutException()
}
}
override suspend fun updateFood(nsFood: NSFood): CreateUpdateResponse = callWrapper(dispatcher) {
val remoteFood = nsFood.toRemoteFood()
val response = api.updateFood(remoteFood)
if (response.isSuccessful) {
return@callWrapper CreateUpdateResponse(
response = response.code(),
identifier = response.body()?.result?.identifier ?: throw UnknownResponseNightscoutException(),
isDeduplication = response.body()?.result?.isDeduplication ?: false,
deduplicatedIdentifier = response.body()?.result?.deduplicatedIdentifier,
lastModified = response.body()?.result?.lastModified
)
} else {
throw UnsuccessfullNightscoutException()
}
}
private suspend fun <T> callWrapper(dispatcher: CoroutineDispatcher, block: suspend () -> T): T =
withContext(dispatcher) {
retry(

View file

@ -2,6 +2,7 @@ package info.nightscout.sdk.interfaces
import info.nightscout.sdk.localmodel.Status
import info.nightscout.sdk.localmodel.entry.NSSgvV3
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.sdk.localmodel.treatment.CreateUpdateResponse
import info.nightscout.sdk.localmodel.treatment.NSTreatment
import info.nightscout.sdk.remotemodel.LastModified
@ -23,9 +24,13 @@ interface NSAndroidClient {
suspend fun getSgvs(): List<NSSgvV3>
suspend fun getSgvsModifiedSince(from: Long, limit: Long): ReadResponse<List<NSSgvV3>>
suspend fun getSgvsNewerThan(from: Long, limit: Long): List<NSSgvV3>
suspend fun getTreatmentsNewerThan(from: Long, limit: Long): List<NSTreatment>
suspend fun getTreatmentsNewerThan(createdAt: String, limit: Long): List<NSTreatment>
suspend fun getTreatmentsModifiedSince(from: Long, limit: Long): ReadResponse<List<NSTreatment>>
suspend fun getDeviceStatusModifiedSince(from: Long): List<RemoteDeviceStatus>
suspend fun createTreatment(nsTreatment: NSTreatment): CreateUpdateResponse
suspend fun updateTreatment(nsTreatment: NSTreatment): CreateUpdateResponse
suspend fun getFoods(limit: Long): List<NSFood>
//suspend fun getFoodsModifiedSince(from: Long, limit: Long): ReadResponse<List<NSFood>>
suspend fun createFood(nsFood: NSFood): CreateUpdateResponse
suspend fun updateFood(nsFood: NSFood): CreateUpdateResponse
}

View file

@ -0,0 +1,30 @@
package info.nightscout.sdk.localmodel.food
import info.nightscout.sdk.localmodel.entry.NsUnits
data class NSFood(
val date: Long,
val device: String? = null,
val identifier: String?,
val units: NsUnits? = null,
val srvModified: Long? = null,
val srvCreated: Long? = null,
val subject: String? = null,
var isReadOnly: Boolean = false,
val isValid: Boolean,
var app: String? = null,
var name: String,
var category: String? = null,
var subCategory: String? = null,
// Example:
// name="juice" portion=250 units="ml" carbs=12
// means 250ml of juice has 12g of carbs
var portion: Double, // common portion in "units"
var carbs: Int, // in grams
var fat: Int? = null, // in grams
var protein: Int? = null, // in grams
var energy: Int? = null, // in kJ
var unit: String = "g",
var gi: Int? = null // not used yet
)

View file

@ -34,6 +34,7 @@ enum class EventType(val text: String) {
@SerializedName("Temp Basal Start") TEMPORARY_BASAL_START("Temp Basal Start"),
@SerializedName("Temp Basal End") TEMPORARY_BASAL_END("Temp Basal End"),
@SerializedName("") ERROR(""),
@SerializedName("<none>") NONE("<none>");
companion object {

View file

@ -0,0 +1,64 @@
package info.nightscout.sdk.mapper
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.sdk.remotemodel.RemoteFood
/**
* Convert to [RemoteFood] and back to [NSFood]
* testing purpose only
*
* @return treatment after double conversion
*/
fun NSFood.convertToRemoteAndBack(): NSFood? =
toRemoteFood().toNSFood()
internal fun RemoteFood.toNSFood(): NSFood? {
when (type) {
"food" ->
return NSFood(
date = date ?: 0L,
device = device,
identifier = identifier,
unit = unit ?: "g",
srvModified = srvModified,
srvCreated = srvCreated,
subject = subject,
isReadOnly = isReadOnly ?: false,
isValid = isValid ?: true,
name = name,
category = category,
subCategory = subcategory,
portion = portion,
carbs = carbs,
fat = fat,
protein = protein,
energy = energy,
gi = gi
)
else -> return null
}
}
internal fun NSFood.toRemoteFood(): RemoteFood =
RemoteFood(
type = "food",
date = date,
device = device,
identifier = identifier,
unit = unit,
srvModified = srvModified,
srvCreated = srvCreated,
subject = subject,
isReadOnly = isReadOnly,
isValid = isValid,
name = name,
category = category,
subcategory = subCategory,
portion = portion,
carbs = carbs,
fat = fat,
protein = protein,
energy = energy,
gi = gi
)

View file

@ -6,6 +6,7 @@ import info.nightscout.sdk.remotemodel.NSResponse
import info.nightscout.sdk.remotemodel.RemoteCreateUpdateResponse
import info.nightscout.sdk.remotemodel.RemoteDeviceStatus
import info.nightscout.sdk.remotemodel.RemoteEntry
import info.nightscout.sdk.remotemodel.RemoteFood
import info.nightscout.sdk.remotemodel.RemoteStatusResponse
import info.nightscout.sdk.remotemodel.RemoteTreatment
import retrofit2.Response
@ -48,7 +49,7 @@ internal interface NightscoutRemoteService {
suspend fun getSgvsModifiedSince(@Path("from") from: Long, @Query("limit") limit: Long): Response<NSResponse<List<RemoteEntry>>>
@GET("v3/treatments")
suspend fun getTreatmentsNewerThan(@Query(value = "date\$gt", encoded = true) date: Long, @Query("limit") limit: Long): Response<NSResponse<List<RemoteTreatment>>>
suspend fun getTreatmentsNewerThan(@Query(value = "created_at\$gt", encoded = true) createdAt: String, @Query("limit") limit: Long): Response<NSResponse<List<RemoteTreatment>>>
@GET("v3/treatments/history/{from}")
suspend fun getTreatmentsModifiedSince(@Path("from") from: Long, @Query("limit") limit: Long): Response<NSResponse<List<RemoteTreatment>>>
@ -62,4 +63,16 @@ internal interface NightscoutRemoteService {
@PUT("v3/treatments")
suspend fun updateTreatment(@Body remoteTreatment: RemoteTreatment): Response<NSResponse<RemoteCreateUpdateResponse>>
@GET("v3/food")
suspend fun getFoods(@Query("limit") limit: Long): Response<NSResponse<List<RemoteFood>>>
/*
@GET("v3/food/history/{from}")
suspend fun getFoodsModifiedSince(@Path("from") from: Long, @Query("limit") limit: Long): Response<NSResponse<List<RemoteFood>>>
*/
@POST("v3/food")
suspend fun createFood(@Body remoteFood: RemoteFood): Response<NSResponse<RemoteCreateUpdateResponse>>
@PUT("v3/food")
suspend fun updateFood(@Body remoteFood: RemoteFood): Response<NSResponse<RemoteCreateUpdateResponse>>
}

View file

@ -18,6 +18,7 @@ data class LastModified(
@SerializedName("devicestatus") var devicestatus: Long = 0, // devicestatus collection
@SerializedName("entries") var entries: Long = 0, // entries collection
@SerializedName("profile") var profile: Long = 0, // profile collection
@SerializedName("treatments") var treatments: Long = 0 // treatments collection
@SerializedName("treatments") var treatments: Long = 0, // treatments collection
@SerializedName("foods") var foods: Long = 0 // foods collection
)
}

View file

@ -0,0 +1,41 @@
package info.nightscout.sdk.remotemodel
import com.google.gson.annotations.SerializedName
/**
* Depending on the type, different other fields are present.
* Those technically need to be optional.
*
* On upload a sanity check still needs to be done to verify that all mandatory fields for that type are there.
*
**/
internal data class RemoteFood(
@SerializedName("type") val type: String, // we are interesting in type "food"
@SerializedName("date") val date: Long?,
@SerializedName("name") val name: String,
@SerializedName("category") val category: String?,
@SerializedName("subcategory") val subcategory: String?,
@SerializedName("unit") val unit: String?,
@SerializedName("portion") val portion: Double,
@SerializedName("carbs") val carbs: Int,
@SerializedName("gi") val gi: Int?,
@SerializedName("energy") val energy: Int?,
@SerializedName("protein") val protein: Int?,
@SerializedName("fat") val fat: Int?,
@SerializedName("identifier")
val identifier: String?, // string Main addressing, required field that identifies document in the collection. The client should not create the identifier, the server automatically assigns it when the document is inserted.
@SerializedName("isValid")
val isValid: Boolean?, // A flag set by the server only for deleted documents. This field appears only within history operation and for documents which were deleted by API v3 (and they always have a false value)
@SerializedName("isReadOnly")
val isReadOnly: Boolean?, // A flag set by client that locks the document from any changes. Every document marked with isReadOnly=true is forever immutable and cannot even be deleted.
@SerializedName("app") var app: String? = null, // Application or system in which the record was entered by human or device for the first time.
@SerializedName("device") val device: String? = null, // string The device from which the data originated (including serial number of the device, if it is relevant and safe).
@SerializedName("srvCreated")
val srvCreated: Long? = null, // integer($int64) example: 1525383610088 The server's timestamp of document insertion into the database (Unix epoch in ms). This field appears only for documents which were inserted by API v3.
@SerializedName("subject")
val subject: String? = null, // string Name of the security subject (within Nightscout scope) which has created the document. This field is automatically set by the server from the passed token or JWT.
@SerializedName("srvModified")
val srvModified: Long? = null, // integer($int64) example: 1525383610088 The server's timestamp of the last document modification in the database (Unix epoch in ms). This field appears only for documents which were somehow modified by API v3 (inserted, updated or deleted).
@SerializedName("modifiedBy")
val modifiedBy: String? = null // string Name of the security subject (within Nightscout scope) which has patched or deleted the document for the last time. This field is automatically set by the server.
)

View file

@ -3,32 +3,33 @@ package info.nightscout.database.impl.transactions
import info.nightscout.database.entities.Food
/**
* Sync the TherapyEvents from NS
* Sync the Foods from NS
*/
class SyncNsFoodTransaction(private val food: Food) : Transaction<SyncNsFoodTransaction.TransactionResult>() {
class SyncNsFoodTransaction(private val foods: List<Food>) : Transaction<SyncNsFoodTransaction.TransactionResult>() {
override fun run(): TransactionResult {
val result = TransactionResult()
val current: Food? =
food.interfaceIDs.nightscoutId?.let {
database.foodDao.findByNSId(it)
}
for (food in foods) {
val current: Food? =
food.interfaceIDs.nightscoutId?.let {
database.foodDao.findByNSId(it)
}
if (current != null) {
// nsId exists, update if different
if (!current.contentEqualsTo(food)) {
current.copyFrom(food)
database.foodDao.updateExistingEntry(current)
if (food.isValid && current.isValid) result.updated.add(current)
else if (!food.isValid && current.isValid) result.invalidated.add(current)
if (current != null) {
// nsId exists, update if different
if (!current.contentEqualsTo(food)) {
current.copyFrom(food)
database.foodDao.updateExistingEntry(current)
if (food.isValid && current.isValid) result.updated.add(current)
else if (!food.isValid && current.isValid) result.invalidated.add(current)
}
} else {
// not known nsId, add
database.foodDao.insertNewEntry(food)
result.inserted.add(food)
}
return result
}
// not known nsId, add
database.foodDao.insertNewEntry(food)
result.inserted.add(food)
return result
}

View file

@ -41,7 +41,7 @@
<string name="setupwizard_loop_description">Press the button below to enable AAPS to suggest/make basal changes</string>
<string name="key_setupwizard_processed" translatable="false">startupwizard_processed</string>
<string name="setupwizard_sensitivity_description">Sensitivity plugin is used for sensitivity detection and COB calculation. For more info visit:</string>
<string name="setupwizard_sensitivity_url">https://androidaps.readthedocs.io/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="setupwizard_sensitivity_url">https://wiki.aaps.app/en/latest/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="setupwizard_aps_description">Select one from availables algorithms. They are sorted from oldest to newest. Newer algorithm is usually more powerful and more aggressive. Thus if you are new looper you may probably start with AMA and not with latest one. Do not forget to read the OpenAPS documentation and configure it before use.</string>
<string name="setupwizard_pump_waiting_for_riley_link_connection">Please configure your RileyLink below. After selecting a RileyLink, it will be possible to continue setup once the RileyLink status is \"Connected\". This might take a minute.\n</string>
<string name="setupwizard_pump_pump_not_initialized"><b>Note:</b> You can continue setup once the pump has been set up.\n</string>

View file

@ -4,7 +4,7 @@
<string name="dia_label_exam">Duration of Insulin Action (DIA)</string>
<string name="dia_profile">You should set the value for DIA in your profile.</string>
<string name="dia_minimumis5h">The minimum allowed value is 5 hours.</string>
<string name="dia_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html?#insulin</string>
<string name="dia_hint1">https://wiki.aaps.app/en/latest/EN/Configuration/Config-Builder.html?#insulin</string>
<string name="dia_meaningisequaltodiapump">If you are satisfied that the value for DIA that you used in your pump prior to AAPS worked well, there is no need to change this when you start looping.</string>
<string name="dia_valuemustbedetermined">You should determine for yourself the appropriate value for DIA.</string>
<string name="hypott_label">Hypo Temp-Target</string>
@ -13,18 +13,18 @@
<string name="hypott_preventoversmb">To prevent AAPS from overcorrecting for a blood glucose rise caused by the fast acting carbs used to treat a hypo.</string>
<string name="hypott_exercise">To correct for a hypo induced as a result of exercise.</string>
<string name="hypott_0basal">To prevent blood glucose from going low if there is already a 0% temporary basal rate running.</string>
<string name="hypott_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html</string>
<string name="hypott_hint1">https://wiki.aaps.app/en/latest/EN/Usage/temptarget.html</string>
<string name="offlineprofile_whatprofile">Which profile can be used and configured offline?</string>
<string name="offlineprofile_label">Topic: Offline Profile</string>
<string name="offlineprofile_nsprofile">NS Profile can be used, but not configured.</string>
<string name="offlineprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#profile</string>
<string name="offlineprofile_hint1">https://wiki.aaps.app/en/latest/EN/Configuration/Config-Builder.html#profile</string>
<string name="pumpdisconnect_label">Reasons for applying "Disconnect pump" in AAPS</string>
<string name="pumpdisconnect_whattodo">What should be done when disconnecting the pump?</string>
<string name="pumpdisconnect_unnecessary">This is unnecessary as insulin will not be delivered if the pump is physically disconnected.</string>
<string name="pumpdisconnect_missinginsulin">It prevents AAPS from accounting for insulin that was not delivered whilst the pump is physically disconnected. </string>
<string name="pumpdisconnect_notstop">It will not stop insulin delivery if the pump remains connected.</string>
<string name="pumpdisconnect_openloop">It will send AAPS into open loop mode.</string>
<string name="pumpdisconnect_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#other-settings</string>
<string name="pumpdisconnect_hint1">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#other-settings</string>
<string name="objectives_label">AAPS Settings</string>
<string name="objectives2_label">AAPS Settings</string>
<string name="objectives_howtosave">What are the best practices for backing up your settings?</string>
@ -36,29 +36,29 @@
<string name="objectives2_internalstorage">Your settings file is found in the folder Internal Storage/AAPS/preferences on your phone.</string>
<string name="objectives2_cloud">Copy your preferences file to a safe location outside of your phone (e.g. by using a cloud drive, connecting a cable to a computer, email, etc.)</string>
<string name="objectives2_easyrestore">If your phone is damaged or lost, there are easy ways to remotely recover your settings without a backup.</string>
<string name="objectives_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/ExportImportSettings.html</string>
<string name="objectives_hint2">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
<string name="objectives_hint1">https://wiki.aaps.app/en/latest/EN/Usage/ExportImportSettings.html</string>
<string name="objectives_hint2">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#what-emergency-equipment-is-recommended-to-take-with-me</string>
<string name="noisycgm_label">Noisy CGM Readings</string>
<string name="noisycgm_whattodo">What should be done if CGM data is noisy?</string>
<string name="noisycgm_nothing">Do nothing - AAPS will deal with it.</string>
<string name="noisycgm_pause">Disable the closed loop to avoid possible over or underdosing.</string>
<string name="noisycgm_replacesensor">Replace consistently noisy or inaccurate sensors.</string>
<string name="noisycgm_checksmoothing">Verify that your CGM app provides smoothed data.</string>
<string name="noisycgm_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
<string name="noisycgm_hint1">https://wiki.aaps.app/en/latest/EN/Usage/Smoothing-Blood-Glucose-Data-in-xDrip.html#smoothing-blood-glucose-data</string>
<string name="exerciseprofile_label">Exercise and Profiles</string>
<string name="exerciseprofile_whattodo">How can you use profiles to best help the system deal with aerobic exercise?</string>
<string name="exerciseprofile_switchprofilebelow100">Do a profile switch to less than 100%.</string>
<string name="exerciseprofile_switchprofileabove100">Do a profile switch to more than 100%.</string>
<string name="exerciseprofile_leaveat100">Leave the profile set to 100%.</string>
<string name="exerciseprofile_suspendloop">Suspend the loop.</string>
<string name="exerciseprofile_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="exerciseprofile_hint1">https://wiki.aaps.app/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="exercise_label">Exercise and Temporary Targets</string>
<string name="exercise_whattodo">How can you use temporary targets to best help the system deal with aerobic exercise?</string>
<string name="exercise_settt">Set an activity blood glucose target starting a suitable time before beginning exercise.</string>
<string name="exercise_setfinished">Set an activity blood glucose target after finishing exercise.</string>
<string name="exercise_setunchanged">Leave your blood glucose target unchanged.</string>
<string name="exercise_15g">Wait until blood glucose drops below your hypo temp target and then eat 15 g of fast acting carbohydrates.</string>
<string name="exercise_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="exercise_hint1">https://wiki.aaps.app/en/latest/EN/Usage/temptarget.html#activity-temp-target</string>
<string name="suspendloop_doigetinsulin">Do I receive insulin when the loop is disabled/suspended?</string>
<string name="suspendloop_yes">Yes, basal insulin continues to be delivered.</string>
<string name="suspendloop_no">No, delivery of insulin is stopped.</string>
@ -68,7 +68,7 @@
<string name="basaltest_havingregularhighlow">When experiencing frequent high or low blood glucose.</string>
<string name="basaltest_weekly">At least once per week.</string>
<string name="basaltest_fixed">Once set and validated, these values should not change over time.</string>
<string name="basaltest_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#androidaps-settings</string>
<string name="basaltest_hint1">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#androidaps-settings</string>
<string name="prerequisites_label">Prerequisites</string>
<string name="prerequisites_what">What is essential to set up and use AAPS?</string>
<string name="prerequisites_determinedcorrectprofile">Validated profile information (Basal, IC, ISF, DIA).</string>
@ -81,7 +81,7 @@
<string name="prerequisites_githubaccount">A Github account.</string>
<string name="prerequisites_beanandroiddeveloper">Experience in programming or editing code.</string>
<string name="prerequisites_own670g">A MiniMed 670G pump.</string>
<string name="prerequisites_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="prerequisites_hint1">https://wiki.aaps.app/en/latest/EN/Module/module.html</string>
<string name="prerequisites_smartwatch">A Smartwatch.</string>
<string name="prerequisites_supportedcgm">A Supported CGM.</string>
<string name="prerequisites2_label">Prerequisites</string>
@ -90,7 +90,7 @@
<string name="prerequisites2_device">A compatible Android device (e.g. mobile/cell phone, full Android watch, or tablet).</string>
<string name="prerequisites2_internet">AAPS requires an internet connection in order to run in closed loop.</string>
<string name="prerequisites2_supportedcgm">A supported CGM and appropriate app to receive blood glucose values on the phone/device.</string>
<string name="prerequisites2_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html</string>
<string name="prerequisites2_hint1">https://wiki.aaps.app/en/latest/EN/Module/module.html</string>
<string name="update_label">Updating AAPS</string>
<string name="whatistrue">Check all correct answers.</string>
<string name="update_git">You need to have Git installed and configured on your computer.</string>
@ -98,14 +98,14 @@
<string name="update_keys">You should save and note the location of your keystore and use the same signing key for updates as for your previous installation.</string>
<string name="update_neverupdate">Never update if the system is working well.</string>
<string name="update_askfriend">If you have difficulty building the apk, you can install an apk that has been built by a friend.</string>
<string name="update_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
<string name="update_hint1">https://wiki.aaps.app/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#update-to-a-new-version-or-branch</string>
<string name="troubleshooting_label">Troubleshooting</string>
<string name="troubleshooting_wheretoask">Where can you look for help with AAPS?</string>
<string name="troubleshooting_fb">You can ask for advice in the AAPS Users Facebook group.</string>
<string name="troubleshooting_wiki">You should read (and re-read) the AAPS documentation.</string>
<string name="troubleshooting_gitter">You can ask for advice and log technical problems or issues in the AAPS Discord.</string>
<string name="troubleshooting_yourendo">You should ask your diabetes clinic/endocrinologist.</string>
<string name="troubleshooting_hint1">https://androidaps.readthedocs.io/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#troubleshooting</string>
<string name="troubleshooting_hint1">https://wiki.aaps.app/en/latest/EN/Installing-AndroidAPS/Update-to-new-version.html#troubleshooting</string>
<string name="troubleshooting_hint2">https://www.facebook.com/groups/AndroidAPSUsers/</string>
<string name="troubleshooting_hint3">https://discord.gg/4fQUWHZ4Mw</string>
<string name="insulin_plugins">Insulin Plugins</string>
@ -114,15 +114,15 @@
<string name="insulin_novorapid">NovoRapid®/Novolog®</string>
<string name="insulin_humalog">Humalog®</string>
<string name="insulin_actrapid">Actrapid®/Humalin R®/"regular" human insulin.</string>
<string name="insulin_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Config-Builder.html#insulin</string>
<string name="insulin_hint1">https://wiki.aaps.app/en/latest/EN/Configuration/Config-Builder.html#insulin</string>
<string name="sensitivity_label">Sensitivity Plugins</string>
<string name="sensitivity_which">Check all correct answers.</string>
<string name="sensitivity_adjust">Sensitivity plugins allow AAPS to adjust for temporary or short-lived changes in insulin sensitivity (for example hormonal changes or issues with absorption at the infusion site).</string>
<string name="sensitivity_edit">Sensitivity plugins provide the user with suggested changes to basal rates, I:C ratios and ISF that can be used to edit profile.</string>
<string name="sensitivity_cannula">Logging a cannula change will reset Autosens ratio back to 100%.</string>
<string name="sensitivity_time">Some of the plugin options have configurable time ranges that can be set by the user.</string>
<string name="sensitivity_hint1">https://androidaps.readthedocs.io/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="sensitivity_hint2">https://androidaps.readthedocs.io/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens</string>
<string name="sensitivity_hint1">https://wiki.aaps.app/en/latest/EN/Configuration/Sensitivity-detection-and-COB.html</string>
<string name="sensitivity_hint2">https://wiki.aaps.app/en/latest/Usage/Open-APS-features.html?highlight=Autosens#autosens</string>
<string name="wrongcarbs_label">Carb Entry Errors</string>
<string name="wrongcarbs_whattodo">What should you do if youve made an incorrect carb entry?</string>
<string name="wrongcarbs_treatmentstab">Delete the incorrect entry in Treatments and enter the correct new carb value.</string>
@ -157,29 +157,29 @@
<string name="breadgrams_exchange">Carbohydrates consumed can be recorded using an appropriate exchange system (e.g. DAFNE "CHO" exchanges or European "Bread Units").</string>
<string name="breadgrams_decay">AAPS uses a dynamic model to estimate carb “decay” and calculate COB.</string>
<string name="breadgrams_calc">If blood glucose levels are outside acceptable values (too low or too high) the bolus calculator can be used to provide suggestions for carb or insulin corrections.</string>
<string name="breadgrams_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
<string name="breadgrams_hint1">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
<string name="extendedcarbs_label">e-carbs</string>
<string name="extendedcarbs_handling">What could you use e-carbs (extended carbs) for?</string>
<string name="extendedcarbs_future">To schedule carbs in the future, possibly distributed over an interval (similar to an extended bolus distributing insulin over an interval).</string>
<string name="extendedcarbs_free">For logging \'free\' exercise carbs you want to hide from AAPS.</string>
<string name="extendedcarbs_fat">e-carbs (distributed in the future) can assist AAPS in dealing with high fat/protein meals.</string>
<string name="extendedcarbs_rescue">For logging rescue carbs you use to treat low blood glucose. </string>
<string name="extendedcarbs_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Extended-Carbs.html</string>
<string name="extendedcarbs_hint1">https://wiki.aaps.app/en/latest/EN/Usage/Extended-Carbs.html</string>
<string name="nsclient_label">Remote Monitoring</string>
<string name="nsclient_howcanyou">How can you monitor AAPS (for example for your child) remotely?</string>
<string name="nsclient_nightscout">AAPSClient app, Nightscout app and Nightscout webpage all allow you to follow AAPS remotely.</string>
<string name="nsclient_dexcomfollow">Other apps (e.g. Dexcom follow, xDrip running in follow mode) allow you to follow some parameters (e.g. blood glucose/sensor values) remotely, but use different algorithms so may have inaccurate IOB or COB values.</string>
<string name="nsclient_data">To follow AAPS remotely, both devices must have internet access (e.g. via Wi-Fi or mobile/cellular network data).</string>
<string name="nsclient_fullcontrol">AAPSClient used as a remote follower will both monitor and provide full control of AAPS.</string>
<string name="nsclient_hint1">https://androidaps.readthedocs.io/en/latest/EN/Children/Children.html</string>
<string name="nsclient_hint1">https://wiki.aaps.app/en/latest/EN/Children/Children.html</string>
<string name="isf_label_exam">Insulin Sensitivity Factor (ISF)</string>
<string name="isf_increasingvalue">Raising ISF values will lead to more insulin delivery to cover a specific amount of carbs.</string>
<string name="isf_decreasingvalue">Reducing ISF values lead to more insulin delivery to correct for an above target blood glucose.</string>
<string name="isf_noeffect">Raising or lowering ISF has no effect on insulin delivery when blood glucose levels are below target.</string>
<string name="isf_preferences">ISF should be entered in your AAPS Preferences.</string>
<string name="isf_profile">Changing the ISF value in your profile is enough to apply the change.</string>
<string name="isf_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#insulin-sensitivity-factor-isf-mmol-l-u-or-mg-dl-u</string>
<string name="isf_hint2">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html</string>
<string name="isf_hint1">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#insulin-sensitivity-factor-isf-mmol-l-u-or-mg-dl-u</string>
<string name="isf_hint2">https://wiki.aaps.app/en/latest/EN/Usage/Profiles.html</string>
<string name="ic_multiple">You can use more than one value for I:C ratio in your profile.</string>
<string name="ic_isf">If you change your ISF in your profile you should always change your I:C ratio too.</string>
<string name="ic_label_exam">Insulin to Carbohydrate Ratio (I:C ratio)</string>
@ -188,14 +188,14 @@
<string name="ic_noeffect">If you have 0 COB, changing the IC ratio will lead to a different amount of insulin to correct a given BG value.</string>
<string name="ic_different">IC will be different if you count bread (exchange) unit as 10g or 12g.</string>
<string name="ic_meaning">IC meaning is: How many bread (exchange) units are covered by 1U of insulin.</string>
<string name="ic_hint1">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#carbohydrate-to-insulin-ratio-cr-g-u</string>
<string name="ic_hint1">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#carbohydrate-to-insulin-ratio-cr-g-u</string>
<string name="profileswitch_label">Profile Switching</string>
<string name="profileswitch_pctwillchange"> When specifying a 90% profile switch, which answers are true?</string>
<string name="profileswitch_basallower">Basal rates will be 10% lower.</string>
<string name="profileswitch_isfhigher">ISF will be 10% higher.</string>
<string name="profileswitch_iclower">The value of the I:C ratio will be a 10% lower number.</string>
<string name="profileswitch_unchanged">ISF and I:C ratios will be unchanged.</string>
<string name="profileswitch_hint1" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#profile-switch</string>
<string name="profileswitch_hint1" formatted="false">https://wiki.aaps.app/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#profile-switch</string>
<string name="profileswitch2_label">Profile Switching</string>
<string name="profileswitch2_pctwillchange"> When specifying a 120% profile switch, which answers are true?</string>
<string name="profileswitch2_bghigher">Target blood glucose will be 20% higher.</string>
@ -208,13 +208,13 @@
<string name="profileswitchtime__2">Initiate a profile switch with a timeshift of -2</string>
<string name="profileswitchtime_tt">Set an eating soon temporary target.</string>
<string name="profileswitchtime_100">Do a profile switch to more than 100%. </string>
<string name="profileswitchtime_hint1">https://androidaps.readthedocs.io/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#timeshift</string>
<string name="profileswitchtime_hint1">https://wiki.aaps.app/en/latest/EN/Usage/Profiles.html?highlight=profile%20switch#timeshift</string>
<string name="profileswitch4_label">Changes to profiles</string>
<string name="profileswitch4_rates">Basal rates, ISF, I:C ratios, etc., should be set in profiles.</string>
<string name="profileswitch4_internet">Activating changes to your Nightscout Profile requires your AAPS phone to have an internet connection.</string>
<string name="profileswitch4_sufficient">Editing profiles to change values is sufficient to enact any changes made.</string>
<string name="profileswitch4_multi">Multiple profiles can be set up and selected to accommodate changing circumstances (e.g. hormonal changes, shift working, weekdays/weekend lifestyle).</string>
<string name="basalhelp_hint1">https://androidaps.readthedocs.io/en/latest/EN/Module/module.html#good-individual-dosage-algorithm-for-your-diabetes-therapy</string>
<string name="basalhelp_hint1">https://wiki.aaps.app/en/latest/EN/Module/module.html#good-individual-dosage-algorithm-for-your-diabetes-therapy</string>
<string name="basalhelp_label">Help with basal rates</string>
<string name="basalhelp_where">Where to go for help with basalrate etc.</string>
<string name="basalhelp_diabetesteam">Your diabetes team</string>

View file

@ -29,7 +29,7 @@
<string name="objectives_smb_gate">You must read the wiki and rise maxIOB to get SMBs working fine! A good start is maxIOB=average mealbolus + 3 x max daily basal</string>
<string name="objectives_smb_learned">Using SMB is your goal. Oref1 algorithm was designed to help you with your boluses as well. You should not give full bolus for your food but only part of it and let AAPS give you the rest if needed. This way you have more space for miscalculated carbs. Did you know that you can set a percentage of bolus calculator result to reduce the size of bolus?</string>
<string name="objectives_auto_objective">Enabling automation</string>
<string name="objectives_auto_gate">Read the docs on how automation works. Set up your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. (https://androidaps.readthedocs.io/en/latest/EN/Usage/Automation.html)</string>
<string name="objectives_auto_gate">Read the docs on how automation works. Set up your first simple rules. Instead of action let AAPS display only notification. When you are sure automation is triggered at the right time replace notification by real action. (https://wiki.aaps.app/en/latest/EN/Usage/Automation.html)</string>
<string name="objectives_auto_learned">Automation can be a good servant but a bad master. Don\'t overuse it. Do not try to replace underlying algorithm. Test the rule with message only before use. It depends on order.</string>
<string name="objectives_bgavailableinns">BG available in NS</string>
<string name="objectives_pumpstatusavailableinns">Pump status available in NS</string>
@ -76,10 +76,10 @@
<string name="unfinshed_button">Next unfinished</string>
<string name="requestcode">Request code: %1$s</string>
<string name="objectives_hint">(check all correct answers)</string>
<string name="disconnectpump_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath</string>
<string name="usetemptarget_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="useaction_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#config-builder</string>
<string name="usescale_hint" formatted="false">https://androidaps.readthedocs.io/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="disconnectpump_hint" formatted="false">https://wiki.aaps.app/en/latest/EN/Getting-Started/FAQ.html#what-to-do-when-taking-a-shower-or-bath</string>
<string name="usetemptarget_hint" formatted="false">https://wiki.aaps.app/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="useaction_hint" formatted="false">https://wiki.aaps.app/en/latest/EN/Getting-Started/Screenshots.html#config-builder</string>
<string name="usescale_hint" formatted="false">https://wiki.aaps.app/en/latest/EN/Getting-Started/Screenshots.html#the-homescreen</string>
<string name="notconnected">Not connected to the internet</string>
<string name="failedretrievetime">Failed retrieve time</string>
<string name="requirementnotmet">Objective requirements not met</string>

View file

@ -3,12 +3,10 @@ package info.nightscout.plugins.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.general.food.FoodFragment
import info.nightscout.plugins.general.food.FoodPlugin
@Module
@Suppress("unused")
abstract class FoodModule {
@ContributesAndroidInjector abstract fun contributesFoodFragment(): FoodFragment
@ContributesAndroidInjector abstract fun contributesFoodWorker(): FoodPlugin.FoodWorker
}

View file

@ -1,25 +1,12 @@
package info.nightscout.plugins.general.food
import android.content.Context
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.core.extensions.foodFromJson
import info.nightscout.core.utils.receivers.DataWorkerStorage
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.database.entities.Food
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.SyncNsFoodTransaction
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.plugin.PluginType
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.plugins.R
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import org.json.JSONObject
import javax.inject.Inject
import javax.inject.Singleton
@ -37,73 +24,4 @@ class FoodPlugin @Inject constructor(
.shortName(R.string.food_short)
.description(R.string.description_food),
aapsLogger, rh, injector
) {
// cannot be inner class because of needed injection
class FoodWorker(
context: Context,
params: WorkerParameters
) : LoggingWorker(context, params) {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var repository: AppRepository
@Inject lateinit var sp: SP
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
override fun doWorkAndLog(): Result {
val foods = dataWorkerStorage.pickupJSONArray(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
?: return Result.failure(workDataOf("Error" to "missing input data"))
aapsLogger.debug(LTag.DATABASE, "Received Food Data: $foods")
var ret = Result.success()
for (index in 0 until foods.length()) {
val jsonFood: JSONObject = foods.getJSONObject(index)
if (JsonHelper.safeGetString(jsonFood, "type") != "food") continue
when (JsonHelper.safeGetString(jsonFood, "action")) {
"remove" -> {
val delFood = Food(
name = "",
portion = 0.0,
carbs = 0,
isValid = false
).also { it.interfaceIDs.nightscoutId = JsonHelper.safeGetString(jsonFood, "_id") }
repository.runTransactionForResult(SyncNsFoodTransaction(delFood))
.doOnError {
aapsLogger.error(LTag.DATABASE, "Error while removing food", it)
ret = Result.failure(workDataOf("Error" to it.toString()))
}
.blockingGet()
.also {
it.invalidated.forEach { f -> aapsLogger.debug(LTag.DATABASE, "Invalidated food ${f.interfaceIDs.nightscoutId}") }
}
}
else -> {
val food = foodFromJson(jsonFood)
if (food != null) {
repository.runTransactionForResult(SyncNsFoodTransaction(food))
.doOnError {
aapsLogger.error(LTag.DATABASE, "Error while adding/updating food", it)
ret = Result.failure(workDataOf("Error" to it.toString()))
}
.blockingGet()
.also { result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted food $it") }
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated food $it") }
result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated food $it") }
}
} else {
aapsLogger.error(LTag.DATABASE, "Error parsing food", jsonFood.toString())
ret = Result.failure(workDataOf("Error" to "Error parsing food"))
}
}
}
}
return ret
}
}
}
)

View file

@ -152,8 +152,11 @@ class AutosensDataStoreObject : AutosensDataStore {
}
var diff = abs(someTime - referenceTime)
diff %= T.mins(5).msecs()
if (diff > T.mins(2).plus(T.secs(30)).msecs()) diff -= T.mins(5).msecs()
return someTime + diff
if (diff > T.mins(2).plus(T.secs(30)).msecs()){
return someTime + abs(diff - T.mins(5).msecs()) // Adjust to the future
} else {
return someTime - diff // adjust to the past
}
}
fun isAbout5minData(aapsLogger: AAPSLogger): Boolean {
@ -222,7 +225,7 @@ class AutosensDataStoreObject : AutosensDataStore {
return
}
val newBucketedData = ArrayList<InMemoryGlucoseValue>()
var currentTime = bgReadings[0].timestamp - bgReadings[0].timestamp % T.mins(5).msecs()
var currentTime = bgReadings[0].timestamp
val adjustedTime = adjustToReferenceTime(currentTime)
// after adjusting time may be newer. In this case use T-5min
currentTime = if (adjustedTime > currentTime) adjustedTime - T.mins(5).msecs() else adjustedTime

View file

@ -1150,6 +1150,177 @@ class AutosensDataStoreTest : TestBase() {
Assertions.assertEquals(false, autosensDataStore.isAbout5minData(aapsLogger))
}
@Test
fun createBucketedData5minTest3() {
val bgReadingList: MutableList<GlucoseValue> = ArrayList()
// non 5min data not aligned to referenceTime should be recalculated to referenceTime
autosensDataStore.referenceTime = T.mins(5).msecs()
bgReadingList.clear()
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 100.0,
timestamp = T.mins(48).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 98.0,
timestamp = T.mins(42).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 90.0,
timestamp = T.mins(40).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 40.0,
timestamp = T.mins(18).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
autosensDataStore.bgReadings = bgReadingList
Assertions.assertEquals(false, autosensDataStore.isAbout5minData(aapsLogger))
autosensDataStore.createBucketedData(aapsLogger, dateUtil)
Assertions.assertEquals(T.mins(45).msecs(), autosensDataStore.bucketedData!![0].timestamp)
Assertions.assertEquals(T.mins(35).msecs(), autosensDataStore.bucketedData!![2].timestamp)
Assertions.assertEquals(T.mins(20).msecs(), autosensDataStore.bucketedData!![5].timestamp)
Assertions.assertEquals(6, autosensDataStore.bucketedData!!.size.toLong())
Assertions.assertEquals(99.0, autosensDataStore.bucketedData!![0].value, 1.0) // Recalculated data to 45min
Assertions.assertEquals(90.0, autosensDataStore.bucketedData!![1].value, 1.0) // Recalculated data to 40min
Assertions.assertEquals(67.0, autosensDataStore.bucketedData!![3].value, 1.0) // Recalculated data to 30min
Assertions.assertEquals(45.0, autosensDataStore.bucketedData!![5].value, 1.0) // Recalculated data to 20min
// non 5min data not aligned to referenceTime should be recalculated to referenceTime
autosensDataStore.referenceTime = T.mins(5).msecs()
bgReadingList.clear()
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 100.0,
timestamp = T.mins(46).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 98.0,
timestamp = T.mins(42).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 90.0,
timestamp = T.mins(40).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 40.0,
timestamp = T.mins(18).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
autosensDataStore.bgReadings = bgReadingList
Assertions.assertEquals(false, autosensDataStore.isAbout5minData(aapsLogger))
autosensDataStore.createBucketedData(aapsLogger, dateUtil)
Assertions.assertEquals(T.mins(45).msecs(), autosensDataStore.bucketedData!![0].timestamp)
Assertions.assertEquals(T.mins(35).msecs(), autosensDataStore.bucketedData!![2].timestamp)
Assertions.assertEquals(T.mins(20).msecs(), autosensDataStore.bucketedData!![5].timestamp)
Assertions.assertEquals(6, autosensDataStore.bucketedData!!.size.toLong())
Assertions.assertEquals(99.0, autosensDataStore.bucketedData!![0].value, 1.0) // Recalculated data to 45min
Assertions.assertEquals(90.0, autosensDataStore.bucketedData!![1].value, 1.0) // Recalculated data to 40min
Assertions.assertEquals(67.0, autosensDataStore.bucketedData!![3].value, 1.0) // Recalculated data to 30min
Assertions.assertEquals(45.0, autosensDataStore.bucketedData!![5].value, 1.0) // Recalculated data to 20min
// non 5min data without referenceTime set, should allign the data to the time of the last reading
autosensDataStore.referenceTime = -1
bgReadingList.clear()
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 100.0,
timestamp = T.mins(48).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 98.0,
timestamp = T.mins(42).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 90.0,
timestamp = T.mins(40).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
bgReadingList.add(
GlucoseValue(
raw = 0.0,
noise = 0.0,
value = 40.0,
timestamp = T.mins(18).msecs(),
sourceSensor = GlucoseValue.SourceSensor.UNKNOWN,
trendArrow = GlucoseValue.TrendArrow.FLAT
)
)
autosensDataStore.bgReadings = bgReadingList
Assertions.assertEquals(false, autosensDataStore.isAbout5minData(aapsLogger))
autosensDataStore.createBucketedData(aapsLogger, dateUtil)
Assertions.assertEquals(T.mins(48).msecs(), autosensDataStore.bucketedData!![0].timestamp)
Assertions.assertEquals(T.mins(43).msecs(), autosensDataStore.bucketedData!![1].timestamp)
Assertions.assertEquals(T.mins(33).msecs(), autosensDataStore.bucketedData!![3].timestamp)
Assertions.assertEquals(T.mins(18).msecs(), autosensDataStore.bucketedData!![6].timestamp)
Assertions.assertEquals(7, autosensDataStore.bucketedData!!.size.toLong())
Assertions.assertEquals(100.0, autosensDataStore.bucketedData!![0].value, 1.0) // Recalculated data to 48min
Assertions.assertEquals(98.0, autosensDataStore.bucketedData!![1].value, 1.0) // Recalculated data to 43min
Assertions.assertEquals(74.0, autosensDataStore.bucketedData!![3].value, 1.0) // Recalculated data to 33min
Assertions.assertEquals(40.0, autosensDataStore.bucketedData!![6].value, 1.0) // Recalculated data to 18min
}
@Test
fun bgReadingsTest() {
val bgReadingList: List<GlucoseValue> = ArrayList()

View file

@ -20,9 +20,11 @@ import info.nightscout.plugins.sync.nsclient.workers.NSClientUpdateRemoveAckWork
import info.nightscout.plugins.sync.nsclientV3.workers.DataSyncWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadBgWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadDeviceStatusWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadFoodsWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadLastModificationWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadStatusWorker
import info.nightscout.plugins.sync.nsclientV3.workers.LoadTreatmentsWorker
import info.nightscout.plugins.sync.nsclientV3.workers.ProcessFoodWorker
import info.nightscout.plugins.sync.nsclientV3.workers.ProcessTreatmentsWorker
import info.nightscout.plugins.sync.tidepool.TidepoolFragment
@ -46,11 +48,14 @@ abstract class SyncModule {
@ContributesAndroidInjector abstract fun contributesLoadStatusWorker(): LoadStatusWorker
@ContributesAndroidInjector abstract fun contributesLoadLastModificationWorker(): LoadLastModificationWorker
@ContributesAndroidInjector abstract fun contributesLoadBgWorker(): LoadBgWorker
@ContributesAndroidInjector abstract fun contributesLoadFoodsWorker(): LoadFoodsWorker
@ContributesAndroidInjector abstract fun contributesStoreBgWorker(): StoreDataForDbImpl.StoreBgWorker
@ContributesAndroidInjector abstract fun contributesStoreFoodWorker(): StoreDataForDbImpl.StoreFoodWorker
@ContributesAndroidInjector abstract fun contributesTreatmentWorker(): LoadTreatmentsWorker
@ContributesAndroidInjector abstract fun contributesProcessTreatmentsWorker(): ProcessTreatmentsWorker
@ContributesAndroidInjector abstract fun contributesLoadDeviceStatusWorker(): LoadDeviceStatusWorker
@ContributesAndroidInjector abstract fun contributesDataSyncWorker(): DataSyncWorker
@ContributesAndroidInjector abstract fun contributesFoodWorker(): ProcessFoodWorker
@ContributesAndroidInjector abstract fun contributesTidepoolFragment(): TidepoolFragment

View file

@ -26,6 +26,7 @@ import info.nightscout.database.impl.transactions.SyncNsBolusTransaction
import info.nightscout.database.impl.transactions.SyncNsCarbsTransaction
import info.nightscout.database.impl.transactions.SyncNsEffectiveProfileSwitchTransaction
import info.nightscout.database.impl.transactions.SyncNsExtendedBolusTransaction
import info.nightscout.database.impl.transactions.SyncNsFoodTransaction
import info.nightscout.database.impl.transactions.SyncNsOfflineEventTransaction
import info.nightscout.database.impl.transactions.SyncNsProfileSwitchTransaction
import info.nightscout.database.impl.transactions.SyncNsTemporaryBasalTransaction
@ -92,11 +93,11 @@ class StoreDataForDbImpl @Inject constructor(
override val temporaryBasals: MutableList<TemporaryBasal> = mutableListOf()
override val profileSwitches: MutableList<ProfileSwitch> = mutableListOf()
override val offlineEvents: MutableList<OfflineEvent> = mutableListOf()
override val foods: MutableList<Food> = mutableListOf()
override val nsIdGlucoseValues: MutableList<GlucoseValue> = mutableListOf()
override val nsIdBoluses: MutableList<Bolus> = mutableListOf()
override val nsIdCarbs: MutableList<Carbs> = mutableListOf()
override val nsIdFoods: MutableList<Food> = mutableListOf()
override val nsIdTemporaryTargets: MutableList<TemporaryTarget> = mutableListOf()
override val nsIdEffectiveProfileSwitches: MutableList<EffectiveProfileSwitch> = mutableListOf()
override val nsIdBolusCalculatorResults: MutableList<BolusCalculatorResult> = mutableListOf()
@ -106,6 +107,7 @@ class StoreDataForDbImpl @Inject constructor(
override val nsIdProfileSwitches: MutableList<ProfileSwitch> = mutableListOf()
override val nsIdOfflineEvents: MutableList<OfflineEvent> = mutableListOf()
override val nsIdDeviceStatuses: MutableList<DeviceStatus> = mutableListOf()
override val nsIdFoods: MutableList<Food> = mutableListOf()
private val userEntries: MutableList<UserEntry> = mutableListOf()
@ -131,6 +133,19 @@ class StoreDataForDbImpl @Inject constructor(
}
}
class StoreFoodWorker(
context: Context,
params: WorkerParameters
) : LoggingWorker(context, params) {
@Inject lateinit var storeDataForDb: StoreDataForDb
override fun doWorkAndLog(): Result {
storeDataForDb.storeFoodsToDb()
return Result.success()
}
}
fun <T> HashMap<T, Long>.inc(key: T) =
if (containsKey(key)) merge(key, 1, Long::plus)
else put(key, 1)
@ -171,6 +186,36 @@ class StoreDataForDbImpl @Inject constructor(
rxBus.send(EventNSClientNewLog("DONE BG", ""))
}
override fun storeFoodsToDb() {
rxBus.send(EventNSClientNewLog("PROCESSING FOOD", ""))
if (foods.isNotEmpty())
repository.runTransactionForResult(SyncNsFoodTransaction(foods))
.doOnError {
aapsLogger.error(LTag.DATABASE, "Error while saving foods", it)
}
.blockingGet()
.also { result ->
foods.clear()
result.updated.forEach {
aapsLogger.debug(LTag.DATABASE, "Updated food $it")
updated.inc(Food::class.java.simpleName)
}
result.inserted.forEach {
aapsLogger.debug(LTag.DATABASE, "Inserted food $it")
inserted.inc(Food::class.java.simpleName)
}
result.invalidated.forEach {
aapsLogger.debug(LTag.DATABASE, "Invalidated food $it")
nsIdUpdated.inc(Food::class.java.simpleName)
}
}
sendLog("Food", Food::class.java.simpleName)
SystemClock.sleep(pause)
rxBus.send(EventNSClientNewLog("DONE FOOD", ""))
}
override fun storeTreatmentsToDb() {
rxBus.send(EventNSClientNewLog("PROCESSING TR", ""))

View file

@ -1,18 +0,0 @@
package info.nightscout.plugins.sync.nsShared.extensions
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.interfaces.utils.Round
import org.json.JSONObject
fun PumpEnactResult.log(): String {
return "Success: " + success +
" Enacted: " + enacted +
" Comment: " + comment +
" Duration: " + duration +
" Absolute: " + absolute +
" Percent: " + percent +
" IsPercent: " + isPercent +
" IsTempCancel: " + isTempCancel +
" bolusDelivered: " + bolusDelivered +
" Queued: " + queued
}

View file

@ -41,7 +41,7 @@ import info.nightscout.plugins.sync.nsclient.data.AlarmAck
import info.nightscout.plugins.sync.nsclient.data.NSDeviceStatusHandler
import info.nightscout.plugins.sync.nsclient.workers.NSClientAddUpdateWorker
import info.nightscout.plugins.sync.nsclient.workers.NSClientMbgWorker
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.plugins.sync.nsclientV3.workers.ProcessFoodWorker
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventAppExit
@ -522,11 +522,14 @@ class NSClientService : DaggerService() {
if (data.has("food")) {
val foods = data.getJSONArray("food")
if (foods.length() > 0) rxBus.send(EventNSClientNewLog("DATA", "received " + foods.length() + " foods"))
dataWorkerStorage.enqueue(
OneTimeWorkRequest.Builder(workerClasses.foodWorker)
.setInputData(dataWorkerStorage.storeInputData(foods))
.build()
)
dataWorkerStorage
.beginUniqueWork(
"ProcessFoods",
OneTimeWorkRequest.Builder(ProcessFoodWorker::class.java)
.setInputData(dataWorkerStorage.storeInputData(foods))
.build()
).then(OneTimeWorkRequest.Builder(StoreDataForDbImpl.StoreFoodWorker::class.java).build())
.enqueue()
}
if (data.has("mbgs")) {
val mbgArray = data.getJSONArray("mbgs")
@ -550,7 +553,7 @@ class NSClientService : DaggerService() {
sp.putBoolean(info.nightscout.core.utils.R.string.key_objectives_bg_is_available_in_ns, true)
dataWorkerStorage
.beginUniqueWork(
NSClientV3Plugin.JOB_NAME,
"ProcessBg",
OneTimeWorkRequest.Builder(workerClasses.nsClientSourceWorker)
.setInputData(dataWorkerStorage.storeInputData(sgvs))
.build()

View file

@ -38,6 +38,7 @@ import info.nightscout.plugins.sync.nsclientV3.extensions.toNSBolus
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSBolusWizard
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSCarbs
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSEffectiveProfileSwitch
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSFood
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSProfileSwitch
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSTemporaryBasal
import info.nightscout.plugins.sync.nsclientV3.extensions.toNSTemporaryTarget
@ -293,6 +294,7 @@ class NSClientV3Plugin @Inject constructor(
when (collection) {
NsClient.Collection.ENTRIES -> lastLoadedSrvModified.collections.entries == 0L
NsClient.Collection.TREATMENTS -> lastLoadedSrvModified.collections.treatments == 0L
NsClient.Collection.FOODS -> lastLoadedSrvModified.collections.foods == 0L
}
override fun updateLatestBgReceivedIfNewer(latestReceived: Long) {
@ -321,35 +323,76 @@ class NSClientV3Plugin @Inject constructor(
private val gson: Gson = GsonBuilder().create()
private fun dbOperation(collection: String, dataPair: DataSyncSelector.DataPair, progress: String, operation: Operation) {
val call = when (operation) {
Operation.CREATE -> nsAndroidClient?.let { return@let it::createTreatment }
Operation.UPDATE -> nsAndroidClient?.let { return@let it::updateTreatment }
}
when (dataPair) {
is DataSyncSelector.PairBolus -> dataPair.value.toNSBolus()
is DataSyncSelector.PairCarbs -> dataPair.value.toNSCarbs()
is DataSyncSelector.PairBolusCalculatorResult -> dataPair.value.toNSBolusWizard()
is DataSyncSelector.PairTemporaryTarget -> dataPair.value.toNSTemporaryTarget()
// is DataSyncSelector.PairFood -> dataPair.value.toJson(false)
// is DataSyncSelector.PairGlucoseValue -> dataPair.value.toJson(false, dateUtil)
is DataSyncSelector.PairTherapyEvent -> dataPair.value.toNSTherapyEvent()
is DataSyncSelector.PairTemporaryBasal -> {
val profile = profileFunction.getProfile(dataPair.value.timestamp)
if (profile == null) {
dataSyncSelector.confirmLastTemporaryBasalIdIfGreater(dataPair.id)
return
}
dataPair.value.toNSTemporaryBasal(profile)
if (collection == "food") {
val call = when (operation) {
Operation.CREATE -> nsAndroidClient?.let { return@let it::createFood }
Operation.UPDATE -> nsAndroidClient?.let { return@let it::updateFood }
}
// is DataSyncSelector.PairExtendedBolus -> dataPair.value.toJson(false, profileFunction.getProfile(dataPair.value.timestamp), dateUtil)
is DataSyncSelector.PairProfileSwitch -> dataPair.value.toNSProfileSwitch(dateUtil)
is DataSyncSelector.PairEffectiveProfileSwitch -> dataPair.value.toNSEffectiveProfileSwitch(dateUtil)
// is DataSyncSelector.PairOfflineEvent -> dataPair.value.toJson(false, dateUtil)
else -> null
}?.let { data ->
runBlocking {
if (collection == "treatments") {
when (dataPair) {
is DataSyncSelector.PairFood -> dataPair.value.toNSFood()
else -> null
}?.let { data ->
runBlocking {
try {
val id = if (dataPair.value is TraceableDBEntry) (dataPair.value as TraceableDBEntry).interfaceIDs.nightscoutId else ""
rxBus.send(
EventNSClientNewLog(
when (operation) {
Operation.CREATE -> "ADD $collection"
Operation.UPDATE -> "UPDATE $collection"
},
when (operation) {
Operation.CREATE -> "Sent ${dataPair.javaClass.simpleName} ${gson.toJson(data)} $progress"
Operation.UPDATE -> "Sent ${dataPair.javaClass.simpleName} $id ${gson.toJson(data)} $progress"
}
)
)
call?.let { it(data) }?.let { result ->
when (dataPair) {
is DataSyncSelector.PairFood -> {
if (result.response == 201) { // created
dataPair.value.interfaceIDs.nightscoutId = result.identifier
storeDataForDb.nsIdFoods.add(dataPair.value)
storeDataForDb.scheduleNsIdUpdate()
}
dataSyncSelector.confirmLastFoodIdIfGreater(dataPair.id)
}
}
}
} catch (e: Exception) {
aapsLogger.error(LTag.NSCLIENT, "Upload exception", e)
}
}
}
}
if (collection == "treatments") {
val call = when (operation) {
Operation.CREATE -> nsAndroidClient?.let { return@let it::createTreatment }
Operation.UPDATE -> nsAndroidClient?.let { return@let it::updateTreatment }
}
when (dataPair) {
is DataSyncSelector.PairBolus -> dataPair.value.toNSBolus()
is DataSyncSelector.PairCarbs -> dataPair.value.toNSCarbs()
is DataSyncSelector.PairBolusCalculatorResult -> dataPair.value.toNSBolusWizard()
is DataSyncSelector.PairTemporaryTarget -> dataPair.value.toNSTemporaryTarget()
// is DataSyncSelector.PairGlucoseValue -> dataPair.value.toJson(false, dateUtil)
is DataSyncSelector.PairTherapyEvent -> dataPair.value.toNSTherapyEvent()
is DataSyncSelector.PairTemporaryBasal -> {
val profile = profileFunction.getProfile(dataPair.value.timestamp)
if (profile == null) {
dataSyncSelector.confirmLastTemporaryBasalIdIfGreater(dataPair.id)
return
}
dataPair.value.toNSTemporaryBasal(profile)
}
// is DataSyncSelector.PairExtendedBolus -> dataPair.value.toJson(false, profileFunction.getProfile(dataPair.value.timestamp), dateUtil)
is DataSyncSelector.PairProfileSwitch -> dataPair.value.toNSProfileSwitch(dateUtil)
is DataSyncSelector.PairEffectiveProfileSwitch -> dataPair.value.toNSEffectiveProfileSwitch(dateUtil)
// is DataSyncSelector.PairOfflineEvent -> dataPair.value.toJson(false, dateUtil)
else -> null
}?.let { data ->
runBlocking {
try {
val id = if (dataPair.value is TraceableDBEntry) (dataPair.value as TraceableDBEntry).interfaceIDs.nightscoutId else ""
rxBus.send(
@ -401,7 +444,6 @@ class NSClientV3Plugin @Inject constructor(
}
dataSyncSelector.confirmLastTempTargetsIdIfGreater(dataPair.id)
}
// is DataSyncSelector.PairFood -> dataPair.value.toJson(false)
// is DataSyncSelector.PairGlucoseValue -> dataPair.value.toJson(false, dateUtil)
is DataSyncSelector.PairTherapyEvent -> {
if (result.response == 201) { // created
@ -487,6 +529,7 @@ class NSClientV3Plugin @Inject constructor(
.then(OneTimeWorkRequest.Builder(LoadBgWorker::class.java).build())
// Other Workers are enqueued after BG finish
// LoadTreatmentsWorker
// LoadFoodsWorker
// LoadDeviceStatusWorker
// DataSyncWorker
.enqueue()

View file

@ -0,0 +1,38 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
import info.nightscout.database.entities.Food
import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.food.NSFood
fun NSFood.toFood(): Food =
Food(
isValid = isValid,
name = name,
category = category,
subCategory = subCategory,
portion = portion,
carbs = carbs,
fat = fat,
protein = protein,
energy = energy,
unit = unit,
gi = gi,
interfaceIDs_backing = InterfaceIDs(nightscoutId = identifier)
)
fun Food.toNSFood(): NSFood =
NSFood(
date = System.currentTimeMillis(),
isValid = isValid,
name = name,
category = category,
subCategory = subCategory,
portion = portion,
carbs = carbs,
fat = fat,
protein = protein,
energy = energy,
unit = unit,
gi = gi,
identifier = interfaceIDs.nightscoutId,
)

View file

@ -0,0 +1,68 @@
package info.nightscout.plugins.sync.nsclientV3.workers
import android.content.Context
import androidx.work.ExistingWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import info.nightscout.core.utils.receivers.DataWorkerStorage
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.interfaces.nsclient.StoreDataForDb
import info.nightscout.interfaces.workflow.WorkerClasses
import info.nightscout.plugins.sync.nsShared.StoreDataForDbImpl
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventNSClientNewLog
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.shared.utils.DateUtil
import kotlinx.coroutines.runBlocking
import javax.inject.Inject
class LoadFoodsWorker(
context: Context,
params: WorkerParameters
) : LoggingWorker(context, params) {
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
@Inject lateinit var rxBus: RxBus
@Inject lateinit var context: Context
@Inject lateinit var nsClientV3Plugin: NSClientV3Plugin
@Inject lateinit var dateUtil: DateUtil
@Inject lateinit var storeDataForDb: StoreDataForDb
@Inject lateinit var workerClasses: WorkerClasses
override fun doWorkAndLog(): Result {
val nsAndroidClient = nsClientV3Plugin.nsAndroidClient ?: return Result.failure(workDataOf("Error" to "AndroidClient is null"))
// Food database doesn't provide last record modification
// Read full collection every 5th attempt
runBlocking {
if (nsClientV3Plugin.lastLoadedSrvModified.collections.foods++ % 5 == 0L) {
val foods: List<NSFood> = nsAndroidClient.getFoods(1000)
aapsLogger.debug("FOODS: $foods")
rxBus.send(EventNSClientNewLog("RCV", "${foods.size} FOODs"))
// Schedule processing of fetched data
WorkManager.getInstance(context)
.beginUniqueWork(
NSClientV3Plugin.JOB_NAME,
ExistingWorkPolicy.APPEND_OR_REPLACE,
OneTimeWorkRequest.Builder(ProcessFoodWorker::class.java)
.setInputData(dataWorkerStorage.storeInputData(foods))
.build()
).then(OneTimeWorkRequest.Builder(StoreDataForDbImpl.StoreFoodWorker::class.java).build())
.then(OneTimeWorkRequest.Builder(LoadDeviceStatusWorker::class.java).build())
.enqueue()
} else {
rxBus.send(EventNSClientNewLog("RCV", "FOOD skipped"))
WorkManager.getInstance(context)
.enqueueUniqueWork(
NSClientV3Plugin.JOB_NAME,
ExistingWorkPolicy.APPEND_OR_REPLACE,
OneTimeWorkRequest.Builder(LoadDeviceStatusWorker::class.java).build()
)
}
}
return Result.success()
}
}

View file

@ -46,7 +46,8 @@ class LoadTreatmentsWorker(
val treatments: List<NSTreatment>
val response: NSAndroidClient.ReadResponse<List<NSTreatment>>?
if (isFirstLoad) {
treatments = nsAndroidClient.getTreatmentsNewerThan(lastLoaded, 500)
val lastLoadedIso = dateUtil.toISOString(lastLoaded)
treatments = nsAndroidClient.getTreatmentsNewerThan(lastLoadedIso, 500)
response = NSAndroidClient.ReadResponse(0, treatments)
}
else {
@ -75,14 +76,13 @@ class LoadTreatmentsWorker(
nsClientV3Plugin.lastLoadedSrvModified.collections.treatments = lastLoaded
nsClientV3Plugin.storeLastFetched()
}
rxBus.send(EventNSClientNewLog("RCV END", "No TRs from ${dateUtil
.dateAndTimeAndSecondsString(lastLoaded)}"))
rxBus.send(EventNSClientNewLog("RCV END", "No TRs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}"))
storeDataForDb.storeTreatmentsToDb()
WorkManager.getInstance(context)
.enqueueUniqueWork(
NSClientV3Plugin.JOB_NAME,
ExistingWorkPolicy.APPEND_OR_REPLACE,
OneTimeWorkRequest.Builder(LoadDeviceStatusWorker::class.java).build()
OneTimeWorkRequest.Builder(LoadFoodsWorker::class.java).build()
)
}
} catch (error: Exception) {
@ -95,14 +95,13 @@ class LoadTreatmentsWorker(
nsClientV3Plugin.lastLoadedSrvModified.collections.treatments = lastLoaded
nsClientV3Plugin.storeLastFetched()
}
rxBus.send(EventNSClientNewLog("RCV END", "No new TRs from ${dateUtil
.dateAndTimeAndSecondsString(lastLoaded)}"))
rxBus.send(EventNSClientNewLog("RCV END", "No new TRs from ${dateUtil.dateAndTimeAndSecondsString(lastLoaded)}"))
storeDataForDb.storeTreatmentsToDb()
WorkManager.getInstance(context)
.enqueueUniqueWork(
NSClientV3Plugin.JOB_NAME,
ExistingWorkPolicy.APPEND_OR_REPLACE,
OneTimeWorkRequest.Builder(LoadDeviceStatusWorker::class.java).build()
OneTimeWorkRequest.Builder(LoadFoodsWorker::class.java).build()
)
}
}

View file

@ -0,0 +1,72 @@
package info.nightscout.plugins.sync.nsclientV3.workers
import android.content.Context
import androidx.work.WorkerParameters
import androidx.work.workDataOf
import dagger.android.HasAndroidInjector
import info.nightscout.core.extensions.foodFromJson
import info.nightscout.core.utils.receivers.DataWorkerStorage
import info.nightscout.core.utils.worker.LoggingWorker
import info.nightscout.database.entities.Food
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.nsclient.StoreDataForDb
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.plugins.sync.nsclientV3.extensions.toFood
import info.nightscout.rx.logging.LTag
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.shared.sharedPreferences.SP
import org.json.JSONArray
import org.json.JSONObject
import javax.inject.Inject
class ProcessFoodWorker(
context: Context,
params: WorkerParameters
) : LoggingWorker(context, params) {
@Inject lateinit var injector: HasAndroidInjector
@Inject lateinit var repository: AppRepository
@Inject lateinit var sp: SP
@Inject lateinit var dataWorkerStorage: DataWorkerStorage
@Inject lateinit var storeDataForDb: StoreDataForDb
override fun doWorkAndLog(): Result {
val data = dataWorkerStorage.pickupObject(inputData.getLong(DataWorkerStorage.STORE_KEY, -1))
?: return Result.failure(workDataOf("Error" to "missing input data"))
aapsLogger.debug(LTag.DATABASE, "Received Food Data: $data")
val ret = Result.success()
val foods = mutableListOf<Food>()
if (data is JSONArray) {
for (index in 0 until data.length()) {
val jsonFood: JSONObject = data.getJSONObject(index)
if (JsonHelper.safeGetString(jsonFood, "type") != "food") continue
when (JsonHelper.safeGetString(jsonFood, "action")) {
"remove" -> {
val delFood = Food(
name = "",
portion = 0.0,
carbs = 0,
isValid = false
).also { it.interfaceIDs.nightscoutId = JsonHelper.safeGetString(jsonFood, "_id") }
foods += delFood
}
else -> {
val food = foodFromJson(jsonFood)
if (food != null) foods += food
else aapsLogger.error(LTag.DATABASE, "Error parsing food", jsonFood.toString())
}
}
}
} else if (data is List<*>) {
for (i in 0 until data.size)
foods += (data[i] as NSFood).toFood()
}
storeDataForDb.foods.addAll(foods)
return ret
}
}

View file

@ -0,0 +1,36 @@
package info.nightscout.plugins.sync.nsclientV3.extensions
import info.nightscout.database.entities.Food
import info.nightscout.database.entities.embedments.InterfaceIDs
import info.nightscout.sdk.localmodel.food.NSFood
import info.nightscout.sdk.mapper.convertToRemoteAndBack
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
@Suppress("SpellCheckingInspection")
internal class FoodExtensionKtTest {
@Test
fun toFood() {
val food = Food(
isValid = true,
name = "name",
category = "category",
subCategory = "subcategory",
portion = 2.0,
carbs = 20,
fat = 21,
protein = 22,
energy = 23,
unit = "g",
gi = 25,
interfaceIDs_backing = InterfaceIDs(
nightscoutId = "nightscoutId"
)
)
val food2 = (food.toNSFood().convertToRemoteAndBack() as NSFood).toFood()
Assertions.assertTrue(food.contentEqualsTo(food2))
Assertions.assertTrue(food.interfaceIdsEqualsTo(food2))
}
}

View file

@ -46,7 +46,7 @@
<string name="combo_error_failure_reading_changed_basal_rate">Basal rate changed on pump, but reading it failed</string>
<string name="combo_activity_checking_for_history_changes">Checking for history changes</string>
<string name="combo_error_multiple_boluses_with_identical_timestamp">Multiple boluses with the same amount within the same minute were just imported. Only one record could be added to treatments. Please check the pump and manually add a bolus record using the Careportal tab. Make sure to create a bolus with a time no other bolus uses.</string>
<string name="about_link_urls">\n\ndocumentation:\nhttps://androidaps.readthedocs.io\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers</string>
<string name="about_link_urls">\n\ndocumentation:\nhttps://wiki.aaps.app\n\nfacebook:\nhttps://www.facebook.com/groups/AndroidAPSUsers</string>
<string name="combo_check_date">The last bolus is older than 24 hours or is in the future. Please check the date on the pump is set correctly.</string>
<string name="combo_suspious_bolus_time">Time/date of the delivered bolus on pump seems wrong, IOB is likely incorrect. Please check pump time/date.</string>
<string name="combo_bolus_count">Bolus count</string>

View file

@ -41,6 +41,7 @@ class ComboV2Fragment : DaggerFragment() {
binding.combov2RefreshButton.setOnClickListener {
binding.combov2RefreshButton.isEnabled = false
combov2Plugin.clearPumpErrorObservedFlag()
commandQueue.readStatus(rh.gs(info.nightscout.core.ui.R.string.user_request), null)
}

View file

@ -25,6 +25,8 @@ import info.nightscout.comboctl.parser.BatteryState
import info.nightscout.comboctl.parser.ReservoirState
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.notifications.Notification
@ -95,6 +97,8 @@ import info.nightscout.comboctl.base.Tbr as ComboCtlTbr
import info.nightscout.comboctl.main.Pump as ComboCtlPump
import info.nightscout.comboctl.main.PumpManager as ComboCtlPumpManager
internal const val PUMP_ERROR_TIMEOUT_INTERVAL_MSECS = 1000L * 60 * 5
@Singleton
class ComboV2Plugin @Inject constructor (
injector: HasAndroidInjector,
@ -107,7 +111,9 @@ class ComboV2Plugin @Inject constructor (
private val sp: SP,
private val pumpSync: PumpSync,
private val dateUtil: DateUtil,
private val uiInteraction: UiInteraction
private val uiInteraction: UiInteraction,
private val androidPermission: AndroidPermission,
private val config: Config
) :
PumpPluginBase(
PluginDescription()
@ -161,6 +167,13 @@ class ComboV2Plugin @Inject constructor (
private var lastConnectionTimestamp = 0L
private var lastComboAlert: AlertScreenContent? = null
// States for when the pump reports an error. We then want isInitialized()
// to return false until either the user presses the Refresh button or the
// pumpErrorTimeoutJob expires. That way, the loop won't run until then,
// giving the user a chance to handle the error.
private var pumpErrorObserved = false
private var pumpErrorTimeoutJob: Job? = null
// Set to true if a disconnect request came in while the driver
// was in the Connecting, CheckingPump, or ExecutingCommand
// state (in other words, while isBusy() was returning true).
@ -183,7 +196,7 @@ class ComboV2Plugin @Inject constructor (
private var activeBasalProfile: BasalProfile? = null
// This is used for checking that the correct basal profile is
// active in the Combo. If not, loop invocation is disallowed.
// This is _not_ reset by disconect(). That's on purpose; it
// This is _not_ reset by disconnect(). That's on purpose; it
// is read by isLoopInvocationAllowed(), which is called even
// if the pump is not connected.
private var lastActiveBasalProfileNumber: Int? = null
@ -277,32 +290,46 @@ class ComboV2Plugin @Inject constructor (
aapsLogger.debug(LTag.PUMP, "Creating bluetooth interface")
bluetoothInterface = AndroidBluetoothInterface(context)
aapsLogger.debug(LTag.PUMP, "Setting up bluetooth interface")
bluetoothInterface!!.setup()
// Continue initialization in a separate coroutine. This allows us to call
// runWithPermissionCheck(), which will keep trying to run the code block
// until either the necessary Bluetooth permissios are granted, or the
// coroutine is cancelled (see onStop() below).
pumpCoroutineScope.launch {
runWithPermissionCheck(
context, config, aapsLogger, androidPermission,
permissionsToCheckFor = listOf("android.permission.BLUETOOTH_CONNECT")
) {
aapsLogger.debug(LTag.PUMP, "Setting up bluetooth interface")
bluetoothInterface!!.setup()
aapsLogger.debug(LTag.PUMP, "Setting up pump manager")
pumpManager = ComboCtlPumpManager(bluetoothInterface!!, pumpStateStore)
pumpManager!!.setup {
_pairedStateUIFlow.value = false
unpairing = false
aapsLogger.debug(LTag.PUMP, "Setting up pump manager")
pumpManager = ComboCtlPumpManager(bluetoothInterface!!, pumpStateStore)
pumpManager!!.setup {
_pairedStateUIFlow.value = false
unpairing = false
}
// UI flows that must have defined values right
// at start are initialized here.
// The paired state UI flow is special in that it is also
// used as the backing store for the isPaired() function,
// so setting up that UI state flow equals updating that
// paired state.
val paired = pumpManager!!.getPairedPumpAddresses().isNotEmpty()
_pairedStateUIFlow.value = paired
setDriverState(DriverState.Disconnected)
// NOTE: EventInitializationChanged is sent in getPumpStatus() .
}
}
// UI flows that must have defined values right
// at start are initialized here.
// The paired state UI flow is special in that it is also
// used as the backing store for the isPaired() function,
// so setting up that UI state flow equals updating that
// paired state.
val paired = pumpManager!!.getPairedPumpAddresses().isNotEmpty()
_pairedStateUIFlow.value = paired
setDriverState(DriverState.Disconnected)
// NOTE: EventInitializationChanged is sent in getPumpStatus() .
}
override fun onStop() {
// Cancel any ongoing background coroutines. This includes an ongoing
// unfinished initialization that still waits for the user to grant
// Bluetooth permissions.
pumpCoroutineScope.cancel()
runBlocking {
@ -381,7 +408,7 @@ class ComboV2Plugin @Inject constructor (
}
override fun isInitialized(): Boolean =
isPaired() && (driverStateFlow.value != DriverState.NotInitialized)
isPaired() && (driverStateFlow.value != DriverState.NotInitialized) && !pumpErrorObserved
override fun isSuspended(): Boolean =
when (driverStateUIFlow.value) {
@ -432,6 +459,16 @@ class ComboV2Plugin @Inject constructor (
return
}
if (pumpErrorObserved) {
aapsLogger.debug(LTag.PUMP, "Aborting connect attempt since the pumpErrorObserved flag is set")
uiInteraction.addNotification(
Notification.COMBO_PUMP_ALARM,
text = rh.gs(R.string.combov2_cannot_connect_pump_error_observed),
level = Notification.NORMAL
)
return
}
when (driverStateFlow.value) {
DriverState.Connecting,
DriverState.CheckingPump,
@ -561,10 +598,15 @@ class ComboV2Plugin @Inject constructor (
var forciblyDisconnectDueToError = false
try {
// Set maxNumAttempts to null to turn off the connection attempt limit inside the connect() call.
// The AAPS queue thread will anyway cause the connectionSetupJob to be canceled when its
// connection timeout expires, so the Pump class' own connection attempt limiter is redundant.
pump?.connect(maxNumAttempts = null)
runWithPermissionCheck(
context, config, aapsLogger, androidPermission,
permissionsToCheckFor = listOf("android.permission.BLUETOOTH_CONNECT")
) {
// Set maxNumAttempts to null to turn off the connection attempt limit inside the connect() call.
// The AAPS queue thread will anyway cause the connectionSetupJob to be canceled when its
// connection timeout expires, so the Pump class' own connection attempt limiter is redundant.
pump?.connect(maxNumAttempts = null)
}
// No need to set the driver state here, since the pump's stateFlow will announce that.
@ -744,17 +786,25 @@ class ComboV2Plugin @Inject constructor (
Notification.INFO,
60
)
pumpEnactResult.apply {
success = true
enacted = true
}
} else {
aapsLogger.debug(LTag.PUMP, "Basal profiles are equal; did not have to set anything")
pumpEnactResult.apply {
success = true
enacted = false
}
// Treat this as if the command had been enacted. Setting a basal profile is
// an idempotent operation, meaning that setting the exact same profile factors
// twice in a row does not actually change anything. Therefore, we can just
// completely skip such a redundant set basal profile operation and still get
// the exact same result.
// Furthermore, it is actually important to also set enacted to true in this case
// because even though this _driver_ might know that the Combo uses this profile
// already, _AAPS_ might not. A good example is when AAPS is set up the first time
// and no profile has been activated. If in this case the profile happens to be
// identical to what's already in the Combo, then enacted=false would cause errors,
// because AAPS expects the driver to always enact the profile change in this case
// (since it thinks that no profile is set yet).
}
pumpEnactResult.apply {
success = true
enacted = true
}
}
} catch (e: CancellationException) {
@ -1398,6 +1448,14 @@ class ComboV2Plugin @Inject constructor (
commandQueue.readStatus(reason, null)
}
fun clearPumpErrorObservedFlag() {
stopPumpErrorTimeout()
if (pumpErrorObserved) {
aapsLogger.info(LTag.PUMP, "Clearing pumpErrorObserved flag")
pumpErrorObserved = false
}
}
/*** Loop constraints ***/
// These restrict the function of the loop in case of an event
// that makes running a loop too risky, for example because something
@ -1459,15 +1517,22 @@ class ComboV2Plugin @Inject constructor (
pairingJob = pumpCoroutineScope.async {
try {
val pairingResult = pumpManager?.pairWithNewPump(discoveryDuration) { newPumpAddress, previousAttemptFailed ->
aapsLogger.info(
LTag.PUMP,
"New pairing PIN request from Combo pump with Bluetooth " +
"address $newPumpAddress (previous attempt failed: $previousAttemptFailed)"
)
_previousPairingAttemptFailedFlow.value = previousAttemptFailed
newPINChannel.receive()
} ?: throw IllegalStateException("Attempting to access uninitialized pump manager")
// Do the pairing attempt within runWithPermissionCheck()
// since pairing requires Bluetooth permissions.
val pairingResult = runWithPermissionCheck(
context, config, aapsLogger, androidPermission,
permissionsToCheckFor = listOf("android.permission.BLUETOOTH_CONNECT")
) {
pumpManager?.pairWithNewPump(discoveryDuration) { newPumpAddress, previousAttemptFailed ->
aapsLogger.info(
LTag.PUMP,
"New pairing PIN request from Combo pump with Bluetooth " +
"address $newPumpAddress (previous attempt failed: $previousAttemptFailed)"
)
_previousPairingAttemptFailedFlow.value = previousAttemptFailed
newPINChannel.receive()
} ?: throw IllegalStateException("Attempting to access uninitialized pump manager")
}
if (pairingResult !is ComboCtlPumpManager.PairingResult.Success)
return@async
@ -1550,6 +1615,8 @@ class ComboV2Plugin @Inject constructor (
_serialNumberUIFlow.value = ""
_bluetoothAddressUIFlow.value = ""
clearPumpErrorObservedFlag()
// The unpairing variable is set to false in
// the PumpManager onPumpUnpaired callback.
}
@ -1748,6 +1815,23 @@ class ComboV2Plugin @Inject constructor (
}
}
private fun startPumpErrorTimeout() {
if (pumpErrorTimeoutJob != null)
return
pumpErrorTimeoutJob = pumpCoroutineScope.launch {
delay(PUMP_ERROR_TIMEOUT_INTERVAL_MSECS)
aapsLogger.info(LTag.PUMP, "Clearing pumpErrorObserved flag after timeout was reached")
pumpErrorObserved = false
commandQueue.readStatus(rh.gs(R.string.combov2_refresh_pump_status_after_error), null)
}
}
private fun stopPumpErrorTimeout() {
pumpErrorTimeoutJob?.cancel()
pumpErrorTimeoutJob = null
}
private fun updateBaseBasalRateUI() {
val currentHour = DateTime().hourOfDay().get()
// This sets value to null if no profile is set,
@ -2142,6 +2226,12 @@ class ComboV2Plugin @Inject constructor (
}
private fun notifyAboutComboAlert(alert: AlertScreenContent) {
if (alert is AlertScreenContent.Error) {
aapsLogger.info(LTag.PUMP, "Error screen observed - setting pumpErrorObserved flag")
pumpErrorObserved = true
startPumpErrorTimeout()
}
uiInteraction.addNotification(
Notification.COMBO_PUMP_ALARM,
text = "${rh.gs(R.string.combov2_combo_alert)}: ${getAlertDescription(alert)}",

View file

@ -1,8 +1,16 @@
package info.nightscout.pump.combov2
import android.content.Context
import android.os.Build
import info.nightscout.comboctl.android.AndroidBluetoothPermissionException
import info.nightscout.comboctl.main.BasalProfile
import info.nightscout.comboctl.main.NUM_COMBO_BASAL_PROFILE_FACTORS
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.profile.Profile as AAPSProfile
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag
import kotlinx.coroutines.delay
// Utility extension functions for clearer conversion between
// ComboCtl units and AAPS units. ComboCtl uses integer-encoded
@ -22,4 +30,37 @@ fun AAPSProfile.toComboCtlBasalProfile(): BasalProfile {
(this.getBasalTimeFromMidnight(hour * 60 * 60) * 1000.0).toInt()
}
return BasalProfile(factors)
}
}
suspend fun <T> runWithPermissionCheck(
context: Context,
config: Config,
aapsLogger: AAPSLogger,
androidPermission: AndroidPermission,
permissionsToCheckFor: Collection<String>,
block: suspend () -> T
): T {
var permissions = permissionsToCheckFor
while (true) {
try {
if (config.PUMPDRIVERS && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
val notAllPermissionsGranted = permissions.fold(initial = false) { currentResult, permission ->
return@fold if (androidPermission.permissionNotGranted(context, permission)) {
aapsLogger.debug(LTag.PUMP, "permission $permission was not granted by the user")
true
} else
currentResult
}
if (notAllPermissionsGranted) {
delay(1000) // Wait a little bit before retrying to avoid 100% CPU usage
continue
}
}
return block.invoke()
} catch (e: AndroidBluetoothPermissionException) {
permissions = permissionsToCheckFor union e.missingPermissions
}
}
}

View file

@ -135,4 +135,6 @@ buttons at the same time to cancel pairing)\n
<string name="combov2_datetime_changed">Date and/or time changed</string>
<string name="combov2_dst_started">Daylight savings time (DST) started</string>
<string name="combov2_dst_ended">Daylight savings time (DST) ended</string>
<string name="combov2_cannot_connect_pump_error_observed">Cannot connect to pump because the pump reported an error. User must handle the error and then either wait 5 minutes or press the Refresh button in the driver tab.</string>
<string name="combov2_refresh_pump_status_after_error">Refreshing pump status after the pump reported an error</string>
</resources>

View file

@ -52,7 +52,7 @@ class AapsV2Watchface : BaseWatchFace() {
binding.rigBattery.setTextColor(dividerTxtColor)
binding.delta.setTextColor(dividerTxtColor)
binding.avgDelta.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.basalRate.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
when (loopLevel) {
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)
@ -85,7 +85,7 @@ class AapsV2Watchface : BaseWatchFace() {
binding.avgDelta.setTextColor(dividerTxtColor)
binding.rigBattery.setTextColor(dividerTxtColor)
binding.uploaderBattery.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.basalRate.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
binding.iob1.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.iob2.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
@ -138,7 +138,7 @@ class AapsV2Watchface : BaseWatchFace() {
binding.rigBattery.setTextColor(dividerTxtColor)
binding.delta.setTextColor(dividerTxtColor)
binding.avgDelta.setTextColor(dividerTxtColor)
binding.basalRate?.setTextColor(dividerTxtColor)
binding.basalRate.setTextColor(dividerTxtColor)
binding.bgi.setTextColor(dividerTxtColor)
when (loopLevel) {
-1 -> binding.loop.setBackgroundResource(R.drawable.loop_grey_25)

View file

@ -19,6 +19,7 @@ class AapsWatchface : BaseWatchFace() {
}
override fun setColorDark() {
binding.mainLayout.setBackgroundColor(ContextCompat.getColor(this, R.color.dark_background))
binding.secondaryLayout.setBackgroundColor(ContextCompat.getColor(this, if (dividerMatchesBg) R.color.dark_background else R.color.dark_statusView))
binding.time.setTextColor(ContextCompat.getColor(this, R.color.dark_mTime))
val color = when (singleBg.sgvLevel) {

View file

@ -9,7 +9,6 @@ import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.watchfaces.utils.WatchfaceViewAdapter
@ -18,11 +17,6 @@ class BigChartWatchface : BaseWatchFace() {
private lateinit var binding: WatchfaceViewAdapter
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) {
val layoutBinding = ActivityBigchartSmallBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
val layoutBinding = ActivityBigchartBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
@ -42,6 +36,7 @@ class BigChartWatchface : BaseWatchFace() {
binding.delta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
highColor = ContextCompat.getColor(this, R.color.dark_midColor)
lowColor = ContextCompat.getColor(this, R.color.dark_midColor)
@ -69,6 +64,7 @@ class BigChartWatchface : BaseWatchFace() {
val colorTime = if (ageLevel == 1) R.color.dark_Timestamp else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, colorTime))
highColor = ContextCompat.getColor(this, R.color.dark_highColor)
lowColor = ContextCompat.getColor(this, R.color.dark_lowColor)
@ -97,6 +93,7 @@ class BigChartWatchface : BaseWatchFace() {
val colorTime = if (ageLevel == 1) R.color.light_mTimestamp1 else R.color.light_mTimestamp
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, colorTime))
highColor = ContextCompat.getColor(this, R.color.light_highColor)
lowColor = ContextCompat.getColor(this, R.color.light_lowColor)

View file

@ -67,18 +67,17 @@ class DigitalStyleWatchface : BaseWatchFace() {
/* frame styles*/
val mShapesElements = layoutView?.findViewById<LinearLayout>(R.id.shapes_elements)
if (mShapesElements != null) {
val displayFormatType = if (mShapesElements.contentDescription.toString().startsWith("round")) "round" else "rect"
val displayStyle = sp.getString(R.string.key_digital_style_frame_style, "full")
val displayFrameColor = sp.getString(R.string.key_digital_style_frame_color, "red")
val displayFrameColorSaturation = sp.getString(R.string.key_digital_style_frame_color_saturation, "500")
val displayFrameColorOpacity = sp.getString(R.string.key_digital_style_frame_color_opacity, "1")
// Load image with shapes
val styleDrawableName = "digitalstyle_bg_" + displayStyle + "_" + displayFormatType
val styleDrawableName = "digital_style_bg_" + displayStyle
try {
mShapesElements.background = ContextCompat.getDrawable(this, resources.getIdentifier(styleDrawableName, "drawable", this.packageName))
} catch (e: Exception) {
aapsLogger.error("digitalstyle_frameStyle", "RESOURCE NOT FOUND >> $styleDrawableName")
aapsLogger.error("digital_style_frameStyle", "RESOURCE NOT FOUND >> $styleDrawableName")
}
// set background-tint-color
@ -86,13 +85,13 @@ class DigitalStyleWatchface : BaseWatchFace() {
mShapesElements.backgroundTintList = null
} else {
val strColorName = if (displayFrameColor == "white" || displayFrameColor == "black") displayFrameColor else displayFrameColor + "_" + displayFrameColorSaturation
aapsLogger.debug(LTag.WEAR, "digitalstyle_strColorName", strColorName)
aapsLogger.debug(LTag.WEAR, "digital_style_strColorName", strColorName)
try {
val colorStateList = ContextCompat.getColorStateList(this, resources.getIdentifier(strColorName, "color", this.packageName))
mShapesElements.backgroundTintList = colorStateList
} catch (e: Exception) {
mShapesElements.backgroundTintList = null
aapsLogger.error("digitalstyle_colorName", "COLOR NOT FOUND >> $strColorName")
aapsLogger.error("digital_style_colorName", "COLOR NOT FOUND >> $strColorName")
}
}

View file

@ -6,9 +6,7 @@ import androidx.viewbinding.ViewBinding
import com.ustwo.clockwise.common.WatchMode
import info.nightscout.androidaps.R
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.databinding.ActivityNochartBinding
import info.nightscout.androidaps.databinding.ActivityNochartSmallBinding
import info.nightscout.androidaps.watchfaces.utils.BaseWatchFace
import info.nightscout.androidaps.watchfaces.utils.WatchfaceViewAdapter
@ -17,11 +15,6 @@ class NoChartWatchface : BaseWatchFace() {
private lateinit var binding: WatchfaceViewAdapter
override fun inflateLayout(inflater: LayoutInflater): ViewBinding {
if (resources.displayMetrics.widthPixels < SCREEN_SIZE_SMALL || resources.displayMetrics.heightPixels < SCREEN_SIZE_SMALL) {
val layoutBinding = ActivityNochartSmallBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
}
val layoutBinding = ActivityNochartBinding.inflate(inflater)
binding = WatchfaceViewAdapter.getBinding(layoutBinding)
return layoutBinding
@ -35,6 +28,7 @@ class NoChartWatchface : BaseWatchFace() {
binding.delta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, R.color.dark_midColor))
binding.timestamp.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, R.color.dark_Timestamp))
}
override fun setColorDark() {
@ -52,6 +46,7 @@ class NoChartWatchface : BaseWatchFace() {
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) R.color.dark_Timestamp else R.color.dark_TimestampOld
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, colorTime))
}
override fun setColorBright() {
@ -70,6 +65,7 @@ class NoChartWatchface : BaseWatchFace() {
binding.avgDelta?.setTextColor(ContextCompat.getColor(this, color))
val colorTime = if (ageLevel == 1) R.color.light_mTimestamp1 else R.color.light_mTimestamp
binding.timestamp.setTextColor(ContextCompat.getColor(this, colorTime))
binding.timePeriod?.setTextColor(ContextCompat.getColor(this, colorTime))
} else {
setColorDark()

View file

@ -331,7 +331,7 @@ abstract class BaseWatchFace : WatchFace() {
}
private fun setDateAndTime() {
binding.time?.text = dateUtil.timeString()
binding.time?.text = if(binding.timePeriod == null) dateUtil.timeString() else dateUtil.hourString() + ":" + dateUtil.minuteString()
binding.hour?.text = dateUtil.hourString()
binding.minute?.text = dateUtil.minuteString()
binding.dateTime?.visibility = sp.getBoolean(R.string.key_show_date, false).toVisibility()

View file

@ -5,7 +5,6 @@ import info.nightscout.androidaps.databinding.ActivityHomeLargeBinding
import info.nightscout.androidaps.databinding.ActivityHome2Binding
import info.nightscout.androidaps.databinding.ActivityHomeBinding
import info.nightscout.androidaps.databinding.ActivityBigchartBinding
import info.nightscout.androidaps.databinding.ActivityBigchartSmallBinding
import info.nightscout.androidaps.databinding.ActivityCockpitBinding
import info.nightscout.androidaps.databinding.ActivityDigitalstyleBinding
import info.nightscout.androidaps.databinding.ActivityNochartBinding
@ -20,7 +19,6 @@ class WatchfaceViewAdapter(
a2: ActivityHome2Binding? = null,
aa: ActivityHomeBinding? = null,
bC: ActivityBigchartBinding? = null,
bCs: ActivityBigchartSmallBinding? = null,
cp: ActivityCockpitBinding? = null,
ds: ActivityDigitalstyleBinding? = null,
nC: ActivityNochartBinding? = null,
@ -28,7 +26,7 @@ class WatchfaceViewAdapter(
) {
init {
if (aL == null && a2 == null && aa == null && bC == null && bCs == null && cp == null && ds == null && nC == null && sP == null) {
if (aL == null && a2 == null && aa == null && bC == null && cp == null && ds == null && nC == null && sP == null) {
throw IllegalArgumentException("Require at least on Binding parameter")
}
}
@ -67,7 +65,7 @@ class WatchfaceViewAdapter(
val iob2 = a2?.iob2 ?: cp?.iob2 ?: ds?.iob2 ?: sP?.iob2
val chart = a2?.chart ?: aa?.chart ?: bC?.chart ?: bC?.chart ?: ds?.chart ?: sP?.chart
val status = aL?.status ?: aa?.status ?: bC?.status ?: bC?.status ?: nC?.status
val timePeriod = ds?.timePeriod
val timePeriod = ds?.timePeriod ?: aL?.timePeriod ?: nC?.timePeriod ?: bC?.timePeriod
val dayName = ds?.dayName
val mainMenuTap = ds?.mainMenuTap ?: sP?.mainMenuTap
val chartZoomTap = ds?.chartZoomTap ?: sP?.chartZoomTap
@ -89,11 +87,10 @@ class WatchfaceViewAdapter(
is ActivityHome2Binding -> WatchfaceViewAdapter(null, bindLayout)
is ActivityHomeBinding -> WatchfaceViewAdapter(null, null, bindLayout)
is ActivityBigchartBinding -> WatchfaceViewAdapter(null, null, null, bindLayout)
is ActivityBigchartSmallBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
is ActivityCockpitBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout)
is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout)
is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, bindLayout)
is ActivitySteampunkBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, null, bindLayout)
is ActivityCockpitBinding -> WatchfaceViewAdapter(null, null, null, null, bindLayout)
is ActivityDigitalstyleBinding -> WatchfaceViewAdapter(null, null, null, null, null, bindLayout)
is ActivityNochartBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, bindLayout)
is ActivitySteampunkBinding -> WatchfaceViewAdapter(null, null, null, null, null, null, null, bindLayout)
else -> throw IllegalArgumentException("ViewBinding is not implement in WatchfaceViewAdapter")
}
}

View file

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View file

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View file

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View file

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View file

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -1,111 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="30sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="41sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="30sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="18sp"
tools:text="E xU/h IOB: x (x+x)" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="35sp"
tools:text="12:00" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="26sp"
tools:text="-- '" />
</LinearLayout>
</LinearLayout>

View file

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="34sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5sp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="18sp"
tools:text="E xU/h IOB: x (x+x)" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center_horizontal" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-5sp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:paddingTop="-5sp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="34sp"
tools:text="12:00" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,447 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/airplane_cockpit_outside_clouds"
tools:context=".watchfaces.CockpitWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:id="@+id/inside"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/airplane_cockpit"
android:orientation="vertical"
android:weightSum="1">
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="0.095" />
<LinearLayout
android:id="@+id/windows"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="0.2575"
android:orientation="horizontal">
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.47"
tools:ignore="NestedWeights" />
<LinearLayout
android:id="@+id/warnings"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.06"
android:baselineAligned="false"
android:orientation="vertical">
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="0.2" />
<TextView
android:id="@+id/highLight"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@drawable/airplane_led_grey_unlit"
android:gravity="center"
android:text="@string/first_char_high"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="8sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="2" />
<TextView
android:id="@+id/lowLight"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@drawable/airplane_led_grey_unlit"
android:gravity="center"
android:text="@string/first_char_low"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="8sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<View
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="0.2" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.47" />
</LinearLayout>
<LinearLayout
android:id="@+id/dashboard"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="0.0775"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:id="@+id/instruments"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.57"
android:orientation="horizontal">
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.08"
tools:ignore="NestedWeights" />
<LinearLayout
android:id="@+id/panel1"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.275"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.07" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.5"
android:orientation="vertical"
android:weightSum="1">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:text="---"
android:textColor="@color/primary_text_dark"
android:textSize="30sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.276"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.35"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/timestamp"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.65"
android:gravity="center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.07" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.0225" />
<LinearLayout
android:id="@+id/panel2"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.245"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.020" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.19"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="16sp"
android:textStyle="bold"
tools:text="12:00" />
<TextView
android:id="@+id/basalRate"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
android:layout_weight="0.19"
android:gravity="bottom|center_horizontal"
android:text="@string/no_tmp_basal_u_h"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
android:layout_weight="0.18"
android:gravity="bottom|center_horizontal"
android:text="@string/no_iob_u"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="bottom|center_horizontal"
android:layout_weight="0.185"
android:gravity="bottom|center_horizontal"
android:text="@string/no_cob_g"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="12sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.185"
android:gravity="center"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom|center_horizontal"
android:gravity="bottom|center_horizontal"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/rig_battery"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom|center_horizontal"
android:gravity="bottom|center_horizontal"
android:paddingStart="4dp"
android:paddingEnd="0dp"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.06" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.0225" />
<LinearLayout
android:id="@+id/panel3"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.275"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.07" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.5"
android:gravity="center"
android:orientation="vertical"
android:weightSum="0.5">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.333"
android:gravity="center"
android:text="--"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="28sp"
android:textStyle="bold"
tools:ignore="HardcodedText, NestedWeights" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.167"
android:gravity="center"
android:weightSum="2">
<TextView
android:id="@+id/delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="+/-"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="13sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="@string/abbreviation_average"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.06" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.250"
android:orientation="horizontal"
android:weightSum="1">
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.1"
tools:ignore="NestedWeights" />
<TextView
android:id="@+id/loop"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_weight="0.5"
android:background="@drawable/loop_grey_25"
android:gravity="center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/primary_text_dark"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<View
android:id="@+id/AAPSv2"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:visibility="invisible" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.16" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.08" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -1,610 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<!-- background-image with shapes elements-->
<LinearLayout
android:id="@+id/shapes_elements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digitalstyle_bg_full_rect"
android:contentDescription="rect-shape-elements"
android:orientation="horizontal"
tools:ignore="HardcodedText" />
<!-- root-element-->
<LinearLayout
android:id="@+id/watchface_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="horizontal"
android:weightSum="8">
<!-- left side 3/8 width -->
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:orientation="vertical"
android:weightSum="100">
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="13.95"
tools:ignore="NestedWeights" />
<!-- COB -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="20.44"
android:orientation="horizontal"
android:weightSum="13">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4.9" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7.0"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:weightSum="5">
<TextView
android:id="@+id/cob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:fontFamily="@font/roboto_slab_light"
android:gravity="bottom|center_horizontal"
android:text="@string/activity_carb"
android:textColor="@color/light_grey"
android:textSize="10sp"
tools:ignore="SmallSp, NestedWeights" />
<TextView
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:fontFamily="@font/roboto_slab_light"
android:gravity="top|center_horizontal"
android:letterSpacing="-0.075"
android:lines="1"
android:text="@string/cob_000g"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.1" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.87" />
<!-- SGV / BZ-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="25.48"
android:orientation="horizontal"
android:weightSum="13">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3.2" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="8.7"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:weightSum="20">
<!-- 1st line with direction and timestamp-->
<LinearLayout
android:id="@+id/directionLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="9"
android:baselineAligned="false"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal"
android:weightSum="10"
tools:ignore="NestedWeights">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
<TextView
android:id="@+id/direction"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="3"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/timestamp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="3dp"
android:layout_marginBottom="2dp"
android:layout_weight="3"
android:fontFamily="sans-serif-condensed-light"
android:text="--'"
android:textColor="@color/light_grey"
android:textSize="10sp"
tools:ignore="HardcodedText,SmallSp" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
</LinearLayout>
<!-- 2nd line with sgv-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-10dp"
android:layout_weight="11"
android:baselineAligned="false"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/sgv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/roboto_slab_light"
android:gravity="top|center_horizontal"
android:letterSpacing="-0.05"
android:lines="1"
android:text="@string/svg_00_0"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.1" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.87" />
<!-- IOB -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="20.44"
android:orientation="horizontal"
android:weightSum="13">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4.9" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7.0"
android:gravity="center_horizontal|center_vertical"
android:orientation="vertical"
android:weightSum="5">
<TextView
android:id="@+id/iob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:fontFamily="@font/roboto_slab_light"
android:gravity="bottom|center_horizontal"
android:text="@string/activity_IOB"
android:textColor="@color/light_grey"
android:textSize="10sp"
tools:ignore="SmallSp, NestedWeights" />
<TextView
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:fontFamily="@font/roboto_slab_light"
android:gravity="top|center_horizontal"
android:letterSpacing="-0.075"
android:lines="1"
android:text="@string/iob_0_00u"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.1" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="13.95" />
</LinearLayout>
<!-- right side 5/8 width -->
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:baselineAligned="false"
android:orientation="vertical"
android:weightSum="2">
<!-- right side 1/2 height - top half -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="9dp"
android:layout_marginEnd="0dp"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="NestedWeights">
<!-- right side top - spacer 2/10 -->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" />
<!-- right side top - date 4/10 -->
<LinearLayout
android:id="@+id/date_time"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:orientation="vertical"
android:weightSum="2">
<!-- day name (short)-->
<LinearLayout
android:id="@+id/date_time1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:id="@+id/day_name"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:fontFamily="@font/roboto_condensed_regular"
android:textAllCaps="true"
android:textColor="@color/white"
android:textFontWeight="400"
android:textSize="18sp"
tools:text="DDD" />
<TextView
android:id="@+id/week_number"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:fontFamily="@font/roboto_condensed_light"
android:letterSpacing="-0.1"
android:textAllCaps="true"
android:textColor="@color/light_grey"
android:textFontWeight="400"
android:textSize="18sp"
android:visibility="gone"
tools:text="ww" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
</LinearLayout>
<!-- day number + month (short)-->
<LinearLayout
android:id="@+id/date_time2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<!-- day number-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/roboto_condensed_regular"
android:paddingStart="0dp"
android:paddingEnd="4dp"
android:textColor="@color/light_grey"
android:textSize="18sp"
tools:text="DD" />
</LinearLayout>
<!-- month short-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:fontFamily="@font/roboto_condensed_regular"
android:textAllCaps="true"
android:textColor="@color/light_grey"
android:textSize="18sp"
tools:text="MMM" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- right side top - hour minute 4/10 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:baselineAligned="false"
android:gravity="start|center_vertical"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="-5dp">
<!-- hour -->
<TextView
android:id="@+id/hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:fontFamily="@font/roboto_condensed_bold"
android:textAllCaps="true"
android:textColor="@color/white"
android:textSize="40sp"
android:textStyle="bold"
tools:text="HH" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<!-- minute -->
<TextView
android:id="@+id/minute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="6sp"
android:layout_marginBottom="-8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:textColor="@color/light_grey"
android:textSize="26sp"
android:textStyle="bold"
tools:text="MI" />
<!-- 12h period AM / PM -->
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="8sp"
android:fontFamily="@font/roboto_condensed_bold"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp"
tools:text="AM" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- right side 1/2 height - bottom half -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:baselineAligned="false"
android:gravity="start|top"
android:orientation="vertical"
android:weightSum="10">
<!-- right side bottom - status bar 2/10 -->
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:baselineAligned="false"
android:gravity="center_horizontal|center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/delta"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|center_vertical"
android:text="+/-"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="HardcodedText, SmallSp, NestedWeights" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|center_vertical"
android:text="@string/abbreviation_average"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|center_vertical"
android:text="--%"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="HardcodedText,SmallSp" />
<TextView
android:id="@+id/rig_battery"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|center_vertical"
android:text="--%"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="HardcodedText,SmallSp" />
<TextView
android:id="@+id/basalRate"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.7"
android:gravity="center_horizontal|center_vertical"
android:text="@string/no_tmp_basal_u_h"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/bgi"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|center_vertical"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="SmallSp"
tools:text="bgi" />
</LinearLayout>
<!-- right side bottom - diagram 6/10 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:baselineAligned="false"
android:orientation="vertical"
android:weightSum="1">
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center_horizontal|top"
tools:ignore="NestedWeights" />
</LinearLayout>
<!-- right side bottom - spacer 2/10 -->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- FLAGs -->
<View
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</RelativeLayout>

View file

@ -1,158 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:layout_marginBottom="-2dp"
android:gravity="bottom"
android:paddingTop="-2dp"
android:text="---"
android:textColor="@color/white"
android:textSize="41sp"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-5dp"
android:gravity="center_horizontal|bottom"
android:paddingTop="1dp"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center_horizontal|bottom"
android:text="@string/delta_na"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/light_grey"
android:orientation="horizontal"
android:padding="1dp"
android:textAlignment="center">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/time_stamp_na_min_ago"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="10sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/uploader_na"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="10sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text=""
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="10sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/no_status"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="10sp"
tools:ignore="SmallSp" />
</LinearLayout>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="35sp"
tools:text="12:00" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="77dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal|top" />
</LinearLayout>

View file

@ -1,351 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1"
tools:context=".watchfaces.AapsV2Watchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:id="@+id/primary_layout"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center_horizontal"
android:layout_weight="0.27"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/loop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:background="@drawable/loop_grey_25"
android:gravity="center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="-2dp"
android:gravity="bottom|end"
android:paddingStart="5dp"
android:paddingTop="-2dp"
android:paddingEnd="5dp"
android:text="---"
android:textColor="@color/white"
android:textSize="38sp"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/timestamp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:gravity="center"
android:text="--'"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.10"
android:background="@color/light_grey"
android:gravity="center"
android:orientation="vertical"
android:padding="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="+/-"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="@string/abbreviation_average"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/rig_battery"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/basal_rate"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.7"
android:gravity="center"
android:text="@string/no_tmp_basal_u_h"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/bgi"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="bgi" />
<View
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.22"
android:background="@color/black"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal"
android:padding="1dp"
android:weightSum="7">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:baselineAligned="false"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center">
<TextView
android:id="@+id/cob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/activity_carb"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_cob_g"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="30sp"
tools:text="12:00" />
<LinearLayout
android:id="@+id/date_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center"
android:visibility="gone">
<TextView
android:id="@+id/day"
android:layout_width="23dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="10sp"
tools:ignore="SmallSp"
tools:text="day" />
<TextView
android:id="@+id/month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@color/white"
android:textSize="10sp"
tools:ignore="SmallSp"
tools:text="mth" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center">
<TextView
android:id="@+id/iob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/activity_IOB"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/iob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_iob_u"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="bottom"
android:layout_weight="0.41"
android:gravity="center_horizontal|top" />
</LinearLayout>

View file

@ -1,136 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="147dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="15dp"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_gravity="bottom"
android:gravity="bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="50sp"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center_horizontal|bottom"
android:paddingTop="1dp"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="27sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/delta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:text="@string/delta_na"
android:textColor="@color/white"
android:textSize="10sp"
tools:ignore="SmallSp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/light_grey"
android:orientation="horizontal"
android:padding="2dp"
android:textAlignment="center">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/time_stamp_na_min_ago"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/uploader_na"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text=""
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/no_status"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="55sp"
tools:text="12:00" />
</LinearLayout>

View file

@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="40sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="55sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="40sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
tools:text="E xU/h IOB: x (x+x)"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
tools:text="12:00"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="47sp" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="-- '"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="35sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.NoChartWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text="---"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="45sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginStart="5dp"
android:gravity="center_vertical|center_horizontal|center"
android:text=" ---"
android:textColor="@color/white"
android:textSize="26sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:id="@+id/dummy1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="2dp"
android:text="@string/no_loop_status"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="21sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="45sp"
tools:text="23:24" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,381 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.SteampunkWatchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/glucose_dial"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:importantForAccessibility="no"
android:src="@drawable/steampunk_dial_mgdl" />
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/steampunk_gauge_mgdl_20"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/delta_pointer"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.69"
android:gravity="center"
android:src="@drawable/steampunk_pointer" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/main_menu_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.7"
android:orientation="vertical"
android:weightSum="1">
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.05"
tools:ignore="NestedWeights" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.26"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="7dp"
android:rotation="-28"
android:text="@string/no_cob_g"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.27"
android:orientation="horizontal">
<TextView
android:id="@+id/basalRate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="14dp"
android:rotation="0"
android:text="@string/no_tmp_basal_u_h"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.165"
android:orientation="horizontal">
<TextView
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingTop="6dp"
android:rotation="28"
android:text="@string/no_iob_u"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="13sp"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.2"
android:gravity="center"
android:textSize="11sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/chart_zoom_tap"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.27"
android:orientation="horizontal"
android:weightSum="1">
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
tools:ignore="NestedWeights" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:orientation="horizontal" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.03" />
</LinearLayout>
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.15" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.21"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1">
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32"
tools:ignore="NestedWeights" />
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/loop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="0dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:rotation="-24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="0.12"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/rig_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:paddingStart="10dp"
android:paddingTop="8dp"
android:paddingEnd="0dp"
android:rotation="24"
android:text="-'"
android:textAlignment="center"
android:textColor="@color/black_86p"
android:textSize="12sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.32" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="0.64" />
</LinearLayout>
<LinearLayout
android:id="@+id/cover_plate_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/steampunk_cover_plate"
android:orientation="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/hour_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:rotation="0"
android:src="@drawable/steampunk_hour_hand" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="@+id/minute_hand"
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.3"
android:orientation="vertical"
android:src="@drawable/steampunk_minute_hand" />
</LinearLayout>
<View
android:id="@+id/AAPSv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</RelativeLayout>

View file

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-2dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="30sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="41sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="30sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="18sp"
tools:text="E xU/h IOB: x (x+x)" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:textColor="@color/white"
android:textSize="35sp"
tools:text="12:00" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="-- '"
android:textColor="@color/white"
android:textSize="26sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,113 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="34sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5sp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="18sp"
tools:text="E xU/h IOB: x (x+x)" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:gravity="center_horizontal" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-5sp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:paddingTop="-5sp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="34sp"
tools:text="12:00" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal|center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,164 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="15dp"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="-2dp"
android:gravity="bottom|end"
android:paddingStart="0dp"
android:paddingTop="-2dp"
android:paddingEnd="5dp"
android:text="---"
android:textColor="@color/white"
android:textSize="41sp"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-5dp"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="30sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/delta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center_horizontal|bottom"
android:text="@string/delta_na"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/light_grey"
android:orientation="vertical"
android:padding="1dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/time_stamp_na_min_ago"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="8sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/uploader_na"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="8sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text=""
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="8sp"
tools:ignore="SmallSp" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/no_status"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="8sp"
tools:ignore="SmallSp" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-3dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="30sp"
tools:text="12:00" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="77dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal|top" />
</LinearLayout>

View file

@ -1,138 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="147dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal"
android:paddingTop="30dp"
android:textAlignment="center">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:paddingBottom="3dp"
android:text="8.8"
android:textColor="@color/white"
android:textSize="50sp"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center_horizontal|bottom"
android:paddingTop="1dp"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="27sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/delta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="center_horizontal"
android:text="@string/delta_na"
android:textColor="@color/white"
android:textSize="10sp"
tools:ignore="SmallSp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/light_grey"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:padding="2dp">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="14sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/uploader_na"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text=""
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="14sp" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:text="@string/no_status"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="55sp"
tools:text="12:00" />
</LinearLayout>

View file

@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.NoChartWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-15dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="40sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="55sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="5dp"
android:gravity="center_horizontal|bottom"
android:text="---"
android:textColor="@color/white"
android:textSize="40sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
tools:text="E xU/h IOB: x (x+x)" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="47sp"
tools:text="12:00" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="-- '"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="35sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
tools:context=".watchfaces.AapsWatchface"
tools:deviceIds="wear_square"
tools:ignore="MissingDefaultResource">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-15dp"
android:layout_marginBottom="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="5dp"
android:textAlignment="center">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginEnd="5dp"
android:layout_marginBottom="-15dp"
android:gravity="center_vertical|center_horizontal|center"
android:text="---"
android:textColor="@color/white"
android:textSize="22sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="---"
android:textColor="@color/white"
android:textSize="42sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginStart="5dp"
android:layout_marginBottom="-15dp"
android:gravity="center_vertical|center_horizontal|center"
android:text=" ---"
android:textColor="@color/white"
android:textSize="22sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<View
android:id="@+id/dummy1"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="bottom"
android:gravity="center_horizontal" />
<TextView
android:id="@+id/status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:paddingBottom="2dp"
android:text="@string/no_loop_status"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="21sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal|bottom"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="6dp"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="43sp"
tools:text="23:24" />
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="24sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>

View file

@ -11,11 +11,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="10sp"
android:layout_margin="10dp"
android:background="@drawable/circle"
android:backgroundTint="@color/white"
android:contentDescription="@string/action_confirm"
android:padding="25sp"
android:padding="25dp"
android:src="@drawable/ic_confirm"
app:tint="@color/white" />

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:textAlignment="center"
tools:context=".watchfaces.BigChartWatchface">
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom"
android:textSize="@dimen/watch_face_big_chart_delta_text_size"
tools:text="---" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:textSize="@dimen/watch_face_big_chart_svg_text_size"
tools:text="---" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:textSize="@dimen/watch_face_big_chart_delta_text_size"
tools:text="---" />
</LinearLayout>
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-4dp"
app:layout_constraintBottom_toTopOf="@+id/status"
app:layout_constraintTop_toBottomOf="@+id/linearLayout3" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-7dp"
android:textSize="@dimen/watch_face_status_text_size"
app:layout_constraintBottom_toTopOf="@+id/linearLayout2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text="E xU/h IOB: x (x+x)" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingBottom="6dp"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="2dp"
android:textSize="@dimen/watch_face_time_text_size"
tools:text="12:00" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:maxLines="1"
android:textSize="@dimen/watch_face_timestamp_text_size"
tools:text="5'" />
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginTop="-5dp"
android:textSize="@dimen/watch_face_time_period_text_size"
android:textStyle="bold"
tools:text="AM" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -6,7 +6,8 @@
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical">
android:orientation="vertical"
tools:context=".watchfaces.CircleWatchface">
<TextView
android:id="@+id/agoString"

View file

@ -5,9 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/airplane_cockpit_outside_clouds"
tools:context=".watchfaces.CockpitWatchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
tools:context=".watchfaces.CockpitWatchface">
<LinearLayout
android:id="@+id/inside"

View file

@ -5,18 +5,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
tools:context=".watchfaces.DigitalStyleWatchface">
<!-- background-image with shapes elements-->
<LinearLayout
android:id="@+id/shapes_elements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digitalstyle_bg_full_round"
android:contentDescription="round-shape-elements"
android:orientation="horizontal"
tools:ignore="HardcodedText" />
android:background="@drawable/digital_style_bg_full"
android:orientation="horizontal" />
<!-- root-element-->
<LinearLayout
@ -66,6 +63,7 @@
android:id="@+id/cob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="1dp"
android:layout_weight="2"
android:fontFamily="@font/roboto_slab_light"
android:gravity="bottom|center_horizontal"
@ -78,6 +76,7 @@
android:id="@+id/cob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-1dp"
android:layout_weight="3"
android:fontFamily="@font/roboto_slab_light"
android:gravity="top|center_horizontal"
@ -85,7 +84,7 @@
android:lines="1"
android:text="@string/cob_000g"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="@dimen/watch_face_digital_sub_text_size" />
</LinearLayout>
@ -150,7 +149,7 @@
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="16sp"
android:textSize="@dimen/watch_face_digital_direction_text_size"
android:textStyle="bold"
tools:ignore="HardcodedText" />
@ -163,9 +162,10 @@
android:layout_marginBottom="2dp"
android:layout_weight="3"
android:fontFamily="sans-serif-condensed-light"
android:maxLines="1"
android:text="--'"
android:textColor="@color/light_grey"
android:textSize="10sp"
android:textSize="@dimen/watch_face_digital_timestamp_text_size"
tools:ignore="HardcodedText,SmallSp" />
<View
@ -196,7 +196,7 @@
android:lines="1"
android:text="@string/svg_00_0"
android:textColor="@color/white"
android:textSize="20sp"
android:textSize="@dimen/watch_face_digital_svg_text_size"
android:textStyle="bold" />
</LinearLayout>
@ -240,6 +240,7 @@
android:id="@+id/iob1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="1dp"
android:layout_weight="2"
android:fontFamily="@font/roboto_slab_light"
android:gravity="bottom|center_horizontal"
@ -252,14 +253,16 @@
android:id="@+id/iob2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-1dp"
android:layout_weight="3"
android:fontFamily="@font/roboto_slab_light"
android:gravity="top|center_horizontal"
android:letterSpacing="-0.075"
android:lines="1"
android:text="@string/iob_0_00u"
android:textColor="@color/white"
android:textSize="14sp" />
android:textSize="@dimen/watch_face_digital_sub_text_size" />
</LinearLayout>
@ -342,7 +345,6 @@
android:textColor="@color/light_grey"
android:textFontWeight="400"
android:textSize="18sp"
android:visibility="gone"
tools:text="ww" />
<View
@ -439,8 +441,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="6sp"
android:layout_marginBottom="-8sp"
android:layout_marginStart="6dp"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-8dp"
android:fontFamily="@font/roboto_condensed_bold"
android:textColor="@color/light_grey"
android:textSize="26sp"
@ -452,7 +455,7 @@
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8sp"
android:layout_marginStart="8dp"
android:fontFamily="@font/roboto_condensed_bold"
android:gravity="top"
android:textColor="@color/light_grey"

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.AapsWatchface">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/secondary_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:gravity="bottom"
android:textSize="41sp"
tools:text="---" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="25sp"
android:textStyle="bold"
tools:text="--" />
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textSize="11sp"
android:textStyle="bold"
tools:text="1" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="?android:colorForeground"
android:gravity="center_horizontal"
android:paddingVertical="1dp"
app:layout_constraintBottom_toTopOf="@+id/time">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="11sp"
android:textStyle="bold"
tools:text="@string/time_stamp_na_min_ago" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textAlignment="center"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="11sp"
android:textStyle="bold"
tools:text="@string/uploader_na" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textAlignment="center"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="11sp"
android:textStyle="bold"
tools:text="" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textAlignment="center"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="11sp"
android:textStyle="bold"
tools:text="@string/no_status" />
</LinearLayout>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:textAlignment="center"
android:textSize="35sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="12:00" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="-5dp"
android:paddingBottom="7dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/time" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,96 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1.1"
tools:context=".watchfaces.AapsV2Watchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
<View
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.05"
android:orientation="vertical" />
tools:context=".watchfaces.AapsV2Watchface">
<LinearLayout
android:id="@+id/primary_layout"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center_horizontal"
android:layout_weight="0.27"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
app:layout_constraintBottom_toTopOf="@+id/secondary_layout"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/loop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_gravity="bottom"
android:background="@drawable/loop_grey_25"
android:gravity="center"
android:text="--'"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
tools:text="--'" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_gravity=""
android:layout_marginBottom="-2dp"
android:gravity="bottom|end"
android:paddingStart="5dp"
android:paddingTop="-2dp"
android:paddingEnd="5dp"
android:text="---"
android:textColor="@color/white"
android:paddingHorizontal="5dp"
android:textSize="38sp"
tools:ignore="HardcodedText" />
tools:text="---" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingStart="0dp"
android:paddingEnd="4dp">
android:orientation="vertical">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="22sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
tools:text="--" />
<TextView
android:id="@+id/timestamp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:gravity="center"
android:text="--'"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
tools:text="--'" />
</LinearLayout>
@ -99,50 +67,39 @@
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.10"
android:background="@color/light_grey"
android:gravity="center"
android:orientation="vertical"
android:padding="1dp">
android:layout_height="wrap_content"
android:background="?android:colorForeground"
android:paddingVertical="1dp"
app:layout_constraintBottom_toTopOf="@+id/tertiary_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textAlignment="center">
android:paddingHorizontal="5dp">
<TextView
android:id="@+id/delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="+/-"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
tools:text="+/-" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="@string/abbreviation_average"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="@string/abbreviation_average" />
<TextView
android:id="@+id/uploader_battery"
@ -151,12 +108,11 @@
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
tools:text="--%" />
<TextView
android:id="@+id/rig_battery"
@ -165,39 +121,34 @@
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:text="--%"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold"
android:visibility="gone"
tools:ignore="HardcodedText" />
android:visibility="visible"
tools:text="--%" />
<TextView
android:id="@+id/basalRate"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1.7"
android:gravity="center"
android:text="@string/no_tmp_basal_u_h"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="@string/no_tmp_basal_u_h" />
<TextView
android:id="@+id/bgi"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/black"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="13sp"
android:textStyle="bold"
android:visibility="gone"
android:visibility="visible"
tools:text="bgi" />
<View
@ -213,46 +164,30 @@
<LinearLayout
android:id="@+id/tertiary_layout"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="center"
android:layout_weight="0.22"
android:background="@color/black"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal"
android:padding="1dp"
android:weightSum="7">
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:weightSum="7"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:baselineAligned="false"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center">
android:orientation="vertical">
<TextView
android:id="@+id/cob1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/activity_carb"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
android:textSize="11sp" />
<TextView
android:id="@+id/cob2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_cob_g"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
@ -268,10 +203,7 @@
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="30sp"
tools:text="12:00" />
@ -279,10 +211,8 @@
android:id="@+id/date_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:textAlignment="center"
android:visibility="gone">
<TextView
@ -292,7 +222,6 @@
android:layout_gravity="center"
android:gravity="center"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="12sp"
tools:text="day" />
@ -302,7 +231,6 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@color/white"
android:textSize="12sp"
tools:text="mth" />
@ -327,12 +255,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/activity_IOB"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp" />
android:textSize="11sp"
tools:text="@string/activity_IOB" />
<TextView
android:id="@+id/iob2"
@ -340,28 +265,21 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/no_iob_u"
android:textColor="@color/white"
android:textSize="14sp"
android:textStyle="bold" />
android:textStyle="bold"
tools:text="@string/no_iob_u" />
</LinearLayout>
</LinearLayout>
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_gravity="bottom"
android:layout_weight="0.41"
android:gravity="center_horizontal|top" />
android:layout_height="0dp"
android:layout_marginTop="-5dp"
android:layout_marginBottom="7dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tertiary_layout" />
<View
android:layout_width="wrap_content"
android:layout_height="0px"
android:layout_weight="0.05"
android:orientation="vertical" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.AapsLargeWatchface">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/secondary_layout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:textSize="50sp"
tools:text="18.8" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/direction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="27sp"
android:textStyle="bold"
tools:text="--" />
<TextView
android:id="@+id/delta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:textSize="11sp"
tools:text="@string/delta_na" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/secondary_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:colorForeground"
android:gravity="center_horizontal"
android:padding="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="@dimen/watch_face_large_status_size"
tools:text="--'" />
<TextView
android:id="@+id/uploader_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="@dimen/watch_face_large_status_size"
tools:text="@string/uploader_na" />
<TextView
android:id="@+id/raw"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="@dimen/watch_face_large_status_size"
tools:text="" />
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10sp"
android:paddingEnd="0sp"
android:textColor="?android:textColorPrimaryInverse"
android:textSize="14sp"
tools:text="@string/no_status" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/secondary_layout">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/watch_face_large_time_text_size"
tools:text="01:00" />
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="15sp"
android:layout_gravity="start"
android:textSize="@dimen/watch_face_large_time_period_text_size"
android:textStyle="bold"
tools:text="AM" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.NoChartWatchface">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
app:layout_constraintBottom_toTopOf="@+id/status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:maxLines="1"
android:textSize="@dimen/watch_face_delta_text_size"
tools:text="+0.0" />
<TextView
android:id="@+id/sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:paddingHorizontal="3dp"
android:textSize="@dimen/watch_face_svg_text_size"
tools:text="10.1" />
<TextView
android:id="@+id/avg_delta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:maxLines="1"
android:textSize="@dimen/watch_face_delta_text_size"
tools:text="+0.0" />
</LinearLayout>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:textSize="@dimen/watch_face_no_chart_status_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="E xU/h IOB: x (x+x)" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:textSize="@dimen/watch_face_time_text_size"
tools:text="12:00" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:maxLines="1"
android:textSize="@dimen/watch_face_timestamp_text_size"
tools:text="5'" />
<TextView
android:id="@+id/timePeriod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:textSize="11sp"
android:textStyle="bold"
tools:text="AM" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -4,9 +4,7 @@
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".watchfaces.SteampunkWatchface"
tools:deviceIds="wear_round"
tools:ignore="MissingDefaultResource">
tools:context=".watchfaces.SteampunkWatchface">
<LinearLayout
android:layout_width="match_parent"
@ -173,14 +171,14 @@
<View
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.25"
android:layout_weight="0.2"
tools:ignore="NestedWeights" />
<lecho.lib.hellocharts.view.LineChartView
android:id="@+id/chart"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="0.5" />
android:layout_weight="0.55" />
<View
android:layout_width="0px"

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Watch face sizes for bigger larger screen sizes -->
<dimen name="watch_face_svg_text_size">50sp</dimen>
<dimen name="watch_face_delta_text_size">25sp</dimen>
<dimen name="watch_face_time_text_size">45sp</dimen>
<dimen name="watch_face_timestamp_text_size">23sp</dimen>
<dimen name="watch_face_time_period_text_size">12sp</dimen>
<dimen name="watch_face_status_text_size">17sp</dimen>
<!-- Watch face specific-->
<dimen name="watch_face_no_chart_status_size">24sp</dimen>
<dimen name="watch_face_big_chart_svg_text_size">35sp</dimen>
<dimen name="watch_face_big_chart_delta_text_size">29sp</dimen>
<dimen name="watch_face_digital_svg_text_size">23sp</dimen>
<dimen name="watch_face_digital_direction_text_size">17sp</dimen>
<dimen name="watch_face_digital_timestamp_text_size">14sp</dimen>
<dimen name="watch_face_digital_sub_text_size">15sp</dimen>
<dimen name="watch_face_large_svg_text_size">55sp</dimen>
<dimen name="watch_face_large_direction_text_size">29sp</dimen>
<dimen name="watch_face_large_delta_text_size">13sp</dimen>
<dimen name="watch_face_large_time_text_size">55sp</dimen>
<dimen name="watch_face_large_time_period_text_size">13sp</dimen>
</resources>

View file

@ -1,8 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Watch Resources list of common watches with DP
Screen density = Screen width (or height) in pixels / Screen width (or height) in inches
dp = (width in pixels * 160) / screen density
Galaxy Watch 4 40mm: 1.2", 396 x 396 px = 192 dp
Galaxy Watch 4 44mm: 1.4", 450 x 450 px = 224 dp
Galaxy Watch 4 Classic 42mm: 1.19", 396 x 396 px = 190 dp
Galaxy Watch 4 Classic 46mm: 1.4", 450 x 450 px = 224 dp
Samsung Galaxy Watch 5 40mm: 1.2", 396 x 396 px = 192 dp
Samsung Galaxy Watch 5 44mm: 1.4", 450 x 450 px = 224 dp
TicWatch Pro 3: 1.39", 454 x 454 px = 222.4 dp
Fossil Gen 5: 1.28", 416 x 416 px = 204.8
Google Pixel Watch: 1.2", 450 x 450 px = 192 dp
-->
<resources>
<dimen name="simple_ui_svg_text_size">50sp</dimen>
<dimen name="simple_ui_direction_text_size">35sp</dimen>
<dimen name="simple_ui_time_text_size">35sp</dimen>
<dimen name="simple_ui_y_offset">5dp</dimen>
<!-- Watch face sizes for small screen sizes -->
<dimen name="watch_face_svg_text_size">40sp</dimen>
<dimen name="watch_face_delta_text_size">20sp</dimen>
<dimen name="watch_face_time_text_size">35sp</dimen>
<dimen name="watch_face_timestamp_text_size">17sp</dimen>
<dimen name="watch_face_time_period_text_size">11sp</dimen>
<dimen name="watch_face_status_text_size">15sp</dimen>
<!-- Watch face specific-->
<dimen name="watch_face_no_chart_status_size">20sp</dimen>
<dimen name="watch_face_big_chart_svg_text_size">30sp</dimen>
<dimen name="watch_face_big_chart_delta_text_size">25sp</dimen>
<dimen name="watch_face_digital_svg_text_size">20sp</dimen>
<dimen name="watch_face_digital_direction_text_size">16sp</dimen>
<dimen name="watch_face_digital_timestamp_text_size">10sp</dimen>
<dimen name="watch_face_digital_sub_text_size">14sp</dimen>
<dimen name="watch_face_large_svg_text_size">50sp</dimen>
<dimen name="watch_face_large_direction_text_size">27sp</dimen>
<dimen name="watch_face_large_delta_text_size">11sp</dimen>
<dimen name="watch_face_large_time_text_size">50sp</dimen>
<dimen name="watch_face_large_time_period_text_size">11sp</dimen>
<dimen name="watch_face_large_status_size">14sp</dimen>
</resources>

View file

@ -216,9 +216,9 @@
<string name="no_iob_u">--U</string>
<string name="no_cob_g">--g</string>
<string name="no_tmp_basal_u_h">-.--U/h</string>
<string name="uploader_na">Uploader: ---%</string>
<string name="no_status">S: no status</string>
<string name="time_stamp_na_min_ago">-- Minutes ago</string>
<string name="uploader_na">U: --%</string>
<string name="no_status">S: --</string>
<string name="time_stamp_na_min_ago">-- Min. ago</string>
<string name="delta_na">--- mg/dl</string>
<string name="no_loop_status">No Loop Status</string>
<string name="cob_000g">000g</string>