Skip to content

Commit 5a0e75b

Browse files
committed
use the variable names from wallpapers and watch faces verbatim
And add a few convenience functions
1 parent 602cec3 commit 5a0e75b

File tree

7 files changed

+168
-41
lines changed

7 files changed

+168
-41
lines changed

core/src/processing/a2d/PGraphicsAndroid2D.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void endDraw() {
232232
// }
233233

234234
if (primaryGraphics) {
235-
SurfaceHolder holder = parent.surface.getSurfaceHolder();
235+
SurfaceHolder holder = parent.getSurface().getSurfaceHolder();
236236
if (holder != null) {
237237
Canvas screen = null;
238238
try {

core/src/processing/android/PFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
129129
Bundle savedInstanceState) {
130130
if (sketch != null) {
131131
sketch.initSurface(inflater, container, savedInstanceState, this, null);
132-
return sketch.surface.getRootView();
132+
return sketch.getSurface().getRootView();
133133
} else {
134134
return null;
135135
}

core/src/processing/android/PWallpaper.java

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ public void onDestroy() {
143143
public class WallpaperEngine extends Engine implements ServiceEngine {
144144
private PApplet sketch;
145145
private float xOffset, xOffsetStep;
146+
private float yOffset, yOffsetStep;
147+
private int xPixelOffset, yPixelOffset;
146148

147149

148150
@Override
@@ -212,7 +214,11 @@ public void onOffsetsChanged(float xOffset, float yOffset,
212214

213215
if (sketch != null) {
214216
this.xOffset = xOffset;
217+
this.yOffset = yOffset;
215218
this.xOffsetStep = xOffsetStep;
219+
this.yOffsetStep = yOffsetStep;
220+
this.xPixelOffset = xPixelOffset;
221+
this.yPixelOffset = yPixelOffset;
216222

217223
sketch.homeScreenOffset = xOffset;
218224
if (0 < xOffsetStep) {
@@ -245,13 +251,43 @@ public void onDestroy() {
245251

246252

247253
@Override
248-
public float homeScreenOffset() {
254+
public float getXOffset() {
249255
return xOffset;
250256
}
251257

252258

253259
@Override
254-
public int homeScreenCount() {
260+
public float getYOffset() {
261+
return yOffset;
262+
}
263+
264+
265+
@Override
266+
public float getXOffsetStep() {
267+
return xOffsetStep;
268+
}
269+
270+
271+
@Override
272+
public float getYOffsetStep() {
273+
return yOffsetStep;
274+
}
275+
276+
277+
@Override
278+
public int getXPixelOffset() {
279+
return xPixelOffset;
280+
}
281+
282+
283+
@Override
284+
public int getYPixelOffset() {
285+
return yPixelOffset;
286+
}
287+
288+
289+
@Override
290+
public int getHomeScreenCount() {
255291
if (0 < xOffsetStep) {
256292
return (int)(1 + 1 / xOffsetStep);
257293
} else {
@@ -261,7 +297,13 @@ public int homeScreenCount() {
261297

262298

263299
@Override
264-
public boolean ambientMode() {
300+
public boolean isInAmbientMode() {
301+
return false;
302+
}
303+
304+
305+
@Override
306+
public boolean isInInteractiveMode() {
265307
return false;
266308
}
267309

@@ -273,37 +315,43 @@ public boolean isRound() {
273315

274316

275317
@Override
276-
public int insetLeft() {
318+
public boolean isSquare() {
319+
return false;
320+
}
321+
322+
323+
@Override
324+
public int getInsetLeft() {
277325
return 0;
278326
}
279327

280328

281329
@Override
282-
public int insetRight() {
330+
public int getInsetRight() {
283331
return 0;
284332
}
285333

286334

287335
@Override
288-
public int insetTop() {
336+
public int getInsetTop() {
289337
return 0;
290338
}
291339

292340

293341
@Override
294-
public int insetBottom() {
342+
public int getInsetBottom() {
295343
return 0;
296344
}
297345

298346

299347
@Override
300-
public boolean lowBitAmbient() {
348+
public boolean useLowBitAmbient() {
301349
return false;
302350
}
303351

304352

305353
@Override
306-
public boolean burnInProtection() {
354+
public boolean requireBurnInProtection() {
307355
return false;
308356
}
309357
}

core/src/processing/android/PWatchFaceCanvas.java

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,20 +379,50 @@ public void onDestroy() {
379379

380380

381381
@Override
382-
public float homeScreenOffset() {
382+
public float getXOffset() {
383383
return 0;
384384
}
385385

386386

387387
@Override
388-
public int homeScreenCount() {
388+
public float getYOffset() {
389389
return 0;
390390
}
391391

392392

393393
@Override
394-
public boolean ambientMode() {
395-
return isInAmbientMode();
394+
public float getXOffsetStep() {
395+
return 0;
396+
}
397+
398+
399+
@Override
400+
public float getYOffsetStep() {
401+
return 0;
402+
}
403+
404+
405+
@Override
406+
public int getXPixelOffset() {
407+
return 0;
408+
}
409+
410+
411+
@Override
412+
public int getYPixelOffset() {
413+
return 0;
414+
}
415+
416+
417+
@Override
418+
public int getHomeScreenCount() {
419+
return 0;
420+
}
421+
422+
423+
@Override
424+
public boolean isInInteractiveMode() {
425+
return !isInAmbientMode();
396426
}
397427

398428

@@ -403,37 +433,43 @@ public boolean isRound() {
403433

404434

405435
@Override
406-
public int insetLeft() {
436+
public boolean isSquare() {
437+
return !isRound;
438+
}
439+
440+
441+
@Override
442+
public int getInsetLeft() {
407443
return insetLeft;
408444
}
409445

410446

411447
@Override
412-
public int insetRight() {
448+
public int getInsetRight() {
413449
return insetRight;
414450
}
415451

416452

417453
@Override
418-
public int insetTop() {
454+
public int getInsetTop() {
419455
return insetTop;
420456
}
421457

422458

423459
@Override
424-
public int insetBottom() {
460+
public int getInsetBottom() {
425461
return insetBottom;
426462
}
427463

428464

429465
@Override
430-
public boolean lowBitAmbient() {
466+
public boolean useLowBitAmbient() {
431467
return lowBitAmbient;
432468
}
433469

434470

435471
@Override
436-
public boolean burnInProtection() {
472+
public boolean requireBurnInProtection() {
437473
return burnInProtection;
438474
}
439475
}

core/src/processing/android/PWatchFaceGLES.java

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -374,20 +374,50 @@ public void onDestroy() {
374374

375375

376376
@Override
377-
public float homeScreenOffset() {
377+
public float getXOffset() {
378378
return 0;
379379
}
380380

381381

382382
@Override
383-
public int homeScreenCount() {
383+
public float getYOffset() {
384384
return 0;
385385
}
386386

387387

388388
@Override
389-
public boolean ambientMode() {
390-
return isInAmbientMode();
389+
public float getXOffsetStep() {
390+
return 0;
391+
}
392+
393+
394+
@Override
395+
public float getYOffsetStep() {
396+
return 0;
397+
}
398+
399+
400+
@Override
401+
public int getXPixelOffset() {
402+
return 0;
403+
}
404+
405+
406+
@Override
407+
public int getYPixelOffset() {
408+
return 0;
409+
}
410+
411+
412+
@Override
413+
public int getHomeScreenCount() {
414+
return 0;
415+
}
416+
417+
418+
@Override
419+
public boolean isInInteractiveMode() {
420+
return !isInAmbientMode();
391421
}
392422

393423

@@ -398,37 +428,43 @@ public boolean isRound() {
398428

399429

400430
@Override
401-
public int insetLeft() {
431+
public boolean isSquare() {
432+
return !isRound;
433+
}
434+
435+
436+
@Override
437+
public int getInsetLeft() {
402438
return insetLeft;
403439
}
404440

405441

406442
@Override
407-
public int insetRight() {
443+
public int getInsetRight() {
408444
return insetRight;
409445
}
410446

411447

412448
@Override
413-
public int insetTop() {
449+
public int getInsetTop() {
414450
return insetTop;
415451
}
416452

417453

418454
@Override
419-
public int insetBottom() {
455+
public int getInsetBottom() {
420456
return insetBottom;
421457
}
422458

423459

424460
@Override
425-
public boolean lowBitAmbient() {
461+
public boolean useLowBitAmbient() {
426462
return lowBitAmbient;
427463
}
428464

429465

430466
@Override
431-
public boolean burnInProtection() {
467+
public boolean requireBurnInProtection() {
432468
return burnInProtection;
433469
}
434470
}

core/src/processing/android/ServiceEngine.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@
2727
public interface ServiceEngine extends PConstants {
2828
// Live wallpapers
2929
public boolean isPreview();
30-
public float homeScreenOffset();
31-
public int homeScreenCount();
30+
public float getXOffset();
31+
public float getYOffset();
32+
public float getXOffsetStep();
33+
public float getYOffsetStep();
34+
public int getXPixelOffset();
35+
public int getYPixelOffset();
36+
public int getHomeScreenCount();
3237

3338
// Watch faces
34-
public boolean ambientMode();
39+
public boolean isInAmbientMode();
40+
public boolean isInInteractiveMode();
3541
public boolean isRound();
42+
public boolean isSquare();
3643

37-
public int insetLeft();
38-
public int insetRight();
39-
public int insetTop();
40-
public int insetBottom();
44+
public int getInsetLeft();
45+
public int getInsetRight();
46+
public int getInsetTop();
47+
public int getInsetBottom();
4148

42-
public boolean lowBitAmbient();
43-
public boolean burnInProtection();
49+
public boolean useLowBitAmbient();
50+
public boolean requireBurnInProtection();
4451
}

0 commit comments

Comments
 (0)