SingleFragmentActivity -> ui

This commit is contained in:
Milos Kozak 2022-11-23 21:14:49 +01:00
parent a451c64a84
commit 7f90807033
14 changed files with 27 additions and 21 deletions

View file

@ -176,10 +176,6 @@
<service android:name=".plugins.general.persistentNotification.DummyService" /> <service android:name=".plugins.general.persistentNotification.DummyService" />
<activity
android:name=".activities.SingleFragmentActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<activity <activity
android:name=".plugins.general.maintenance.activities.LogSettingActivity" android:name=".plugins.general.maintenance.activities.LogSettingActivity"
android:exported="false" /> android:exported="false" />

View file

@ -32,13 +32,12 @@ import com.joanzapata.iconify.Iconify
import com.joanzapata.iconify.fonts.FontAwesomeModule import com.joanzapata.iconify.fonts.FontAwesomeModule
import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.databinding.ActivityMainBinding import info.nightscout.androidaps.databinding.ActivityMainBinding
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.configuration.setupwizard.SetupWizardActivity import info.nightscout.configuration.setupwizard.SetupWizardActivity
import info.nightscout.core.activities.NoSplashAppCompatActivity import info.nightscout.core.activities.NoSplashAppCompatActivity
import info.nightscout.core.ui.UIRunnable import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.ui.dialogs.OKDialog import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.locale.LocaleHelper
import info.nightscout.core.ui.toast.ToastUtils import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.utils.CryptoUtil import info.nightscout.core.utils.CryptoUtil
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
@ -50,7 +49,7 @@ import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config import info.nightscout.interfaces.Config
import info.nightscout.interfaces.aps.Loop import info.nightscout.interfaces.aps.Loop
import info.nightscout.interfaces.constraints.Constraints import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.maintenance.PrefFileListProvider import info.nightscout.interfaces.maintenance.PrefFileListProvider
import info.nightscout.interfaces.plugin.ActivePlugin import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
@ -68,6 +67,7 @@ import info.nightscout.rx.events.EventRebuildTabs
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.ui.activities.ProfileHelperActivity import info.nightscout.ui.activities.ProfileHelperActivity
import info.nightscout.ui.activities.SingleFragmentActivity
import info.nightscout.ui.activities.StatsActivity import info.nightscout.ui.activities.StatsActivity
import info.nightscout.ui.activities.TreatmentsActivity import info.nightscout.ui.activities.TreatmentsActivity
import info.nightscout.ui.tabs.TabPageAdapter import info.nightscout.ui.tabs.TabPageAdapter

View file

@ -5,9 +5,9 @@ import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity
import info.nightscout.ui.activities.SingleFragmentActivity
@Module @Module
@Suppress("unused") @Suppress("unused")

View file

@ -9,11 +9,12 @@ import androidx.fragment.app.FragmentManager
import info.nightscout.androidaps.MainActivity import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.activities.HistoryBrowseActivity import info.nightscout.androidaps.activities.HistoryBrowseActivity
import info.nightscout.androidaps.activities.MyPreferenceFragment import info.nightscout.androidaps.activities.MyPreferenceFragment
import info.nightscout.androidaps.activities.SingleFragmentActivity import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.interfaces.ui.ActivityNames import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.ui.activities.BolusProgressHelperActivity import info.nightscout.ui.activities.BolusProgressHelperActivity
import info.nightscout.ui.activities.ErrorHelperActivity import info.nightscout.ui.activities.ErrorHelperActivity
import info.nightscout.ui.activities.SingleFragmentActivity
import info.nightscout.ui.activities.TDDStatsActivity import info.nightscout.ui.activities.TDDStatsActivity
import info.nightscout.ui.dialogs.BolusProgressDialog import info.nightscout.ui.dialogs.BolusProgressDialog
import info.nightscout.ui.dialogs.CareDialog import info.nightscout.ui.dialogs.CareDialog
@ -34,6 +35,7 @@ class ActivityNamesImpl @Inject constructor() : ActivityNames {
override val errorHelperActivity: Class<*> = ErrorHelperActivity::class.java override val errorHelperActivity: Class<*> = ErrorHelperActivity::class.java
override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java override val bolusProgressHelperActivity: Class<*> = BolusProgressHelperActivity::class.java
override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java override val singleFragmentActivity: Class<*> = SingleFragmentActivity::class.java
override val preferencesActivity: Class<*> = PreferencesActivity::class.java
override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java override val myPreferenceFragment: Class<*> = MyPreferenceFragment::class.java
override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) { override fun runAlarm(ctx: Context, status: String, title: String, @RawRes soundId: Int) {

View file

@ -17,7 +17,6 @@ import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.PreferencesActivity import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.databinding.ConfigbuilderFragmentBinding import info.nightscout.androidaps.databinding.ConfigbuilderFragmentBinding
import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui import info.nightscout.androidaps.plugins.configBuilder.events.EventConfigBuilderUpdateGui
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
@ -32,6 +31,7 @@ import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventRebuildTabs import info.nightscout.rx.events.EventRebuildTabs
import info.nightscout.shared.extensions.toVisibility import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.ui.activities.SingleFragmentActivity
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign
import javax.inject.Inject import javax.inject.Inject

View file

@ -8,12 +8,10 @@ import android.view.ViewGroup
import androidx.core.text.toSpanned import androidx.core.text.toSpanned
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.SingleFragmentActivity
import info.nightscout.androidaps.dana.database.DanaHistoryDatabase import info.nightscout.androidaps.dana.database.DanaHistoryDatabase
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
import info.nightscout.androidaps.diaconn.database.DiaconnHistoryDatabase import info.nightscout.androidaps.diaconn.database.DiaconnHistoryDatabase
import info.nightscout.androidaps.insight.database.InsightDatabase import info.nightscout.androidaps.insight.database.InsightDatabase
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity import info.nightscout.androidaps.plugins.general.maintenance.activities.LogSettingActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase import info.nightscout.androidaps.plugins.pump.omnipod.eros.history.database.ErosHistoryDatabase
@ -24,6 +22,7 @@ import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.logging.UserEntryLogger
import info.nightscout.interfaces.maintenance.ImportExportPrefs import info.nightscout.interfaces.maintenance.ImportExportPrefs
import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.protection.ProtectionCheck.Protection.PREFERENCES import info.nightscout.interfaces.protection.ProtectionCheck.Protection.PREFERENCES
@ -37,6 +36,7 @@ import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.logging.LTag import info.nightscout.rx.logging.LTag
import info.nightscout.shared.extensions.toVisibility import info.nightscout.shared.extensions.toVisibility
import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.ui.activities.SingleFragmentActivity
import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign import io.reactivex.rxjava3.kotlin.plusAssign

View file

@ -193,7 +193,6 @@
<string name="wear_general_settings">General Settings</string> <string name="wear_general_settings">General Settings</string>
<string name="open_navigation">Open navigation</string> <string name="open_navigation">Open navigation</string>
<string name="close_navigation">Close navigation</string> <string name="close_navigation">Close navigation</string>
<string name="nav_plugin_preferences">Plugin preferences</string>
<string name="key_keep_screen_on" translatable="false">keep_screen_on</string> <string name="key_keep_screen_on" translatable="false">keep_screen_on</string>
<string name="remove_items">Remove items</string> <string name="remove_items">Remove items</string>
<string name="sort_items">Sort items</string> <string name="sort_items">Sort items</string>

View file

@ -17,6 +17,7 @@ interface ActivityNames {
val errorHelperActivity: Class<*> val errorHelperActivity: Class<*>
val bolusProgressHelperActivity: Class<*> val bolusProgressHelperActivity: Class<*>
val singleFragmentActivity: Class<*> val singleFragmentActivity: Class<*>
val preferencesActivity: Class<*>
val myPreferenceFragment: Class<*> val myPreferenceFragment: Class<*>
/** /**

View file

@ -44,11 +44,15 @@
android:exported="false" android:exported="false"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="info.nightscout.ui.activities.TreatmentsActivity" android:name=".activities.TreatmentsActivity"
android:exported="false" android:exported="false"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />
<activity <activity
android:name="info.nightscout.ui.activities.ProfileHelperActivity" android:name=".activities.ProfileHelperActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<activity
android:name=".activities.SingleFragmentActivity"
android:exported="false" android:exported="false"
android:theme="@style/AppTheme" /> android:theme="@style/AppTheme" />

View file

@ -1,29 +1,31 @@
package info.nightscout.androidaps.activities package info.nightscout.ui.activities
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import info.nightscout.androidaps.R
import info.nightscout.core.activities.DaggerAppCompatActivityWithResult import info.nightscout.core.activities.DaggerAppCompatActivityWithResult
import info.nightscout.core.ui.locale.LocaleHelper import info.nightscout.core.ui.locale.LocaleHelper
import info.nightscout.implementation.plugin.PluginStore import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.plugin.PluginBase import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.protection.ProtectionCheck import info.nightscout.interfaces.protection.ProtectionCheck
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.ui.R
import javax.inject.Inject import javax.inject.Inject
class SingleFragmentActivity : DaggerAppCompatActivityWithResult() { class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
@Inject lateinit var pluginStore: PluginStore @Inject lateinit var activePlugin: ActivePlugin
@Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var activityNames: ActivityNames
private var plugin: PluginBase? = null private var plugin: PluginBase? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_single_fragment) setContentView(R.layout.activity_single_fragment)
plugin = pluginStore.plugins[intent.getIntExtra("plugin", -1)] plugin = activePlugin.getPluginsList()[intent.getIntExtra("plugin", -1)]
title = plugin?.name title = plugin?.name
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true)
@ -44,7 +46,7 @@ class SingleFragmentActivity : DaggerAppCompatActivityWithResult() {
R.id.nav_plugin_preferences -> { R.id.nav_plugin_preferences -> {
protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, { protectionCheck.queryProtection(this, ProtectionCheck.Protection.PREFERENCES, {
val i = Intent(this, PreferencesActivity::class.java) val i = Intent(this, activityNames.preferencesActivity)
i.putExtra("id", plugin?.preferencesId) i.putExtra("id", plugin?.preferencesId)
startActivity(i) startActivity(i)
}, null) }, null)

View file

@ -165,4 +165,6 @@
<string name="check_preferences_cannot_import">Preferences cannot be imported!</string> <string name="check_preferences_cannot_import">Preferences cannot be imported!</string>
<string name="check_preferences_dangerous_import">Preferences should not be imported!</string> <string name="check_preferences_dangerous_import">Preferences should not be imported!</string>
<!-- Preferences -->
<string name="nav_plugin_preferences">Plugin preferences</string>
</resources> </resources>