ThemeSwitcherPlugin -> plugins module

This commit is contained in:
Milos Kozak 2022-11-04 17:14:43 +01:00
parent 139e788e6e
commit 683f87cd15
7 changed files with 89 additions and 84 deletions

View file

@ -34,7 +34,7 @@ import info.nightscout.androidaps.plugins.configBuilder.PluginStore
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtils
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore import info.nightscout.androidaps.plugins.general.overview.notifications.NotificationStore
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
import info.nightscout.androidaps.receivers.BTReceiver import info.nightscout.androidaps.receivers.BTReceiver
import info.nightscout.androidaps.receivers.ChargingStateReceiver import info.nightscout.androidaps.receivers.ChargingStateReceiver
import info.nightscout.androidaps.receivers.KeepAliveWorker import info.nightscout.androidaps.receivers.KeepAliveWorker

View file

@ -31,7 +31,7 @@ import info.nightscout.androidaps.plugins.general.maintenance.MaintenancePlugin
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin
import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin
import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin import info.nightscout.androidaps.plugins.general.persistentNotification.PersistentNotificationPlugin
import info.nightscout.androidaps.plugins.general.themes.ThemeSwitcherPlugin import info.nightscout.plugins.general.themes.ThemeSwitcherPlugin
import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin import info.nightscout.androidaps.plugins.general.tidepool.TidepoolPlugin
import info.nightscout.androidaps.plugins.general.wear.WearPlugin import info.nightscout.androidaps.plugins.general.wear.WearPlugin
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorPlugin

View file

@ -151,16 +151,4 @@
<item>4</item> <item>4</item>
</string-array> </string-array>
<string-array name="darkMode">
<item>@string/dark_theme</item>
<item>@string/light_theme</item>
<item>@string/follow_system_theme</item>
</string-array>
<string-array name="darkModeValues">
<item>@string/value_dark_theme</item>
<item>@string/value_light_theme</item>
<item>@string/value_system_theme</item>
</string-array>
</resources> </resources>

View file

@ -921,15 +921,6 @@
<string name="a11y_clone_profile">clone current profile</string> <string name="a11y_clone_profile">clone current profile</string>
<string name="a11y_delete_current_profile">delete current profile</string> <string name="a11y_delete_current_profile">delete current profile</string>
<string name="a11y_add_new_to_list">add new to list</string> <string name="a11y_add_new_to_list">add new to list</string>
<!-- Theme switcher dark and light mode-->
<string name="theme_switcher_summary">Choose dark, light, or to follow the system theme</string>
<string name="app_color_scheme">App Color Scheme</string>
<string name="dark_theme">Dark theme</string>
<string name="light_theme">Light theme</string>
<string name="follow_system_theme">Use device theme</string>
<string name="value_dark_theme" translatable="false">dark</string>
<string name="value_light_theme" translatable="false">light</string>
<string name="value_system_theme" translatable="false">system</string>
<!-- WEAR OS--> <!-- WEAR OS-->
<string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string> <string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string>
<string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string> <string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string>

View file

@ -1,19 +1,19 @@
package info.nightscout.androidaps.plugins.general.themes package info.nightscout.plugins.general.themes
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventPreferenceChange import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.events.EventThemeSwitch import info.nightscout.androidaps.events.EventThemeSwitch
import info.nightscout.androidaps.interfaces.PluginBase import info.nightscout.androidaps.interfaces.PluginBase
import info.nightscout.androidaps.interfaces.PluginDescription import info.nightscout.androidaps.interfaces.PluginDescription
import info.nightscout.androidaps.interfaces.PluginType import info.nightscout.androidaps.interfaces.PluginType
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.plugins.R
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.sharedPreferences.SP import info.nightscout.shared.sharedPreferences.SP
import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.disposables.CompositeDisposable
import javax.inject.Inject import javax.inject.Inject
@ -31,7 +31,7 @@ class ThemeSwitcherPlugin @Inject constructor(
.neverVisible(true) .neverVisible(true)
.alwaysEnabled(true) .alwaysEnabled(true)
.showInList(false) .showInList(false)
.pluginName(R.string.dst_plugin_name), .pluginName(R.string.theme_switcher),
aapsLogger, rh, injector aapsLogger, rh, injector
) { ) {

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme switcher dark and light mode-->
<string-array name="darkMode">
<item>@string/dark_theme</item>
<item>@string/light_theme</item>
<item>@string/follow_system_theme</item>
</string-array>
<string-array name="darkModeValues">
<item>@string/value_dark_theme</item>
<item>@string/value_light_theme</item>
<item>@string/value_system_theme</item>
</string-array>
</resources>

View file

@ -157,5 +157,16 @@
<string name="shortenergy">En</string> <string name="shortenergy">En</string>
<string name="shortprotein">Pr</string> <string name="shortprotein">Pr</string>
<string name="shortfat">Fat</string> <string name="shortfat">Fat</string>
<string name="theme_switcher">Theme switcher</string>
<!-- Theme switcher dark and light mode-->
<string name="theme_switcher_summary">Choose dark, light, or to follow the system theme</string>
<string name="app_color_scheme">App Color Scheme</string>
<string name="dark_theme">Dark theme</string>
<string name="light_theme">Light theme</string>
<string name="follow_system_theme">Use device theme</string>
<string name="value_dark_theme" translatable="false">dark</string>
<string name="value_light_theme" translatable="false">light</string>
<string name="value_system_theme" translatable="false">system</string>
</resources> </resources>