Refactoring again - DigitalStyle01 -> DigitalStyle, Use @string as label in manifest

This commit is contained in:
rICTx-T1D 2020-10-31 21:00:46 +01:00 committed by mh
parent 6e996c65df
commit bb6c7bc1a9
18 changed files with 62 additions and 63 deletions

View file

@ -163,16 +163,16 @@
</service>
<service
android:name=".watchfaces.DigitalStyle01"
android:name=".watchfaces.DigitalStyle"
android:allowEmbedded="true"
android:label="AAPS (DigitalStyle01)"
android:label="@string/label_digitalstyle"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="@xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="@drawable/watchface_digitalstyle01" />
android:resource="@drawable/watchface_digitalstyle" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyle01ConfigAct" />
@ -507,7 +507,7 @@
<activity
android:name=".interaction.actions.TempTargetActivity"
android:label="@string/menu_tempt" />
<activity android:name=".interaction.configurationActivities.DigitalStyle01ConfigAct">
<activity android:name=".interaction.configurationActivities.DigitalStyleConfigAct">
<intent-filter>
<action android:name="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyle01ConfigAct" />

View file

@ -7,13 +7,13 @@ import android.view.ViewGroup;
import info.nightscout.androidaps.R;
import preference.WearPreferenceActivity;
public class DigitalStyle01ConfigAct extends WearPreferenceActivity {
public class DigitalStyleConfigAct extends WearPreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle("watchface");
addPreferencesFromResource(R.xml.watch_face_digitalstyle01_configuration);
addPreferencesFromResource(R.xml.watch_face_digitalstyle_configuration);
ViewGroup view = (ViewGroup) getWindow().getDecorView();
removeBackgroundRecursively(view);
view.setBackground(getResources().getDrawable(R.drawable.settings_background));

View file

@ -2,7 +2,6 @@ package info.nightscout.androidaps.watchfaces;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.os.Vibrator;
import android.support.wearable.watchface.WatchFaceStyle;
import android.util.Log;
import android.view.LayoutInflater;
@ -12,16 +11,13 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.ustwo.clockwise.common.WatchFaceTime;
import com.ustwo.clockwise.common.WatchMode;
import java.text.SimpleDateFormat;
import java.util.Date;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
public class DigitalStyle01 extends BaseWatchFace {
public class DigitalStyle extends BaseWatchFace {
private static final long TIME_TAP_THRESHOLD = 800;
private long chartTapTime = 0;
private long sgvTapTime = 0;
@ -30,7 +26,7 @@ public class DigitalStyle01 extends BaseWatchFace {
public void onCreate() {
super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_digitalstyle01, null);
layoutView = inflater.inflate(R.layout.activity_digitalstyle, null);
performViewSetup();
}
@ -103,17 +99,17 @@ public class DigitalStyle01 extends BaseWatchFace {
LinearLayout mShapesElements = layoutView.findViewById(R.id.shapes_elements);
if (mShapesElements != null) {
String displayFormatType = (mShapesElements.getContentDescription().toString().startsWith("round") ? "round" : "rect");
String displayStyle=sharedPrefs.getString("digitalstyle01_frameStyle", "full");
String displayFrameColor=sharedPrefs.getString("digitalstyle01_frameColor", "red");
String displayFrameColorSaturation=sharedPrefs.getString("digitalstyle01_frameColorSaturation", "500");
String displayFrameColorOpacity=sharedPrefs.getString("digitalstyle01_frameColorOpacity", "1");
String displayStyle=sharedPrefs.getString("digitalstyle_frameStyle", "full");
String displayFrameColor=sharedPrefs.getString("digitalstyle_frameColor", "red");
String displayFrameColorSaturation=sharedPrefs.getString("digitalstyle_frameColorSaturation", "500");
String displayFrameColorOpacity=sharedPrefs.getString("digitalstyle_frameColorOpacity", "1");
// Load image with shapes
String styleDrawableName = "digitalstyle01_bg_" + displayStyle + "_" + displayFormatType;
String styleDrawableName = "digitalstyle_bg_" + displayStyle + "_" + displayFormatType;
try {
mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName())));
} catch (Exception e) {
Log.e("digitalstyle01_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName);
Log.e("digitalstyle_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName);
}
// set background-tint-color
@ -121,13 +117,13 @@ public class DigitalStyle01 extends BaseWatchFace {
mShapesElements.setBackgroundTintList(null);
} else {
String strColorName =(( displayFrameColor.equals("white") || displayFrameColor.equals("black") )?displayFrameColor:displayFrameColor+"_"+displayFrameColorSaturation);
Log.v("digitalstyle01_strColorName",strColorName);
Log.v("digitalstyle_strColorName",strColorName);
try {
ColorStateList colorStateList = ContextCompat.getColorStateList(getApplicationContext(), getResources().getIdentifier(strColorName, "color", getApplicationContext().getPackageName()));
mShapesElements.setBackgroundTintList(colorStateList);
} catch (Exception e) {
mShapesElements.setBackgroundTintList(null);
Log.e("digitalstyle01_colorName", "COLOR NOT FOUND >> " + strColorName);
Log.e("digitalstyle_colorName", "COLOR NOT FOUND >> " + strColorName);
}
}

View file

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View file

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View file

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View file

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View file

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View file

Before

Width:  |  Height:  |  Size: 137 B

After

Width:  |  Height:  |  Size: 137 B

View file

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View file

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View file

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 84 KiB

View file

@ -7,7 +7,7 @@
android:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:rectLayout="@layout/rect_activity_digitalstyle01"
app:roundLayout="@layout/round_activity_digitalstyle01"
app:rectLayout="@layout/rect_activity_digitalstyle"
app:roundLayout="@layout/round_activity_digitalstyle"
tools:context=".watchfaces.Home"
tools:deviceIds="wear"/>

View file

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".watchfaces.DigitalStyle01"
tools:context=".watchfaces.DigitalStyle"
tools:deviceIds="wear_square">
@ -15,7 +15,7 @@
android:id="@+id/shapes_elements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digitalstyle01_bg_full_rect"
android:background="@drawable/digitalstyle_bg_full_rect"
android:contentDescription="rect-shape-elements"
android:orientation="horizontal" />

View file

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
tools:context=".watchfaces.DigitalStyle01"
tools:context=".watchfaces.DigitalStyle"
tools:deviceIds="wear_round">
@ -15,7 +15,7 @@
android:id="@+id/shapes_elements"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/digitalstyle01_bg_full_round"
android:background="@drawable/digitalstyle_bg_full_round"
android:contentDescription="round-shape-elements"
android:orientation="horizontal" />

View file

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="digitalstyle01_styles_name">
<item>@string/style_none</item>
<item>@string/style_minimal</item>
<item>@string/style_shape</item>
<item>@string/style_full</item>
<string-array name="digitalstyle_styles_name">
<item>@string/digitalstyle_style_none</item>
<item>@string/digitalstyle_style_minimal</item>
<item>@string/digitalstyle_style_shape</item>
<item>@string/digitalstyle_style_full</item>
</string-array>
<string-array name="digitalstyle01_styles_values">
<string-array name="digitalstyle_styles_values">
<item>none</item>
<item>minimal</item>
<item>shape</item>
<item>full</item>
</string-array>
<string-array name="digitalstyle01_color_name">
<string-array name="digitalstyle_color_name">
<item>@string/color_name_red</item>
<item>@string/color_name_pink</item>
<item>@string/color_name_purple</item>
@ -36,7 +36,7 @@
<item>@string/color_name_white</item>
<item>@string/color_name_multicolor</item>
</string-array>
<string-array name="digitalstyle01_color_values">
<string-array name="digitalstyle_color_values">
<item>red</item>
<item>pink</item>
<item>purple</item>
@ -61,7 +61,7 @@
</string-array>
<string-array name="digitalstyle01_color_saturation">
<string-array name="digitalstyle_color_saturation">
<item>100</item>
<item>500</item>
<item>700</item>
@ -69,7 +69,7 @@
</string-array>
<string-array name="digitalstyle01_color_opacity_name">
<string-array name="digitalstyle_color_opacity_name">
<item>10%</item>
<item>20%</item>
<item>30%</item>
@ -81,7 +81,7 @@
<item>90%</item>
<item>100%</item>
</string-array>
<string-array name="digitalstyle01_color_opacity_value">
<string-array name="digitalstyle_color_opacity_value">
<item>0.1</item>
<item>0.2</item>
<item>0.3</item>

View file

@ -12,6 +12,7 @@
<string name="label_xdrip_v2">AAPSv2</string>
<string name="label_xdrip_cockpit">AAPS(Cockpit)</string>
<string name="label_xdrip_steampunk">AAPS(Steampunk)</string>
<string name="label_digitalstyle">AAPS(DigitalStyle)</string>
<string name="label_warning_sync">No data!</string>
<string name="label_warning_old">Old data!</string>
@ -143,17 +144,19 @@
<string name="color_name_multicolor">multicolor</string>
<string name="pref_choose_your_style">Choose your style</string>
<string name="style_none">no style</string>
<string name="style_minimal">minimal style</string>
<string name="style_shape">shape style</string>
<string name="style_full">full style</string>
<string name="pref_choose_your_color">Choose your color</string>
<string name="pref_choose_your_color_saturation">Choose your color saturation</string>
<string name="pref_choose_your_color_opacity">Choose your color opacity</string>
<string name="pref_vibrate_hourly">Vibrate hourly</string>
<string name="pref_show_weeknumber">Show Week number</string>
<string name="digitalstyle_pref_your_style">Your style:</string>
<string name="digitalstyle_style_none">no style</string>
<string name="digitalstyle_style_minimal">minimal style</string>
<string name="digitalstyle_style_shape">shape style</string>
<string name="digitalstyle_style_full">full style</string>
<string name="digitalstyle_pref_your_color">Your color:</string>
<string name="digitalstyle_pref_your_color_saturation">Your color saturation:</string>
<string name="digitalstyle_pref_your_color_opacity">Your color opacity:</string>
</resources>

View file

@ -4,31 +4,31 @@
<ListPreference
android:key="digitalstyle01_frameStyle"
android:title="@string/pref_choose_your_style"
android:key="digitalstyle_frameStyle"
android:title="@string/digitalstyle_pref_your_style"
android:defaultValue="full"
android:entries="@array/digitalstyle01_styles_name"
android:entryValues="@array/digitalstyle01_styles_values"/>
android:entries="@array/digitalstyle_styles_name"
android:entryValues="@array/digitalstyle_styles_values"/>
<ListPreference
android:key="digitalstyle01_frameColor"
android:title="@string/pref_choose_your_color"
android:key="digitalstyle_frameColor"
android:title="@string/digitalstyle_pref_your_color"
android:defaultValue="red"
android:entries="@array/digitalstyle01_color_name"
android:entryValues="@array/digitalstyle01_color_values"/>
android:entries="@array/digitalstyle_color_name"
android:entryValues="@array/digitalstyle_color_values"/>
<ListPreference
android:key="digitalstyle01_frameColorSaturation"
android:title="@string/pref_choose_your_color_saturation"
android:key="digitalstyle_frameColorSaturation"
android:title="@string/digitalstyle_pref_your_color_saturation"
android:defaultValue="700"
android:entries="@array/digitalstyle01_color_saturation"
android:entryValues="@array/digitalstyle01_color_saturation"/>
android:entries="@array/digitalstyle_color_saturation"
android:entryValues="@array/digitalstyle_color_saturation"/>
<ListPreference
android:key="digitalstyle01_frameColorOpacity"
android:title="@string/pref_choose_your_color_opacity"
android:key="digitalstyle_frameColorOpacity"
android:title="@string/digitalstyle_pref_your_color_opacity"
android:defaultValue="1"
android:entries="@array/digitalstyle01_color_opacity_name"
android:entryValues="@array/digitalstyle01_color_opacity_value"/>
android:entries="@array/digitalstyle_color_opacity_name"
android:entryValues="@array/digitalstyle_color_opacity_value"/>
<CheckBoxPreference
android:key="show_date"