diff --git a/app/build.gradle b/app/build.gradle index 61dae24ba6..07139638fc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,7 +26,7 @@ ext { powermockVersion = "1.7.3" dexmakerVersion = "1.2" retrofit2Version = '2.9.0' - okhttp3Version = '4.7.2' + okhttp3Version = '4.9.0' } @@ -247,15 +247,17 @@ dependencies { implementation project(':danar') implementation project(':rileylink') implementation project(':medtronic') + implementation project(':omnipod') implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.google.android.gms:play-services-wearable:17.0.0' - implementation "com.google.android.gms:play-services-location:17.0.0" - implementation 'com.google.firebase:firebase-core:17.4.3' - implementation 'com.google.firebase:firebase-auth:19.3.1' - implementation 'com.google.firebase:firebase-database:19.3.1' + implementation 'com.google.android.gms:play-services-location:17.1.0' + implementation platform('com.google.firebase:firebase-bom:25.12.0') + implementation "com.google.firebase:firebase-analytics-ktx" + implementation 'com.google.firebase:firebase-auth-ktx' + implementation 'com.google.firebase:firebase-database-ktx' - implementation 'androidx.appcompat:appcompat:1.1.0' + implementation "androidx.appcompat:appcompat:$appcompat_verison" implementation 'androidx.legacy:legacy-support-v13:1.0.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' @@ -263,11 +265,13 @@ dependencies { implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.gridlayout:gridlayout:1.0.0' implementation 'androidx.percentlayout:percentlayout:1.0.0' - implementation "androidx.preference:preference-ktx:1.1.1" + implementation "androidx.preference:preference-ktx:$preferencektx_version" implementation "androidx.activity:activity-ktx:${activityVersion}" - implementation "androidx.fragment:fragment:${fragmentVersion}" - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.1.0' + implementation "androidx.fragment:fragment-ktx:${fragmentktx_version}" + implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" + implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" + implementation "androidx.navigation:navigation-ui-ktx:$nav_version" + implementation "com.google.android.material:material:$material_version" implementation "io.reactivex.rxjava2:rxandroid:${rxandroid_version}" @@ -276,14 +280,12 @@ dependencies { implementation("com.github.tony19:logback-android-classic:1.1.1-6") { exclude group: "com.google.android", module: "android" } - implementation 'org.apache.commons:commons-lang3:3.10' + implementation "org.apache.commons:commons-lang3:$commonslang3_version" implementation 'org.slf4j:slf4j-api:1.7.30' // Graphview cannot be upgraded implementation "com.jjoe64:graphview:4.0.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2" implementation 'com.madgag.spongycastle:core:1.58.0.0' - // Omnipod wizard - implementation(name: "com.atech-software.android.library.wizardpager-1.1.4", ext: "aar") implementation("com.google.android:flexbox:0.3.0") { exclude group: "com.android.support" } @@ -292,21 +294,21 @@ dependencies { exclude group: "org.json", module: "json" } implementation "com.google.code.gson:gson:2.8.6" - implementation('com.google.guava:guava:29.0-jre') { + implementation('com.google.guava:guava:30.0-jre') { exclude group: "com.google.code.findbugs", module: "jsr305" } implementation 'com.google.code.findbugs:jsr305:3.0.2' implementation 'net.danlew:android.joda:2.10.6' - implementation 'org.mozilla:rhino:1.7.12' + implementation 'org.mozilla:rhino:1.7.13' implementation 'com.github.DavidProdinger:weekdays-selector:1.1.0' implementation 'com.github.kenglxn.QRGen:android:2.6.0' implementation 'com.eatthepath:java-otp:0.2.0' - testImplementation "junit:junit:4.13" + testImplementation "junit:junit:$junit_version" testImplementation 'org.json:json:20200518' testImplementation "org.mockito:mockito-core:2.8.47" testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}" @@ -356,11 +358,11 @@ dependencies { androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0' //WorkManager - implementation 'androidx.work:work-runtime:2.3.4' - implementation 'androidx.work:work-runtime-ktx:2.3.4' - implementation 'androidx.work:work-rxjava2:2.3.4' + implementation "androidx.work:work-runtime:$work_version" + implementation "androidx.work:work-runtime-ktx:$work_version" + implementation "androidx.work:work-rxjava2:$work_version" - implementation 'com.google.androidbrowserhelper:androidbrowserhelper:1.1.0' + implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.0.0' implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' } diff --git a/app/libs/com.atech-software.android.library.wizardpager-1.1.4.aar b/app/libs/com.atech-software.android.library.wizardpager-1.1.4.aar deleted file mode 100644 index af0c6511cf..0000000000 Binary files a/app/libs/com.atech-software.android.library.wizardpager-1.1.4.aar and /dev/null differ diff --git a/app/src/main/assets/OpenAPSSMB/determine-basal.js b/app/src/main/assets/OpenAPSSMB/determine-basal.js index 64cde918c5..c4930b7789 100644 --- a/app/src/main/assets/OpenAPSSMB/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMB/determine-basal.js @@ -110,7 +110,7 @@ function enable_smb( return false; } -var determine_basal = function determine_basal(glucose_status, currenttemp, iob_data, profile, autosens_data, meal_data, tempBasalFunctions, microBolusAllowed, reservoir_data, currentTime) { +var determine_basal = function determine_basal(glucose_status, currenttemp, iob_data, profile, autosens_data, meal_data, tempBasalFunctions, microBolusAllowed, reservoir_data, currentTime, isSaveCgmSource) { var rT = {}; //short for requestedTemp var deliverAt = new Date(); @@ -143,7 +143,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ rT.reason = "If current system time "+systemTime+" is correct, then BG data is too old. The last BG data was read "+minAgo+"m ago at "+bgTime; // if BG is too old/noisy, or is changing less than 1 mg/dL/5m for 45m, cancel any high temps and shorten any long zero temps //cherry pick from oref upstream dev cb8e94990301277fb1016c778b4e9efa55a6edbc - } else if ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 ) { + } else if ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 && !isSaveCgmSource) { if ( glucose_status.last_cal && glucose_status.last_cal < 3 ) { rT.reason = "CGM was just calibrated"; } else { diff --git a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt index ff35d585ee..809914053a 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/MainActivity.kt @@ -45,6 +45,8 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.configBuilder.ConstraintChecker import info.nightscout.androidaps.plugins.constraints.signatureVerifier.SignatureVerifierPlugin import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils +import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs +import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.androidaps.setupwizard.SetupWizardActivity @@ -87,10 +89,17 @@ class MainActivity : NoSplashAppCompatActivity() { @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var signatureVerifierPlugin: SignatureVerifierPlugin @Inject lateinit var config: Config + @Inject lateinit var importExportPrefs: ImportExportPrefs private lateinit var actionBarDrawerToggle: ActionBarDrawerToggle private var pluginPreferencesMenuItem: MenuItem? = null + val callForPrefFile = registerForActivityResult(PrefsFileContract()) { + it?.let { + importExportPrefs.importSharedPreferences(this, it) + } + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Iconify.with(FontAwesomeModule()) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index d7ffdc5358..705c377afa 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -175,7 +175,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang addPreferencesFromResourceIfEnabled(localInsightPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(comboPlugin, rootKey, config.PUMPDRIVERS) addPreferencesFromResourceIfEnabled(medtronicPumpPlugin, rootKey, config.PUMPDRIVERS) - addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey, !config.NSCLIENT) + addPreferencesFromResource(R.xml.pref_pump, rootKey, config.PUMPDRIVERS) + addPreferencesFromResourceIfEnabled(virtualPumpPlugin, rootKey) addPreferencesFromResourceIfEnabled(insulinOrefFreePeakPlugin, rootKey) addPreferencesFromResourceIfEnabled(nsClientPlugin, rootKey) addPreferencesFromResourceIfEnabled(tidepoolPlugin, rootKey) @@ -251,6 +252,10 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang } } + private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?, enabled: Boolean) { + if (enabled) addPreferencesFromResource(preferencesResId, key) + } + @SuppressLint("RestrictedApi") private fun addPreferencesFromResource(@XmlRes preferencesResId: Int, key: String?) { val xmlRoot = preferenceManager.inflateFromResource(context, diff --git a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt index 0193b690a6..862509249e 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/SingleFragmentActivity.kt @@ -9,6 +9,8 @@ import dagger.android.support.DaggerAppCompatActivity import info.nightscout.androidaps.R import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.plugins.configBuilder.PluginStore +import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs +import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract import info.nightscout.androidaps.utils.locale.LocaleHelper import info.nightscout.androidaps.utils.protection.ProtectionCheck import javax.inject.Inject @@ -16,9 +18,16 @@ import javax.inject.Inject class SingleFragmentActivity : DaggerAppCompatActivity() { @Inject lateinit var pluginStore: PluginStore @Inject lateinit var protectionCheck: ProtectionCheck + @Inject lateinit var importExportPrefs: ImportExportPrefs private var plugin: PluginBase? = null + val callForPrefFile = registerForActivityResult(PrefsFileContract()) { + it?.let { + importExportPrefs.importSharedPreferences(this, it) + } + } + public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_single_fragment) diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt index 1c0583f042..ef728a2193 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/AppComponent.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.dana.di.DanaModule import info.nightscout.androidaps.danar.di.DanaRModule import info.nightscout.androidaps.danars.di.DanaRSModule import info.nightscout.androidaps.plugins.pump.common.dagger.RileyLinkModule +import info.nightscout.androidaps.plugins.pump.omnipod.dagger.OmnipodModule import javax.inject.Singleton @Singleton @@ -29,6 +30,7 @@ import javax.inject.Singleton WizardModule::class, RileyLinkModule::class, MedtronicModule::class, + OmnipodModule::class, APSModule::class, PreferencesModule::class, OverviewModule::class, diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt index e9339e187b..014a8de8e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/CommandQueueModule.kt @@ -26,4 +26,5 @@ abstract class CommandQueueModule { @ContributesAndroidInjector abstract fun commandTempBasalAbsoluteInjector(): CommandTempBasalAbsolute @ContributesAndroidInjector abstract fun commandTempBasalPercentInjector(): CommandTempBasalPercent @ContributesAndroidInjector abstract fun commandSetUserSettingsInjector(): CommandSetUserSettings + @ContributesAndroidInjector abstract fun commandCustomCommandInjector(): CommandCustomCommand } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt index 0af077c632..42dd3e2972 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/FragmentsModule.kt @@ -36,6 +36,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyL import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.dialog.RileyLinkStatusDeviceMedtronic +import info.nightscout.androidaps.plugins.pump.omnipod.ui.OmnipodOverviewFragment import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment import info.nightscout.androidaps.plugins.source.BGSourceFragment import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment @@ -67,6 +68,7 @@ abstract class FragmentsModule { @ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment + @ContributesAndroidInjector abstract fun contributesOmnipodFragment(): OmnipodOverviewFragment @ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment @ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment @ContributesAndroidInjector diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt index 75c834977a..892c9c36a8 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/PluginsModule.kt @@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.general.persistentNotification.Persist import info.nightscout.androidaps.plugins.general.smsCommunicator.SmsCommunicatorPlugin import info.nightscout.androidaps.plugins.general.wear.WearPlugin import info.nightscout.androidaps.plugins.general.xdripStatusline.StatusLinePlugin +import info.nightscout.androidaps.plugins.insulin.InsulinLyumjevPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefFreePeakPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefRapidActingPlugin import info.nightscout.androidaps.plugins.insulin.InsulinOrefUltraRapidActingPlugin @@ -82,6 +83,12 @@ abstract class PluginsModule { @IntKey(40) abstract fun bindInsulinOrefUltraRapidActingPlugin(plugin: InsulinOrefUltraRapidActingPlugin): PluginBase + @Binds + @AllConfigs + @IntoMap + @IntKey(42) + abstract fun bindInsulinLyumjevPlugin(plugin: InsulinLyumjevPlugin): PluginBase + @Binds @AllConfigs @IntoMap diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt index ec71d8a4ad..6ba01130ae 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ServicesModule.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService +import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.service.RileyLinkOmnipodService import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.DataService import info.nightscout.androidaps.services.LocationService @@ -29,4 +30,5 @@ abstract class ServicesModule { @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService @ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService + @ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index fb28182e33..17ed64b96f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -108,7 +108,7 @@ class WizardDialog : DaggerDialogFragment() { if (profileFunction.getUnits() == Constants.MGDL) treatments_wizard_bg_input.setParams(savedInstanceState?.getDouble("treatments_wizard_bg_input") - ?: 0.0, 0.0, 500.0, 1.0, DecimalFormat("0.0"), false, ok, textWatcher) + ?: 0.0, 0.0, 500.0, 1.0, DecimalFormat("0"), false, ok, textWatcher) else treatments_wizard_bg_input.setParams(savedInstanceState?.getDouble("treatments_wizard_bg_input") ?: 0.0, 0.0, 30.0, 0.1, DecimalFormat("0.0"), false, ok, textWatcher) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java index 058ae596bd..f25dfee9c0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/DetermineBasalAdapterSMBJS.java @@ -65,6 +65,7 @@ public class DetermineBasalAdapterSMBJS { private boolean mMicrobolusAllowed; private boolean mSMBAlwaysAllowed; private long mCurrentTime; + private boolean mIsSaveCgmSource; private String storedCurrentTemp = null; private String storedIobData = null; @@ -108,6 +109,7 @@ public class DetermineBasalAdapterSMBJS { aapsLogger.debug(LTag.APS, "MicroBolusAllowed: " + (storedMicroBolusAllowed = "" + mMicrobolusAllowed)); aapsLogger.debug(LTag.APS, "SMBAlwaysAllowed: " + (storedSMBAlwaysAllowed = "" + mSMBAlwaysAllowed)); aapsLogger.debug(LTag.APS, "CurrentTime: " + (storedCurrentTime = "" + mCurrentTime)); + aapsLogger.debug(LTag.APS, "isSaveCgmSource: " + mIsSaveCgmSource); DetermineBasalResultSMB determineBasalResultSMB = null; @@ -237,7 +239,8 @@ public class DetermineBasalAdapterSMBJS { boolean tempTargetSet, boolean microBolusAllowed, boolean uamAllowed, - boolean advancedFiltering + boolean advancedFiltering, + boolean isSaveCgmSource ) throws JSONException { String units = profile.getUnits(); @@ -282,7 +285,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable); boolean smbEnabled = sp.getBoolean(resourceHelper.gs(R.string.key_use_smb), false); - mProfile.put("SMBInterval", sp.getInt("key_smbinterval", SMBDefaults.SMBInterval)); + mProfile.put("SMBInterval", sp.getInt(R.string.key_smbinterval, SMBDefaults.SMBInterval)); mProfile.put("enableSMB_with_COB", smbEnabled && sp.getBoolean(R.string.key_enableSMB_with_COB, false)); mProfile.put("enableSMB_with_temptarget", smbEnabled && sp.getBoolean(R.string.key_enableSMB_with_temptarget, false)); mProfile.put("allowSMB_with_high_temptarget", smbEnabled && sp.getBoolean(R.string.key_allowSMB_with_high_temptarget, false)); @@ -354,6 +357,7 @@ public class DetermineBasalAdapterSMBJS { mCurrentTime = now; + mIsSaveCgmSource = isSaveCgmSource; } private Object makeParam(JSONObject jsonObject, Context rhino, Scriptable scope) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java index 3e54eb8a3a..b952a6a909 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java @@ -270,7 +270,8 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr isTempTarget, smbAllowed.value(), uam.value(), - advancedFiltering.value() + advancedFiltering.value(), + activePlugin.getActiveBgSource().getClass().getSimpleName().equals("DexcomPlugin") ); } catch (JSONException e) { fabricPrivacy.logException(e); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt index cc57908438..1c33eb7a2f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/ObjectivesPlugin.kt @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.constraints.objectives -import android.app.Activity +import androidx.fragment.app.FragmentActivity import com.google.common.base.Charsets import com.google.common.hash.Hashing import dagger.android.HasAndroidInjector @@ -116,7 +116,7 @@ class ObjectivesPlugin @Inject constructor( sp.putBoolean(R.string.key_objectiveusescale, false) } - fun completeObjectives(activity: Activity, request: String) { + fun completeObjectives(activity: FragmentActivity, request: String) { val requestCode = sp.getString(R.string.key_objectives_request_code, "") var url = sp.getString(R.string.key_nsclientinternal_url, "").toLowerCase(Locale.getDefault()) if (!url.endsWith("/")) url = "$url/" @@ -145,7 +145,7 @@ class ObjectivesPlugin @Inject constructor( } } - fun allPriorAccomplished(position: Int) : Boolean { + fun allPriorAccomplished(position: Int): Boolean { var accomplished = true for (i in 0 until position) { accomplished = accomplished && objectives[i].isAccomplished diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java index c15e1f8599..28efcf6f55 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective.java @@ -8,6 +8,7 @@ import android.widget.CheckBox; import android.widget.TextView; import androidx.annotation.StringRes; +import androidx.fragment.app.FragmentActivity; import java.util.ArrayList; import java.util.List; @@ -110,7 +111,7 @@ public abstract class Objective { return true; } - public void specialAction(Activity activity, String input) { + public void specialAction(FragmentActivity activity, String input) { } public abstract class Task { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.java index d673e2b7f4..90ef0462f8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective0.java @@ -48,7 +48,7 @@ public class Objective0 extends Objective { tasks.add(new Task(R.string.virtualpump_uploadstatus_title) { @Override public boolean isCompleted() { - return sp.getBoolean("virtualpump_uploadstatus", false); + return sp.getBoolean(R.string.key_virtualpump_uploadstatus, false); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective3.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective3.java index bf0783c3f4..2bbaebd263 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective3.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/objectives/objectives/Objective3.java @@ -1,6 +1,6 @@ package info.nightscout.androidaps.plugins.constraints.objectives.objectives; -import android.app.Activity; +import androidx.fragment.app.FragmentActivity; import java.util.List; @@ -54,7 +54,7 @@ public class Objective3 extends Objective { } @Override - public void specialAction(Activity activity, String input) { + public void specialAction(FragmentActivity activity, String input) { objectivesPlugin.completeObjectives(activity, input); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java index b6f25325f3..f0cb07061f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/constraints/safety/SafetyPlugin.java @@ -37,17 +37,17 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP; @Singleton public class SafetyPlugin extends PluginBase implements ConstraintsInterface { - private SP sp; - private RxBusWrapper rxBus; - private ConstraintChecker constraintChecker; - private OpenAPSAMAPlugin openAPSAMAPlugin; - private OpenAPSSMBPlugin openAPSSMBPlugin; - private SensitivityOref1Plugin sensitivityOref1Plugin; - private ActivePluginProvider activePlugin; - private HardLimits hardLimits; - private BuildHelper buildHelper; - private TreatmentsPlugin treatmentsPlugin; - private Config config; + private final SP sp; + private final RxBusWrapper rxBus; + private final ConstraintChecker constraintChecker; + private final OpenAPSAMAPlugin openAPSAMAPlugin; + private final OpenAPSSMBPlugin openAPSSMBPlugin; + private final SensitivityOref1Plugin sensitivityOref1Plugin; + private final ActivePluginProvider activePlugin; + private final HardLimits hardLimits; + private final BuildHelper buildHelper; + private final TreatmentsPlugin treatmentsPlugin; + private final Config config; @Inject public SafetyPlugin( diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt index 74abd439f8..5c5d9c843f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/ImportExportPrefs.kt @@ -1,7 +1,7 @@ package info.nightscout.androidaps.plugins.general.maintenance import android.Manifest -import android.app.Activity +import androidx.appcompat.app.AppCompatActivity import android.bluetooth.BluetoothAdapter import android.content.Context import android.content.Intent @@ -12,8 +12,10 @@ import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import info.nightscout.androidaps.BuildConfig +import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.R import info.nightscout.androidaps.activities.PreferencesActivity +import info.nightscout.androidaps.activities.SingleFragmentActivity import info.nightscout.androidaps.events.EventAppExit import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.logging.LTag @@ -122,7 +124,7 @@ class ImportExportPrefs @Inject constructor( private fun prefsEncryptionIsDisabled() = buildHelper.isEngineeringMode() && !sp.getBoolean(resourceHelper.gs(R.string.key_maintenance_encrypt_exported_prefs), true) - private fun askForMasterPass(activity: Activity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) { + private fun askForMasterPass(activity: FragmentActivity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) { passwordCheck.queryPassword(activity, R.string.master_password, R.string.key_master_password, { password -> then(password) }, { @@ -130,7 +132,7 @@ class ImportExportPrefs @Inject constructor( }) } - private fun askForEncryptionPass(activity: Activity, @StringRes canceledMsg: Int, @StringRes passwordName: Int, @StringRes passwordExplanation: Int?, + private fun askForEncryptionPass(activity: FragmentActivity, @StringRes canceledMsg: Int, @StringRes passwordName: Int, @StringRes passwordExplanation: Int?, @StringRes passwordWarning: Int?, then: ((password: String) -> Unit)) { passwordCheck.queryAnyPassword(activity, passwordName, R.string.key_master_password, passwordExplanation, passwordWarning, { password -> then(password) @@ -139,7 +141,7 @@ class ImportExportPrefs @Inject constructor( }) } - private fun askForMasterPassIfNeeded(activity: Activity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) { + private fun askForMasterPassIfNeeded(activity: FragmentActivity, @StringRes canceledMsg: Int, then: ((password: String) -> Unit)) { if (prefsEncryptionIsDisabled()) { then("") } else { @@ -147,7 +149,7 @@ class ImportExportPrefs @Inject constructor( } } - private fun assureMasterPasswordSet(activity: Activity, @StringRes wrongPwdTitle: Int): Boolean { + private fun assureMasterPasswordSet(activity: FragmentActivity, @StringRes wrongPwdTitle: Int): Boolean { if (!sp.contains(R.string.key_master_password) || (sp.getString(R.string.key_master_password, "") == "")) { WarningDialog.showWarning(activity, resourceHelper.gs(wrongPwdTitle), @@ -163,23 +165,22 @@ class ImportExportPrefs @Inject constructor( return true } - private fun askToConfirmExport(activity: Activity, fileToExport: File, then: ((password: String) -> Unit)) { + private fun askToConfirmExport(activity: FragmentActivity, fileToExport: File, then: ((password: String) -> Unit)) { if (!prefsEncryptionIsDisabled() && !assureMasterPasswordSet(activity, R.string.nav_export)) return TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_export), - resourceHelper.gs(R.string.export_to) + " " + fileToExport + " ?", + resourceHelper.gs(R.string.export_to) + " " + fileToExport.name + " ?", resourceHelper.gs(R.string.password_preferences_encrypt_prompt), { askForMasterPassIfNeeded(activity, R.string.preferences_export_canceled, then) }, null, R.drawable.ic_header_export) } - private fun askToConfirmImport(activity: Activity, fileToImport: PrefsFile, then: ((password: String) -> Unit)) { + private fun askToConfirmImport(activity: FragmentActivity, fileToImport: PrefsFile, then: ((password: String) -> Unit)) { if (fileToImport.handler == PrefsFormatsHandler.ENCRYPTED) { if (!assureMasterPasswordSet(activity, R.string.nav_import)) return - TwoMessagesAlertDialog.showAlert(activity, resourceHelper.gs(R.string.nav_import), - resourceHelper.gs(R.string.import_from) + " " + fileToImport.file + " ?", + resourceHelper.gs(R.string.import_from) + " " + fileToImport.name + " ?", resourceHelper.gs(R.string.password_preferences_decrypt_prompt), { askForMasterPass(activity, R.string.preferences_import_canceled, then) }, null, R.drawable.ic_header_import) @@ -191,7 +192,7 @@ class ImportExportPrefs @Inject constructor( } } - private fun promptForDecryptionPasswordIfNeeded(activity: Activity, prefs: Prefs, importOk: Boolean, + private fun promptForDecryptionPasswordIfNeeded(activity: FragmentActivity, prefs: Prefs, importOk: Boolean, format: PrefsFormat, importFile: PrefsFile, then: ((prefs: Prefs, importOk: Boolean) -> Unit)) { // current master password was not the one used for decryption, so we prompt for old password... @@ -213,7 +214,7 @@ class ImportExportPrefs @Inject constructor( } } - private fun exportSharedPreferences(activity: Activity) { + private fun exportSharedPreferences(activity: FragmentActivity) { prefFileList.ensureExportDirExists() val legacyFile = prefFileList.legacyFile() @@ -262,14 +263,12 @@ class ImportExportPrefs @Inject constructor( } fun importSharedPreferences(activity: FragmentActivity) { - val callForPrefFile = activity.registerForActivityResult(PrefsFileContract()) { - it?.let { - importSharedPreferences(activity, it) - } - } try { - callForPrefFile.launch(null) + if (activity is SingleFragmentActivity) + activity.callForPrefFile.launch(null) + if (activity is MainActivity) + activity.callForPrefFile.launch(null) } catch (e: IllegalArgumentException) { // this exception happens on some early implementations of ActivityResult contracts // when registered and called for the second time @@ -278,12 +277,12 @@ class ImportExportPrefs @Inject constructor( } } - private fun importSharedPreferences(activity: Activity, importFile: PrefsFile) { + public fun importSharedPreferences(activity: FragmentActivity, importFile: PrefsFile) { askToConfirmImport(activity, importFile) { password -> val format: PrefsFormat = when (importFile.handler) { - PrefsFormatsHandler.CLASSIC -> classicPrefsFormat + PrefsFormatsHandler.CLASSIC -> classicPrefsFormat PrefsFormatsHandler.ENCRYPTED -> encryptedPrefsFormat } @@ -345,7 +344,7 @@ class ImportExportPrefs @Inject constructor( show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp), Runnable { log.debug(TAG, "Exiting") rxBus.send(EventAppExit()) - if (context is Activity) { + if (context is AppCompatActivity) { context.finish() } System.runFinalization() diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt index 52910dfff1..ce9c1bdd7c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/PrefFileListProvider.kt @@ -1,20 +1,18 @@ package info.nightscout.androidaps.plugins.general.maintenance -import android.app.Activity import android.content.Context import android.content.Intent import android.os.Build import android.os.Environment import android.os.Parcelable import androidx.activity.result.contract.ActivityResultContract +import androidx.fragment.app.FragmentActivity import info.nightscout.androidaps.BuildConfig import info.nightscout.androidaps.R -import info.nightscout.androidaps.logging.AAPSLogger import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImportListActivity import info.nightscout.androidaps.plugins.general.maintenance.formats.* import info.nightscout.androidaps.utils.resources.ResourceHelper -import info.nightscout.androidaps.utils.sharedPreferences.SP import info.nightscout.androidaps.utils.storage.Storage import kotlinx.android.parcel.Parcelize import kotlinx.android.parcel.RawValue @@ -34,6 +32,7 @@ enum class PrefsImportDir { @Parcelize data class PrefsFile( + val name: String, val file: File, val baseDir: File, val dirKind: PrefsImportDir, @@ -46,13 +45,14 @@ data class PrefsFile( class PrefsFileContract : ActivityResultContract() { companion object { + const val OUTPUT_PARAM = "prefs_file" } override fun parseResult(resultCode: Int, intent: Intent?): PrefsFile? { return when (resultCode) { - Activity.RESULT_OK -> intent?.getParcelableExtra(OUTPUT_PARAM) - else -> null + FragmentActivity.RESULT_OK -> intent?.getParcelableExtra(OUTPUT_PARAM) + else -> null } } @@ -74,6 +74,7 @@ class PrefFileListProvider @Inject constructor( ) { companion object { + private val path = File(Environment.getExternalStorageDirectory().toString()) private val aapsPath = File(path, "AAPS" + File.separator + "preferences") private const val IMPORT_AGE_NOT_YET_OLD_DAYS = 60 @@ -96,7 +97,7 @@ class PrefFileListProvider @Inject constructor( val detectedOld = !detectedNew && classicPrefsFormat.isPreferencesFile(it, contents) if (detectedNew || detectedOld) { val formatHandler = if (detectedNew) PrefsFormatsHandler.ENCRYPTED else PrefsFormatsHandler.CLASSIC - prefFiles.add(PrefsFile(it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents))) + prefFiles.add(PrefsFile(it.name, it, path, PrefsImportDir.ROOT_DIR, formatHandler, metadataFor(loadMetadata, formatHandler, contents))) } } @@ -104,7 +105,7 @@ class PrefFileListProvider @Inject constructor( aapsPath.walk().filter { it.isFile && it.name.endsWith(".json") }.forEach { val contents = storage.getFileContents(it) if (encryptedPrefsFormat.isPreferencesFile(it, contents)) { - prefFiles.add(PrefsFile(it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents))) + prefFiles.add(PrefsFile(it.name, it, aapsPath, PrefsImportDir.AAPS_DIR, PrefsFormatsHandler.ENCRYPTED, metadataFor(loadMetadata, PrefsFormatsHandler.ENCRYPTED, contents))) } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt index 6be8b5e020..9f71e46afb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/activities/PrefImportListActivity.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.general.maintenance.activities -import android.app.Activity import android.content.Context import android.content.Intent import android.os.Bundle @@ -9,6 +8,7 @@ import android.view.MenuItem import android.view.View import android.view.ViewGroup import android.widget.TextView +import androidx.fragment.app.FragmentActivity import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import dagger.android.support.DaggerAppCompatActivity @@ -63,7 +63,7 @@ class PrefImportListActivity : DaggerAppCompatActivity() { val i = Intent() i.putExtra(PrefsFileContract.OUTPUT_PARAM, prefFile) - setResult(Activity.RESULT_OK, i) + setResult(FragmentActivity.RESULT_OK, i) finish() } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt index 40b1ceada4..f264e7c06d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/maintenance/formats/ClassicPrefsFormat.kt @@ -22,7 +22,7 @@ class ClassicPrefsFormat @Inject constructor( override fun isPreferencesFile(file: File, preloadedContents: String?): Boolean { val contents = preloadedContents ?: storage.getFileContents(file) - return contents.contains("units::" + Constants.MGDL) || contents.contains("units::" + Constants.MMOL) + return contents.contains("units::" + Constants.MGDL) || contents.contains("units::" + Constants.MMOL) || contents.contains("language::") || contents.contains("I_understand::") } override fun savePreferences(file: File, prefs: Prefs, masterPassword: String?) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java index 1764142432..9b1fcab0f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/nsclient/NSClientPlugin.java @@ -10,6 +10,7 @@ import android.os.IBinder; import android.text.Spanned; import androidx.preference.PreferenceFragmentCompat; +import androidx.preference.SwitchPreference; import org.jetbrains.annotations.NotNull; @@ -190,7 +191,21 @@ public class NSClientPlugin extends PluginBase { super.preprocessPreferences(preferenceFragment); if (config.getNSCLIENT()) { - preferenceFragment.findPreference(resourceHelper.gs(R.string.key_statuslights_overview_advanced)); + SwitchPreference key_ns_uploadlocalprofile = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_uploadlocalprofile)); + if (key_ns_uploadlocalprofile != null) key_ns_uploadlocalprofile.setVisible(false); + SwitchPreference key_ns_autobackfill = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_autobackfill)); + if (key_ns_autobackfill != null) key_ns_autobackfill.setVisible(false); + SwitchPreference key_ns_create_announcements_from_errors = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_create_announcements_from_errors)); + if (key_ns_create_announcements_from_errors != null) key_ns_create_announcements_from_errors.setVisible(false); + SwitchPreference key_ns_create_announcements_from_carbs_req = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_create_announcements_from_carbs_req)); + if (key_ns_create_announcements_from_carbs_req != null) key_ns_create_announcements_from_carbs_req.setVisible(false); + SwitchPreference key_ns_upload_only = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_upload_only)); + if (key_ns_upload_only != null) { + key_ns_upload_only.setVisible(false); + key_ns_upload_only.setEnabled(false); + } + SwitchPreference key_ns_sync_use_absolute = preferenceFragment.findPreference(resourceHelper.gs(R.string.key_ns_sync_use_absolute)); + if (key_ns_sync_use_absolute != null) key_ns_sync_use_absolute.setVisible(false); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/AllowedPreferenceKeys.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/AllowedPreferenceKeys.kt index 04045becdb..c8f13a842c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/AllowedPreferenceKeys.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/AllowedPreferenceKeys.kt @@ -185,7 +185,7 @@ private val allowedKeys = """ tidepool_only_while_charging tidepool_only_while_unmetered virtualpump - virtualpump_uploadstatus + key_virtualpump_uploadstatus virtualpump_type wearplugin wearcontrol diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansLoginActivity.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansLoginActivity.kt index 9220457bbb..b9395f5416 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansLoginActivity.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/openhumans/OpenHumansLoginActivity.kt @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.general.openhumans -import android.app.Activity import android.app.Dialog import android.content.Intent import android.net.Uri @@ -11,6 +10,7 @@ import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.browser.customtabs.CustomTabsIntent import androidx.fragment.app.DialogFragment +import androidx.fragment.app.FragmentActivity import dagger.android.support.DaggerDialogFragment import info.nightscout.androidaps.R import info.nightscout.androidaps.activities.NoSplashAppCompatActivity @@ -26,7 +26,7 @@ class OpenHumansLoginActivity : NoSplashAppCompatActivity() { val button = findViewById