diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index 479bd6045c..9a5d86db99 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -70,7 +70,6 @@ class MainActivity : NoSplashAppCompatActivity() { private val disposable = CompositeDisposable() @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var rxBus: RxBus @Inject lateinit var androidPermission: AndroidPermission @Inject lateinit var sp: SP @Inject lateinit var versionCheckerUtils: VersionCheckerUtils diff --git a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt index 006732d5aa..96653af940 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/HistoryBrowseActivity.kt @@ -52,7 +52,6 @@ class HistoryBrowseActivity : NoSplashAppCompatActivity() { @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var aapsSchedulers: AapsSchedulers - @Inject lateinit var rxBus: RxBus @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var defaultValueHelper: DefaultValueHelper diff --git a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt index 22322c5bb9..03c3362d9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/ProfileHelperActivity.kt @@ -38,7 +38,6 @@ class ProfileHelperActivity : NoSplashAppCompatActivity() { @Inject lateinit var defaultProfile: DefaultProfile @Inject lateinit var defaultProfileDPV: DefaultProfileDPV @Inject lateinit var localProfilePlugin: LocalProfilePlugin - @Inject lateinit var rxBus: RxBus @Inject lateinit var dateUtil: DateUtil @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var repository: AppRepository diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt index f3f7b150bb..680bbd2727 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/smsCommunicator/activities/SmsCommunicatorOtpActivity.kt @@ -31,7 +31,6 @@ import javax.inject.Inject class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() { @Inject lateinit var fabricPrivacy: FabricPrivacy - @Inject lateinit var rxBus: RxBus @Inject lateinit var smsCommunicatorPlugin: SmsCommunicatorPlugin @Inject lateinit var otp: OneTimePassword @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt index 090b9ae07d..a5d157707f 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SetupWizardActivity.kt @@ -34,7 +34,6 @@ class SetupWizardActivity : NoSplashAppCompatActivity() { @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var localProfilePlugin: LocalProfilePlugin @Inject lateinit var swDefinition: SWDefinition - @Inject lateinit var rxBus: RxBus @Inject lateinit var sp: SP @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var aapsSchedulers: AapsSchedulers diff --git a/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt index c8f9888ec6..430c562448 100644 --- a/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/activities/NoSplashAppCompatActivity.kt @@ -1,15 +1,33 @@ package info.nightscout.androidaps.activities - import android.content.Context import android.os.Bundle import info.nightscout.androidaps.core.R +import info.nightscout.androidaps.events.EventThemeSwitch +import info.nightscout.androidaps.plugins.bus.RxBus import info.nightscout.androidaps.utils.locale.LocaleHelper +import io.reactivex.rxjava3.disposables.CompositeDisposable +import javax.inject.Inject + open class NoSplashAppCompatActivity : DaggerAppCompatActivityWithResult() { - override fun onCreate(savedInstanceState: Bundle?) { + @Inject lateinit var rxBus: RxBus + + private val compositeDisposable = CompositeDisposable() + + public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setTheme(R.style.AppTheme_NoActionBar) + + compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe { + recreate() + }) + + } + + override fun onDestroy() { + compositeDisposable.clear() + super.onDestroy() } override fun attachBaseContext(newBase: Context) { diff --git a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt index 11c1954b55..b07f66f893 100644 --- a/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt +++ b/core/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.kt @@ -44,7 +44,6 @@ import kotlin.math.roundToInt class TDDStatsActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var sp: SP @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var activePlugin: ActivePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt b/core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt similarity index 96% rename from app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt rename to core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt index 37cbef5ae3..8876540f00 100644 --- a/app/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt +++ b/core/src/main/java/info/nightscout/androidaps/events/EventThemeSwitch.kt @@ -1,3 +1,3 @@ -package info.nightscout.androidaps.events - -class EventThemeSwitch : Event() +package info.nightscout.androidaps.events + +class EventThemeSwitch : Event() diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt index b7055732c0..d978b295cf 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaHistoryActivity.kt @@ -38,7 +38,6 @@ import javax.inject.Inject class DanaHistoryActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var activePlugin: ActivePlugin diff --git a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt index 7c97bdf480..fed75385ff 100644 --- a/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt +++ b/dana/src/main/java/info/nightscout/androidaps/dana/activities/DanaUserOptionsActivity.kt @@ -26,7 +26,6 @@ import kotlin.math.min class DanaUserOptionsActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var context: Context @Inject lateinit var danaPump: DanaPump diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt index 4352630f7f..da57033b39 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/BLEScanActivity.kt @@ -30,7 +30,6 @@ import javax.inject.Inject class BLEScanActivity : NoSplashAppCompatActivity() { @Inject lateinit var sp: SP - @Inject lateinit var rxBus: RxBus @Inject lateinit var blePreCheck: BlePreCheck @Inject lateinit var context: Context diff --git a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt index 8aff58f856..eca503acf5 100644 --- a/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt +++ b/danars/src/main/java/info/nightscout/androidaps/danars/activities/EnterPinActivity.kt @@ -22,7 +22,6 @@ import kotlin.experimental.xor class EnterPinActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var danaRSPlugin: DanaRSPlugin @Inject lateinit var sp: SP diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt index 25dda64b2a..52165d828d 100644 --- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt +++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8BLEScanActivity.kt @@ -32,7 +32,6 @@ import javax.inject.Inject class DiaconnG8BLEScanActivity : NoSplashAppCompatActivity() { @Inject lateinit var sp: SP - @Inject lateinit var rxBus: RxBus @Inject lateinit var blePreCheck: BlePreCheck @Inject lateinit var context: Context diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt index 2c9c5e23f6..0ee0bc8e54 100644 --- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt +++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8HistoryActivity.kt @@ -33,7 +33,6 @@ import javax.inject.Inject class DiaconnG8HistoryActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var activePlugin: ActivePlugin diff --git a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt index 0f30c7e151..49d315f341 100644 --- a/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt +++ b/diaconn/src/main/java/info/nightscout/androidaps/diaconn/activities/DiaconnG8UserOptionsActivity.kt @@ -25,7 +25,6 @@ import javax.inject.Inject class DiaconnG8UserOptionsActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var context: Context @Inject lateinit var diaconnG8Pump: DiaconnG8Pump diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt index bdf09c0a36..791f655273 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/DashPodManagementActivity.kt @@ -28,7 +28,6 @@ import javax.inject.Inject class DashPodManagementActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var injector: HasAndroidInjector diff --git a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt index 2ec76043d5..0aa199eabc 100644 --- a/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt +++ b/omnipod-eros/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/eros/ui/ErosPodManagementActivity.kt @@ -43,7 +43,6 @@ import javax.inject.Inject */ class ErosPodManagementActivity : NoSplashAppCompatActivity() { - @Inject lateinit var rxBus: RxBus @Inject lateinit var fabricPrivacy: FabricPrivacy @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var podStateManager: ErosPodStateManager