eliminate NoSplashActivity
This commit is contained in:
parent
e00a60e0a0
commit
abd39063cf
5 changed files with 38 additions and 45 deletions
|
@ -34,7 +34,7 @@ import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||||
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
||||||
import info.nightscout.configuration.setupwizard.SetupWizardActivity
|
import info.nightscout.configuration.setupwizard.SetupWizardActivity
|
||||||
import info.nightscout.core.activities.NoSplashAppCompatActivity
|
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||||
import info.nightscout.core.ui.UIRunnable
|
import info.nightscout.core.ui.UIRunnable
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.core.ui.locale.LocaleHelper
|
import info.nightscout.core.ui.locale.LocaleHelper
|
||||||
|
@ -42,7 +42,6 @@ import info.nightscout.core.ui.toast.ToastUtils
|
||||||
import info.nightscout.core.utils.CryptoUtil
|
import info.nightscout.core.utils.CryptoUtil
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.core.utils.isRunningRealPumpTest
|
import info.nightscout.core.utils.isRunningRealPumpTest
|
||||||
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
|
||||||
import info.nightscout.database.entities.UserEntry.Action
|
import info.nightscout.database.entities.UserEntry.Action
|
||||||
import info.nightscout.database.entities.UserEntry.Sources
|
import info.nightscout.database.entities.UserEntry.Sources
|
||||||
import info.nightscout.interfaces.AndroidPermission
|
import info.nightscout.interfaces.AndroidPermission
|
||||||
|
@ -51,14 +50,15 @@ import info.nightscout.interfaces.aps.Loop
|
||||||
import info.nightscout.interfaces.constraints.Constraints
|
import info.nightscout.interfaces.constraints.Constraints
|
||||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||||
|
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
||||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||||
import info.nightscout.interfaces.plugin.PluginBase
|
import info.nightscout.interfaces.plugin.PluginBase
|
||||||
import info.nightscout.interfaces.profile.ProfileFunction
|
import info.nightscout.interfaces.profile.ProfileFunction
|
||||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||||
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator
|
||||||
import info.nightscout.interfaces.ui.IconsProvider
|
import info.nightscout.interfaces.ui.IconsProvider
|
||||||
|
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
||||||
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
import info.nightscout.plugins.constraints.signatureVerifier.SignatureVerifierPlugin
|
||||||
import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.events.EventAppExit
|
import info.nightscout.rx.events.EventAppExit
|
||||||
import info.nightscout.rx.events.EventInitializationChanged
|
import info.nightscout.rx.events.EventInitializationChanged
|
||||||
|
@ -78,7 +78,7 @@ import java.util.Locale
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class MainActivity : NoSplashAppCompatActivity() {
|
class MainActivity : DaggerAppCompatActivityWithResult() {
|
||||||
|
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import info.nightscout.androidaps.R
|
import info.nightscout.androidaps.R
|
||||||
import info.nightscout.androidaps.databinding.ActivityPreferencesBinding
|
import info.nightscout.androidaps.databinding.ActivityPreferencesBinding
|
||||||
import info.nightscout.core.activities.NoSplashAppCompatActivity
|
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||||
import info.nightscout.core.ui.locale.LocaleHelper
|
import info.nightscout.core.ui.locale.LocaleHelper
|
||||||
|
|
||||||
class PreferencesActivity : NoSplashAppCompatActivity(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
|
class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
|
||||||
|
|
||||||
private var preferenceId = 0
|
private var preferenceId = 0
|
||||||
private var myPreferenceFragment: MyPreferenceFragment? = null
|
private var myPreferenceFragment: MyPreferenceFragment? = null
|
||||||
|
|
|
@ -1,26 +1,55 @@
|
||||||
package info.nightscout.core.activities
|
package info.nightscout.core.activities
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
|
import android.content.Context
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
|
import android.os.Bundle
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import dagger.android.support.DaggerAppCompatActivity
|
import dagger.android.support.DaggerAppCompatActivity
|
||||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract
|
import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract
|
||||||
import info.nightscout.core.main.R
|
import info.nightscout.core.main.R
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
|
import info.nightscout.core.ui.locale.LocaleHelper
|
||||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||||
import info.nightscout.interfaces.permissions.OptimizationPermissionContract
|
import info.nightscout.interfaces.permissions.OptimizationPermissionContract
|
||||||
|
import info.nightscout.rx.bus.RxBus
|
||||||
|
import info.nightscout.rx.events.EventThemeSwitch
|
||||||
import info.nightscout.rx.logging.AAPSLogger
|
import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.logging.LTag
|
import info.nightscout.rx.logging.LTag
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
|
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
open class DaggerAppCompatActivityWithResult : DaggerAppCompatActivity() {
|
||||||
|
|
||||||
|
@Inject lateinit var rxBus: RxBus
|
||||||
@Inject lateinit var rh: ResourceHelper
|
@Inject lateinit var rh: ResourceHelper
|
||||||
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
||||||
@Inject lateinit var aapsLogger: AAPSLogger
|
@Inject lateinit var aapsLogger: AAPSLogger
|
||||||
|
|
||||||
|
private val compositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
|
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setTheme(R.style.AppTheme_NoActionBar)
|
||||||
|
rh.updateContext(this)
|
||||||
|
|
||||||
|
compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe {
|
||||||
|
recreate()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
compositeDisposable.clear()
|
||||||
|
super.onDestroy()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun attachBaseContext(newBase: Context) {
|
||||||
|
super.attachBaseContext(LocaleHelper.wrap(newBase))
|
||||||
|
}
|
||||||
|
|
||||||
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
|
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
|
||||||
it?.let {
|
it?.let {
|
||||||
importExportPrefs.importSharedPreferences(this, it)
|
importExportPrefs.importSharedPreferences(this, it)
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
package info.nightscout.core.activities
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
|
||||||
import info.nightscout.core.main.R
|
|
||||||
import info.nightscout.core.ui.locale.LocaleHelper
|
|
||||||
import info.nightscout.rx.bus.RxBus
|
|
||||||
import info.nightscout.rx.events.EventThemeSwitch
|
|
||||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
open class NoSplashAppCompatActivity : DaggerAppCompatActivityWithResult() {
|
|
||||||
|
|
||||||
@Inject lateinit var rxBus: RxBus
|
|
||||||
|
|
||||||
private val compositeDisposable = CompositeDisposable()
|
|
||||||
|
|
||||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setTheme(R.style.AppTheme_NoActionBar)
|
|
||||||
rh.updateContext(this)
|
|
||||||
|
|
||||||
compositeDisposable.add(rxBus.toObservable(EventThemeSwitch::class.java).subscribe {
|
|
||||||
recreate()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
compositeDisposable.clear()
|
|
||||||
super.onDestroy()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun attachBaseContext(newBase: Context) {
|
|
||||||
super.attachBaseContext(LocaleHelper.wrap(newBase))
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -8,10 +8,10 @@ import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.configuration.R
|
import info.nightscout.configuration.R
|
||||||
import info.nightscout.configuration.databinding.ActivitySetupwizardBinding
|
import info.nightscout.configuration.databinding.ActivitySetupwizardBinding
|
||||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||||
import info.nightscout.core.activities.NoSplashAppCompatActivity
|
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
|
||||||
import info.nightscout.core.ui.dialogs.OKDialog
|
import info.nightscout.core.ui.dialogs.OKDialog
|
||||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
|
||||||
import info.nightscout.core.ui.locale.LocaleHelper.update
|
import info.nightscout.core.ui.locale.LocaleHelper.update
|
||||||
|
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||||
import info.nightscout.interfaces.ui.ActivityNames
|
import info.nightscout.interfaces.ui.ActivityNames
|
||||||
import info.nightscout.rx.AapsSchedulers
|
import info.nightscout.rx.AapsSchedulers
|
||||||
import info.nightscout.rx.events.EventProfileStoreChanged
|
import info.nightscout.rx.events.EventProfileStoreChanged
|
||||||
|
@ -27,7 +27,7 @@ import javax.inject.Inject
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
class SetupWizardActivity : NoSplashAppCompatActivity() {
|
class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
||||||
|
|
||||||
@Inject lateinit var injector: HasAndroidInjector
|
@Inject lateinit var injector: HasAndroidInjector
|
||||||
@Inject lateinit var swDefinition: SWDefinition
|
@Inject lateinit var swDefinition: SWDefinition
|
||||||
|
|
Loading…
Reference in a new issue