diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml index ab50e950d1..837f323a78 100644 --- a/wear/src/main/AndroidManifest.xml +++ b/wear/src/main/AndroidManifest.xml @@ -602,6 +602,10 @@ android:name=".interaction.menus.StatusMenuActivity" android:exported="true" android:label="@string/menu_status" /> + startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) + getString(R.string.menu_settings) -> startActivity(Intent(this, PreferenceMenuActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) getString(R.string.menu_resync) -> rxBus.send(EventWearToMobile(ActionResendData("Re-Sync"))) getString(R.string.status_profile_switch) -> rxBus.send(EventWearToMobile(EventData.ActionProfileSwitchSendInitialData(System.currentTimeMillis()))) getString(R.string.menu_tempt) -> startActivity(Intent(this, TempTargetActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) diff --git a/wear/src/main/java/info/nightscout/androidaps/interaction/menus/PreferenceMenuActivity.kt b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/PreferenceMenuActivity.kt new file mode 100644 index 0000000000..c0e19ad06f --- /dev/null +++ b/wear/src/main/java/info/nightscout/androidaps/interaction/menus/PreferenceMenuActivity.kt @@ -0,0 +1,49 @@ +package info.nightscout.androidaps.interaction.menus + +import android.content.Intent +import android.os.Bundle +import info.nightscout.androidaps.R +import info.nightscout.androidaps.interaction.WatchfaceConfigurationActivity +import info.nightscout.androidaps.interaction.utils.MenuListActivity + +class PreferenceMenuActivity : MenuListActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + setTitle(R.string.menu_settings) + super.onCreate(savedInstanceState) + } + + override fun provideElements(): List = + ArrayList().apply { + add(MenuItem(R.drawable.ic_settings, getString(R.string.pref_display_settings))) + add(MenuItem(R.drawable.ic_settings, getString(R.string.pref_graph_settings))) + add(MenuItem(R.drawable.ic_settings, getString(R.string.pref_interface_settings))) + add(MenuItem(R.drawable.ic_settings, getString(R.string.pref_complication_settings))) + add(MenuItem(R.drawable.ic_settings, getString(R.string.pref_others_settings))) + } + + override fun doAction(position: String) { + when (position) { + getString(R.string.pref_display_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(getString(R.string.key_preference_id), R.xml.display_preferences) + }) + getString(R.string.pref_graph_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(getString(R.string.key_preference_id), R.xml.graph_preferences) + }) + getString(R.string.pref_interface_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(getString(R.string.key_preference_id), R.xml.interface_preferences) + }) + getString(R.string.pref_complication_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(getString(R.string.key_preference_id), R.xml.complication_preferences) + }) + getString(R.string.pref_others_settings) -> startActivity(Intent(this, WatchfaceConfigurationActivity::class.java).apply { + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + putExtra(getString(R.string.key_preference_id), R.xml.others_preferences) + }) + } + } +} diff --git a/wear/src/main/res/values/strings.xml b/wear/src/main/res/values/strings.xml index 02d4feb90a..81b770c83f 100644 --- a/wear/src/main/res/values/strings.xml +++ b/wear/src/main/res/values/strings.xml @@ -24,6 +24,11 @@ Vibrate on Bolus Units for Actions U + Display + Graph + Interface + Others + Complication Show Date Show IOB Show detailed IOB @@ -175,6 +180,7 @@ No config available Wear controls disabled No data available + preference_id QuickWizard wearcontrol units_mgdl diff --git a/wear/src/main/res/xml/complication_preferences.xml b/wear/src/main/res/xml/complication_preferences.xml new file mode 100644 index 0000000000..c69586c648 --- /dev/null +++ b/wear/src/main/res/xml/complication_preferences.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/wear/src/main/res/xml/preferences.xml b/wear/src/main/res/xml/display_preferences.xml similarity index 53% rename from wear/src/main/res/xml/preferences.xml rename to wear/src/main/res/xml/display_preferences.xml index cd6bfbb80b..608b3cc8bb 100644 --- a/wear/src/main/res/xml/preferences.xml +++ b/wear/src/main/res/xml/display_preferences.xml @@ -110,101 +110,6 @@ app:wear_iconOff="@drawable/settings_off" app:wear_iconOn="@drawable/settings_on" /> - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/wear/src/main/res/xml/graph_preferences.xml b/wear/src/main/res/xml/graph_preferences.xml new file mode 100644 index 0000000000..2ea1779240 --- /dev/null +++ b/wear/src/main/res/xml/graph_preferences.xml @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/wear/src/main/res/xml/interface_preferences.xml b/wear/src/main/res/xml/interface_preferences.xml new file mode 100644 index 0000000000..b2bdc24964 --- /dev/null +++ b/wear/src/main/res/xml/interface_preferences.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + diff --git a/wear/src/main/res/xml/others_preferences.xml b/wear/src/main/res/xml/others_preferences.xml new file mode 100644 index 0000000000..381cb5fd10 --- /dev/null +++ b/wear/src/main/res/xml/others_preferences.xml @@ -0,0 +1,20 @@ + + + + + + +