Refactoring rICTx_WF01 -> DigitalStyle01
|
@ -163,19 +163,19 @@
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".watchfaces.RICTxWF01"
|
android:name=".watchfaces.DigitalStyle01"
|
||||||
android:allowEmbedded="true"
|
android:allowEmbedded="true"
|
||||||
android:label="AAPS (rICTx_WF01)"
|
android:label="AAPS (DigitalStyle01)"
|
||||||
android:permission="android.permission.BIND_WALLPAPER">
|
android:permission="android.permission.BIND_WALLPAPER">
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.service.wallpaper"
|
android:name="android.service.wallpaper"
|
||||||
android:resource="@xml/watch_face" />
|
android:resource="@xml/watch_face" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.wearable.watchface.preview"
|
android:name="com.google.android.wearable.watchface.preview"
|
||||||
android:resource="@drawable/watchface_rictxwf01" />
|
android:resource="@drawable/watchface_digitalstyle01" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
|
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
|
||||||
android:value="info.nightscout.androidaps.interaction.configurationActivities.RICTxWF01ConfigurationActivity" />
|
android:value="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyle01ConfigAct" />
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.service.wallpaper.WallpaperService" />
|
<action android:name="android.service.wallpaper.WallpaperService" />
|
||||||
|
@ -507,9 +507,9 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".interaction.actions.TempTargetActivity"
|
android:name=".interaction.actions.TempTargetActivity"
|
||||||
android:label="@string/menu_tempt" />
|
android:label="@string/menu_tempt" />
|
||||||
<activity android:name=".interaction.configurationActivities.RICTxWF01ConfigurationActivity">
|
<activity android:name=".interaction.configurationActivities.DigitalStyle01ConfigAct">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="info.nightscout.androidaps.interaction.configurationActivities.RICTxWF01ConfigurationActivity" />
|
<action android:name="info.nightscout.androidaps.interaction.configurationActivities.DigitalStyle01ConfigAct" />
|
||||||
|
|
||||||
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
|
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
|
@ -7,13 +7,13 @@ import android.view.ViewGroup;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import preference.WearPreferenceActivity;
|
import preference.WearPreferenceActivity;
|
||||||
|
|
||||||
public class RICTxWF01ConfigurationActivity extends WearPreferenceActivity {
|
public class DigitalStyle01ConfigAct extends WearPreferenceActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setTitle("watchface");
|
setTitle("watchface");
|
||||||
addPreferencesFromResource(R.xml.rictxwf01configuration);
|
addPreferencesFromResource(R.xml.watch_face_digitalstyle01_configuration);
|
||||||
ViewGroup view = (ViewGroup) getWindow().getDecorView();
|
ViewGroup view = (ViewGroup) getWindow().getDecorView();
|
||||||
removeBackgroundRecursively(view);
|
removeBackgroundRecursively(view);
|
||||||
view.setBackground(getResources().getDrawable(R.drawable.settings_background));
|
view.setBackground(getResources().getDrawable(R.drawable.settings_background));
|
|
@ -21,7 +21,8 @@ import java.util.Date;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
|
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
|
||||||
|
|
||||||
public class RICTxWF01 extends BaseWatchFace {
|
public class DigitalStyle01 extends BaseWatchFace {
|
||||||
|
private static final long TIME_TAP_THRESHOLD = 800;
|
||||||
private long chartTapTime = 0;
|
private long chartTapTime = 0;
|
||||||
private long sgvTapTime = 0;
|
private long sgvTapTime = 0;
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ public class RICTxWF01 extends BaseWatchFace {
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
|
||||||
layoutView = inflater.inflate(R.layout.activity_rictxwf01, null);
|
layoutView = inflater.inflate(R.layout.activity_digitalstyle01, null);
|
||||||
performViewSetup();
|
performViewSetup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public class RICTxWF01 extends BaseWatchFace {
|
||||||
Log.d("onTapCommand: DeviceWidth x DeviceHeight /// x , y, TapType >> ", Integer.toString(getWidth()) + " x " + Integer.toString(getHeight()) + " /// " + Integer.toString(x) + " , " + Integer.toString(y) + " , " + Integer.toString(tapType));
|
Log.d("onTapCommand: DeviceWidth x DeviceHeight /// x , y, TapType >> ", Integer.toString(getWidth()) + " x " + Integer.toString(getHeight()) + " /// " + Integer.toString(x) + " , " + Integer.toString(y) + " , " + Integer.toString(tapType));
|
||||||
|
|
||||||
if (tapType == TAP_TYPE_TAP) {
|
if (tapType == TAP_TYPE_TAP) {
|
||||||
if (eventTime - sgvTapTime < 800) {
|
if (eventTime - sgvTapTime < TIME_TAP_THRESHOLD) {
|
||||||
Intent intent = new Intent(this, MainMenuActivity.class);
|
Intent intent = new Intent(this, MainMenuActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -93,23 +94,26 @@ public class RICTxWF01 extends BaseWatchFace {
|
||||||
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
|
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
|
||||||
pointSize = 1;
|
pointSize = 1;
|
||||||
setupCharts();
|
setupCharts();
|
||||||
|
setWatchfaceStyle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setWatchfaceStyle(){
|
||||||
/* frame styles*/
|
/* frame styles*/
|
||||||
LinearLayout mShapesElements = layoutView.findViewById(R.id.shapes_elements);
|
LinearLayout mShapesElements = layoutView.findViewById(R.id.shapes_elements);
|
||||||
if (mShapesElements != null) {
|
if (mShapesElements != null) {
|
||||||
String displayFormatType = (mShapesElements.getContentDescription().toString().startsWith("round") ? "round" : "rect");
|
String displayFormatType = (mShapesElements.getContentDescription().toString().startsWith("round") ? "round" : "rect");
|
||||||
String displayStyle=sharedPrefs.getString("rictxwf01_frameStyle", "full");
|
String displayStyle=sharedPrefs.getString("digitalstyle01_frameStyle", "full");
|
||||||
String displayFrameColor=sharedPrefs.getString("rictxwf01_frameColor", "red");
|
String displayFrameColor=sharedPrefs.getString("digitalstyle01_frameColor", "red");
|
||||||
String displayFrameColorSaturation=sharedPrefs.getString("rictxwf01_frameColorSaturation", "500");
|
String displayFrameColorSaturation=sharedPrefs.getString("digitalstyle01_frameColorSaturation", "500");
|
||||||
String displayFrameColorOpacity=sharedPrefs.getString("rictxwf01_frameColorOpacity", "1");
|
String displayFrameColorOpacity=sharedPrefs.getString("digitalstyle01_frameColorOpacity", "1");
|
||||||
|
|
||||||
// Load image with shapes
|
// Load image with shapes
|
||||||
String styleDrawableName = "rictxwf01_bg_" + displayStyle + "_" + displayFormatType;
|
String styleDrawableName = "digitalstyle01_bg_" + displayStyle + "_" + displayFormatType;
|
||||||
try {
|
try {
|
||||||
mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName())));
|
mShapesElements.setBackground(getResources().getDrawable(getResources().getIdentifier(styleDrawableName, "drawable", getApplicationContext().getPackageName())));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("rictxwf01_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName);
|
Log.e("digitalstyle01_frameStyle", "RESOURCE NOT FOUND >> " + styleDrawableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set background-tint-color
|
// set background-tint-color
|
||||||
|
@ -117,13 +121,13 @@ public class RICTxWF01 extends BaseWatchFace {
|
||||||
mShapesElements.setBackgroundTintList(null);
|
mShapesElements.setBackgroundTintList(null);
|
||||||
} else {
|
} else {
|
||||||
String strColorName =(( displayFrameColor.equals("white") || displayFrameColor.equals("black") )?displayFrameColor:displayFrameColor+"_"+displayFrameColorSaturation);
|
String strColorName =(( displayFrameColor.equals("white") || displayFrameColor.equals("black") )?displayFrameColor:displayFrameColor+"_"+displayFrameColorSaturation);
|
||||||
Log.v("rictxwf01_strColorName",strColorName);
|
Log.v("digitalstyle01_strColorName",strColorName);
|
||||||
try {
|
try {
|
||||||
ColorStateList colorStateList = ContextCompat.getColorStateList(getApplicationContext(), getResources().getIdentifier(strColorName, "color", getApplicationContext().getPackageName()));
|
ColorStateList colorStateList = ContextCompat.getColorStateList(getApplicationContext(), getResources().getIdentifier(strColorName, "color", getApplicationContext().getPackageName()));
|
||||||
mShapesElements.setBackgroundTintList(colorStateList);
|
mShapesElements.setBackgroundTintList(colorStateList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
mShapesElements.setBackgroundTintList(null);
|
mShapesElements.setBackgroundTintList(null);
|
||||||
Log.e("rictxwf01_ColorName", "COLOR NOT FOUND >> " + strColorName);
|
Log.e("digitalstyle01_colorName", "COLOR NOT FOUND >> " + strColorName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +185,7 @@ public class RICTxWF01 extends BaseWatchFace {
|
||||||
super.onTimeChanged(oldTime,newTime);
|
super.onTimeChanged(oldTime,newTime);
|
||||||
|
|
||||||
/* hourly vibration*/
|
/* hourly vibration*/
|
||||||
Boolean hourlyVibratePref = sharedPrefs.getBoolean("rictxwf01_vibrateHourly", false);
|
Boolean hourlyVibratePref = sharedPrefs.getBoolean("vibrate_Hourly", false);
|
||||||
if (hourlyVibratePref && layoutSet && newTime.hasHourChanged(oldTime)) {
|
if (hourlyVibratePref && layoutSet && newTime.hasHourChanged(oldTime)) {
|
||||||
Log.i("hourlyVibratePref", "true --> " + newTime.toString());
|
Log.i("hourlyVibratePref", "true --> " + newTime.toString());
|
||||||
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 84 KiB |
|
@ -7,7 +7,7 @@
|
||||||
android:id="@+id/watch_view_stub"
|
android:id="@+id/watch_view_stub"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:rectLayout="@layout/rect_activity_rictxwf01"
|
app:rectLayout="@layout/rect_activity_digitalstyle01"
|
||||||
app:roundLayout="@layout/round_activity_rictxwf01"
|
app:roundLayout="@layout/round_activity_digitalstyle01"
|
||||||
tools:context=".watchfaces.Home"
|
tools:context=".watchfaces.Home"
|
||||||
tools:deviceIds="wear"/>
|
tools:deviceIds="wear"/>
|
|
@ -6,7 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/black"
|
android:background="@color/black"
|
||||||
tools:context=".watchfaces.RICTxWF01"
|
tools:context=".watchfaces.DigitalStyle01"
|
||||||
tools:deviceIds="wear_square">
|
tools:deviceIds="wear_square">
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
android:id="@+id/shapes_elements"
|
android:id="@+id/shapes_elements"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/rictxwf01_bg_full_rect"
|
android:background="@drawable/digitalstyle01_bg_full_rect"
|
||||||
android:contentDescription="rect-shape-elements"
|
android:contentDescription="rect-shape-elements"
|
||||||
android:orientation="horizontal" />
|
android:orientation="horizontal" />
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/black"
|
android:background="@color/black"
|
||||||
tools:context=".watchfaces.RICTxWF01"
|
tools:context=".watchfaces.DigitalStyle01"
|
||||||
tools:deviceIds="wear_round">
|
tools:deviceIds="wear_round">
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
android:id="@+id/shapes_elements"
|
android:id="@+id/shapes_elements"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/rictxwf01_bg_full_round"
|
android:background="@drawable/digitalstyle01_bg_full_round"
|
||||||
android:contentDescription="round-shape-elements"
|
android:contentDescription="round-shape-elements"
|
||||||
android:orientation="horizontal" />
|
android:orientation="horizontal" />
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string-array name="rictxwf01_styles_name">
|
<string-array name="digitalstyle01_styles_name">
|
||||||
<item>@string/style_none</item>
|
<item>@string/style_none</item>
|
||||||
<item>@string/style_minimal</item>
|
<item>@string/style_minimal</item>
|
||||||
<item>@string/style_shape</item>
|
<item>@string/style_shape</item>
|
||||||
<item>@string/style_full</item>
|
<item>@string/style_full</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="rictxwf01_styles_values">
|
<string-array name="digitalstyle01_styles_values">
|
||||||
<item>none</item>
|
<item>none</item>
|
||||||
<item>minimal</item>
|
<item>minimal</item>
|
||||||
<item>shape</item>
|
<item>shape</item>
|
||||||
<item>full</item>
|
<item>full</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="rictxwf01_color_name">
|
<string-array name="digitalstyle01_color_name">
|
||||||
<item>@string/color_name_red</item>
|
<item>@string/color_name_red</item>
|
||||||
<item>@string/color_name_pink</item>
|
<item>@string/color_name_pink</item>
|
||||||
<item>@string/color_name_purple</item>
|
<item>@string/color_name_purple</item>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<item>@string/color_name_white</item>
|
<item>@string/color_name_white</item>
|
||||||
<item>@string/color_name_multicolor</item>
|
<item>@string/color_name_multicolor</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="rictxwf01_color_values">
|
<string-array name="digitalstyle01_color_values">
|
||||||
<item>red</item>
|
<item>red</item>
|
||||||
<item>pink</item>
|
<item>pink</item>
|
||||||
<item>purple</item>
|
<item>purple</item>
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
<string-array name="rictxwf01_color_saturation">
|
<string-array name="digitalstyle01_color_saturation">
|
||||||
<item>100</item>
|
<item>100</item>
|
||||||
<item>500</item>
|
<item>500</item>
|
||||||
<item>700</item>
|
<item>700</item>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
<string-array name="rictxwf01_color_opacity_name">
|
<string-array name="digitalstyle01_color_opacity_name">
|
||||||
<item>10%</item>
|
<item>10%</item>
|
||||||
<item>20%</item>
|
<item>20%</item>
|
||||||
<item>30%</item>
|
<item>30%</item>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<item>90%</item>
|
<item>90%</item>
|
||||||
<item>100%</item>
|
<item>100%</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="rictxwf01_color_opacity_value">
|
<string-array name="digitalstyle01_color_opacity_value">
|
||||||
<item>0.1</item>
|
<item>0.1</item>
|
||||||
<item>0.2</item>
|
<item>0.2</item>
|
||||||
<item>0.3</item>
|
<item>0.3</item>
|
|
@ -4,31 +4,31 @@
|
||||||
|
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="rictxwf01_frameStyle"
|
android:key="digitalstyle01_frameStyle"
|
||||||
android:title="@string/pref_choose_your_style"
|
android:title="@string/pref_choose_your_style"
|
||||||
android:defaultValue="full"
|
android:defaultValue="full"
|
||||||
android:entries="@array/rictxwf01_styles_name"
|
android:entries="@array/digitalstyle01_styles_name"
|
||||||
android:entryValues="@array/rictxwf01_styles_values"/>
|
android:entryValues="@array/digitalstyle01_styles_values"/>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="rictxwf01_frameColor"
|
android:key="digitalstyle01_frameColor"
|
||||||
android:title="@string/pref_choose_your_color"
|
android:title="@string/pref_choose_your_color"
|
||||||
android:defaultValue="red"
|
android:defaultValue="red"
|
||||||
android:entries="@array/rictxwf01_color_name"
|
android:entries="@array/digitalstyle01_color_name"
|
||||||
android:entryValues="@array/rictxwf01_color_values"/>
|
android:entryValues="@array/digitalstyle01_color_values"/>
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="rictxwf01_frameColorSaturation"
|
android:key="digitalstyle01_frameColorSaturation"
|
||||||
android:title="@string/pref_choose_your_color_saturation"
|
android:title="@string/pref_choose_your_color_saturation"
|
||||||
android:defaultValue="700"
|
android:defaultValue="700"
|
||||||
android:entries="@array/rictxwf01_color_saturation"
|
android:entries="@array/digitalstyle01_color_saturation"
|
||||||
android:entryValues="@array/rictxwf01_color_saturation"/>
|
android:entryValues="@array/digitalstyle01_color_saturation"/>
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:key="rictxwf01_frameColorOpacity"
|
android:key="digitalstyle01_frameColorOpacity"
|
||||||
android:title="@string/pref_choose_your_color_opacity"
|
android:title="@string/pref_choose_your_color_opacity"
|
||||||
android:defaultValue="1"
|
android:defaultValue="1"
|
||||||
android:entries="@array/rictxwf01_color_opacity_name"
|
android:entries="@array/digitalstyle01_color_opacity_name"
|
||||||
android:entryValues="@array/rictxwf01_color_opacity_value"/>
|
android:entryValues="@array/digitalstyle01_color_opacity_value"/>
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="show_date"
|
android:key="show_date"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
app:wear_iconOn="@drawable/settings_on" />
|
app:wear_iconOn="@drawable/settings_on" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="rictxwf01_vibrateHourly"
|
android:key="vibrate_Hourly"
|
||||||
android:title="@string/pref_vibrate_hourly"
|
android:title="@string/pref_vibrate_hourly"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
app:wear_iconOff="@drawable/settings_off"
|
app:wear_iconOff="@drawable/settings_off"
|