Android ConditionVariable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ConditionVariable class.

This code example shows how to use the following methods:block, close
            } 
        } 
    }; 
    
    private void waitForPreviewDone() { 
        if (!mPreviewDone.block(WAIT_FOR_COMMAND_TO_COMPLETE)) {
            Log.v(TAG, "waitForPreviewDone: timeout");
        } 
        mPreviewDone.close();
    } 
 
    private void waitForSnapshotDone() { 
        if (!mSnapshotDone.block(MediaNames.WAIT_SNAPSHOT_TIME)) {
            // timeout could be expected or unexpected. The caller will decide. 
            Log.v(TAG, "waitForSnapshotDone: timeout");
        } 
        mSnapshotDone.close();
    } 
 
 
7
CodeRank
This code example shows how to use the following methods:block, close
        public android.hardware.Camera getCamera() {
            return mCamera;
        } 
 
        public void release() { 
            mSig.close();
            mCameraHandler.sendEmptyMessage(RELEASE);
            mSig.block();
        } 
 
        public void reconnect() throws IOException { 
            mSig.close();
            mCameraHandler.sendEmptyMessage(RECONNECT);
            mSig.block();
            if (mReconnectException != null) {
                throw mReconnectException;
            } 
        } 
 
        public void unlock() { 
6
CodeRank
This code example shows how to use the following methods:block, close
    private int mHeight; // height of the view in UI
 
    private boolean mIsLandscape = true;
    private final float[] mTransformMatrix = new float[16];
 
    private ConditionVariable mEglThreadBlockVar = new ConditionVariable();
    private HandlerThread mEglThread;
    private EGLHandler mEglHandler;
 
    private EGLConfig mEglConfig;
    private EGLDisplay mEglDisplay;
    private EGLContext mEglContext;
    private EGLSurface mEglSurface;
    private SurfaceTexture mMosaicOutputSurfaceTexture;
    private SurfaceTexture mInputSurfaceTexture;
    private EGL10 mEgl;
    private GL10 mGl;
 
    private class EGLHandler extends Handler {
        public static final int MSG_INIT_EGL_SYNC = 0;

6
CodeRank
This code example shows how to use the following methods:block, close
            } 
        } 
 
        // Should be called from other thread. 
        public void sendMessageSync(int msg) {
            mEglThreadBlockVar.close();
            sendEmptyMessage(msg);
            mEglThreadBlockVar.block();
        } 
 
    } 
 
    public MosaicPreviewRenderer(SurfaceTexture tex, int w, int h, boolean isLandscape) {
        mMosaicOutputSurfaceTexture = tex;
        mWidth = w;
        mHeight = h;
        mIsLandscape = isLandscape;
 
        mEglThread = new HandlerThread("PanoramaRealtimeRenderer");
        mEglThread.start();
6
CodeRank
This code example shows how to use the following methods:open
            if (rawDataLength > 0) {
                rawPreviewCallbackResult = true;
            } else { 
                rawPreviewCallbackResult = false;
            } 
            mPreviewDone.open();
            Log.v(TAG, "Preview callback stop");
        } 
    }; 
     
    //Implement the shutterCallback 
    private final class TestShutterCallback implements ShutterCallback {
        public void onShutter() { 
            shutterCallbackResult = true;
            Log.v(TAG, "onShutter called");
        } 
    }; 
     
    //Implement the RawPictureCallback 
    private final class RawPictureCallback implements PictureCallback { 
6
CodeRank
This code example shows how to use the following methods:open
                    } catch (RuntimeException e) {
                        Log.w(TAG, "take picture failed; cameraState:" + cameraState
                            + ", focusState:" + focusState);
                        throw e;
                    } 
                    mSig.open();
                } 
            }); 
            mSig.block();
        } 
 
        public void setDisplayOrientation(int degrees) {
            mSig.close();
            mCameraHandler.obtainMessage(SET_DISPLAY_ORIENTATION, degrees, 0)
                    .sendToTarget();
            mSig.block();
        } 
 
        public void setZoomChangeListener(OnZoomChangeListener listener) {
            mSig.close();
5
CodeRank
This code example shows how to use the following methods:block, close
            } 
        } 
    }; 
    
    private void waitForPreviewDone() { 
        if (!mPreviewDone.block(WAIT_FOR_COMMAND_TO_COMPLETE)) {
            Log.v(TAG, "waitForPreviewDone: timeout");
        } 
        mPreviewDone.close();
    } 
 
    private void waitForSnapshotDone() { 
        if (!mSnapshotDone.block(MediaNames.WAIT_SNAPSHOT_TIME)) {
            // timeout could be expected or unexpected. The caller will decide. 
            Log.v(TAG, "waitForSnapshotDone: timeout");
        } 
        mSnapshotDone.close();
    } 
 
 
5
CodeRank
This code example shows how to use the following methods:block
 
public final class SettingsTests extends AndroidTestCase {
 
    @SmallTest @MediumTest @LargeTest 
    public void testGetExecutor() { 
        final ConditionVariable condition = new ConditionVariable();
 
        Settings.getExecutor().execute(new Runnable() {
            @Override 
            public void run() { 
                condition.open();
            } 
        }); 
 
        boolean success = condition.block(5000);
        assertTrue(success);
    } 
 
    @SmallTest @MediumTest @LargeTest 
    public void testSetExecutor() { 
5
CodeRank
This code example shows how to use the following methods:open
                    mCamera = null;
                    mCameraProxy = null;
                } 
                throw e;
            } 
            mSig.open();
        } 
    } 
 
    @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN) 
    private void setAutoFocusMoveCallback(android.hardware.Camera camera,
            Object cb) {
        camera.setAutoFocusMoveCallback((AutoFocusMoveCallback) cb);
    } 
 
    // Open camera synchronously. This method is invoked in the context of a 
    // background thread. 
    CameraProxy cameraOpen(int cameraId) {
        // Cannot open camera in mCameraHandler, otherwise all camera events 
        // will be routed to mCameraHandler looper, which in turn will call 
5
CodeRank
This code example shows how to use the following methods:block, close, sleep
	} 
 
	private class TakePictureTask extends AsyncTask<Void, Void, Void> {
		protected Void doInBackground(Void... urls) {
			Log.d(TAG, "Wait");
			sync.block();
			try { 
				Thread.sleep(500);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block 
				Log.d(TAG, "Sleep threw an exception");
				e.printStackTrace();
			} 
			mCamera.takePicture(null, null, mPicture);
			Log.w(TAG, "We're taking pictures, bastards!!!");
			sync.close();
			// cancel(true); 
			return null; 
		} 
 
		protected void onPostExecute(Void result) {
5
CodeRank

Related Android ConditionVariable Questions & Answers:

See Code Examples for Android ConditionVariable Methods: