Java Code Examples for android.view.View#SYSTEM_UI_FLAG_VISIBLE

The following examples show how to use android.view.View#SYSTEM_UI_FLAG_VISIBLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemUiHiderHoneycomb.java    From lantern with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link com.tudorluca.lantern.utils.SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 2
Source File: MainActivity.java    From MoeGallery with GNU General Public License v3.0 6 votes vote down vote up
@UiThread
public void showSystemUI() {

    cancelHideSystemUIDelayed();

    toolbar.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();

    int flags = 0;

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        flags = View.SYSTEM_UI_FLAG_VISIBLE;

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
    }
    getWindow().getDecorView().setSystemUiVisibility(flags);
}
 
Example 3
Source File: SystemUiHiderHoneycomb.java    From Easycam with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 4
Source File: SystemUiHiderHoneycomb.java    From support with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 5
Source File: SystemUiHiderHoneycomb.java    From VLC-Simple-Player-Android with MIT License 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 6
Source File: SystemUiHiderHoneycomb.java    From starcor.xul with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use {@link SystemUiHider#getInstance} to
 * obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= 0x00000400;// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= 0x00000400 //View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                      | 0x00000004; // View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= 0x00000200;//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= 0x00000200//View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                      | 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= 0x00000002;//View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 7
Source File: SystemUiHiderHoneycomb.java    From androidtv-VisualGameController with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 8
Source File: ImmersionBar.java    From a with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Hide bar.
 * 隐藏或显示状态栏和导航栏。
 *
 * @param uiFlags the ui flags
 * @return the int
 */

@SuppressLint("ObsoleteSdkInt")
private int hideBar(int uiFlags) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        switch (mBarParams.barHide) {
            case FLAG_HIDE_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.INVISIBLE;
                break;
            case FLAG_HIDE_STATUS_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.INVISIBLE;
                break;
            case FLAG_HIDE_NAVIGATION_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
                break;
            case FLAG_SHOW_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_VISIBLE;
                break;
        }
    }
    return uiFlags | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
 
Example 9
Source File: SystemUiHiderHoneycomb.java    From janus-gateway-android with MIT License 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 10
Source File: SystemUiHiderHoneycomb.java    From KinoCast with MIT License 6 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
    super(activity, anchorView, flags);

    mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
    mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

    if ((mFlags & FLAG_FULLSCREEN) != 0) {
        // If the client requested fullscreen, add flags relevant to hiding
        // the status bar. Note that some of these constants are new as of
        // API 16 (Jelly Bean). It is safe to use them, as they are inlined
        // at compile-time and do nothing on pre-Jelly Bean devices.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
        // If the client requested hiding navigation, add relevant flags.
        mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
}
 
Example 11
Source File: ImmersionBar.java    From ImmersionBar with Apache License 2.0 6 votes vote down vote up
/**
 * Hide bar.
 * 隐藏或显示状态栏和导航栏。
 *
 * @param uiFlags the ui flags
 * @return the int
 */
private int hideBar(int uiFlags) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        switch (mBarParams.barHide) {
            case FLAG_HIDE_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.INVISIBLE;
                break;
            case FLAG_HIDE_STATUS_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.INVISIBLE;
                break;
            case FLAG_HIDE_NAVIGATION_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
                break;
            case FLAG_SHOW_BAR:
                uiFlags |= View.SYSTEM_UI_FLAG_VISIBLE;
                break;
            default:
                break;
        }
    }
    return uiFlags | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
 
Example 12
Source File: SystemUiHiderHoneycomb.java    From react-native-3d-model-view with MIT License 5 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView,
		int flags) {
	super(activity, anchorView, flags);

	mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
	mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
	mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

	if ((mFlags & FLAG_FULLSCREEN) != 0) {
		// If the client requested fullscreen, add flags relevant to hiding
		// the status bar. Note that some of these constants are new as of
		// API 16 (Jelly Bean). It is safe to use them, as they are inlined
		// at compile-time and do nothing on pre-Jelly Bean devices.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				| View.SYSTEM_UI_FLAG_FULLSCREEN;
	}

	if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
		// If the client requested hiding navigation, add relevant flags.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
		mTestFlags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
	}
}
 
Example 13
Source File: StatusBarUtil.java    From HHComicViewer with Apache License 2.0 5 votes vote down vote up
/**
 * 打开状态栏,同样API16以上适用
 *
 * @param activity
 */
public static void showStatusBar(Activity activity) {
    if (Build.VERSION.SDK_INT < 16) {
        activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decorView = activity.getWindow().getDecorView();
        // Show Status Bar.
        int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
Example 14
Source File: SystemUiHiderHoneycomb.java    From comfortreader with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructor not intended to be called by clients. Use
 * {@link SystemUiHider#getInstance} to obtain an instance.
 */
protected SystemUiHiderHoneycomb(Activity activity, View anchorView,
		int flags) {
	super(activity, anchorView, flags);

	mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
	//geändert zugunsten des Platzes...
	//mShowFlags = View.SYSTEM_UI_FLAG_FULLSCREEN;
	mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
	mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;

	if ((mFlags & FLAG_FULLSCREEN) != 0) {
		// If the client requested fullscreen, add flags relevant to hiding
		// the status bar. Note that some of these constants are new as of
		// API 16 (Jelly Bean). It is safe to use them, as they are inlined
		// at compile-time and do nothing on pre-Jelly Bean devices.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
				| View.SYSTEM_UI_FLAG_FULLSCREEN;
	}

	if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
		// If the client requested hiding navigation, add relevant flags.
		mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
		mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
				| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
		mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
	}
}
 
Example 15
Source File: AndroidBarUtils.java    From AndroidBarUtils with Apache License 2.0 5 votes vote down vote up
/**
     * Android 6.0使用原始的主题适配
     *
     * @param activity Activity
     * @param darkMode 是否是黑色模式
     */
    public static void setBarDarkMode(Activity activity, boolean darkMode) {
        Window window = activity.getWindow();
        if (window == null) {
            return;
        }
        //设置StatusBar模式
        if (darkMode) {//黑色模式
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//设置statusBar和navigationBar为黑色
                    window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
                } else {//设置statusBar为黑色
                    window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
                }
            }
        } else {//白色模式
            int statusBarFlag = View.SYSTEM_UI_FLAG_VISIBLE;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                statusBarFlag = window.getDecorView().getSystemUiVisibility()
                        & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {//设置statusBar为白色,navigationBar为灰色
//                int navBarFlag = window.getDecorView().getSystemUiVisibility()
//                        & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;//如果想让navigationBar为白色,那么就使用这个代码。
                int navBarFlag = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
                window.getDecorView().setSystemUiVisibility(navBarFlag | statusBarFlag);
            } else {
                window.getDecorView().setSystemUiVisibility(statusBarFlag);
            }
        }
        setHuaWeiStatusBar(darkMode, window);
    }
 
Example 16
Source File: PStatusBarUtil.java    From YImagePicker with Apache License 2.0 4 votes vote down vote up
public static void setStatusBar(Activity activity, int bgColor, boolean isFullScreen, boolean isDarkStatusBarIcon) {
    //5.0以下不处理
    if (Build.VERSION.SDK_INT < 21) {
        return;
    }
    int option = 0;
    activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    //只有在6.0以上才改变状态栏颜色,否则在5.0机器上,电量条图标是白色的,标题栏也是白色的,就看不见电量条了了
    //在5.0上显示默认灰色背景色
    if (Build.VERSION.SDK_INT >= 23) {
        // 设置状态栏底色颜色
        activity.getWindow().setStatusBarColor(bgColor);
        //浅色状态栏,则让状态栏图标变黑,深色状态栏,则让状态栏图标变白
        if (isDarkStatusBarIcon) {
            if (isFullScreen) {
                option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            } else {
                option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
        } else {
            if (isFullScreen) {
                option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
            } else {
                option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
            }
        }
    } else {
        if (isFullScreen) {
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        } else {
            activity.getWindow().setStatusBarColor(bgColor);
            option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        }
    }
    activity.getWindow().getDecorView().setSystemUiVisibility(option);
}
 
Example 17
Source File: PStatusBarUtil.java    From YImagePicker with Apache License 2.0 4 votes vote down vote up
public static void setStatusBar(Activity activity, int bgColor, boolean isFullScreen, boolean isDarkStatusBarIcon) {
    //5.0以下不处理
    if (Build.VERSION.SDK_INT < 21) {
        return;
    }
    int option = 0;
    activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    //只有在6.0以上才改变状态栏颜色,否则在5.0机器上,电量条图标是白色的,标题栏也是白色的,就看不见电量条了了
    //在5.0上显示默认灰色背景色
    if (Build.VERSION.SDK_INT >= 23) {
        // 设置状态栏底色颜色
        activity.getWindow().setStatusBarColor(bgColor);
        //浅色状态栏,则让状态栏图标变黑,深色状态栏,则让状态栏图标变白
        if (isDarkStatusBarIcon) {
            if (isFullScreen) {
                option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            } else {
                option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
            }
        } else {
            if (isFullScreen) {
                option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
            } else {
                option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
            }
        }
    } else {
        if (isFullScreen) {
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
            option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        } else {
            activity.getWindow().setStatusBarColor(bgColor);
            option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        }
    }
    activity.getWindow().getDecorView().setSystemUiVisibility(option);
}
 
Example 18
Source File: LegacyPastePopupMenu.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void positionAt(int x, int y) {
    if (mRawPositionX == x && mRawPositionY == y) return;
    mRawPositionX = x;
    mRawPositionY = y;

    final View contentView = mContainer.getContentView();
    final int width = contentView.getMeasuredWidth();
    final int height = contentView.getMeasuredHeight();

    int positionX = (int) (x - width / 2.0f);
    int positionY = y - height - mLineOffsetY;

    int minOffsetY = 0;
    if (mParent.getSystemUiVisibility() == View.SYSTEM_UI_FLAG_VISIBLE) {
        minOffsetY = mStatusBarHeight;
    }

    final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
    if (positionY < minOffsetY) {
        // Vertical clipping, move under edited line and to the side of insertion cursor
        // TODO bottom clipping in case there is no system bar
        positionY += height;
        positionY += mLineOffsetY;

        // Move to right hand side of insertion cursor by default. TODO RTL text.
        final int handleHalfWidth = mWidthOffsetX / 2;

        if (x + width < screenWidth) positionX += handleHalfWidth + width / 2;
        else positionX -= handleHalfWidth + width / 2;
    } else {
        // Horizontal clipping
        positionX = Math.max(0, positionX);
        positionX = Math.min(screenWidth - width, positionX);
    }

    // Offseting with location in window.
    final int[] coords = new int[2];
    mParent.getLocationInWindow(coords);
    positionX += coords[0];
    positionY += coords[1];

    mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, positionX, positionY);
}
 
Example 19
Source File: SystemUiHelperImplICS.java    From turbo-editor with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected int createShowFlags() {
    return View.SYSTEM_UI_FLAG_VISIBLE;
}
 
Example 20
Source File: SystemUiHelperImplICS.java    From MHViewer with Apache License 2.0 4 votes vote down vote up
@Override
protected int createShowFlags() {
    return View.SYSTEM_UI_FLAG_VISIBLE;
}