Search in sources :

Example 1 with Circle

use of com.rodolfonavalon.shaperipplelibrary.model.Circle in project ring-client-android by savoirfairelinux.

the class TVCallFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    mScreenWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "cx.ring.onIncomingCall");
    mScreenWakeLock.setReferenceCounted(false);
    if (mScreenWakeLock != null && !mScreenWakeLock.isHeld()) {
        mScreenWakeLock.acquire();
    }
    mVideoSurface.getHolder().setFormat(PixelFormat.RGBA_8888);
    mVideoSurface.getHolder().addCallback(new SurfaceHolder.Callback() {

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            presenter.videoSurfaceCreated(holder);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            presenter.videoSurfaceDestroyed();
        }
    });
    mVideoPreview.getHolder().setFormat(PixelFormat.RGBA_8888);
    mVideoPreview.getHolder().addCallback(new SurfaceHolder.Callback() {

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            presenter.previewVideoSurfaceCreated(holder);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            presenter.previewVideoSurfaceDestroyed();
        }
    });
    mVideoPreview.setZOrderMediaOverlay(true);
    shapeRipple.setRippleShape(new Circle());
    handler = new Handler();
    runnable = () -> presenter.uiVisibilityChanged(false);
}
Also used : PowerManager(android.os.PowerManager) SurfaceHolder(android.view.SurfaceHolder) Circle(com.rodolfonavalon.shaperipplelibrary.model.Circle) Handler(android.os.Handler)

Example 2 with Circle

use of com.rodolfonavalon.shaperipplelibrary.model.Circle in project ring-client-android by savoirfairelinux.

the class CallFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    setHasOptionsMenu(true);
    super.onViewCreated(view, savedInstanceState);
    mCurrentOrientation = getResources().getConfiguration().orientation;
    PowerManager powerManager = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
    mScreenWakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "cx.ring.onIncomingCall");
    mScreenWakeLock.setReferenceCounted(false);
    if (mScreenWakeLock != null && !mScreenWakeLock.isHeld()) {
        mScreenWakeLock.acquire();
    }
    displayListener = new DisplayManager.DisplayListener() {

        @Override
        public void onDisplayAdded(int displayId) {
        }

        @Override
        public void onDisplayRemoved(int displayId) {
        }

        @Override
        public void onDisplayChanged(int displayId) {
            getActivity().runOnUiThread(() -> presenter.displayChanged());
        }
    };
    mVideoSurface.getHolder().setFormat(PixelFormat.RGBA_8888);
    mVideoSurface.getHolder().addCallback(new SurfaceHolder.Callback() {

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            presenter.videoSurfaceCreated(holder);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            presenter.videoSurfaceDestroyed();
        }
    });
    view.addOnLayoutChangeListener((parent, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> presenter.layoutChanged());
    view.setOnSystemUiVisibilityChangeListener(visibility -> {
        boolean ui = (visibility & (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN)) == 0;
        presenter.uiVisibilityChanged(ui);
    });
    mVideoPreview.getHolder().setFormat(PixelFormat.RGBA_8888);
    mVideoPreview.getHolder().addCallback(new SurfaceHolder.Callback() {

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            presenter.previewVideoSurfaceCreated(holder);
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            presenter.previewVideoSurfaceDestroyed();
        }
    });
    mVideoPreview.setZOrderMediaOverlay(true);
    shapeRipple.setRippleShape(new Circle());
}
Also used : PowerManager(android.os.PowerManager) SurfaceHolder(android.view.SurfaceHolder) Circle(com.rodolfonavalon.shaperipplelibrary.model.Circle) DisplayManager(android.hardware.display.DisplayManager)

Aggregations

PowerManager (android.os.PowerManager)2 SurfaceHolder (android.view.SurfaceHolder)2 Circle (com.rodolfonavalon.shaperipplelibrary.model.Circle)2 DisplayManager (android.hardware.display.DisplayManager)1 Handler (android.os.Handler)1