Skip to content

Commit

Permalink
option to hide complications in ambient mode
Browse files Browse the repository at this point in the history
  • Loading branch information
lanrat committed Jun 11, 2019
1 parent a47ea56 commit 72cf668
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
17 changes: 15 additions & 2 deletions Wearable/src/main/java/com/vorsk/minimalin/model/ConfigData.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class ConfigData {
public static final boolean DEFAULT_24_HOUR_TIME = false;
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 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 @@ -115,15 +116,27 @@ public static ArrayList<ConfigItemType> getDataToPopulateAdapter(Context context
DEFAULT_24_HOUR_TIME);
settingsConfigData.add(militaryTimeConfigItem);


// Option to hide complications in ambient mode
ConfigItemType hideAmbientComplicationsConfigItem =
new SwitchConfigItem(
context.getString(R.string.config_hide_ambient_complications_label),
R.drawable.added_complication,
R.drawable.add_complication,
R.string.saved_hide_ambient_complications,
DEFAULT_HIDE_COMPLICATIONS_AMBIENT);
settingsConfigData.add(hideAmbientComplicationsConfigItem);

// Show seconds tick UX (toggle) in settings Activity.
ConfigItemType SettingTickConfigItem =
ConfigItemType settingTickConfigItem =
new SwitchConfigItem(
context.getString(R.string.config_enable_seconds_label),
R.drawable.clock_seconds,
R.drawable.clock,
R.string.saved_seconds_enable,
DEFAULT_SECONDS_TICK_ENABLE);
settingsConfigData.add(SettingTickConfigItem);
settingsConfigData.add(settingTickConfigItem);


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


Expand Down Expand Up @@ -355,6 +356,11 @@ private void loadSavedPreferences() {
getApplicationContext().getString(R.string.saved_seconds_enable);
secondsTickPreference =
mSharedPref.getBoolean(secondsTickPreferenceResourceName, ConfigData.DEFAULT_SECONDS_TICK_ENABLE);

String hideAmbientComplicationsPreferenceResourceName =
getApplicationContext().getString(R.string.saved_hide_ambient_complications);
hideAmbientComplicationPreference =
mSharedPref.getBoolean(hideAmbientComplicationsPreferenceResourceName, ConfigData.DEFAULT_HIDE_COMPLICATIONS_AMBIENT);
}

private void initializeComplications() {
Expand Down Expand Up @@ -825,6 +831,9 @@ private void drawBackground(Canvas canvas) {
}

private void drawComplications(Canvas canvas, long currentTimeMillis) {
if (mAmbient && hideAmbientComplicationPreference) {
return;
}
ComplicationDrawable complicationDrawable;

int skipComplication = NOTIFICATION_COMPLICATION_ID;
Expand Down
4 changes: 2 additions & 2 deletions Wearable/src/main/res/drawable/add_complication.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:width="16.597347dp"
android:height="16.597347dp"
android:viewportWidth="67.73333"
android:viewportHeight="67.73334">
<path
Expand Down
4 changes: 2 additions & 2 deletions Wearable/src/main/res/drawable/added_complication.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:width="16.597347dp"
android:height="16.597347dp"
android:viewportWidth="67.73333"
android:viewportHeight="67.73334">
<path
Expand Down
2 changes: 2 additions & 0 deletions Wearable/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<string name="config_complication_background_label">Show Complication\nBackgrounds</string>
<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="saved_primary_color">saved_primary_color</string>
<string name="saved_secondary_color">saved_secondary_color</string>
Expand All @@ -19,6 +20,7 @@
<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="preference_file_key">com.vorsk.minimalin.PREFERENCE_FILE_KEY</string>

Expand Down

0 comments on commit 72cf668

Please sign in to comment.