コード例 #1
0
ファイル: GLView.java プロジェクト: sparksunflower/MD.emu
 @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;
 }
コード例 #2
0
  public void exit() {
    finish();
    // 延迟半秒杀进程
    new Handler(Looper.getMainLooper())
        .postDelayed(
            new Runnable() {

              @Override
              public void run() {
                AndyLog.i("andygzyu", "kill process in main called.last create time");
                Process.killProcess(Process.myPid());
              }
            },
            800);
  }
コード例 #3
0
 public static Scheduler getUiThreadScheduler() {
   return shadowOf(Looper.getMainLooper()).getScheduler();
 }
コード例 #4
0
ファイル: Util.java プロジェクト: gubo/slipwire
 public static void assertMainThread() {
   if (Looper.myLooper() != Looper.getMainLooper()) {
     throw new RuntimeException();
   }
 }