Beispiel #1
0
 @Override
 public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
   /*Log.i(logTag, "surfaceChanged " + Integer.toString(w) + " " + Integer.toString(h)
   + " " + getHolder().getSurfaceFrame().toString());*/
   if (mEglHelper.mEglContext == null) {
     // Log.i(logTag, "context lost");
     return;
   }
   if (!initNative) {
     handler = new Handler();
     nativeInit(w, h);
     queue = Looper.myQueue();
     queue.addIdleHandler(this);
     idleHandlerActive = true;
     initNative = true;
   } else {
     nativeResize(w, h);
     postUpdate();
     if (initSurface == true
         && android.os.Build.VERSION.SDK_INT
             >= 11) // HACK: resize is from a screen rotation, do swap() again or display may not
     // render, Android bug? Custom rotation animation in pre 3.0 redraws the screen
     // at least one more time anyway
     {
       // Log.i(logTag, "extra swap after rotation");
       mEglHelper.swap();
     }
   }
   initSurface = true;
 }
Beispiel #2
0
 public static Scheduler getUiThreadScheduler() {
   return shadowOf(Looper.getMainLooper()).getScheduler();
 }