Search in sources :

Example 1 with AbstractActivity

use of com.frostwire.android.gui.views.AbstractActivity in project frostwire by frostwire.

the class ImageViewerFragment method toggleFullScreen.

private void toggleFullScreen() {
    int newFlag = inFullScreenMode ? WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN : WindowManager.LayoutParams.FLAG_FULLSCREEN;
    int clearFlag = inFullScreenMode ? WindowManager.LayoutParams.FLAG_FULLSCREEN : WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN;
    getActivity().getWindow().clearFlags(clearFlag);
    getActivity().getWindow().addFlags(newFlag);
    int backgroundColor = getActivity().getResources().getColor(!inFullScreenMode ? R.color.black : R.color.app_background_body_light);
    containerLayout.setBackgroundColor(backgroundColor);
    if (!inFullScreenMode) {
        // so it doesn't finish the activity when destroyed
        actionModeCallback.setInFullScreenMode(true);
        actionModeCallback.getActionMode().finish();
    } else {
        actionModeCallback.setInFullScreenMode(false);
        startActionMode(actionModeCallback);
    }
    Toolbar actionBar = ((AbstractActivity) getActivity()).findToolbar();
    if (actionBar != null) {
        actionBar.setVisibility(!inFullScreenMode ? View.GONE : View.VISIBLE);
    }
    inFullScreenMode = !inFullScreenMode;
    LOG.info("toggleFullScreen() my position is " + position);
}
Also used : AbstractActivity(com.frostwire.android.gui.views.AbstractActivity) Point(android.graphics.Point) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Point (android.graphics.Point)1 Toolbar (android.support.v7.widget.Toolbar)1 AbstractActivity (com.frostwire.android.gui.views.AbstractActivity)1