Skip to content

Commit

Permalink
option to hide watch hands
Browse files Browse the repository at this point in the history
  • Loading branch information
lanrat committed Jun 11, 2019
1 parent 72cf668 commit aabe303
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Wearable/src/main/java/com/vorsk/minimalin/model/ConfigData.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ConfigData {
public static final boolean DEFAULT_SECONDS_TICK_ENABLE = true;
public static final boolean DEFAULT_NOTIFICATION_COMPLICATION = false;
public static final boolean DEFAULT_HIDE_COMPLICATIONS_AMBIENT = false;
public static final boolean DEFAULT_SHOW_HANDS = true;
public static final String DEFAULT_BACKGROUND_COLOR = MaterialColors.Color.GREY.name();
public static final String DEFAULT_PRIMARY_COLOR = MaterialColors.Color.BLUE.name();
public static final String DEFAULT_SECONDARY_COLOR = MaterialColors.Color.PURPLE.name();
Expand Down Expand Up @@ -137,6 +138,15 @@ public static ArrayList<ConfigItemType> getDataToPopulateAdapter(Context context
DEFAULT_SECONDS_TICK_ENABLE);
settingsConfigData.add(settingTickConfigItem);

// Show seconds tick UX (toggle) in settings Activity.
ConfigItemType settingShowHandsItem =
new SwitchConfigItem(
context.getString(R.string.config_show_hands_label),
R.drawable.clock,
R.drawable.clock_no_hands,
R.string.saved_show_watch_hands,
DEFAULT_SHOW_HANDS);
settingsConfigData.add(settingShowHandsItem);

return settingsConfigData;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ public void onReceive(Context context, Intent intent) {
private boolean mMilitaryTimePreference;
private boolean secondsTickPreference;
private boolean hideAmbientComplicationPreference;
private boolean showHandsPreference;
private boolean mNotificationComplication;


Expand Down Expand Up @@ -361,6 +362,11 @@ private void loadSavedPreferences() {
getApplicationContext().getString(R.string.saved_hide_ambient_complications);
hideAmbientComplicationPreference =
mSharedPref.getBoolean(hideAmbientComplicationsPreferenceResourceName, ConfigData.DEFAULT_HIDE_COMPLICATIONS_AMBIENT);

String showHandsPreferenceResourceName =
getApplicationContext().getString(R.string.saved_show_watch_hands);
showHandsPreference =
mSharedPref.getBoolean(showHandsPreferenceResourceName, ConfigData.DEFAULT_SHOW_HANDS);
}

private void initializeComplications() {
Expand Down Expand Up @@ -803,6 +809,9 @@ public void onDraw(Canvas canvas, Rect bounds) {
* @param canvas to draw to
*/
private void drawNotificationCount(Canvas canvas) {
if (!showHandsPreference) {
return;
}
if (mUnreadNotificationsPreference && (mNumberOfUnreadNotifications > 0)) {
int count = mNumberOfUnreadNotifications;
String countStr = "+";
Expand Down Expand Up @@ -867,7 +876,9 @@ private boolean minimalinTimesConflictingNorthOrSouth(int hour, int minute) {

private void drawWatchFace(Canvas canvas) {
drawMinimalinTime(canvas);
drawWatchHands(canvas);
if (showHandsPreference) {
drawWatchHands(canvas);
}
}

private void drawMinimalinTime(Canvas canvas) {
Expand Down
53 changes: 53 additions & 0 deletions Wearable/src/main/res/drawable/clock_no_hands.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16.597347dp"
android:height="16.597347dp"
android:viewportWidth="100"
android:viewportHeight="100">

<group
android:translateX="-50"
android:translateY="-50"
android:scaleX="0.69"
android:scaleY="0.69">
</group>
<path
android:fillColor="#FFFFFF"
android:pathData="M50,5C25.187,5,5,25.187,5,50s20.187,45,45,45s45-20.187,45-45S74.813,5,50,5z M50,90c-22.056,0-40-17.944-40-40 s17.944-40,40-40s40,17.944,40,40S72.056,90,50,90z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M50,18.75c0.69,0,1.25-0.56,1.25-1.25V15c0-0.69-0.56-1.25-1.25-1.25s-1.25,0.56-1.25,1.25v2.5 C48.75,18.19,49.31,18.75,50,18.75z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M50,81.25c-0.69,0-1.25,0.56-1.25,1.25V85c0,0.69,0.56,1.25,1.25,1.25s1.25-0.56,1.25-1.25v-2.5 C51.25,81.81,50.69,81.25,50,81.25z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M32.667,22.479c0.231,0.401,0.652,0.625,1.083,0.625c0.212,0,0.427-0.054,0.624-0.167c0.598-0.345,0.803-1.11,0.458-1.708 l-1.25-2.165c-0.346-0.598-1.11-0.802-1.708-0.458c-0.598,0.345-0.803,1.11-0.458,1.708L32.667,22.479z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M67.333,77.521c-0.345-0.598-1.111-0.802-1.708-0.458c-0.598,0.345-0.803,1.11-0.458,1.708l1.25,2.165 c0.231,0.401,0.652,0.625,1.083,0.625c0.212,0,0.427-0.054,0.624-0.167c0.598-0.345,0.803-1.11,0.458-1.708L67.333,77.521z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M22.479,32.667l-2.165-1.25c-0.597-0.344-1.362-0.141-1.708,0.458c-0.345,0.598-0.14,1.362,0.458,1.708l2.165,1.25 C21.426,34.946,21.641,35,21.853,35c0.432,0,0.852-0.224,1.083-0.625C23.282,33.777,23.077,33.013,22.479,32.667z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M80.936,66.417l-2.165-1.25c-0.597-0.345-1.362-0.141-1.708,0.458c-0.345,0.598-0.14,1.362,0.458,1.708l2.165,1.25 c0.197,0.114,0.412,0.167,0.624,0.167c0.432,0,0.852-0.224,1.083-0.625C81.739,67.527,81.534,66.763,80.936,66.417z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M17.5,48.75H15c-0.69,0-1.25,0.56-1.25,1.25s0.56,1.25,1.25,1.25h2.5c0.69,0,1.25-0.56,1.25-1.25S18.19,48.75,17.5,48.75z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M82.5,51.25H85c0.69,0,1.25-0.56,1.25-1.25s-0.56-1.25-1.25-1.25h-2.5c-0.69,0-1.25,0.56-1.25,1.25S81.81,51.25,82.5,51.25z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M65.625,22.937c0.197,0.114,0.412,0.167,0.624,0.167c0.432,0,0.852-0.224,1.083-0.625l1.25-2.165 c0.345-0.598,0.14-1.362-0.458-1.708c-0.596-0.345-1.362-0.141-1.708,0.458l-1.25,2.165C64.822,21.827,65.027,22.591,65.625,22.937z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M34.375,77.063c-0.597-0.345-1.362-0.141-1.708,0.458l-1.25,2.165c-0.345,0.598-0.14,1.362,0.458,1.708 c0.197,0.114,0.412,0.167,0.624,0.167c0.432,0,0.852-0.224,1.083-0.625l1.25-2.165C35.178,78.173,34.973,77.409,34.375,77.063z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M77.063,34.375C77.295,34.776,77.715,35,78.147,35c0.212,0,0.427-0.054,0.624-0.167l2.165-1.25 c0.598-0.345,0.803-1.11,0.458-1.708c-0.346-0.599-1.111-0.802-1.708-0.458l-2.165,1.25C76.923,33.013,76.718,33.777,77.063,34.375z" />
<path
android:fillColor="#FFFFFF"
android:pathData="M21.229,65.167l-2.165,1.25c-0.598,0.345-0.803,1.11-0.458,1.708c0.231,0.401,0.652,0.625,1.083,0.625 c0.212,0,0.427-0.054,0.624-0.167l2.165-1.25c0.598-0.345,0.803-1.11,0.458-1.708C22.591,65.027,21.826,64.823,21.229,65.167z" />
</vector>
4 changes: 3 additions & 1 deletion Wearable/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<string name="config_notification_complication_label">Show Notification Preview Over Top Complication</string>
<string name="config_enable_seconds_label">Show seconds tick</string>
<string name="config_hide_ambient_complications_label">Hide complications in ambient mode</string>
<string name="config_show_hands_label">Show Watch Face Hands</string>

<string name="saved_primary_color">saved_primary_color</string>
<string name="saved_secondary_color">saved_secondary_color</string>
Expand All @@ -20,7 +21,8 @@
<string name="saved_24h_pref">saved_24h</string>
<string name="saved_notification_complication">saved_notification_complication</string>
<string name="saved_seconds_enable">saved_seconds_enable</string>
<string name="saved_hide_ambient_complications">saved_hide_ambient_complications_enable</string>
<string name="saved_hide_ambient_complications">saved_hide_ambient_complications</string>
<string name="saved_show_watch_hands">saved_show_watch_hands</string>

<string name="preference_file_key">com.vorsk.minimalin.PREFERENCE_FILE_KEY</string>

Expand Down

0 comments on commit aabe303

Please sign in to comment.