Merge branch 'dev' into comboctl-dev
This commit is contained in:
commit
4ea6b48047
3115 changed files with 72043 additions and 42616 deletions
|
@ -8,6 +8,7 @@
|
||||||
<w>actionstring</w>
|
<w>actionstring</w>
|
||||||
<w>aidex</w>
|
<w>aidex</w>
|
||||||
<w>alarmack</w>
|
<w>alarmack</w>
|
||||||
|
<w>alexpr</w>
|
||||||
<w>allowednumbers</w>
|
<w>allowednumbers</w>
|
||||||
<w>androidaps</w>
|
<w>androidaps</w>
|
||||||
<w>autosens</w>
|
<w>autosens</w>
|
||||||
|
@ -43,9 +44,14 @@
|
||||||
<w>dexcom</w>
|
<w>dexcom</w>
|
||||||
<w>dexdrip</w>
|
<w>dexdrip</w>
|
||||||
<w>diaconn</w>
|
<w>diaconn</w>
|
||||||
|
<w>dlvoy</w>
|
||||||
|
<w>dttm</w>
|
||||||
|
<w>ecarbs</w>
|
||||||
<w>enteredby</w>
|
<w>enteredby</w>
|
||||||
<w>enteredinsulin</w>
|
<w>enteredinsulin</w>
|
||||||
|
<w>eoflow</w>
|
||||||
<w>eopatch</w>
|
<w>eopatch</w>
|
||||||
|
<w>epss</w>
|
||||||
<w>eveningoutpost</w>
|
<w>eveningoutpost</w>
|
||||||
<w>eversense</w>
|
<w>eversense</w>
|
||||||
<w>extendedbolus</w>
|
<w>extendedbolus</w>
|
||||||
|
@ -56,12 +62,15 @@
|
||||||
<w>gson</w>
|
<w>gson</w>
|
||||||
<w>hmac</w>
|
<w>hmac</w>
|
||||||
<w>iage</w>
|
<w>iage</w>
|
||||||
|
<w>infinivocgm</w>
|
||||||
<w>insulet</w>
|
<w>insulet</w>
|
||||||
|
<w>intelligo</w>
|
||||||
<w>iobtotal</w>
|
<w>iobtotal</w>
|
||||||
<w>joda</w>
|
<w>joda</w>
|
||||||
<w>libre</w>
|
<w>libre</w>
|
||||||
<w>listdelimiter</w>
|
<w>listdelimiter</w>
|
||||||
<w>localprofile</w>
|
<w>localprofile</w>
|
||||||
|
<w>lyumjev</w>
|
||||||
<w>mdtp</w>
|
<w>mdtp</w>
|
||||||
<w>medtronic</w>
|
<w>medtronic</w>
|
||||||
<w>mgdl</w>
|
<w>mgdl</w>
|
||||||
|
@ -74,6 +83,7 @@
|
||||||
<w>nightscout</w>
|
<w>nightscout</w>
|
||||||
<w>notif</w>
|
<w>notif</w>
|
||||||
<w>nsclient</w>
|
<w>nsclient</w>
|
||||||
|
<w>oaps</w>
|
||||||
<w>okcancel</w>
|
<w>okcancel</w>
|
||||||
<w>omnipod</w>
|
<w>omnipod</w>
|
||||||
<w>openaps</w>
|
<w>openaps</w>
|
||||||
|
@ -88,10 +98,12 @@
|
||||||
<w>profileswitch</w>
|
<w>profileswitch</w>
|
||||||
<w>pumpbtcomm</w>
|
<w>pumpbtcomm</w>
|
||||||
<w>pumpcontrol</w>
|
<w>pumpcontrol</w>
|
||||||
|
<w>pumpdrivers</w>
|
||||||
<w>quickwizard</w>
|
<w>quickwizard</w>
|
||||||
<w>readstatus</w>
|
<w>readstatus</w>
|
||||||
<w>realduration</w>
|
<w>realduration</w>
|
||||||
<w>refresheventsfromnightscout</w>
|
<w>refresheventsfromnightscout</w>
|
||||||
|
<w>rfspy</w>
|
||||||
<w>rileylink</w>
|
<w>rileylink</w>
|
||||||
<w>roboelectric</w>
|
<w>roboelectric</w>
|
||||||
<w>rozman</w>
|
<w>rozman</w>
|
||||||
|
@ -104,6 +116,8 @@
|
||||||
<w>soundid</w>
|
<w>soundid</w>
|
||||||
<w>splitted</w>
|
<w>splitted</w>
|
||||||
<w>ssid</w>
|
<w>ssid</w>
|
||||||
|
<w>statuslight</w>
|
||||||
|
<w>statuslights</w>
|
||||||
<w>superbolus</w>
|
<w>superbolus</w>
|
||||||
<w>targethigh</w>
|
<w>targethigh</w>
|
||||||
<w>targetlow</w>
|
<w>targetlow</w>
|
||||||
|
@ -119,6 +133,7 @@
|
||||||
<w>totp</w>
|
<w>totp</w>
|
||||||
<w>tunedays</w>
|
<w>tunedays</w>
|
||||||
<w>uart</w>
|
<w>uart</w>
|
||||||
|
<w>unfinshed</w>
|
||||||
<w>urgentalarm</w>
|
<w>urgentalarm</w>
|
||||||
<w>wizzardpage</w>
|
<w>wizzardpage</w>
|
||||||
<w>xdrip</w>
|
<w>xdrip</w>
|
||||||
|
|
36
app-wear-shared/rx/build.gradle
Normal file
36
app-wear-shared/rx/build.gradle
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'kotlin-android'
|
||||||
|
id 'kotlin-kapt'
|
||||||
|
id 'kotlin-allopen'
|
||||||
|
id 'com.hiya.jacoco-android'
|
||||||
|
id 'kotlinx-serialization'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/core-main/jacoco_global.gradle"
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
namespace 'info.nightscout.rx'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 23 // for wear
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
api "com.google.dagger:dagger:$dagger_version"
|
||||||
|
api "com.google.dagger:dagger-android:$dagger_version"
|
||||||
|
|
||||||
|
//Logger
|
||||||
|
api 'org.slf4j:slf4j-api:1.7.36' // 2.0.x breaks logging. Code change needed
|
||||||
|
api 'com.github.tony19:logback-android:2.0.0'
|
||||||
|
|
||||||
|
//RxBus
|
||||||
|
api "io.reactivex.rxjava3:rxjava:$rxjava_version"
|
||||||
|
api "io.reactivex.rxjava3:rxkotlin:$rxkotlin_version"
|
||||||
|
api "io.reactivex.rxjava3:rxandroid:$rxandroid_version"
|
||||||
|
|
||||||
|
api "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
|
||||||
|
api "org.apache.commons:commons-lang3:$commonslang3_version"
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package info.nightscout.rx.annotations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the actual annotation that makes the class open. Don't use it directly, only through [RxOpenForTesting]
|
||||||
|
* which has a NOOP replacement in production.
|
||||||
|
*/
|
||||||
|
@Target(AnnotationTarget.ANNOTATION_CLASS)
|
||||||
|
annotation class RxOpenClass
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotate a class with [RxOpenForTesting] if it should be extendable for testing.
|
||||||
|
*/
|
||||||
|
@RxOpenClass
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
annotation class RxOpenForTesting
|
4
app-wear-shared/rx/src/main/AndroidManifest.xml
Normal file
4
app-wear-shared/rx/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.utils.rx
|
package info.nightscout.rx
|
||||||
|
|
||||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.rxjava3.core.Scheduler
|
import io.reactivex.rxjava3.core.Scheduler
|
|
@ -1,16 +1,16 @@
|
||||||
package info.nightscout.androidaps.plugins.bus
|
package info.nightscout.rx.bus
|
||||||
|
|
||||||
import info.nightscout.androidaps.annotations.OpenForTesting
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.androidaps.events.Event
|
import info.nightscout.rx.annotations.RxOpenForTesting
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
import info.nightscout.rx.events.Event
|
||||||
import info.nightscout.shared.logging.LTag
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
import info.nightscout.rx.logging.LTag
|
||||||
import io.reactivex.rxjava3.core.Observable
|
import io.reactivex.rxjava3.core.Observable
|
||||||
import io.reactivex.rxjava3.subjects.PublishSubject
|
import io.reactivex.rxjava3.subjects.PublishSubject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@OpenForTesting
|
@RxOpenForTesting
|
||||||
@Singleton
|
@Singleton
|
||||||
class RxBus @Inject constructor(
|
class RxBus @Inject constructor(
|
||||||
val aapsSchedulers: AapsSchedulers,
|
val aapsSchedulers: AapsSchedulers,
|
||||||
|
@ -26,7 +26,7 @@ class RxBus @Inject constructor(
|
||||||
|
|
||||||
// Listen should return an Observable and not the publisher
|
// Listen should return an Observable and not the publisher
|
||||||
// Using ofType we filter only events that match that class type
|
// Using ofType we filter only events that match that class type
|
||||||
fun <T: Any> toObservable(eventType: Class<T>): Observable<T> =
|
fun <T : Any> toObservable(eventType: Class<T>): Observable<T> =
|
||||||
publisher
|
publisher
|
||||||
.subscribeOn(aapsSchedulers.io)
|
.subscribeOn(aapsSchedulers.io)
|
||||||
.ofType(eventType)
|
.ofType(eventType)
|
|
@ -0,0 +1,25 @@
|
||||||
|
package info.nightscout.rx.di
|
||||||
|
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import info.nightscout.rx.AapsSchedulers
|
||||||
|
import info.nightscout.rx.DefaultAapsSchedulers
|
||||||
|
import info.nightscout.rx.interfaces.L
|
||||||
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
|
import info.nightscout.rx.logging.AAPSLoggerProduction
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module(
|
||||||
|
includes = [
|
||||||
|
]
|
||||||
|
)
|
||||||
|
open class RxModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
internal fun provideSchedulers(): AapsSchedulers = DefaultAapsSchedulers()
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideAAPSLogger(l: L): AAPSLogger = AAPSLoggerProduction(l)
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder
|
import org.apache.commons.lang3.builder.ReflectionToStringBuilder
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle
|
import org.apache.commons.lang3.builder.ToStringStyle
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventAcceptOpenLoopChange : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventAppExit : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventAppInitialized : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventAutosensCalculationFinished(val cause: Event?) : EventLoop()
|
class EventAutosensCalculationFinished(val cause: Event?) : EventLoop()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventBTChange(val state: Change, val deviceName: String?, val deviceAddress: String? = null) : Event() {
|
class EventBTChange(val state: Change, val deviceName: String?, val deviceAddress: String? = null) : Event() {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventBucketedDataCreated : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventChargingState(val isCharging: Boolean, val batterLevel: Int) : Event()
|
class EventChargingState(val isCharging: Boolean, val batterLevel: Int) : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventConfigBuilderChange : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventCustomActionsChanged : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventCustomCalculationFinished : Event()
|
class EventCustomCalculationFinished : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventDanaRSyncStatus(var message: String) : Event()
|
class EventDanaRSyncStatus(var message: String) : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventExtendedBolusChange : EventLoop()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventFoodDatabaseChanged : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventInitializationChanged : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventLocalProfileChanged : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
/** Supeclass for all events concerned with input or output into or from the LoopPlugin. */
|
/** Supeclass for all events concerned with input or output into or from the LoopPlugin. */
|
||||||
abstract class EventLoop : Event()
|
abstract class EventLoop : Event()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import info.nightscout.rx.weardata.EventData
|
||||||
|
|
||||||
|
class EventMobileToWear(val payload: EventData) : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventNSClientRestart : Event()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventNetworkChange(
|
class EventNetworkChange(
|
||||||
var mobileConnected: Boolean = false,
|
var mobileConnected: Boolean = false,
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventNtpStatus(val status: String, val percent: Int) : Event()
|
class EventNtpStatus(val status: String, val percent: Int) : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventOfflineChange : Event()
|
|
@ -1,6 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.general.overview.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
|
||||||
|
|
||||||
object EventOverviewBolusProgress : Event() {
|
object EventOverviewBolusProgress : Event() {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventPreferenceChange : Event {
|
||||||
|
|
||||||
|
var changedKey: String? = null
|
||||||
|
private set
|
||||||
|
|
||||||
|
constructor(key: String) {
|
||||||
|
changedKey = key
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isChanged(key: String): Boolean {
|
||||||
|
return changedKey == key
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventProfileStoreChanged : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventProfileSwitchChanged : Event()
|
class EventProfileSwitchChanged : Event()
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
import info.nightscout.androidaps.core.R
|
import android.content.Context
|
||||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
import info.nightscout.rx.R
|
||||||
|
|
||||||
class EventPumpStatusChanged : EventStatus {
|
class EventPumpStatusChanged : EventStatus {
|
||||||
|
|
||||||
|
@ -45,14 +45,14 @@ class EventPumpStatusChanged : EventStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
// status for startup wizard
|
// status for startup wizard
|
||||||
override fun getStatus(rh: ResourceHelper): String {
|
override fun getStatus(context: Context): String {
|
||||||
return when (status) {
|
return when (status) {
|
||||||
Status.CONNECTING -> rh.gs(R.string.connectingfor, secondsElapsed)
|
Status.CONNECTING -> context.getString(R.string.connecting_for, secondsElapsed)
|
||||||
Status.HANDSHAKING -> rh.gs(R.string.handshaking)
|
Status.HANDSHAKING -> context.getString(R.string.handshaking)
|
||||||
Status.CONNECTED -> rh.gs(R.string.connected)
|
Status.CONNECTED -> context.getString(R.string.connected)
|
||||||
Status.PERFORMING -> performingAction
|
Status.PERFORMING -> performingAction
|
||||||
Status.WAITING_FOR_DISCONNECTION -> rh.gs(R.string.waiting_for_disconnection)
|
Status.WAITING_FOR_DISCONNECTION -> context.getString(R.string.waiting_for_disconnection)
|
||||||
Status.DISCONNECTING -> rh.gs(R.string.disconnecting)
|
Status.DISCONNECTING -> context.getString(R.string.disconnecting)
|
||||||
Status.DISCONNECTED -> ""
|
Status.DISCONNECTED -> ""
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventQueueChanged : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventRebuildTabs constructor(var recreate: Boolean = false) : Event()
|
class EventRebuildTabs constructor(var recreate: Boolean = false) : Event()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import info.nightscout.rx.events.Event
|
||||||
|
|
||||||
|
class EventRefreshButtonState (val newState : Boolean): Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventRefreshOverview(var from: String, val now : Boolean = false) : Event()
|
class EventRefreshOverview(var from: String, val now : Boolean = false) : Event()
|
|
@ -0,0 +1,9 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
// Pass RL status to setup wizard
|
||||||
|
class EventSWRLStatus(val status: String) : EventStatus() {
|
||||||
|
|
||||||
|
override fun getStatus(context: Context): String = status
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
// Pass pump status to setup wizard
|
||||||
|
class EventSWSyncStatus(val status: String) : EventStatus() {
|
||||||
|
|
||||||
|
override fun getStatus(context: Context): String = status
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventSWUpdate(var redraw: Boolean) : Event()
|
|
@ -1,3 +1,3 @@
|
||||||
package info.nightscout.androidaps.events
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
class EventScale(val hours: Int) : Event()
|
class EventScale(val hours: Int) : Event()
|
|
@ -0,0 +1,8 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
|
||||||
|
// pass string to startup wizard
|
||||||
|
abstract class EventStatus : Event() {
|
||||||
|
abstract fun getStatus(context: Context) : String
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventTempBasalChange : EventLoop()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventTempTargetChange : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventThemeSwitch : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventTherapyEventChange : Event()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
class EventTreatmentChange : EventLoop()
|
|
@ -0,0 +1,4 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
/** Base class for events to update the UI, mostly a specific tab. */
|
||||||
|
abstract class EventUpdateGui : Event()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.rx.events
|
||||||
|
|
||||||
|
import info.nightscout.rx.weardata.EventData
|
||||||
|
|
||||||
|
class EventWearToMobile(val payload: EventData) : Event()
|
|
@ -0,0 +1,7 @@
|
||||||
|
package info.nightscout.rx.interfaces
|
||||||
|
|
||||||
|
interface L {
|
||||||
|
fun resetToDefaults()
|
||||||
|
fun findByName(name: String): LogElement
|
||||||
|
fun getLogElements(): List<LogElement>
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package info.nightscout.rx.interfaces
|
||||||
|
|
||||||
|
interface LogElement {
|
||||||
|
|
||||||
|
var name: String
|
||||||
|
var defaultValue: Boolean
|
||||||
|
var enabled: Boolean
|
||||||
|
|
||||||
|
fun enable(enabled: Boolean)
|
||||||
|
fun resetToDefault()
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.rx.logging
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 2019-12-27.
|
* Created by adrian on 2019-12-27.
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.rx.logging
|
||||||
|
|
||||||
|
import info.nightscout.rx.interfaces.L
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.rx.logging
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by adrian on 2019-12-27.
|
* Created by adrian on 2019-12-27.
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.rx.logging
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.rx.logging
|
||||||
|
|
||||||
enum class LTag(val tag: String, val defaultValue : Boolean = true, val requiresRestart: Boolean = false) {
|
enum class LTag(val tag: String, val defaultValue : Boolean = true, val requiresRestart: Boolean = false) {
|
||||||
CORE("CORE"),
|
CORE("CORE"),
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.shared.weardata
|
package info.nightscout.rx.weardata
|
||||||
|
|
||||||
import info.nightscout.androidaps.events.Event
|
import info.nightscout.rx.events.Event
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import java.util.*
|
import java.util.Objects
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
sealed class EventData : Event() {
|
sealed class EventData : Event() {
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Handskudding</string>
|
||||||
|
<string name="connected">Gekoppel</string>
|
||||||
|
<string name="disconnecting">Ontkoppel</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Сдвояване</string>
|
||||||
|
<string name="connected">Свързана</string>
|
||||||
|
<string name="disconnecting">Разкачане</string>
|
||||||
|
<string name="waiting_for_disconnection">Изчакване за разкачане</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Establint comunicació</string>
|
||||||
|
<string name="connected">Connectat</string>
|
||||||
|
<string name="disconnecting">Desconnectant</string>
|
||||||
|
<string name="waiting_for_disconnection">S\'està esperant la desconnexió</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connecting_for">Připojování %1$d sec</string>
|
||||||
|
<string name="handshaking">Navazování spojení</string>
|
||||||
|
<string name="connected">Připojeno</string>
|
||||||
|
<string name="disconnecting">Odpojuji</string>
|
||||||
|
<string name="waiting_for_disconnection">Čekám na odpojení</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Forbindelse verificeres</string>
|
||||||
|
<string name="connected">Tilsuttet</string>
|
||||||
|
<string name="disconnecting">Afbryder</string>
|
||||||
|
<string name="waiting_for_disconnection">Venter på afbrydelse</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Handshaking</string>
|
||||||
|
<string name="connected">Verbunden</string>
|
||||||
|
<string name="disconnecting">Verbindung wird getrennt</string>
|
||||||
|
<string name="waiting_for_disconnection">Warte auf Trennung der Verbindung</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Δημιουργία σύνδεσης</string>
|
||||||
|
<string name="connected">Συνδέθηκε</string>
|
||||||
|
<string name="disconnecting">Αποσυνδέεται</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connecting_for">Conectando durante %1$d s</string>
|
||||||
|
<string name="handshaking">Estableciendo comunicacion</string>
|
||||||
|
<string name="connected">Conectado</string>
|
||||||
|
<string name="disconnecting">Desconectando</string>
|
||||||
|
<string name="waiting_for_disconnection">Esperando la desconexión</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connecting_for">Connexion en cours %1$ds</string>
|
||||||
|
<string name="handshaking">Connexion</string>
|
||||||
|
<string name="connected">Connectée</string>
|
||||||
|
<string name="disconnecting">Déconnexion en cours</string>
|
||||||
|
<string name="waiting_for_disconnection">Attente de déconnexion</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connected">Nasctha</string>
|
||||||
|
<string name="disconnecting">Dícheangal</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Povezivanje</string>
|
||||||
|
<string name="connected">Povezano</string>
|
||||||
|
<string name="disconnecting">Odspajanje</string>
|
||||||
|
<string name="waiting_for_disconnection">Čeka se prekid veze</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Connessione</string>
|
||||||
|
<string name="connected">Connesso</string>
|
||||||
|
<string name="disconnecting">Disconnessione</string>
|
||||||
|
<string name="waiting_for_disconnection">In attesa della disconnessione</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">לוחץ יד</string>
|
||||||
|
<string name="connected">מחובר</string>
|
||||||
|
<string name="disconnecting">מתנתק</string>
|
||||||
|
<string name="waiting_for_disconnection">ממתין לניתוק</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">통신 확인</string>
|
||||||
|
<string name="connected">연결됨</string>
|
||||||
|
<string name="disconnecting">연결끊기중</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Ryšio užmezgimas</string>
|
||||||
|
<string name="connected">Prisijungta</string>
|
||||||
|
<string name="disconnecting">Atsijungiama</string>
|
||||||
|
<string name="waiting_for_disconnection">Laukiama atsijungimo</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Handshaking</string>
|
||||||
|
<string name="connected">Verbonden</string>
|
||||||
|
<string name="disconnecting">Verbinding aan het verbreken</string>
|
||||||
|
<string name="waiting_for_disconnection">Wachten op het loskoppelen</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connecting_for">Tilkobler i %1$d sek</string>
|
||||||
|
<string name="handshaking">Tilkobling verifiseres</string>
|
||||||
|
<string name="connected">Tilkoblet</string>
|
||||||
|
<string name="disconnecting">Frakobler</string>
|
||||||
|
<string name="waiting_for_disconnection">Venter på frakobling</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Uściskdłoni</string>
|
||||||
|
<string name="connected">Połączono</string>
|
||||||
|
<string name="disconnecting">Rozłączanie</string>
|
||||||
|
<string name="waiting_for_disconnection">Oczekiwanie na rozłączenie</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Cumprimento</string>
|
||||||
|
<string name="connected">Conectado</string>
|
||||||
|
<string name="disconnecting">A desligar</string>
|
||||||
|
<string name="waiting_for_disconnection">Aguardando a desconexão</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Cumprimento</string>
|
||||||
|
<string name="connected">Ligado</string>
|
||||||
|
<string name="disconnecting">A desconectar</string>
|
||||||
|
<string name="waiting_for_disconnection">A aguardar a desconexão</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Împerechere</string>
|
||||||
|
<string name="connected">Conectat</string>
|
||||||
|
<string name="disconnecting">Se deconectează</string>
|
||||||
|
<string name="waiting_for_disconnection">Se așteaptă deconectarea</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Подтверждение связи</string>
|
||||||
|
<string name="connected">соединение установлено</string>
|
||||||
|
<string name="disconnecting">разъединение</string>
|
||||||
|
<string name="waiting_for_disconnection">Ожидание разъединения</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Overovanie</string>
|
||||||
|
<string name="connected">Pripojené</string>
|
||||||
|
<string name="disconnecting">Odpájanie</string>
|
||||||
|
<string name="waiting_for_disconnection">Čakám na odpojenie</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Anslutningen verifieras</string>
|
||||||
|
<string name="connected">Ansluten</string>
|
||||||
|
<string name="disconnecting">Kopplar från</string>
|
||||||
|
<string name="waiting_for_disconnection">Väntar på frånkoppling</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">Bağlandı</string>
|
||||||
|
<string name="connected">Bağlanıldı</string>
|
||||||
|
<string name="disconnecting">Bağlantı kesiliyor</string>
|
||||||
|
<string name="waiting_for_disconnection">Bağlantının kesilmesi bekleniyor</string>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="handshaking">握手</string>
|
||||||
|
<string name="connected">已连接</string>
|
||||||
|
<string name="disconnecting">正在断开连接</string>
|
||||||
|
<string name="waiting_for_disconnection">正在等待连接</string>
|
||||||
|
</resources>
|
9
app-wear-shared/rx/src/main/res/values/strings.xml
Normal file
9
app-wear-shared/rx/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="connecting_for">Connecting for %1$d s</string>
|
||||||
|
<string name="handshaking">Handshaking</string>
|
||||||
|
<string name="connected">Connected</string>
|
||||||
|
<string name="disconnecting">Disconnecting</string>
|
||||||
|
<string name="waiting_for_disconnection">Waiting for disconnection</string>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -0,0 +1,8 @@
|
||||||
|
package info.nightscout.rx.annotations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Annotate a class with [RxOpenForTesting] if it should be extendable for testing.
|
||||||
|
* In production the class remains final.
|
||||||
|
*/
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
annotation class RxOpenForTesting
|
24
app-wear-shared/shared-impl/build.gradle
Normal file
24
app-wear-shared/shared-impl/build.gradle
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
id 'kotlin-android'
|
||||||
|
id 'kotlin-kapt'
|
||||||
|
id 'kotlin-allopen'
|
||||||
|
id 'com.hiya.jacoco-android'
|
||||||
|
id 'kotlinx-serialization'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
|
||||||
|
apply from: "${project.rootDir}/core/core-main/android_module_dependencies.gradle"
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
namespace 'info.nightscout.shared.impl'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 23 // for wear
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':app-wear-shared:rx')
|
||||||
|
implementation project(':app-wear-shared:shared')
|
||||||
|
}
|
4
app-wear-shared/shared-impl/src/main/AndroidManifest.xml
Normal file
4
app-wear-shared/shared-impl/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,25 @@
|
||||||
|
package info.nightscout.shared.impl.di
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.preference.PreferenceManager
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.Provides
|
||||||
|
import info.nightscout.rx.interfaces.L
|
||||||
|
import info.nightscout.shared.impl.logging.LImpl
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@Module(
|
||||||
|
includes = [
|
||||||
|
]
|
||||||
|
)
|
||||||
|
open class SharedImplModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideSharedPreferences(context: Context): SP = info.nightscout.shared.impl.sharedPreferences.SPImplementation(PreferenceManager.getDefaultSharedPreferences(context), context)
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideL(sp: SP): L = LImpl(sp)
|
||||||
|
}
|
|
@ -1,43 +1,46 @@
|
||||||
package info.nightscout.shared.logging
|
package info.nightscout.shared.impl.logging
|
||||||
|
|
||||||
|
import info.nightscout.rx.interfaces.L
|
||||||
|
import info.nightscout.rx.interfaces.LogElement
|
||||||
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class L @Inject constructor(
|
class LImpl @Inject constructor(
|
||||||
private val sp: SP
|
private val sp: SP
|
||||||
) {
|
) : L {
|
||||||
|
|
||||||
private var logElements: MutableList<LogElement> = ArrayList()
|
private var logElements: MutableList<LogElement> = ArrayList()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
LTag.values().forEach { logElements.add(LogElement(it, sp)) }
|
LTag.values().forEach { logElements.add(LogElementImpl(it, sp)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findByName(name: String): LogElement {
|
override fun findByName(name: String): LogElement {
|
||||||
for (element in logElements) {
|
for (element in logElements) {
|
||||||
if (element.name == name) return element
|
if (element.name == name) return element
|
||||||
}
|
}
|
||||||
return LogElement(false, sp)
|
return LogElementImpl(false, sp)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLogElements(): List<LogElement> {
|
override fun getLogElements(): List<LogElement> {
|
||||||
return logElements
|
return logElements
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetToDefaults() {
|
override fun resetToDefaults() {
|
||||||
for (element in logElements) {
|
for (element in logElements) {
|
||||||
element.resetToDefault()
|
element.resetToDefault()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LogElement {
|
class LogElementImpl : LogElement {
|
||||||
|
|
||||||
var sp: SP
|
var sp: SP
|
||||||
var name: String
|
override var name: String
|
||||||
var defaultValue: Boolean
|
override var defaultValue: Boolean
|
||||||
var enabled: Boolean
|
override var enabled: Boolean
|
||||||
private var requiresRestart = false
|
private var requiresRestart = false
|
||||||
|
|
||||||
internal constructor(tag: LTag, sp: SP) {
|
internal constructor(tag: LTag, sp: SP) {
|
||||||
|
@ -57,12 +60,12 @@ class L @Inject constructor(
|
||||||
|
|
||||||
private fun getSPName(): String = "log_$name"
|
private fun getSPName(): String = "log_$name"
|
||||||
|
|
||||||
fun enable(enabled: Boolean) {
|
override fun enable(enabled: Boolean) {
|
||||||
this.enabled = enabled
|
this.enabled = enabled
|
||||||
sp.putBoolean(getSPName(), enabled)
|
sp.putBoolean(getSPName(), enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetToDefault() {
|
override fun resetToDefault() {
|
||||||
enable(defaultValue)
|
enable(defaultValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.shared.sharedPreferences
|
package info.nightscout.shared.impl.sharedPreferences
|
||||||
|
|
||||||
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import kotlin.properties.ReadWriteProperty
|
import kotlin.properties.ReadWriteProperty
|
||||||
import kotlin.reflect.KProperty
|
import kotlin.reflect.KProperty
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue