Merge pull request #68 from rICTx-T1D/rICTx-T1D_Watchface_ConfigurationActivitiesForIndividuallyWatchfaceSettings

watchface  - configuration activities for individually watchface settings
This commit is contained in:
AdrianLxM 2020-11-29 17:55:39 +01:00 committed by GitHub
commit cfe308ebca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 351 additions and 121 deletions

View file

@ -30,6 +30,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_bigchart" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_bigchart" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -48,6 +51,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_nochart" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_nochart" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -66,6 +72,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_graph" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_home" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -76,7 +85,7 @@
<service
android:name=".watchfaces.Home2"
android:allowEmbedded="true"
android:label="AAPSv2"
android:label="@string/label_xdrip_v2"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
@ -84,6 +93,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_graph_2" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_home2" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -94,7 +106,7 @@
<service
android:name=".watchfaces.Cockpit"
android:allowEmbedded="true"
android:label="AAPS(Cockpit)"
android:label="@string/label_xdrip_cockpit"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
@ -102,6 +114,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_cockpit" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_cockpit" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -112,7 +127,7 @@
<service
android:name=".watchfaces.Steampunk"
android:allowEmbedded="true"
android:label="AAPS(Steampunk)"
android:label="@string/label_xdrip_steampunk"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
@ -120,6 +135,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_steampunk" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_steampunk" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -138,6 +156,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_dark" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_largehome" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -155,6 +176,9 @@
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_circle" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="watch_face_configuration_circle" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -175,7 +199,7 @@
android:resource="@drawable/watchface_digitalstyle" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyleConfigAct" />
android:value="watch_face_configuration_digitalstyle" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
@ -507,10 +531,19 @@
<activity
android:name=".interaction.actions.TempTargetActivity"
android:label="@string/menu_tempt" />
<activity android:name=".interaction.configurationActivities.DigitalStyleConfigAct">
<intent-filter>
<action android:name="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyleConfigAct" />
<activity android:name=".interaction.ConfigurationActivity">
<intent-filter>
<!-- action-name must be equal with name of xml-ressource where the configuration is describe -->
<action android:name="watch_face_configuration_bigchart" />
<action android:name="watch_face_configuration_circle" />
<action android:name="watch_face_configuration_cockpit" />
<action android:name="watch_face_configuration_digitalstyle" />
<action android:name="watch_face_configuration_home" />
<action android:name="watch_face_configuration_home2" />
<action android:name="watch_face_configuration_largehome" />
<action android:name="watch_face_configuration_nochart" />
<action android:name="watch_face_configuration_steampunk" />
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

View file

@ -1,19 +1,24 @@
package info.nightscout.androidaps.interaction.configurationActivities;
package info.nightscout.androidaps.interaction;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import info.nightscout.androidaps.R;
import preference.WearPreferenceActivity;
public class DigitalStyleConfigAct extends WearPreferenceActivity {
public class ConfigurationActivity extends WearPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle("watchface");
addPreferencesFromResource(R.xml.watch_face_digitalstyle_configuration);
setTitle("Watchface");
String configFileName=getIntent().getAction();
int resXmlId = getResources().getIdentifier(configFileName, "xml", getApplicationContext().getPackageName());
Log.d("ConfigurationActivity::onCreate --->> getIntent().getAction()",configFileName);
Log.d("ConfigurationActivity::onCreate --->> resXmlId",String.valueOf(resXmlId));
addPreferencesFromResource(resXmlId);
ViewGroup view = (ViewGroup) getWindow().getDecorView();
removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background));

View file

@ -0,0 +1,32 @@
package info.nightscout.androidaps.interaction.utils;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Toast;
import androidx.annotation.NonNull;
import preference.WearListPreference;
public class WatchfaceSettingsPreference extends WearListPreference {
private String pref_moreWatchfaceSettings,pref_lookInYourWatchfaceConfiguration;
public WatchfaceSettingsPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.pref_moreWatchfaceSettings =context.getResources().getString(context.getResources().getIdentifier("pref_moreWatchfaceSettings", "string", context.getApplicationContext().getPackageName()));
this.pref_lookInYourWatchfaceConfiguration=context.getResources().getString(context.getResources().getIdentifier("pref_lookInYourWatchfaceConfiguration", "string", context.getApplicationContext().getPackageName()));
entries = new CharSequence[]{pref_moreWatchfaceSettings};
entryValues = new CharSequence[]{""};
}
@Override public CharSequence getSummary(@NonNull final Context context) {
return "";
}
@Override
public void onPreferenceClick(@NonNull Context context) {
Toast.makeText(context, pref_lookInYourWatchfaceConfiguration, Toast.LENGTH_LONG).show();
}
}

View file

@ -67,6 +67,9 @@
<string name="pref_complication_tap_action">Complication Tap Action</string>
<string name="pref_unicode_in_complications">Unicode in Complications</string>
<string name="pref_version">Version:</string>
<string name="pref_moreWatchfaceSettings">more Watchface settings</string>
<string name="pref_lookInYourWatchfaceConfiguration">Look into Watchface configuration, please.</string>
<string name="menu_tempt">TempT</string>
<string name="menu_wizard">Wizard</string>

View file

@ -2,29 +2,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="vibrateOnBolus"
android:title="@string/pref_vibrate_on_bolus"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="units_mgdl"
android:title="@string/pref_units_for_actions"
android:summaryOn="mg/dl"
android:summaryOff="mmol/l"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="show_date"
android:title="@string/pref_show_date"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="show_iob"
@ -41,10 +18,18 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="showBG"
android:summary="Show BG."
android:title="@string/pref_show_bg"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="showDelta"
android:summary="Show delta. (Circle WF)"
android:summary="Show delta."
android:title="@string/pref_show_delta"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
@ -56,6 +41,21 @@
android:title="@string/pref_show_avgdelta"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="show_direction"
android:summary="Show direction arrow"
android:title="@string/pref_show_direction_arrow"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="showAgo"
android:summary="Minutes since last reading."
android:title="@string/pref_show_ago"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
@ -85,37 +85,7 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="showBG"
android:summary="Show BG. (Circle WF)"
android:title="@string/pref_show_bg"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="show_direction"
android:summary="Show direction arrow"
android:title="@string/pref_show_direction_arrow"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="showAgo"
android:summary="Minutes since last reading. (Circle WF)"
android:title="@string/pref_show_ago"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
@ -125,14 +95,6 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<ListPreference
android:defaultValue="3"
android:entries="@array/chart_timeframe"
@ -141,6 +103,17 @@
android:summary="Chart Timeframe"
android:title="@string/pref_chart_timeframe" />
<CheckBoxPreference
android:defaultValue="true"
android:key="units_mgdl"
android:title="@string/pref_units_for_actions"
android:summaryOn="mg/dl"
android:summaryOff="mmol/l"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<ListPreference
android:defaultValue="1"
android:entries="@array/input_design"
@ -149,46 +122,6 @@
android:summary="Input Design"
android:title="@string/pref_input_design" />
<ListPreference
android:defaultValue="2"
android:entries="@array/delta_granularity"
android:entryValues="@array/delta_granularity_values"
android:key="delta_granularity"
android:summary="Delta Granularity (Steampunk)"
android:title="@string/pref_delta_granularity" />
<CheckBoxPreference
android:defaultValue="false"
android:key="showBigNumbers"
android:summary="Big numbers. (Circle WF)"
android:title="@string/pref_big_numbers"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="showRingHistory"
android:summary="Graphical history. (Circle WF)"
android:title="@string/pref_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="softRingHistory"
android:summary="Less eyecandy. (Circle WF)"
android:title="@string/pref_light_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="animation"
android:summary="Animations. (Circle WF)"
android:title="@string/pref_animations"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="showWizard"
@ -197,6 +130,13 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="vibrateOnBolus"
android:title="@string/pref_vibrate_on_bolus"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="primefill"
@ -221,6 +161,8 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<ListPreference
android:defaultValue="default"
android:entries="@array/complication_tap_action"
@ -237,13 +179,6 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<info.nightscout.androidaps.interaction.utils.VersionPreference
android:defaultValue="1"
android:entries="@array/input_design"
@ -251,4 +186,13 @@
android:key="version_number"
android:summary="Input Design"
android:title="@string/pref_version" />
<info.nightscout.androidaps.interaction.utils.WatchfaceSettingsPreference
android:defaultValue="1"
android:entries="@array/input_design"
android:entryValues="@array/input_design_values"
android:key="more_settings"
android:summary="Input Design"
android:title="@string/pref_moreWatchfaceSettings" />
</PreferenceScreen>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="showBigNumbers"
android:summary="Big numbers. (Circle WF)"
android:title="@string/pref_big_numbers"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="showRingHistory"
android:summary="Graphical history. (Circle WF)"
android:title="@string/pref_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="true"
android:key="softRingHistory"
android:summary="Less eyecandy. (Circle WF)"
android:title="@string/pref_light_ring_history"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="animation"
android:summary="Animations. (Circle WF)"
android:title="@string/pref_animations"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="show_date"
android:title="@string/pref_show_date"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference
android:defaultValue="true"
android:key="dark"
android:summary="Dark theme"
android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ListPreference
android:defaultValue="2"
android:entries="@array/delta_granularity"
android:entryValues="@array/delta_granularity_values"
android:key="delta_granularity"
android:summary="Delta Granularity (Steampunk)"
android:title="@string/pref_delta_granularity" />
<CheckBoxPreference
android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen>