@Override
  public void onPause() {
    stopChoreographerThread();

    final CountDownLatch cdl;
    if (null != mSurfaceView) {
      mSurfaceView.onPause();
      cdl = new CountDownLatch(1);
      mSurfaceView.queueEvent(
          new Runnable() {
            @Override
            public void run() {
              // these two must happen on the gl thread
              nativeLeaveVrMode(mPtr);
              destroySurfaceForTimeWarp();
              cdl.countDown();
            }
          });
    } else {
      cdl = null;
    }

    if (mVrApiInitialized) {
      if (null != cdl) {
        try {
          cdl.await();
        } catch (final InterruptedException ignored) {
        }
      }
      nativeUninitializeVrApi(mPtr);
      mVrApiInitialized = false;
    }
  }
 /** onClick handler for "record" button. */
 public void clickToggleRecording(@SuppressWarnings("unused") View unused) {
   mRecordingEnabled = !mRecordingEnabled;
   mGLView.queueEvent(
       new Runnable() {
         @Override
         public void run() {
           // notify the renderer that we want to change the encoder's state
           mRenderer.changeRecordingState(mRecordingEnabled);
         }
       });
   updateControls();
 }
Exemplo n.º 3
0
  /*----------------------queueEvent-------------------------------------------------------------------------------*/
  @Override
  public void queueEvent(Runnable r) {

    Log.d(TAG, "queueEvent()");

    if (mRenderer.MidasisInitialized) {
      Log.d(TAG, "mRenderer.isInitialized == true");
      super.queueEvent(r);
    } else {
      Log.d(TAG, "mRenderer.isInitialized == false");
      mRenderer.queuePostInitEvent(r);
    }
  }
  // spinner selected
  @Override
  public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
    Spinner spinner = (Spinner) parent;
    final int filterNum = spinner.getSelectedItemPosition();

    Log.d(TAG, "onItemSelected: " + filterNum);
    mGLView.queueEvent(
        new Runnable() {
          @Override
          public void run() {
            // notify the renderer that we want to change the encoder's state
            mRenderer.changeFilterMode(filterNum);
          }
        });
  }
 @Override
 protected void onPause() {
   Log.d(TAG, "onPause -- releasing camera");
   super.onPause();
   releaseCamera();
   mGLView.queueEvent(
       new Runnable() {
         @Override
         public void run() {
           // Tell the renderer that it's about to be paused so it can clean up.
           mRenderer.notifyPausing();
         }
       });
   mGLView.onPause();
   Log.d(TAG, "onPause complete");
 }
Exemplo n.º 6
0
 @Override
 protected void onResume() {
   Log.d(TAG, "onResume -- acquiring camera");
   super.onResume();
   updateControls();
   // openCamera(640, 480);      // updates mCameraPreviewWidth/Height
   openCamera(1280, 720); // updates mCameraPreviewWidth/Height
   mGLView.onResume();
   mGLView.queueEvent(
       new Runnable() {
         @Override
         public void run() {
           mRenderer.setCameraPreviewSize(mCameraPreviewWidth, mCameraPreviewHeight);
         }
       });
   Log.d(TAG, "onResume complete: " + this);
 }
  @Override
  protected void onResume() {
    Log.d(TAG, "onResume -- acquiring camera");
    super.onResume();
    updateControls();
    openCamera(1080, 1080); // updates mCameraPreviewWidth/Height

    // Set the preview aspect ratio.
    AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.cameraPreview_afl);
    layout.setAspectRatio((double) mCameraPreviewWidth / mCameraPreviewHeight);

    mGLView.onResume();
    mGLView.queueEvent(
        new Runnable() {
          @Override
          public void run() {
            mRenderer.setCameraPreviewSize(mCameraPreviewWidth, mCameraPreviewHeight);
          }
        });
    Log.d(TAG, "onResume complete: " + this);
  }