Skip to content

Commit fc80c87

Browse files
committed
set surface ready for watch faces
1 parent 8e4b52c commit fc80c87

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

core/src/processing/a2d/PSurfaceAndroid2D.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ public PSurfaceAndroid2D(PGraphics graphics, AppComponent component, SurfaceHold
5353
} else if (component.getKind() == AppComponent.WATCHFACE) {
5454
watchface = (CanvasWatchFaceService)component;
5555
surfaceView = null;
56+
// Set as ready here, as watch faces don't have a surface view with a
57+
// surfaceCreate() event to do it.
58+
surfaceReady = true;
5659
}
5760
}
5861

core/src/processing/android/PWatchFaceCanvas.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ public void requestDraw() {
108108

109109

110110
public boolean canDraw() {
111-
// The rendering loop should never call handleDraw() directly, it only needs to invalidate the
112-
// screen
111+
// The rendering loop should never call handleDraw() directly,
112+
// it only needs to invalidate the screen
113113
return false;
114114
}
115115

@@ -144,15 +144,10 @@ private class CanvasEngine extends CanvasWatchFaceService.Engine implements Serv
144144
private boolean lowBitAmbient = false;
145145
private boolean burnInProtection = false;
146146

147-
@SuppressWarnings("deprecation")
148147
@Override
149148
public void onCreate(SurfaceHolder surfaceHolder) {
150149
super.onCreate(surfaceHolder);
151150
setWatchFaceStyle(new WatchFaceStyle.Builder(PWatchFaceCanvas.this)
152-
.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
153-
.setAmbientPeekMode(WatchFaceStyle.AMBIENT_PEEK_MODE_HIDDEN)
154-
.setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
155-
.setShowSystemUiTime(false)
156151
.setAcceptsTapEvents(true)
157152
.build());
158153
sketch = createSketch();

core/src/processing/android/PWatchFaceGLES.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,10 @@ private class GLES2Engine extends Gles2WatchFaceService.Engine implements
143143
private boolean lowBitAmbient = false;
144144
private boolean burnInProtection = false;
145145

146-
147-
@SuppressWarnings("deprecation")
148146
@Override
149147
public void onCreate(SurfaceHolder surfaceHolder) {
150148
super.onCreate(surfaceHolder);
151149
setWatchFaceStyle(new WatchFaceStyle.Builder(PWatchFaceGLES.this)
152-
.setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
153-
.setAmbientPeekMode(WatchFaceStyle.AMBIENT_PEEK_MODE_HIDDEN)
154-
.setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
155-
.setShowSystemUiTime(false)
156150
.setAcceptsTapEvents(true)
157151
.build());
158152
sketch = createSketch();

0 commit comments

Comments
 (0)