Code example for FrameLayout

Methods: removeView, setSystemUiVisibility, setVisibility

0
        public void onHideCustomView() { 
            if (!inCustomView()) return; 
            ((SherlockFragmentActivity) mContext).getSupportActionBar().hide();
            if(Build.VERSION.SDK_INT > 11) showUI();
            mCustomView.setVisibility(View.GONE);
            mCustomViewContainer.removeView(mCustomView);
            mCustomView = null;
            mCustomViewContainer.setVisibility(View.GONE);
            mCustomViewCallback.onCustomViewHidden();
 
            ArticleWebView.this.setVisibility(View.VISIBLE);
            ArticleWebView.this.goBack();
        } 
 
        @Override 
        public void onShowCustomView(View view, CustomViewCallback callback) {
            ArticleWebView.this.setVisibility(View.GONE);
            if(Build.VERSION.SDK_INT > 11) hideUI();
            if (inCustomView()) { 
                callback.onCustomViewHidden();
                return; 
            } 
            ((SherlockFragmentActivity) mContext).getSupportActionBar().hide();
            mCustomViewContainer.addView(view);
            mCustomView = view;
            mCustomViewCallback = callback;
            mCustomViewContainer.setVisibility(View.VISIBLE);
        } 
 
        @TargetApi(11) 
        @SuppressWarnings("deprecation") 
        private void hideUI() { 
            if (Build.VERSION.SDK_INT >= 16)
                mCustomViewContainer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
            else if (Build.VERSION.SDK_INT >= 14)
                mCustomViewContainer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
            else 
                mCustomViewContainer.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
        } 
 
        @TargetApi(11) 
        @SuppressWarnings("deprecation") 
        private void showUI() { 
            if (Build.VERSION.SDK_INT >= 14)
                mCustomViewContainer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
            else 
                mCustomViewContainer.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
        } 
 
    }