:plugins:configuration cleanup
This commit is contained in:
parent
7c7879e0b0
commit
7b07580881
|
@ -29,6 +29,9 @@ import androidx.core.view.GravityCompat
|
|||
import androidx.core.view.MenuCompat
|
||||
import androidx.core.view.MenuProvider
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import app.aaps.configuration.activities.SingleFragmentActivity
|
||||
import app.aaps.configuration.setupwizard.SetupWizardActivity
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
|
@ -37,9 +40,6 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule
|
|||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.androidaps.databinding.ActivityMainBinding
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.configuration.setupwizard.SetupWizardActivity
|
||||
import info.nightscout.core.ui.UIRunnable
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
|
@ -207,8 +207,8 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
|
|||
R.id.nav_about -> {
|
||||
var message = "Build: ${BuildConfig.BUILDVERSION}\n"
|
||||
message += "Flavor: ${BuildConfig.FLAVOR}${BuildConfig.BUILD_TYPE}\n"
|
||||
message += "${rh.gs(info.nightscout.configuration.R.string.configbuilder_nightscoutversion_label)} ${activePlugin.activeNsClient?.detectedNsVersion() ?: rh.gs(info.nightscout.plugins.R.string.not_available_full)}"
|
||||
if (config.isEngineeringMode()) message += "\n${rh.gs(info.nightscout.configuration.R.string.engineering_mode_enabled)}"
|
||||
message += "${rh.gs(app.aaps.configuration.R.string.configbuilder_nightscoutversion_label)} ${activePlugin.activeNsClient?.detectedNsVersion() ?: rh.gs(info.nightscout.plugins.R.string.not_available_full)}"
|
||||
if (config.isEngineeringMode()) message += "\n${rh.gs(app.aaps.configuration.R.string.engineering_mode_enabled)}"
|
||||
if (config.isUnfinishedMode()) message += "\nUnfinished mode enabled"
|
||||
if (!fabricPrivacy.fabricEnabled()) message += "\n${rh.gs(info.nightscout.core.ui.R.string.fabric_upload_disabled)}"
|
||||
message += rh.gs(info.nightscout.core.ui.R.string.about_link_urls)
|
||||
|
@ -307,7 +307,7 @@ class MainActivity : DaggerAppCompatActivityWithResult() {
|
|||
}
|
||||
|
||||
private fun startWizard(): Boolean =
|
||||
!sp.getBoolean(info.nightscout.configuration.R.string.key_setupwizard_processed, false)
|
||||
!sp.getBoolean(app.aaps.configuration.R.string.key_setupwizard_processed, false)
|
||||
|
||||
override fun onPostCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
|
||||
super.onPostCreate(savedInstanceState, persistentState)
|
||||
|
|
|
@ -223,8 +223,8 @@ class MainApp : DaggerApplication() {
|
|||
}
|
||||
if (!sp.contains(info.nightscout.plugins.sync.R.string.key_ns_log_app_started_event))
|
||||
sp.putBoolean(info.nightscout.plugins.sync.R.string.key_ns_log_app_started_event, config.APS)
|
||||
if (sp.getString(info.nightscout.configuration.R.string.key_maintenance_logs_email, "") == "logs@androidaps.org")
|
||||
sp.putString(info.nightscout.configuration.R.string.key_maintenance_logs_email, "logs@aaps.app")
|
||||
if (sp.getString(app.aaps.configuration.R.string.key_maintenance_logs_email, "") == "logs@androidaps.org")
|
||||
sp.putString(app.aaps.configuration.R.string.key_maintenance_logs_email, "logs@aaps.app")
|
||||
// fix values for theme switching
|
||||
sp.putString(info.nightscout.plugins.R.string.value_dark_theme, "dark")
|
||||
sp.putString(info.nightscout.plugins.R.string.value_light_theme, "light")
|
||||
|
|
|
@ -15,6 +15,7 @@ import androidx.preference.PreferenceGroup
|
|||
import androidx.preference.PreferenceManager
|
||||
import androidx.preference.PreferenceScreen
|
||||
import androidx.preference.size
|
||||
import app.aaps.configuration.maintenance.MaintenancePlugin
|
||||
import dagger.android.support.AndroidSupportInjection
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
|
@ -24,7 +25,6 @@ import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
|||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
||||
import info.nightscout.automation.AutomationPlugin
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.implementation.plugin.PluginStore
|
||||
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
||||
|
@ -226,7 +226,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
addPreferencesFromResourceIfEnabled(wearPlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(statusLinePlugin, rootKey)
|
||||
addPreferencesFromResource(R.xml.pref_alerts, rootKey)
|
||||
addPreferencesFromResource(info.nightscout.configuration.R.xml.pref_datachoices, rootKey)
|
||||
addPreferencesFromResource(app.aaps.configuration.R.xml.pref_datachoices, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(maintenancePlugin, rootKey)
|
||||
addPreferencesFromResourceIfEnabled(openHumansUploaderPlugin, rootKey)
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
}
|
||||
if (key == rh.gs(info.nightscout.plugins.aps.R.string.key_openapsama_use_autosens) && sp.getBoolean(info.nightscout.plugins.aps.R.string.key_openapsama_use_autosens, false)) {
|
||||
activity?.let {
|
||||
OKDialog.show(it, rh.gs(info.nightscout.configuration.R.string.configbuilder_sensitivity), rh.gs(R.string.sensitivity_warning))
|
||||
OKDialog.show(it, rh.gs(app.aaps.configuration.R.string.configbuilder_sensitivity), rh.gs(R.string.sensitivity_warning))
|
||||
}
|
||||
}
|
||||
checkForBiometricFallback(key)
|
||||
|
@ -276,7 +276,8 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
) {
|
||||
activity?.let {
|
||||
val title = rh.gs(info.nightscout.core.ui.R.string.unsecure_fallback_biometric)
|
||||
val message = rh.gs(info.nightscout.configuration.R.string.master_password_missing, rh.gs(info.nightscout.configuration.R.string.configbuilder_general), rh.gs(info.nightscout.configuration.R.string.protection))
|
||||
val message =
|
||||
rh.gs(app.aaps.configuration.R.string.master_password_missing, rh.gs(app.aaps.configuration.R.string.configbuilder_general), rh.gs(app.aaps.configuration.R.string.protection))
|
||||
OKDialog.show(it, title = title, message = message)
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +442,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang
|
|||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||
context?.let { context ->
|
||||
if (preference.key == rh.gs(info.nightscout.core.utils.R.string.key_master_password)) {
|
||||
passwordCheck.queryPassword(context, info.nightscout.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, {
|
||||
passwordCheck.queryPassword(context, app.aaps.configuration.R.string.current_master_password, info.nightscout.core.utils.R.string.key_master_password, {
|
||||
passwordCheck.setPassword(context, info.nightscout.core.ui.R.string.master_password, info.nightscout.core.utils.R.string.key_master_password)
|
||||
})
|
||||
return true
|
||||
|
|
|
@ -8,9 +8,9 @@ import androidx.appcompat.widget.SearchView
|
|||
import androidx.core.view.MenuProvider
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
import androidx.preference.PreferenceScreen
|
||||
import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.databinding.ActivityPreferencesBinding
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
|
||||
class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragmentCompat.OnPreferenceStartScreenCallback {
|
||||
|
||||
|
@ -25,7 +25,7 @@ class PreferencesActivity : DaggerAppCompatActivityWithResult(), PreferenceFragm
|
|||
binding = ActivityPreferencesBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
title = rh.gs(info.nightscout.configuration.R.string.nav_preferences)
|
||||
title = rh.gs(app.aaps.configuration.R.string.nav_preferences)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||
myPreferenceFragment = MyPreferenceFragment()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.di
|
||||
|
||||
import app.aaps.configuration.di.ConfigurationModule
|
||||
import app.aaps.shared.impl.di.SharedImplModule
|
||||
import dagger.BindsInstance
|
||||
import dagger.Component
|
||||
|
@ -15,7 +16,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.di.MedtronicModule
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.di.OmnipodDashModule
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.di.OmnipodErosModule
|
||||
import info.nightscout.automation.di.AutomationModule
|
||||
import info.nightscout.configuration.di.ConfigurationModule
|
||||
import info.nightscout.core.di.CoreModule
|
||||
import info.nightscout.core.validators.di.ValidatorsModule
|
||||
import info.nightscout.database.impl.DatabaseModule
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.di
|
||||
|
||||
import app.aaps.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import app.aaps.configuration.maintenance.MaintenancePlugin
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.multibindings.IntKey
|
||||
|
@ -7,15 +9,12 @@ import dagger.multibindings.IntoMap
|
|||
import info.nightscout.androidaps.danaRKorean.DanaRKoreanPlugin
|
||||
import info.nightscout.androidaps.danaRv2.DanaRv2Plugin
|
||||
import info.nightscout.androidaps.danar.DanaRPlugin
|
||||
import info.nightscout.plugins.sync.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.eopatch.EopatchPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||
import info.nightscout.automation.AutomationPlugin
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.insulin.InsulinLyumjevPlugin
|
||||
import info.nightscout.insulin.InsulinOrefFreePeakPlugin
|
||||
import info.nightscout.insulin.InsulinOrefRapidActingPlugin
|
||||
|
@ -42,12 +41,13 @@ import info.nightscout.plugins.profile.ProfilePlugin
|
|||
import info.nightscout.plugins.sync.dataBroadcaster.DataBroadcastPlugin
|
||||
import info.nightscout.plugins.sync.nsclient.NSClientPlugin
|
||||
import info.nightscout.plugins.sync.nsclientV3.NSClientV3Plugin
|
||||
import info.nightscout.plugins.sync.openhumans.OpenHumansUploaderPlugin
|
||||
import info.nightscout.plugins.sync.tidepool.TidepoolPlugin
|
||||
import info.nightscout.plugins.sync.xdrip.XdripPlugin
|
||||
import info.nightscout.pump.combo.ComboPlugin
|
||||
import info.nightscout.pump.combov2.ComboV2Plugin
|
||||
import info.nightscout.pump.medtrum.MedtrumPlugin
|
||||
import info.nightscout.pump.diaconn.DiaconnG8Plugin
|
||||
import info.nightscout.pump.medtrum.MedtrumPlugin
|
||||
import info.nightscout.pump.virtual.VirtualPumpPlugin
|
||||
import info.nightscout.sensitivity.SensitivityAAPSPlugin
|
||||
import info.nightscout.sensitivity.SensitivityOref1Plugin
|
||||
|
|
|
@ -6,13 +6,13 @@ import android.os.Bundle
|
|||
import androidx.annotation.RawRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import app.aaps.configuration.activities.SingleFragmentActivity
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.MainActivity
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.HistoryBrowseActivity
|
||||
import info.nightscout.androidaps.activities.MyPreferenceFragment
|
||||
import info.nightscout.androidaps.activities.PreferencesActivity
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.core.events.EventNewNotification
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
|
@ -77,8 +77,8 @@ class UiInteractionImpl @Inject constructor(
|
|||
override fun runWizardDialog(fragmentManager: FragmentManager, carbs: Int?, name: String?) {
|
||||
WizardDialog().also { dialog ->
|
||||
dialog.arguments = Bundle().also { bundle ->
|
||||
carbs?.let { bundle.putDouble("carbs_input", carbs.toDouble())}
|
||||
name?.let {bundle.putString("notes_input", " $name - ${carbs}g") }
|
||||
carbs?.let { bundle.putDouble("carbs_input", carbs.toDouble()) }
|
||||
name?.let { bundle.putString("notes_input", " $name - ${carbs}g") }
|
||||
}
|
||||
}.show(fragmentManager, "Food Item")
|
||||
|
||||
|
@ -160,6 +160,7 @@ class UiInteractionImpl @Inject constructor(
|
|||
}
|
||||
.show(fragmentManager, "CareDialog")
|
||||
}
|
||||
|
||||
override fun runBolusProgressDialog(fragmentManager: FragmentManager, insulin: Double, id: Long) {
|
||||
BolusProgressDialog().also {
|
||||
it.setInsulin(insulin)
|
||||
|
|
|
@ -9,9 +9,9 @@ import androidx.work.WorkManager
|
|||
import androidx.work.WorkQuery
|
||||
import androidx.work.WorkerParameters
|
||||
import androidx.work.workDataOf
|
||||
import app.aaps.configuration.maintenance.MaintenancePlugin
|
||||
import com.google.common.util.concurrent.ListenableFuture
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.core.profile.ProfileSealed
|
||||
import info.nightscout.core.utils.worker.LoggingWorker
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.plugins.configBuilder
|
||||
|
||||
import app.aaps.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.plugins.general.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import app.aaps.configuration.maintenance.MaintenancePlugin
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
|
|
|
@ -12,7 +12,7 @@ apply from: "${project.rootDir}/core/main/allopen_dependencies.gradle"
|
|||
apply from: "${project.rootDir}/core/main/test_dependencies.gradle"
|
||||
apply from: "${project.rootDir}/core/main/jacoco_global.gradle"
|
||||
android {
|
||||
namespace 'info.nightscout.configuration'
|
||||
namespace 'app.aaps.configuration'
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
<activity
|
||||
android:name="info.nightscout.configuration.activities.SingleFragmentActivity"
|
||||
android:name=".activities.SingleFragmentActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/AppTheme" />
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package info.nightscout.configuration.setupwizard;
|
||||
|
||||
// keep in java, it's easier
|
||||
public interface SWIntNumberValidator {
|
||||
boolean isValid(int value);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package info.nightscout.configuration.setupwizard;
|
||||
|
||||
// keep in java, it's easier
|
||||
public interface SWNumberValidator {
|
||||
boolean isValid(double value);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package info.nightscout.configuration.setupwizard;
|
||||
|
||||
// keep in java, it's easier
|
||||
public interface SWTextValidator {
|
||||
boolean isValid(String text);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
package info.nightscout.configuration.setupwizard;
|
||||
|
||||
// keep in java, it's easier
|
||||
public interface SWValidator {
|
||||
boolean isValid();
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration
|
||||
package app.aaps.configuration
|
||||
|
||||
import android.Manifest
|
||||
import android.annotation.SuppressLint
|
||||
|
@ -13,7 +13,7 @@ import android.os.PowerManager
|
|||
import android.provider.Settings
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.AndroidPermission
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.activities
|
||||
package app.aaps.configuration.activities
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
@ -6,10 +6,10 @@ import android.content.pm.PackageManager
|
|||
import android.os.Bundle
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.app.ActivityCompat
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.maintenance.CustomWatchfaceFileContract
|
||||
import app.aaps.configuration.maintenance.PrefsFileContract
|
||||
import dagger.android.support.DaggerAppCompatActivity
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.maintenance.CustomWatchfaceFileContract
|
||||
import info.nightscout.configuration.maintenance.PrefsFileContract
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.activities
|
||||
package app.aaps.configuration.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.activities
|
||||
package app.aaps.configuration.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -6,7 +6,7 @@ import android.view.Menu
|
|||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import androidx.core.view.MenuProvider
|
||||
import info.nightscout.configuration.R
|
||||
import app.aaps.configuration.R
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
import info.nightscout.interfaces.plugin.PluginBase
|
||||
import info.nightscout.interfaces.protection.ProtectionCheck
|
||||
|
@ -52,7 +52,7 @@ class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
|
|||
R.id.nav_plugin_preferences -> {
|
||||
protectionCheck.queryProtection(this@SingleFragmentActivity, ProtectionCheck.Protection.PREFERENCES, {
|
||||
val i = Intent(this@SingleFragmentActivity, uiInteraction.preferencesActivity)
|
||||
.setAction("info.nightscout.configuration.activities.SingleFragmentActivity")
|
||||
.setAction("app.aaps.configuration.activities.SingleFragmentActivity")
|
||||
.putExtra("id", plugin?.preferencesId)
|
||||
startActivity(i)
|
||||
}, null)
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.configuration.configBuilder
|
||||
package app.aaps.configuration.configBuilder
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import app.aaps.configuration.databinding.ConfigbuilderFragmentBinding
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import info.nightscout.configuration.databinding.ConfigbuilderFragmentBinding
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.configBuilder
|
||||
package app.aaps.configuration.configBuilder
|
||||
|
||||
import android.content.Intent
|
||||
import android.view.LayoutInflater
|
||||
|
@ -13,9 +13,9 @@ import androidx.annotation.StringRes
|
|||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.database.entities.UserEntry.Action
|
||||
import info.nightscout.database.entities.UserEntry.Sources
|
|
@ -1,10 +1,9 @@
|
|||
package info.nightscout.configuration.configBuilder
|
||||
package app.aaps.configuration.configBuilder
|
||||
|
||||
import info.nightscout.configuration.R
|
||||
import app.aaps.configuration.R
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.aps.Sensitivity
|
||||
import info.nightscout.sdk.interfaces.RunningConfiguration
|
||||
import info.nightscout.interfaces.insulin.Insulin
|
||||
import info.nightscout.interfaces.notifications.Notification
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
||||
|
@ -17,6 +16,7 @@ import info.nightscout.rx.bus.RxBus
|
|||
import info.nightscout.rx.events.EventNSClientNewLog
|
||||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.logging.LTag
|
||||
import info.nightscout.sdk.interfaces.RunningConfiguration
|
||||
import info.nightscout.sdk.localmodel.devicestatus.NSDeviceStatus
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.configBuilder.events
|
||||
package app.aaps.configuration.configBuilder.events
|
||||
|
||||
import info.nightscout.rx.events.EventUpdateGui
|
||||
|
|
@ -1,25 +1,25 @@
|
|||
package info.nightscout.configuration.di
|
||||
package app.aaps.configuration.di
|
||||
|
||||
import app.aaps.configuration.AndroidPermissionImpl
|
||||
import app.aaps.configuration.activities.SingleFragmentActivity
|
||||
import app.aaps.configuration.configBuilder.ConfigBuilderFragment
|
||||
import app.aaps.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import app.aaps.configuration.configBuilder.RunningConfigurationImpl
|
||||
import app.aaps.configuration.maintenance.ImportExportPrefsImpl
|
||||
import app.aaps.configuration.maintenance.MaintenanceFragment
|
||||
import app.aaps.configuration.maintenance.PrefFileListProviderImpl
|
||||
import app.aaps.configuration.maintenance.activities.CustomWatchfaceImportListActivity
|
||||
import app.aaps.configuration.maintenance.activities.LogSettingActivity
|
||||
import app.aaps.configuration.maintenance.activities.PrefImportListActivity
|
||||
import app.aaps.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.configuration.AndroidPermissionImpl
|
||||
import info.nightscout.configuration.activities.SingleFragmentActivity
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderFragment
|
||||
import info.nightscout.configuration.configBuilder.ConfigBuilderPlugin
|
||||
import info.nightscout.configuration.configBuilder.RunningConfigurationImpl
|
||||
import info.nightscout.configuration.maintenance.ImportExportPrefsImpl
|
||||
import info.nightscout.configuration.maintenance.MaintenanceFragment
|
||||
import info.nightscout.configuration.maintenance.PrefFileListProviderImpl
|
||||
import info.nightscout.configuration.maintenance.activities.CustomWatchfaceImportListActivity
|
||||
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.configuration.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.interfaces.AndroidPermission
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.sdk.interfaces.RunningConfiguration
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.sdk.interfaces.RunningConfiguration
|
||||
|
||||
@Module(
|
||||
includes = [
|
|
@ -1,25 +1,25 @@
|
|||
package info.nightscout.configuration.di
|
||||
package app.aaps.configuration.di
|
||||
|
||||
import app.aaps.configuration.setupwizard.SWEventListener
|
||||
import app.aaps.configuration.setupwizard.SWScreen
|
||||
import app.aaps.configuration.setupwizard.SetupWizardActivity
|
||||
import app.aaps.configuration.setupwizard.elements.SWBreak
|
||||
import app.aaps.configuration.setupwizard.elements.SWButton
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditEncryptedPassword
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditIntNumber
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditNumber
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditNumberWithUnits
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditString
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditUrl
|
||||
import app.aaps.configuration.setupwizard.elements.SWFragment
|
||||
import app.aaps.configuration.setupwizard.elements.SWHtmlLink
|
||||
import app.aaps.configuration.setupwizard.elements.SWInfoText
|
||||
import app.aaps.configuration.setupwizard.elements.SWItem
|
||||
import app.aaps.configuration.setupwizard.elements.SWPlugin
|
||||
import app.aaps.configuration.setupwizard.elements.SWPreference
|
||||
import app.aaps.configuration.setupwizard.elements.SWRadioButton
|
||||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWEventListener
|
||||
import info.nightscout.configuration.setupwizard.SWScreen
|
||||
import info.nightscout.configuration.setupwizard.SetupWizardActivity
|
||||
import info.nightscout.configuration.setupwizard.elements.SWBreak
|
||||
import info.nightscout.configuration.setupwizard.elements.SWButton
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditEncryptedPassword
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditIntNumber
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditNumber
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditNumberWithUnits
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditString
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditUrl
|
||||
import info.nightscout.configuration.setupwizard.elements.SWFragment
|
||||
import info.nightscout.configuration.setupwizard.elements.SWHtmlLink
|
||||
import info.nightscout.configuration.setupwizard.elements.SWInfoText
|
||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||
import info.nightscout.configuration.setupwizard.elements.SWPlugin
|
||||
import info.nightscout.configuration.setupwizard.elements.SWPreference
|
||||
import info.nightscout.configuration.setupwizard.elements.SWRadioButton
|
||||
|
||||
@Module
|
||||
@Suppress("unused")
|
|
@ -1,13 +1,14 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
|
||||
class CustomWatchfaceFileContract: ActivityResultContract<Void?, Unit?>() {
|
||||
class CustomWatchfaceFileContract : ActivityResultContract<Void?, Unit?>() {
|
||||
|
||||
companion object {
|
||||
|
||||
const val OUTPUT_PARAM = "custom_file"
|
||||
}
|
||||
|
||||
|
@ -19,6 +20,6 @@ class CustomWatchfaceFileContract: ActivityResultContract<Void?, Unit?>() {
|
|||
}
|
||||
|
||||
override fun createIntent(context: Context, input: Void?): Intent {
|
||||
return Intent(context, info.nightscout.configuration.maintenance.activities.CustomWatchfaceImportListActivity::class.java)
|
||||
return Intent(context, app.aaps.configuration.maintenance.activities.CustomWatchfaceImportListActivity::class.java)
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.Manifest
|
||||
import android.bluetooth.BluetoothManager
|
||||
|
@ -18,11 +18,16 @@ import androidx.work.OneTimeWorkRequest
|
|||
import androidx.work.WorkManager
|
||||
import androidx.work.WorkerParameters
|
||||
import androidx.work.workDataOf
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import app.aaps.configuration.maintenance.data.PrefFileNotFoundError
|
||||
import app.aaps.configuration.maintenance.data.PrefIOError
|
||||
import app.aaps.configuration.maintenance.data.Prefs
|
||||
import app.aaps.configuration.maintenance.data.PrefsFormat
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import app.aaps.configuration.maintenance.dialogs.PrefImportSummaryDialog
|
||||
import app.aaps.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.maintenance.dialogs.PrefImportSummaryDialog
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.dialogs.TwoMessagesAlertDialog
|
||||
import info.nightscout.core.ui.dialogs.WarningDialog
|
||||
|
@ -37,14 +42,9 @@ import info.nightscout.interfaces.db.PersistenceLayer
|
|||
import info.nightscout.interfaces.logging.UserEntryLogger
|
||||
import info.nightscout.interfaces.maintenance.ImportExportPrefs
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.maintenance.PrefFileNotFoundError
|
||||
import info.nightscout.interfaces.maintenance.PrefIOError
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
import info.nightscout.interfaces.maintenance.Prefs
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
||||
import info.nightscout.interfaces.maintenance.PrefsFormat
|
||||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.interfaces.protection.PasswordCheck
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import info.nightscout.interfaces.ui.UiInteraction
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -6,10 +6,10 @@ import android.view.LayoutInflater
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.text.toSpanned
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.databinding.MaintenanceFragmentBinding
|
||||
import app.aaps.configuration.maintenance.activities.LogSettingActivity
|
||||
import dagger.android.support.DaggerFragment
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.MaintenanceFragmentBinding
|
||||
import info.nightscout.configuration.maintenance.activities.LogSettingActivity
|
||||
import info.nightscout.core.graph.OverviewData
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.utils.HtmlHelper
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.core.content.FileProvider
|
||||
import app.aaps.configuration.R
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.logging.LoggerUtils
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
|
@ -1,20 +1,20 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Environment
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.maintenance.data.PrefMetadataMap
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import app.aaps.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import dagger.Lazy
|
||||
import dagger.Reusable
|
||||
import info.nightscout.annotations.OpenForTesting
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.maintenance.formats.EncryptedPrefsFormat
|
||||
import info.nightscout.interfaces.Config
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadataMap
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
||||
import info.nightscout.interfaces.maintenance.PrefsImportDir
|
||||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
||||
import info.nightscout.rx.bus.RxBus
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.activity.result.contract.ActivityResultContract
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import info.nightscout.configuration.maintenance.activities.PrefImportListActivity
|
||||
import app.aaps.configuration.maintenance.activities.PrefImportListActivity
|
||||
import info.nightscout.core.utils.extensions.safeGetParcelableExtra
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.configuration.maintenance
|
||||
package app.aaps.configuration.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.interfaces.maintenance.PrefsFormat
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.maintenance.data.PrefsFormat
|
||||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
|
||||
enum class PrefsMetadataKeyImpl(override val key: String, @DrawableRes override val icon: Int, @StringRes override val label: Int) : PrefsMetadataKey {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance.activities
|
||||
package app.aaps.configuration.maintenance.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -7,9 +7,9 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.CustomWatchfaceImportListActivityBinding
|
||||
import info.nightscout.configuration.databinding.CustomWatchfaceImportListItemBinding
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.databinding.CustomWatchfaceImportListActivityBinding
|
||||
import app.aaps.configuration.databinding.CustomWatchfaceImportListItemBinding
|
||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
|
||||
|
@ -18,7 +18,6 @@ import info.nightscout.rx.events.EventMobileDataToWear
|
|||
import info.nightscout.rx.logging.AAPSLogger
|
||||
import info.nightscout.rx.weardata.CUSTOM_VERSION
|
||||
import info.nightscout.rx.weardata.CwfData
|
||||
import info.nightscout.rx.weardata.ResFileMap
|
||||
import info.nightscout.rx.weardata.CwfMetadataKey.CWF_AUTHOR
|
||||
import info.nightscout.rx.weardata.CwfMetadataKey.CWF_AUTHOR_VERSION
|
||||
import info.nightscout.rx.weardata.CwfMetadataKey.CWF_CREATED_AT
|
||||
|
@ -27,13 +26,14 @@ import info.nightscout.rx.weardata.CwfMetadataKey.CWF_NAME
|
|||
import info.nightscout.rx.weardata.CwfMetadataKey.CWF_VERSION
|
||||
import info.nightscout.rx.weardata.CwfMetadataMap
|
||||
import info.nightscout.rx.weardata.EventData
|
||||
import info.nightscout.rx.weardata.ResFileMap
|
||||
import info.nightscout.rx.weardata.ZipWatchfaceFormat
|
||||
import info.nightscout.shared.extensions.toVisibility
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import javax.inject.Inject
|
||||
|
||||
class CustomWatchfaceImportListActivity: TranslatedDaggerAppCompatActivity() {
|
||||
class CustomWatchfaceImportListActivity : TranslatedDaggerAppCompatActivity() {
|
||||
|
||||
@Inject lateinit var rh: ResourceHelper
|
||||
@Inject lateinit var sp: SP
|
||||
|
@ -92,7 +92,7 @@ class CustomWatchfaceImportListActivity: TranslatedDaggerAppCompatActivity() {
|
|||
val metadata = customWatchfaceFile.metadata
|
||||
val drawable = customWatchfaceFile.resDatas[ResFileMap.CUSTOM_WATCHFACE.fileName]?.toDrawable(resources)
|
||||
with(holder.customWatchfaceImportListItemBinding) {
|
||||
val fileName = metadata[CWF_FILENAME]?.let { "$it${ZipWatchfaceFormat.CWF_EXTENTION}"} ?:""
|
||||
val fileName = metadata[CWF_FILENAME]?.let { "$it${ZipWatchfaceFormat.CWF_EXTENTION}" } ?: ""
|
||||
filelistName.text = rh.gs(info.nightscout.interfaces.R.string.metadata_wear_import_filename, fileName)
|
||||
filelistName.tag = customWatchfaceFile
|
||||
customWatchface.setImageDrawable(drawable)
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.configuration.maintenance.activities
|
||||
package app.aaps.configuration.maintenance.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.ActivityLogsettingBinding
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.databinding.ActivityLogsettingBinding
|
||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||
import info.nightscout.rx.interfaces.L
|
||||
import info.nightscout.rx.interfaces.LogElement
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance.activities
|
||||
package app.aaps.configuration.maintenance.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -8,15 +8,15 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.databinding.MaintenanceImportListActivityBinding
|
||||
import info.nightscout.configuration.databinding.MaintenanceImportListItemBinding
|
||||
import info.nightscout.configuration.maintenance.PrefsFileContract
|
||||
import info.nightscout.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.databinding.MaintenanceImportListActivityBinding
|
||||
import app.aaps.configuration.databinding.MaintenanceImportListItemBinding
|
||||
import app.aaps.configuration.maintenance.PrefsFileContract
|
||||
import app.aaps.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||
import info.nightscout.interfaces.maintenance.PrefFileListProvider
|
||||
import info.nightscout.interfaces.maintenance.PrefsFile
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
package info.nightscout.interfaces.maintenance
|
||||
package app.aaps.configuration.maintenance.data
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import info.nightscout.configuration.R
|
||||
import app.aaps.configuration.R
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatus
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import java.io.File
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance.dialogs
|
||||
package app.aaps.configuration.maintenance.dialogs
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
|
@ -16,11 +16,11 @@ import androidx.annotation.DrawableRes
|
|||
import androidx.annotation.StringRes
|
||||
import androidx.annotation.StyleRes
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.maintenance.data.Prefs
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.core.ui.toast.ToastUtils
|
||||
import info.nightscout.interfaces.maintenance.Prefs
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.shared.extensions.runOnUiThread
|
||||
import java.util.LinkedList
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
package info.nightscout.configuration.maintenance.formats
|
||||
package app.aaps.configuration.maintenance.formats
|
||||
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import app.aaps.configuration.maintenance.data.PrefFileNotFoundError
|
||||
import app.aaps.configuration.maintenance.data.PrefFormatError
|
||||
import app.aaps.configuration.maintenance.data.PrefIOError
|
||||
import app.aaps.configuration.maintenance.data.PrefMetadataMap
|
||||
import app.aaps.configuration.maintenance.data.Prefs
|
||||
import app.aaps.configuration.maintenance.data.PrefsFormat
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import info.nightscout.core.utils.CryptoUtil
|
||||
import info.nightscout.core.utils.hexStringToByteArray
|
||||
import info.nightscout.core.utils.toHex
|
||||
import info.nightscout.interfaces.maintenance.PrefFileNotFoundError
|
||||
import info.nightscout.interfaces.maintenance.PrefFormatError
|
||||
import info.nightscout.interfaces.maintenance.PrefIOError
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadataMap
|
||||
import info.nightscout.interfaces.maintenance.Prefs
|
||||
import info.nightscout.interfaces.maintenance.PrefsFormat
|
||||
import info.nightscout.interfaces.maintenance.PrefsMetadataKey
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatus
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import org.json.JSONException
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard
|
||||
package app.aaps.configuration.setupwizard
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
|
@ -6,21 +6,21 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.setupwizard.elements.SWBreak
|
||||
import app.aaps.configuration.setupwizard.elements.SWButton
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditEncryptedPassword
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditIntNumber
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditNumber
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditNumberWithUnits
|
||||
import app.aaps.configuration.setupwizard.elements.SWEditString
|
||||
import app.aaps.configuration.setupwizard.elements.SWFragment
|
||||
import app.aaps.configuration.setupwizard.elements.SWHtmlLink
|
||||
import app.aaps.configuration.setupwizard.elements.SWInfoText
|
||||
import app.aaps.configuration.setupwizard.elements.SWPlugin
|
||||
import app.aaps.configuration.setupwizard.elements.SWPreference
|
||||
import app.aaps.configuration.setupwizard.elements.SWRadioButton
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.setupwizard.elements.SWBreak
|
||||
import info.nightscout.configuration.setupwizard.elements.SWButton
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditEncryptedPassword
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditIntNumber
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditNumber
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditNumberWithUnits
|
||||
import info.nightscout.configuration.setupwizard.elements.SWEditString
|
||||
import info.nightscout.configuration.setupwizard.elements.SWFragment
|
||||
import info.nightscout.configuration.setupwizard.elements.SWHtmlLink
|
||||
import info.nightscout.configuration.setupwizard.elements.SWInfoText
|
||||
import info.nightscout.configuration.setupwizard.elements.SWPlugin
|
||||
import info.nightscout.configuration.setupwizard.elements.SWPreference
|
||||
import info.nightscout.configuration.setupwizard.elements.SWRadioButton
|
||||
import info.nightscout.core.profile.ProfileSealed
|
||||
import info.nightscout.core.utils.CryptoUtil
|
||||
import info.nightscout.core.utils.isRunningTest
|
||||
|
@ -207,7 +207,7 @@ class SWDefinition @Inject constructor(
|
|||
get() = SWScreen(injector, R.string.patient_name)
|
||||
.skippable(true)
|
||||
.add(SWInfoText(injector).label(R.string.patient_name_summary))
|
||||
.add(SWEditString(injector).validator(SWTextValidator(String::isNotEmpty)).preferenceId(info.nightscout.core.utils.R.string.key_patient_name))
|
||||
.add(SWEditString(injector).validator(String::isNotEmpty).preferenceId(info.nightscout.core.utils.R.string.key_patient_name))
|
||||
|
||||
private val privacy
|
||||
get() = SWScreen(injector, R.string.privacy_settings)
|
||||
|
@ -308,10 +308,8 @@ class SWDefinition @Inject constructor(
|
|||
.add( // Omnipod Eros only
|
||||
SWInfoText(injector)
|
||||
.label(R.string.setupwizard_pump_waiting_for_riley_link_connection)
|
||||
.visibility {
|
||||
val activePump = activePlugin.activePump
|
||||
activePump is OmnipodEros && !activePump.isRileyLinkReady()
|
||||
})
|
||||
.visibility { activePlugin.activePump.let { it is OmnipodEros && !it.isRileyLinkReady() } }
|
||||
)
|
||||
.add( // Omnipod Eros only
|
||||
SWEventListener(injector, EventSWRLStatus::class.java)
|
||||
.label(R.string.setupwizard_pump_riley_link_status)
|
|
@ -1,18 +1,19 @@
|
|||
package info.nightscout.configuration.setupwizard
|
||||
package app.aaps.configuration.setupwizard
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import app.aaps.configuration.setupwizard.elements.SWItem
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||
import info.nightscout.rx.AapsSchedulers
|
||||
import info.nightscout.rx.events.EventStatus
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import javax.inject.Inject
|
||||
|
||||
class SWEventListener constructor(
|
||||
class SWEventListener(
|
||||
injector: HasAndroidInjector,
|
||||
clazz: Class<out EventStatus>
|
||||
) : SWItem(injector, Type.LISTENER) {
|
||||
|
@ -21,14 +22,14 @@ class SWEventListener constructor(
|
|||
private var textLabel = 0
|
||||
private var status = ""
|
||||
private var textView: TextView? = null
|
||||
private var visibilityValidator: SWValidator? = null
|
||||
private var visibilityValidator: (() -> Boolean)? = null
|
||||
|
||||
@Inject lateinit var aapsSchedulers: AapsSchedulers
|
||||
@Inject lateinit var context: Context
|
||||
|
||||
// TODO: Adrian how to clear disposable in this case?
|
||||
init {
|
||||
disposable.add(rxBus
|
||||
disposable += rxBus
|
||||
.toObservable(clazz)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
.subscribe { event: Any ->
|
||||
|
@ -36,7 +37,6 @@ class SWEventListener constructor(
|
|||
@SuppressLint("SetTextI18n")
|
||||
textView?.text = (if (textLabel != 0) rh.gs(textLabel) else "") + " " + status
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun label(label: Int): SWEventListener {
|
||||
|
@ -49,7 +49,7 @@ class SWEventListener constructor(
|
|||
return this
|
||||
}
|
||||
|
||||
fun visibility(visibilityValidator: SWValidator): SWEventListener {
|
||||
fun visibility(visibilityValidator: () -> Boolean): SWEventListener {
|
||||
this.visibilityValidator = visibilityValidator
|
||||
return this
|
||||
}
|
||||
|
@ -64,6 +64,6 @@ class SWEventListener constructor(
|
|||
}
|
||||
|
||||
override fun processVisibility() {
|
||||
if (visibilityValidator != null && !visibilityValidator!!.isValid) textView?.visibility = View.GONE else textView?.visibility = View.VISIBLE
|
||||
if (visibilityValidator?.invoke() == false) textView?.visibility = View.GONE else textView?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package info.nightscout.configuration.setupwizard
|
||||
package app.aaps.configuration.setupwizard
|
||||
|
||||
import app.aaps.configuration.setupwizard.elements.SWItem
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -10,8 +10,8 @@ class SWScreen(val injector: HasAndroidInjector, private var header: Int) {
|
|||
@Inject lateinit var rh: ResourceHelper
|
||||
|
||||
var items: MutableList<SWItem> = ArrayList()
|
||||
var validator: SWValidator? = null
|
||||
var visibility: SWValidator? = null
|
||||
var validator: (() -> Boolean)? = null
|
||||
var visibility: (() -> Boolean)? = null
|
||||
var skippable = false
|
||||
|
||||
init {
|
||||
|
@ -32,12 +32,12 @@ class SWScreen(val injector: HasAndroidInjector, private var header: Int) {
|
|||
return this
|
||||
}
|
||||
|
||||
fun validator(validator: SWValidator): SWScreen {
|
||||
fun validator(validator: () -> Boolean): SWScreen {
|
||||
this.validator = validator
|
||||
return this
|
||||
}
|
||||
|
||||
fun visibility(visibility: SWValidator): SWScreen {
|
||||
fun visibility(visibility: () -> Boolean): SWScreen {
|
||||
this.visibility = visibility
|
||||
return this
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard
|
||||
package app.aaps.configuration.setupwizard
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
|
@ -9,11 +9,11 @@ import android.view.View
|
|||
import android.widget.TextView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.core.view.MenuProvider
|
||||
import app.aaps.configuration.R
|
||||
import app.aaps.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import app.aaps.configuration.databinding.ActivitySetupwizardBinding
|
||||
import app.aaps.configuration.setupwizard.elements.SWItem
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.R
|
||||
import info.nightscout.configuration.activities.DaggerAppCompatActivityWithResult
|
||||
import info.nightscout.configuration.databinding.ActivitySetupwizardBinding
|
||||
import info.nightscout.configuration.setupwizard.elements.SWItem
|
||||
import info.nightscout.core.ui.dialogs.OKDialog
|
||||
import info.nightscout.core.ui.locale.LocaleHelper.update
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
|
@ -146,7 +146,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
override fun updateButtons() {
|
||||
runOnUiThread {
|
||||
val currentScreen = screens[currentWizardPage]
|
||||
if (currentScreen.validator == null || currentScreen.validator?.isValid == true || currentScreen.skippable) {
|
||||
if (currentScreen.validator == null || currentScreen.validator?.invoke() == true || currentScreen.skippable) {
|
||||
if (currentWizardPage == nextPage(null)) {
|
||||
findViewById<View>(R.id.finish_button).visibility = View.VISIBLE
|
||||
findViewById<View>(R.id.next_button).visibility = View.GONE
|
||||
|
@ -166,7 +166,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
@Suppress("UNUSED_PARAMETER")
|
||||
fun showNextPage(view: View?) {
|
||||
finish()
|
||||
val intent = Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
|
||||
val intent = Intent(this, SetupWizardActivity::class.java).setAction("app.aaps.configuration.setupwizard.SetupWizardActivity")
|
||||
intent.putExtra(intentMessage, nextPage(null))
|
||||
startActivity(intent)
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
@Suppress("UNUSED_PARAMETER")
|
||||
fun showPreviousPage(view: View?) {
|
||||
finish()
|
||||
val intent = Intent(this, SetupWizardActivity::class.java).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
|
||||
val intent = Intent(this, SetupWizardActivity::class.java).setAction("app.aaps.configuration.setupwizard.SetupWizardActivity")
|
||||
intent.putExtra(intentMessage, previousPage(null))
|
||||
startActivity(intent)
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
@Suppress("UNUSED_PARAMETER")
|
||||
fun finishSetupWizard(view: View?) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
val intent = Intent(this, uiInteraction.mainActivity).setAction("info.nightscout.configuration.setupwizard.SetupWizardActivity")
|
||||
val intent = Intent(this, uiInteraction.mainActivity).setAction("app.aaps.configuration.setupwizard.SetupWizardActivity")
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
|
@ -193,7 +193,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
private fun nextPage(view: View?): Int {
|
||||
var page = currentWizardPage + 1
|
||||
while (page < screens.size) {
|
||||
if (screens[page].visibility == null || screens[page].visibility?.isValid == true) return page
|
||||
if (screens[page].visibility == null || screens[page].visibility?.invoke() == true) return page
|
||||
page++
|
||||
}
|
||||
return min(currentWizardPage, screens.size - 1)
|
||||
|
@ -203,7 +203,7 @@ class SetupWizardActivity : DaggerAppCompatActivityWithResult() {
|
|||
private fun previousPage(view: View?): Int {
|
||||
var page = currentWizardPage - 1
|
||||
while (page >= 0) {
|
||||
if (screens[page].visibility == null || screens[page].visibility?.isValid == true) return page
|
||||
if (screens[page].visibility == null || screens[page].visibility?.invoke() == true) return page
|
||||
page--
|
||||
}
|
||||
return max(currentWizardPage, 0)
|
|
@ -1,16 +1,16 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWValidator
|
||||
|
||||
class SWBreak(injector: HasAndroidInjector) : SWItem(injector, Type.BREAK) {
|
||||
private var l: TextView? = null
|
||||
private var visibilityValidator: SWValidator? = null
|
||||
|
||||
fun visibility(visibilityValidator: SWValidator): SWBreak {
|
||||
private var l: TextView? = null
|
||||
private var visibilityValidator: (() -> Boolean)? = null
|
||||
|
||||
fun visibility(visibilityValidator: () -> Boolean): SWBreak {
|
||||
this.visibilityValidator = visibilityValidator
|
||||
return this
|
||||
}
|
||||
|
@ -24,8 +24,7 @@ class SWBreak(injector: HasAndroidInjector) : SWItem(injector, Type.BREAK) {
|
|||
}
|
||||
|
||||
override fun processVisibility() {
|
||||
if (visibilityValidator != null && !visibilityValidator!!.isValid)
|
||||
l?.visibility = View.GONE
|
||||
if (visibilityValidator?.invoke() == false) l?.visibility = View.GONE
|
||||
else l?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.LinearLayout
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWValidator
|
||||
|
||||
class SWButton(injector: HasAndroidInjector) : SWItem(injector, Type.BUTTON) {
|
||||
|
||||
private var buttonRunnable: Runnable? = null
|
||||
private var buttonText = 0
|
||||
private var buttonValidator: SWValidator? = null
|
||||
private var buttonValidator: (() -> Boolean)? = { false }
|
||||
private var button: Button? = null
|
||||
|
||||
fun text(buttonText: Int): SWButton {
|
||||
|
@ -22,7 +22,7 @@ class SWButton(injector: HasAndroidInjector) : SWItem(injector, Type.BUTTON) {
|
|||
return this
|
||||
}
|
||||
|
||||
fun visibility(buttonValidator: SWValidator): SWButton {
|
||||
fun visibility(buttonValidator: () -> Boolean): SWButton {
|
||||
this.buttonValidator = buttonValidator
|
||||
return this
|
||||
}
|
||||
|
@ -38,8 +38,7 @@ class SWButton(injector: HasAndroidInjector) : SWItem(injector, Type.BUTTON) {
|
|||
}
|
||||
|
||||
override fun processVisibility() {
|
||||
if (buttonValidator != null && !buttonValidator!!.isValid)
|
||||
button!!.visibility = View.GONE
|
||||
else button!!.visibility = View.VISIBLE
|
||||
if (buttonValidator?.invoke() == false) button?.visibility = View.GONE
|
||||
else button?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -10,14 +10,12 @@ import android.widget.EditText
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWTextValidator
|
||||
import info.nightscout.core.utils.CryptoUtil
|
||||
import info.nightscout.shared.extensions.toVisibility
|
||||
|
||||
class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUtil: CryptoUtil) : SWItem(injector, Type.STRING) {
|
||||
|
||||
private var validator: SWTextValidator =
|
||||
SWTextValidator(String::isNotEmpty)
|
||||
private var validator: (String) -> Boolean = String::isNotEmpty
|
||||
private var updateDelay = 0L
|
||||
private var button: Button? = null
|
||||
private var editText: EditText? = null
|
||||
|
@ -92,7 +90,7 @@ class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUt
|
|||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
sp.remove(preferenceId)
|
||||
scheduleChange(updateDelay)
|
||||
if (validator.isValid(editText?.text.toString()) && validator.isValid(editText2?.text.toString()) && editText?.text.toString() == editText2?.text.toString())
|
||||
if (validator.invoke(editText?.text.toString()) && validator.invoke(editText2?.text.toString()) && editText?.text.toString() == editText2?.text.toString())
|
||||
save(s.toString(), updateDelay)
|
||||
}
|
||||
|
||||
|
@ -107,7 +105,7 @@ class SWEditEncryptedPassword(injector: HasAndroidInjector, private val cryptoUt
|
|||
return this
|
||||
}
|
||||
|
||||
fun validator(validator: SWTextValidator): SWEditEncryptedPassword {
|
||||
fun validator(validator: (String) -> Boolean): SWEditEncryptedPassword {
|
||||
this.validator = validator
|
||||
return this
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -7,15 +7,13 @@ import android.view.View
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWIntNumberValidator
|
||||
import info.nightscout.core.ui.elements.NumberPicker
|
||||
import info.nightscout.shared.SafeParse
|
||||
import java.text.DecimalFormat
|
||||
|
||||
class SWEditIntNumber(injector: HasAndroidInjector, private val init: Int, private val min: Int, private val max: Int) : SWItem(injector, Type.NUMBER) {
|
||||
|
||||
private val validator: SWIntNumberValidator =
|
||||
SWIntNumberValidator { value -> value in min..max }
|
||||
private val validator: (Int) -> Boolean = { value -> value in min..max }
|
||||
private var updateDelay = 0
|
||||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
||||
|
@ -23,7 +21,7 @@ class SWEditIntNumber(injector: HasAndroidInjector, private val init: Int, priva
|
|||
val watcher: TextWatcher = object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
if (validator.isValid(SafeParse.stringToInt(s.toString())))
|
||||
if (validator.invoke(SafeParse.stringToInt(s.toString())))
|
||||
save(s.toString(), updateDelay.toLong())
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -7,15 +7,13 @@ import android.view.View
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWNumberValidator
|
||||
import info.nightscout.core.ui.elements.NumberPicker
|
||||
import info.nightscout.shared.SafeParse
|
||||
import java.text.DecimalFormat
|
||||
|
||||
class SWEditNumber(injector: HasAndroidInjector, private val init: Double, private val min: Double, private val max: Double) : SWItem(injector, Type.DECIMAL_NUMBER) {
|
||||
|
||||
private val validator: SWNumberValidator =
|
||||
SWNumberValidator { value -> value in min..max }
|
||||
private val validator: (Double) -> Boolean = { value -> value in min..max }
|
||||
private var updateDelay = 0
|
||||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
||||
|
@ -23,7 +21,7 @@ class SWEditNumber(injector: HasAndroidInjector, private val init: Double, priva
|
|||
val watcher: TextWatcher = object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
if (validator.isValid(SafeParse.stringToDouble(s.toString())))
|
||||
if (validator.invoke(SafeParse.stringToDouble(s.toString())))
|
||||
save(s.toString(), updateDelay.toLong())
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -7,7 +7,6 @@ import android.view.View
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWNumberValidator
|
||||
import info.nightscout.core.ui.elements.NumberPicker
|
||||
import info.nightscout.interfaces.Constants
|
||||
import info.nightscout.interfaces.GlucoseUnit
|
||||
|
@ -20,11 +19,9 @@ class SWEditNumberWithUnits(injector: HasAndroidInjector, private val init: Doub
|
|||
|
||||
@Inject lateinit var profileUtil: ProfileUtil
|
||||
|
||||
private val validator: SWNumberValidator =
|
||||
if (profileUtil.units == GlucoseUnit.MMOL)
|
||||
SWNumberValidator { value -> value in minMmol..maxMmol }
|
||||
else
|
||||
SWNumberValidator { value -> value in minMmol * Constants.MMOLL_TO_MGDL..maxMmol * Constants.MMOLL_TO_MGDL }
|
||||
private val validator: (Double) -> Boolean =
|
||||
if (profileUtil.units == GlucoseUnit.MMOL) { value -> value in minMmol..maxMmol }
|
||||
else { value -> value in minMmol * Constants.MMOLL_TO_MGDL..maxMmol * Constants.MMOLL_TO_MGDL }
|
||||
private var updateDelay = 0
|
||||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
||||
|
@ -32,7 +29,7 @@ class SWEditNumberWithUnits(injector: HasAndroidInjector, private val init: Doub
|
|||
val watcher: TextWatcher = object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
if (validator.isValid(SafeParse.stringToDouble(s.toString())))
|
||||
if (validator.invoke(SafeParse.stringToDouble(s.toString())))
|
||||
save(s.toString(), updateDelay.toLong())
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -9,11 +9,10 @@ import android.widget.EditText
|
|||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWTextValidator
|
||||
|
||||
class SWEditString(injector: HasAndroidInjector) : SWItem(injector, Type.STRING) {
|
||||
|
||||
private var validator: SWTextValidator? = null
|
||||
private var validator: ((string: String) -> Boolean)? = null
|
||||
private var updateDelay = 0L
|
||||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
||||
|
@ -38,7 +37,7 @@ class SWEditString(injector: HasAndroidInjector) : SWItem(injector, Type.STRING)
|
|||
editText.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
if (validator != null && validator!!.isValid(s.toString())) save(s.toString(), updateDelay)
|
||||
if (validator?.invoke(s.toString()) == true) save(s.toString(), updateDelay)
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable) {}
|
||||
|
@ -50,7 +49,7 @@ class SWEditString(injector: HasAndroidInjector) : SWItem(injector, Type.STRING)
|
|||
return this
|
||||
}
|
||||
|
||||
fun validator(validator: SWTextValidator): SWEditString {
|
||||
fun validator(validator: (string: String) -> Boolean): SWEditString {
|
||||
this.validator = validator
|
||||
return this
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.graphics.Typeface
|
||||
import android.text.Editable
|
||||
|
@ -9,10 +9,11 @@ import android.view.View
|
|||
import android.widget.EditText
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import app.aaps.configuration.setupwizard.events.EventSWLabel
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.events.EventSWLabel
|
||||
|
||||
class SWEditUrl(injector: HasAndroidInjector) : SWItem(injector, Type.URL) {
|
||||
|
||||
private var updateDelay = 0L
|
||||
|
||||
override fun generateDialog(layout: LinearLayout) {
|
|
@ -1,11 +1,12 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import app.aaps.configuration.setupwizard.SWDefinition
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWDefinition
|
||||
|
||||
class SWFragment(injector:HasAndroidInjector, private var definition: SWDefinition) : SWItem(injector, Type.FRAGMENT) {
|
||||
class SWFragment(injector: HasAndroidInjector, private var definition: SWDefinition) : SWItem(injector, Type.FRAGMENT) {
|
||||
|
||||
lateinit var fragment: Fragment
|
||||
|
||||
fun add(fragment: Fragment): SWFragment {
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.text.util.Linkify
|
||||
import android.view.View
|
||||
|
@ -6,13 +6,12 @@ import android.widget.LinearLayout
|
|||
import android.widget.TextView
|
||||
import androidx.annotation.StringRes
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWValidator
|
||||
|
||||
class SWHtmlLink(injector: HasAndroidInjector) : SWItem(injector, Type.HTML_LINK) {
|
||||
|
||||
private var textLabel: String? = null
|
||||
private var l: TextView? = null
|
||||
private var visibilityValidator: SWValidator? = null
|
||||
private var visibilityValidator: (() -> Boolean)? = null
|
||||
|
||||
override fun label(@StringRes label: Int): SWHtmlLink {
|
||||
this.label = label
|
||||
|
@ -24,7 +23,7 @@ class SWHtmlLink(injector: HasAndroidInjector) : SWItem(injector, Type.HTML_LINK
|
|||
return this
|
||||
}
|
||||
|
||||
fun visibility(visibilityValidator: SWValidator): SWHtmlLink {
|
||||
fun visibility(visibilityValidator: () -> Boolean): SWHtmlLink {
|
||||
this.visibilityValidator = visibilityValidator
|
||||
return this
|
||||
}
|
||||
|
@ -39,6 +38,6 @@ class SWHtmlLink(injector: HasAndroidInjector) : SWItem(injector, Type.HTML_LINK
|
|||
}
|
||||
|
||||
override fun processVisibility() {
|
||||
if (visibilityValidator != null && !visibilityValidator!!.isValid) l?.visibility = View.GONE else l?.visibility = View.VISIBLE
|
||||
if (visibilityValidator?.invoke() == false) l?.visibility = View.GONE else l?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.view.View
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWValidator
|
||||
|
||||
class SWInfoText(injector: HasAndroidInjector) : SWItem(injector, Type.TEXT) {
|
||||
|
||||
private var textLabel: String? = null
|
||||
private var l: TextView? = null
|
||||
private var visibilityValidator: SWValidator? = null
|
||||
private var visibilityValidator: (() -> Boolean)? = null
|
||||
|
||||
override fun label(label: Int): SWInfoText {
|
||||
this.label = label
|
||||
|
@ -21,7 +21,7 @@ class SWInfoText(injector: HasAndroidInjector) : SWItem(injector, Type.TEXT) {
|
|||
return this
|
||||
}
|
||||
|
||||
fun visibility(visibilityValidator: SWValidator): SWInfoText {
|
||||
fun visibility(visibilityValidator: () -> Boolean): SWInfoText {
|
||||
this.visibilityValidator = visibilityValidator
|
||||
return this
|
||||
}
|
||||
|
@ -35,6 +35,6 @@ class SWInfoText(injector: HasAndroidInjector) : SWItem(injector, Type.TEXT) {
|
|||
}
|
||||
|
||||
override fun processVisibility() {
|
||||
if (visibilityValidator != null && !visibilityValidator!!.isValid) l?.visibility = View.GONE else l?.visibility = View.VISIBLE
|
||||
if (visibilityValidator?.invoke() == false) l?.visibility = View.GONE else l?.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.content.Context
|
||||
import android.content.ContextWrapper
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.StringRes
|
||||
import app.aaps.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import app.aaps.configuration.setupwizard.SWDefinition
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.configBuilder.events.EventConfigBuilderUpdateGui
|
||||
import info.nightscout.configuration.setupwizard.SWDefinition
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
import info.nightscout.interfaces.ConfigBuilder
|
||||
import info.nightscout.interfaces.plugin.ActivePlugin
|
|
@ -1,10 +1,10 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.LinearLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import app.aaps.configuration.setupwizard.SWDefinition
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.setupwizard.SWDefinition
|
||||
import info.nightscout.interfaces.ui.UiInteraction
|
||||
import javax.inject.Inject
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.elements
|
||||
package app.aaps.configuration.setupwizard.elements
|
||||
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -9,6 +9,7 @@ import android.widget.TextView
|
|||
import dagger.android.HasAndroidInjector
|
||||
|
||||
class SWRadioButton(injector: HasAndroidInjector) : SWItem(injector, Type.RADIOBUTTON) {
|
||||
|
||||
private var labelsArray = 0
|
||||
private var valuesArray = 0
|
||||
private var radioGroup: RadioGroup? = null
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.setupwizard.events
|
||||
package app.aaps.configuration.setupwizard.events
|
||||
|
||||
import info.nightscout.rx.events.Event
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.configuration.maintenance.activities.LogSettingActivity">
|
||||
tools:context=".maintenance.activities.LogSettingActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -13,11 +13,11 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/spacer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" />
|
||||
android:id="@+id/spacer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/placeholder"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.configuration.setupwizard.SetupWizardActivity">
|
||||
tools:context=".setupwizard.SetupWizardActivity">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sw_content"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.configuration.maintenance.activities.CustomWatchfaceImportListActivity">
|
||||
tools:context=".maintenance.activities.CustomWatchfaceImportListActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<androidx.core.widget.NestedScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="2dp"
|
||||
tools:context="info.nightscout.configuration.maintenance.MaintenanceFragment">
|
||||
tools:context=".maintenance.MaintenanceFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
tools:context="info.nightscout.configuration.maintenance.activities.PrefImportListActivity">
|
||||
tools:context=".maintenance.activities.PrefImportListActivity">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerview"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
package info.nightscout.configuration.maintenance.formats
|
||||
package app.aaps.configuration.maintenance.formats
|
||||
|
||||
import app.aaps.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import app.aaps.configuration.maintenance.data.PrefFormatError
|
||||
import app.aaps.configuration.maintenance.data.Prefs
|
||||
import app.aaps.configuration.maintenance.data.PrefsFormat
|
||||
import app.aaps.configuration.maintenance.data.PrefsStatusImpl
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.TruthJUnit.assume
|
||||
import info.nightscout.configuration.maintenance.PrefsMetadataKeyImpl
|
||||
import info.nightscout.core.utils.CryptoUtil
|
||||
import info.nightscout.interfaces.maintenance.PrefFormatError
|
||||
import info.nightscout.interfaces.maintenance.PrefMetadata
|
||||
import info.nightscout.interfaces.maintenance.Prefs
|
||||
import info.nightscout.interfaces.maintenance.PrefsFormat
|
||||
import info.nightscout.interfaces.maintenance.PrefsStatusImpl
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.configuration.maintenance.formats
|
||||
package app.aaps.configuration.maintenance.formats
|
||||
|
||||
import info.nightscout.interfaces.storage.Storage
|
||||
import java.io.File
|
Loading…
Reference in a new issue