fix build
This commit is contained in:
parent
6fab5a9b8d
commit
fcd75c35d6
21 changed files with 47 additions and 52 deletions
|
@ -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
|
||||
}
|
|
@ -75,7 +75,6 @@ import info.nightscout.interfaces.plugin.PluginBase
|
|||
import info.nightscout.interfaces.profile.Profile
|
||||
import info.nightscout.interfaces.profile.ProfileFunction
|
||||
import info.nightscout.interfaces.pump.defs.PumpType
|
||||
import info.nightscout.interfaces.queue.CommandQueue
|
||||
import info.nightscout.interfaces.ui.ActivityNames
|
||||
import info.nightscout.interfaces.utils.JsonHelper
|
||||
import info.nightscout.interfaces.utils.TrendCalculator
|
||||
|
@ -145,7 +144,6 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
@Inject lateinit var notificationStore: NotificationStore
|
||||
@Inject lateinit var quickWizard: QuickWizard
|
||||
@Inject lateinit var buildHelper: BuildHelper
|
||||
@Inject lateinit var commandQueue: CommandQueue
|
||||
@Inject lateinit var protectionCheck: ProtectionCheck
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var overviewMenus: OverviewMenus
|
||||
|
@ -318,7 +316,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
.observeOn(aapsSchedulers.main)
|
||||
.delay(30, TimeUnit.MILLISECONDS, aapsSchedulers.main)
|
||||
.subscribe({
|
||||
overviewData.pumpStatus = it.getStatus(rh)
|
||||
overviewData.pumpStatus = it.getStatus(requireContext())
|
||||
updatePumpStatus()
|
||||
}, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
|
|
|
@ -50,7 +50,8 @@ class OverviewPlugin @Inject constructor(
|
|||
rh: ResourceHelper,
|
||||
private val config: Config,
|
||||
private val overviewData: OverviewData,
|
||||
private val overviewMenus: OverviewMenus
|
||||
private val overviewMenus: OverviewMenus,
|
||||
private val context: Context
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.GENERAL)
|
||||
|
@ -69,12 +70,6 @@ class OverviewPlugin @Inject constructor(
|
|||
|
||||
override val overviewBus = RxBus(aapsSchedulers, aapsLogger)
|
||||
|
||||
@FunctionalInterface
|
||||
interface RunnableWithContext : Runnable {
|
||||
|
||||
var context: Context?
|
||||
}
|
||||
|
||||
override fun addNotificationWithDialogResponse(id: Int, text: String, level: Int, @StringRes actionButtonId: Int, title: String, message: String) {
|
||||
rxBus.send(
|
||||
EventNewNotification(
|
||||
|
@ -131,7 +126,7 @@ class OverviewPlugin @Inject constructor(
|
|||
.toObservable(EventPumpStatusChanged::class.java)
|
||||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({
|
||||
overviewData.pumpStatus = it.getStatus(rh)
|
||||
overviewData.pumpStatus = it.getStatus(context)
|
||||
}, fabricPrivacy::logException)
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package info.nightscout.androidaps.setupwizard
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.events.EventStatus
|
||||
import info.nightscout.androidaps.setupwizard.elements.SWItem
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.events.EventStatus
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -23,6 +24,7 @@ class SWEventListener constructor(
|
|||
private var visibilityValidator: SWValidator? = null
|
||||
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var context: Context
|
||||
|
||||
// TODO: Adrian how to clear disposable in this case?
|
||||
init {
|
||||
|
@ -30,7 +32,7 @@ class SWEventListener constructor(
|
|||
.toObservable(clazz)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { event: Any ->
|
||||
status = (event as EventStatus).getStatus(rh)
|
||||
status = (event as EventStatus).getStatus(context)
|
||||
@SuppressLint("SetTextI18n")
|
||||
textView?.text = (if (textLabel != 0) rh.gs(textLabel) else "") + " " + status
|
||||
}
|
||||
|
|
|
@ -67,9 +67,6 @@ dependencies {
|
|||
api 'com.madgag.spongycastle:core:1.58.0.0'
|
||||
api "com.google.crypto.tink:tink-android:$tink_version"
|
||||
|
||||
// pumpCommon
|
||||
api "com.google.code.gson:gson:$gson_version"
|
||||
|
||||
//WorkManager
|
||||
api "androidx.work:work-runtime:$work_version"
|
||||
api "androidx.work:work-runtime-ktx:$work_version"
|
||||
|
|
|
@ -120,7 +120,7 @@ class BolusProgressDialog : DaggerDialogFragment() {
|
|||
disposable += rxBus
|
||||
.toObservable(EventPumpStatusChanged::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { binding.status.text = it.getStatus(rh) }
|
||||
.subscribe { binding.status.text = it.getStatus(requireContext()) }
|
||||
disposable += rxBus
|
||||
.toObservable(EventDismissBolusProgressIfRunning::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package info.nightscout.androidaps.events
|
||||
|
||||
import android.content.Context
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.rx.events.EventStatus
|
||||
|
||||
class EventPumpStatusChanged : EventStatus {
|
||||
|
||||
|
@ -45,14 +46,14 @@ class EventPumpStatusChanged : EventStatus {
|
|||
}
|
||||
|
||||
// status for startup wizard
|
||||
override fun getStatus(rh: ResourceHelper): String {
|
||||
override fun getStatus(context: Context): String {
|
||||
return when (status) {
|
||||
Status.CONNECTING -> rh.gs(R.string.connectingfor, secondsElapsed)
|
||||
Status.HANDSHAKING -> rh.gs(R.string.handshaking)
|
||||
Status.CONNECTED -> rh.gs(R.string.connected)
|
||||
Status.CONNECTING -> context.getString(R.string.connectingfor, secondsElapsed)
|
||||
Status.HANDSHAKING -> context.getString(R.string.handshaking)
|
||||
Status.CONNECTED -> context.getString(R.string.connected)
|
||||
Status.PERFORMING -> performingAction
|
||||
Status.WAITING_FOR_DISCONNECTION -> rh.gs(R.string.waiting_for_disconnection)
|
||||
Status.DISCONNECTING -> rh.gs(R.string.disconnecting)
|
||||
Status.WAITING_FOR_DISCONNECTION -> context.getString(R.string.waiting_for_disconnection)
|
||||
Status.DISCONNECTING -> context.getString(R.string.disconnecting)
|
||||
Status.DISCONNECTED -> ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package info.nightscout.androidaps.events
|
||||
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.rx.events.Event
|
||||
|
||||
// pass string to startup wizard
|
||||
abstract class EventStatus : Event() {
|
||||
abstract fun getStatus(rh: ResourceHelper) : String
|
||||
}
|
|
@ -10,6 +10,6 @@ annotation class DbOpenClass
|
|||
/**
|
||||
* Annotate a class with [DbOpenForTesting] if it should be extendable for testing.
|
||||
*/
|
||||
@info.nightscout.database.annotations.DbOpenClass
|
||||
@DbOpenClass
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class DbOpenForTesting
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.database.impl
|
||||
|
||||
import info.nightscout.database.annotations.DbOpenForTesting
|
||||
import info.nightscout.database.entities.Bolus
|
||||
import info.nightscout.database.entities.BolusCalculatorResult
|
||||
import info.nightscout.database.entities.Carbs
|
||||
|
@ -31,7 +32,7 @@ import javax.inject.Inject
|
|||
import javax.inject.Singleton
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@info.nightscout.database.annotations.DbOpenForTesting
|
||||
@DbOpenForTesting
|
||||
@Singleton class AppRepository @Inject internal constructor(
|
||||
internal val database: AppDatabase
|
||||
) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.plugins.sync.nsShared.events
|
||||
|
||||
import info.nightscout.androidaps.events.EventStatus
|
||||
import android.content.Context
|
||||
import info.nightscout.interfaces.sync.NsClient
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.rx.events.EventStatus
|
||||
|
||||
class EventNSClientStatus(var text: String, val version: NsClient.Version) : EventStatus() {
|
||||
override fun getStatus(rh: ResourceHelper): String = text
|
||||
override fun getStatus(context: Context): String = text
|
||||
}
|
|
@ -93,7 +93,7 @@ class NSClientPlugin @Inject constructor(
|
|||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ event: EventNSClientStatus ->
|
||||
if (event.version == NsClient.Version.V1) {
|
||||
status = event.getStatus(rh)
|
||||
status = event.getStatus(context)
|
||||
rxBus.send(EventNSClientUpdateGUI())
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
|
|
|
@ -146,7 +146,7 @@ class NSClientV3Plugin @Inject constructor(
|
|||
.observeOn(aapsSchedulers.io)
|
||||
.subscribe({ event ->
|
||||
if (event.version == NsClient.Version.V3) {
|
||||
status = event.getStatus(rh)
|
||||
status = event.getStatus(context)
|
||||
rxBus.send(EventNSClientUpdateGUI())
|
||||
}
|
||||
}, fabricPrivacy::logException)
|
||||
|
|
|
@ -168,7 +168,7 @@ class DanaFragment : DaggerFragment() {
|
|||
"{fa-bluetooth-b}"
|
||||
}
|
||||
binding.btConnection.text = pumpStatusIcon
|
||||
pumpStatus = it.getStatus(rh)
|
||||
pumpStatus = it.getStatus(requireContext())
|
||||
binding.pumpStatus.text = pumpStatus
|
||||
binding.pumpStatusLayout.visibility = (pumpStatus != "").toVisibility()
|
||||
}, fabricPrivacy::logException)
|
||||
|
|
|
@ -61,7 +61,7 @@ class DanaHistoryActivity : NoSplashAppCompatActivity() {
|
|||
disposable += rxBus
|
||||
.toObservable(EventPumpStatusChanged::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({ binding.status.text = it.getStatus(rh) }, fabricPrivacy::logException)
|
||||
.subscribe({ binding.status.text = it.getStatus(this@DanaHistoryActivity) }, fabricPrivacy::logException)
|
||||
disposable += rxBus
|
||||
.toObservable(EventDanaRSyncStatus::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
|
|
@ -128,8 +128,8 @@ class DiaconnG8Fragment : DaggerFragment() {
|
|||
|
||||
else -> {}
|
||||
}
|
||||
if (it.getStatus(rh) != "") {
|
||||
binding.diaconnG8Pumpstatus.text = it.getStatus(rh)
|
||||
if (it.getStatus(requireContext()) != "") {
|
||||
binding.diaconnG8Pumpstatus.text = it.getStatus(requireContext())
|
||||
binding.diaconnG8Pumpstatuslayout.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.diaconnG8Pumpstatuslayout.visibility = View.GONE
|
||||
|
|
|
@ -56,7 +56,7 @@ class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() {
|
|||
disposable += rxBus
|
||||
.toObservable(EventPumpStatusChanged::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({ binding.status.text = it.getStatus(rh) }) { fabricPrivacy.logException(it) }
|
||||
.subscribe({ binding.status.text = it.getStatus(this@DiaconnG8HistoryActivity) }) { fabricPrivacy.logException(it) }
|
||||
swapAdapter(showingType)
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
}
|
||||
|
||||
private fun updateBluetoothConnectionStatus(event: EventPumpStatusChanged) {
|
||||
val status = event.getStatus(rh)
|
||||
val status = event.getStatus(requireContext())
|
||||
bluetoothStatusBinding.omnipodDashBluetoothStatus.text = status
|
||||
}
|
||||
|
||||
|
|
|
@ -25,4 +25,6 @@ dependencies {
|
|||
implementation('com.thoughtworks.xstream:xstream:1.4.19') {
|
||||
exclude group: 'xmlpull', module: 'xmlpull'
|
||||
}
|
||||
|
||||
api "com.google.code.gson:gson:$gson_version"
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.common.events
|
||||
|
||||
import info.nightscout.androidaps.events.EventStatus
|
||||
import android.content.Context
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
|
||||
import info.nightscout.pump.core.defs.PumpDeviceState
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.rx.events.EventStatus
|
||||
|
||||
open class EventRileyLinkDeviceStatusChange : EventStatus {
|
||||
|
||||
|
@ -33,16 +33,16 @@ open class EventRileyLinkDeviceStatusChange : EventStatus {
|
|||
this.errorDescription = errorDescription
|
||||
}
|
||||
|
||||
override fun getStatus(rh: ResourceHelper): String {
|
||||
override fun getStatus(context: Context): String {
|
||||
val rileyLinkServiceState = this.rileyLinkServiceState ?: return ""
|
||||
val resourceId = rileyLinkServiceState.resourceId
|
||||
val rileyLinkError = this.rileyLinkError
|
||||
|
||||
if (rileyLinkServiceState.isError && rileyLinkError != null) {
|
||||
val rileyLinkTargetDevice = this.rileyLinkTargetDevice ?: return ""
|
||||
return rh.gs(rileyLinkError.getResourceId(rileyLinkTargetDevice))
|
||||
return context.getString(rileyLinkError.getResourceId(rileyLinkTargetDevice))
|
||||
}
|
||||
|
||||
return rh.gs(resourceId)
|
||||
return context.getString(resourceId)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ class TDDStatsActivity : NoSplashAppCompatActivity() {
|
|||
rxBus
|
||||
.toObservable(EventPumpStatusChanged::class.java)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(rh) }, fabricPrivacy::logException)
|
||||
.subscribe({ event -> binding.connectionStatus.text = event.getStatus(this@TDDStatsActivity) }, fabricPrivacy::logException)
|
||||
)
|
||||
disposable.add(
|
||||
rxBus
|
||||
|
|
Loading…
Reference in a new issue