Minor cleanup to match code lab improvements.
Bug: 32214858
Change-Id: I898e3ea65669c863e6f915993c511e9d623ab25d
diff --git a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigRecyclerViewAdapter.java b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigRecyclerViewAdapter.java
index bb666d6..5af192a 100644
--- a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigRecyclerViewAdapter.java
+++ b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigRecyclerViewAdapter.java
@@ -559,11 +559,7 @@
.getBackground()
.setColorFilter(backgroundColorFilter);
- // TODO: change this to return from watch face
- final int[] complicationIds =
- new int[] {
- mBackgroundComplicationId, mLeftComplicationId, mRightComplicationId
- };
+ final int[] complicationIds = AnalogComplicationWatchFaceService.getComplicationIds();
mProviderInfoRetriever.retrieveProviderInfo(
new OnProviderInfoReceivedCallback() {
@@ -572,7 +568,7 @@
int watchFaceComplicationId,
@Nullable ComplicationProviderInfo complicationProviderInfo) {
- Log.d(TAG, "\n\nonProviderInfoReceived: " + complicationProviderInfo);
+ Log.d(TAG, "onProviderInfoReceived: " + complicationProviderInfo);
updateComplicationViews(
watchFaceComplicationId, complicationProviderInfo);
diff --git a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/AnalogComplicationWatchFaceService.java b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/AnalogComplicationWatchFaceService.java
index 12a7dec..2fc0b2d 100644
--- a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/AnalogComplicationWatchFaceService.java
+++ b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/AnalogComplicationWatchFaceService.java
@@ -97,6 +97,11 @@
}
}
+ // Used by {@link AnalogComplicationConfigRecyclerViewAdapter} to retrieve all complication ids.
+ public static int[] getComplicationIds() {
+ return COMPLICATION_IDS;
+ }
+
// Used by {@link AnalogComplicationConfigRecyclerViewAdapter} to see which complication types
// are supported in the settings config activity.
public static int[] getSupportedComplicationTypes(
@@ -197,10 +202,6 @@
new Handler() {
@Override
public void handleMessage(Message message) {
-
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "updating time");
- }
invalidate();
if (shouldTimerBeRunning()) {
long timeMs = System.currentTimeMillis();
@@ -214,9 +215,8 @@
@Override
public void onCreate(SurfaceHolder holder) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onCreate");
- }
+ Log.d(TAG, "onCreate");
+
super.onCreate(holder);
// Used throughout watch face to pull user's preferences.
@@ -268,9 +268,7 @@
}
private void initializeComplicationsAndBackground() {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "initializeComplications()");
- }
+ Log.d(TAG, "initializeComplications()");
// Initialize background color (in case background complication is inactive).
mBackgroundPaint = new Paint();
@@ -374,9 +372,7 @@
@Override
public void onPropertiesChanged(Bundle properties) {
super.onPropertiesChanged(properties);
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
- }
+ Log.d(TAG, "onPropertiesChanged: low-bit ambient = " + mLowBitAmbient);
mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
mBurnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false);
@@ -470,9 +466,7 @@
* Fires PendingIntent associated with complication (if it has one).
*/
private void onComplicationTap(int complicationId) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onComplicationTap()");
- }
+ Log.d(TAG, "onComplicationTap()");
ComplicationData complicationData =
mActiveComplicationDataSparseArray.get(complicationId);
@@ -503,9 +497,7 @@
}
} else {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "No PendingIntent for complication " + complicationId + ".");
- }
+ Log.d(TAG, "No PendingIntent for complication " + complicationId + ".");
}
}
@@ -518,9 +510,8 @@
@Override
public void onAmbientModeChanged(boolean inAmbientMode) {
super.onAmbientModeChanged(inAmbientMode);
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
- }
+ Log.d(TAG, "onAmbientModeChanged: " + inAmbientMode);
+
mAmbient = inAmbientMode;
updateWatchPaintStyles();
@@ -666,9 +657,6 @@
@Override
public void onDraw(Canvas canvas, Rect bounds) {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "onDraw");
- }
long now = System.currentTimeMillis();
mCalendar.setTimeInMillis(now);
@@ -858,9 +846,6 @@
* Starts/stops the {@link #mUpdateTimeHandler} timer based on the state of the watch face.
*/
private void updateTimer() {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "updateTimer");
- }
mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME);
if (shouldTimerBeRunning()) {
mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME);
diff --git a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/DigitalWatchFaceService.java b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/DigitalWatchFaceService.java
index 17e4421..6392b5a 100644
--- a/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/DigitalWatchFaceService.java
+++ b/wearable/wear/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/watchface/DigitalWatchFaceService.java
@@ -58,6 +58,9 @@
import java.util.concurrent.TimeUnit;
/**
+ * IMPORTANT NOTE: This watch face is optimized for Wear 1.x. If you want to see a Wear 2.0 watch
+ * face, check out AnalogComplicationWatchFaceService.java.
+ *
* Sample digital watch face with blinking colons and seconds. In ambient mode, the seconds are
* replaced with an AM/PM indicator and the colons don't blink. On devices with low-bit ambient
* mode, the text is drawn without anti-aliasing in ambient mode. On devices which require burn-in