File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 2323package processing .android ;
2424
2525import android .service .wallpaper .WallpaperService ;
26- import android .util .DisplayMetrics ;
26+ // import android.util.DisplayMetrics;
2727import android .view .MotionEvent ;
2828import android .view .SurfaceHolder ;
2929import android .view .WindowManager ;
3030import processing .core .PApplet ;
3131import android .util .Log ;
3232import android .os .Build ;
33- import android .view .WindowManager ;
33+ // import android.view.WindowManager;
3434import android .view .Display ;
3535import android .graphics .Point ;
3636
3737public class PWallpaper extends WallpaperService implements AppComponent {
3838 String TAG = "PWallpaper" ;
3939
4040 private Point size ;
41- private DisplayMetrics metrics ;
41+ // private DisplayMetrics metrics;
4242 private PEngine engine ;
4343
4444 public PWallpaper () {
@@ -116,6 +116,7 @@ public void onCreate(SurfaceHolder surfaceHolder) {
116116 if (sketch != null ) {
117117 sketch .initSurface (PWallpaper .this , getSurfaceHolder ());
118118 sketch .startSurface ();
119+ sketch .preview = isPreview ();
119120 // By default we don't get touch events, so enable them.
120121 setTouchEventsEnabled (true );
121122 }
Original file line number Diff line number Diff line change @@ -301,6 +301,11 @@ public class PApplet extends Object implements PConstants {
301301 public float offsetX = 0 ;
302302 public float offsetY = 0 ;
303303
304+ /**
305+ * Indicates if the wallpaper is in preview mode.
306+ */
307+ public boolean preview = false ;
308+
304309 /**
305310 * true if the applet is online.
306311 * <P>
You can’t perform that action at this time.
0 commit comments