Java Code Examples for android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE

The following examples show how to use android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE . 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: XanderPanel.java    From XanderPanel with Apache License 2.0 6 votes vote down vote up
private void setStatusBarAndNavigationBarColor(int gravity) {
    mGravity = gravity;
    if (Build.VERSION.SDK_INT >= 21) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        if (Gravity.TOP == mGravity) {
            getWindow().setStatusBarColor(statusBarColor);
            getWindow().setNavigationBarColor(0x00000000);
        } else if (Gravity.BOTTOM == mGravity) {
            getWindow().setStatusBarColor(0x00000000);
            getWindow().setNavigationBarColor(navigationBarColor);
        } else {
            getWindow().setStatusBarColor(0x00000000);
            getWindow().setNavigationBarColor(0x00000000);
        }
    }
}
 
Example 2
Source File: Util.java    From DMusic with Apache License 2.0 6 votes vote down vote up
/**
 * 隐藏状态栏&&导航栏
 */
public static void hideSystemUI(Activity activity, View... views) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        // 4.1 above API level 16
        int uist = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LOW_PROFILE
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            uist |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }
        View decorView = activity.getWindow().getDecorView();
        decorView.setSystemUiVisibility(uist);
        // Some views can setFitsSystemWindows(true), setPadding()
        setFitsPadding(0, getStatusBarHeight(activity), getNavigationBarHeight(activity), 0, views);
    } else {
        WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
        attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        activity.getWindow().setAttributes(attrs);
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }
}
 
Example 3
Source File: BaseActivity.java    From PicKing with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    changeTheme((String) SPUtils.get(this, AppConfig.choose_theme, AppConfig.DEFAULT_COLOR));
    super.onCreate(savedInstanceState);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
        localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
        }
    }
}
 
Example 4
Source File: ExoVideoPlaybackControlView.java    From ExoVideoView with Apache License 2.0 6 votes vote down vote up
private void changeSystemUiVisibilityLandscape() {
    WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
    if (windowManager == null) {
        return;
    }

    int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        flag |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }

    videoViewAccessor.attachVideoView().setSystemUiVisibility(flag);
}
 
Example 5
Source File: SystemUiHelperImplJB.java    From MHViewer with Apache License 2.0 6 votes vote down vote up
@Override
protected int createHideFlags() {
    int flag = super.createHideFlags();

    if (mLevel >= SystemUiHelper.LEVEL_HIDE_STATUS_BAR) {
        flag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_FULLSCREEN;

        if (mLevel >= SystemUiHelper.LEVEL_LEAN_BACK) {
            flag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        }
    }

    return flag;
}
 
Example 6
Source File: ExoVideoControlsMobile.java    From v9porn with MIT License 6 votes vote down vote up
/**
 * Determines the appropriate fullscreen flags based on the
 * systems API version.
 *
 * @return The appropriate decor view flags to enter fullscreen mode when supported
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private int getFullscreenUiFlags() {
    int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        flags |= View.SYSTEM_UI_FLAG_IMMERSIVE;
    }
    return flags;
}
 
Example 7
Source File: TransparentActivity.java    From Rucky with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    View view = getWindow().getDecorView();
    view.setSystemUiVisibility(flags);
    setContentView(R.layout.activity_transparent);
    new Handler().postDelayed(this::launchNext, 2000);
}
 
Example 8
Source File: WebPlayerActivity.java    From mv-android-client with Apache License 2.0 5 votes vote down vote up
@SuppressLint("ObsoleteSdkInt")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (BuildConfig.BACK_BUTTON_QUITS) {
        createQuitDialog();
    }

    mSystemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            mSystemUiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }
    }

    mPlayer = PlayerHelper.create(this);

    mPlayer.setKeepScreenOn();

    setContentView(mPlayer.getView());

    if (!addBootstrapInterface(mPlayer)) {
        Uri.Builder projectURIBuilder = Uri.fromFile(new File(getString(R.string.mv_project_index))).buildUpon();
        Bootstrapper.appendQuery(projectURIBuilder, getString(R.string.query_noaudio));
        if (BuildConfig.SHOW_FPS) {
            Bootstrapper.appendQuery(projectURIBuilder, getString(R.string.query_showfps));
        }
        mPlayer.loadUrl(projectURIBuilder.build().toString());
    }
}
 
Example 9
Source File: ProfileActivity.java    From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 5 votes vote down vote up
private void setupStatusBar() {
    Window window = getWindow();
    View decorView = window.getDecorView();
    //两个 flag 要结合使用,表示让应用的主体内容占用系统状态栏的空间
    int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    decorView.setSystemUiVisibility(option);
    getWindow().setStatusBarColor(Color.TRANSPARENT);
}
 
Example 10
Source File: BaseActivity.java    From timecat with Apache License 2.0 5 votes vote down vote up
/**
 * <半透明状态栏>
 * 半透明状态栏,fitsSystemWindows=false
 * public void init(Bundle savedInstanceState) {
 * setHalfTransparent();
 * setFitSystemWindow(false);
 * }
 * 半透明状态栏,fitsSystemWindows=true
 * public void init(Bundle savedInstanceState) {
 * setHalfTransparent();
 * setFitSystemWindow(true);
 * }
 * </半透明状态栏>
 */
protected void setHalfTransparent() {

    if (Build.VERSION.SDK_INT >= 21) {//21表示5.0
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

    } else if (Build.VERSION.SDK_INT >= 19) {//19表示4.4
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        //虚拟键盘也透明
        // getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
    }
}
 
Example 11
Source File: Utils.java    From TubiPlayer with MIT License 5 votes vote down vote up
public static void hideSystemUI(@NonNull final Activity activity, final boolean immediate, final int delayMs) {
    View decorView = activity.getWindow().getDecorView();
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    int uiState = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
            | View.SYSTEM_UI_FLAG_FULLSCREEN; // hide status bar
    if (Util.SDK_INT > 18) {
        uiState |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                | View.SYSTEM_UI_FLAG_IMMERSIVE;
    } else {
        final Handler handler = new Handler();
        decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int visibility) {
                if (visibility == View.VISIBLE) {
                    Runnable runnable = new Runnable() {
                        @Override
                        public void run() {
                            hideSystemUI(activity, false);
                        }
                    };
                    if (immediate) {
                        handler.post(runnable);
                    } else {
                        handler.postDelayed(runnable, delayMs);
                    }
                }
            }
        });
    }
    decorView.setSystemUiVisibility(uiState);
}
 
Example 12
Source File: DUtils.java    From UTubeTV with The Unlicense 5 votes vote down vote up
public static String systemUIVisibilityString(View theView) {
  int crap = theView.getWindowSystemUiVisibility();

  int duhs[] = {View.SYSTEM_UI_FLAG_LOW_PROFILE, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION, View.SYSTEM_UI_FLAG_FULLSCREEN, View.SYSTEM_UI_FLAG_LAYOUT_STABLE, View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, View.SYSTEM_UI_FLAG_IMMERSIVE, View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY};
  String result = "OK: 0";

  for (int duh : duhs) {
    if ((crap & duh) == duh) {
      switch (duh) {
        case View.SYSTEM_UI_FLAG_LOW_PROFILE:
          result += " | SYSTEM_UI_FLAG_LOW_PROFILE";
          break;
        case View.SYSTEM_UI_FLAG_HIDE_NAVIGATION:
          result += " | SYSTEM_UI_FLAG_HIDE_NAVIGATION";
          break;
        case View.SYSTEM_UI_FLAG_FULLSCREEN:
          result += " | SYSTEM_UI_FLAG_FULLSCREEN";
          break;
        case View.SYSTEM_UI_FLAG_LAYOUT_STABLE:
          result += " | SYSTEM_UI_FLAG_LAYOUT_STABLE";
          break;
        case View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION:
          result += " | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION";
          break;
        case View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN:
          result += " | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN";
          break;
        case View.SYSTEM_UI_FLAG_IMMERSIVE:
          result += " | SYSTEM_UI_FLAG_IMMERSIVE";
          break;
        case View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY:
          result += " | SYSTEM_UI_FLAG_IMMERSIVE_STICKY";
          break;
      }
    }
  }

  return result;
}
 
Example 13
Source File: BarUtils.java    From Android-utils with Apache License 2.0 5 votes vote down vote up
public static void transparentStatusBar(final Window window) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        int option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
        int vis = window.getDecorView().getSystemUiVisibility();
        window.getDecorView().setSystemUiVisibility(option | vis);
        window.setStatusBarColor(Color.TRANSPARENT);
    } else {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
}
 
Example 14
Source File: MainActivity.java    From GLEXP-Team-onebillion with Apache License 2.0 5 votes vote down vote up
public void setupWindowVisibilityFlags()
{
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    //
    final View decorView = getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener()
    {

        @Override
        public void onSystemUiVisibilityChange (int visibility)
        {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
            {
                decorView.setSystemUiVisibility(flags);
            }
        }
    });
    //
    decorView.setSystemUiVisibility(flags);
    //
    // disable the lock screen when the app is running
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
}
 
Example 15
Source File: VideoPlayWebActivity.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
@Override
    public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) {

        super.onCreate(savedInstanceState, persistentState);
//        requestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏标题
//        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
//                WindowManager.LayoutParams.FLAG_FULLSCREEN);//设置全屏


        final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

        // This work only for android 4.4+
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

            getWindow().getDecorView().setSystemUiVisibility(flags);

            // Code below is to handle presses of Volume up or Volume down.
            // Without this, after pressing volume buttons, the navigation bar will
            // show up and won't hide
            final View decorView = getWindow().getDecorView();
            decorView
                    .setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {

                        @Override
                        public void onSystemUiVisibilityChange(int visibility) {
                            if (((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
                                    && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                                decorView.setSystemUiVisibility(flags);
                            }
                        }
                    });
        }


    }
 
Example 16
Source File: PasscodeActivity3.java    From PasscodeView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= 21) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }

    setContentView(R.layout.activity_passcode3);
    PasscodeView passcodeView = (PasscodeView) findViewById(R.id.passcodeView);
    passcodeView
            .setPasscodeLength(4)
            .setLocalPasscode("5555")
            .setListener(new PasscodeView.PasscodeViewListener() {
                @Override
                public void onFail(String wrongNumber) {
                    Toast.makeText(getApplication(),"Wrong!!",Toast.LENGTH_SHORT).show();
                }

        @Override
        public void onSuccess(String number) {
            Toast.makeText(getApplication(), "finish", Toast.LENGTH_SHORT).show();
            onBackPressed();
        }
    });
}
 
Example 17
Source File: ImmersionBar.java    From a with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 初始化状态栏和导航栏
 */
private void initBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        int uiFlags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE;  //防止系统栏隐藏时内容区域大小发生变化
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !OSUtils.isEMUI3_1()) {
            uiFlags = initBarAboveLOLLIPOP(uiFlags); //初始化5.0以上,包含5.0
            uiFlags = setStatusBarDarkFont(uiFlags); //android 6.0以上设置状态栏字体为暗色
            uiFlags = setNavigationBarLightFont(uiFlags);
            supportActionBar();
        } else {
            initBarBelowLOLLIPOP(); //初始化5.0以下,4.4以上沉浸式
            solveNavigation();  //解决android4.4有导航栏的情况下,activity底部被导航栏遮挡的问题和android 5.0以下解决状态栏和布局重叠问题
        }
        uiFlags = hideBar(uiFlags);  //隐藏状态栏或者导航栏
        mWindow.getDecorView().setSystemUiVisibility(uiFlags);
        hideStatusBar(mBarParams.barHide == BarHide.FLAG_HIDE_STATUS_BAR || mBarParams.barHide == BarHide.FLAG_HIDE_BAR);
    }
    if (OSUtils.isMIUI6Later())
        setMIUIStatusBarDarkFont(mWindow, mBarParams.darkFont);         //修改miui状态栏字体颜色
    if (OSUtils.isFlymeOS4Later()) {          // 修改Flyme OS状态栏字体颜色
        if (mBarParams.flymeOSStatusBarFontColor != 0) {
            FlymeOSStatusBarFontUtils.setStatusBarDarkIcon(mActivity, mBarParams.flymeOSStatusBarFontColor);
        } else {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
                FlymeOSStatusBarFontUtils.setStatusBarDarkIcon(mActivity, mBarParams.darkFont);
        }
    }
}
 
Example 18
Source File: MainActivity.java    From Sunshine with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //设置透明状态栏
        if (Build.VERSION.SDK_INT >= 21) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
            getWindow().setStatusBarColor(Color.TRANSPARENT);
        }

        binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        viewModel = new MainActivityViewModel(this, binding);
        binding.setViewModel(viewModel);

        EventBus.getDefault().register(this);
        registerMQMessageReceiver();

        initViews();

//        final String FILE_PATH = Environment.getExternalStorageDirectory() + File.separator + "Sunshine";
//        SkinManager.getInstance().setSkinConfig(this,
//                FILE_PATH + File.separator + "sunshine_christmas_1712121455.skin",
//                "2017-11-28 00:00:00",
//                "2017-12-25 23:59:59"
//        );

//        downloadSkin("sunshine_christmas_1712121455.skin",
//                "https://raw.githubusercontent.com/CooLoongWu/Sunshine/master/skin/sunshine_christmas_1712121455.skin");
    }
 
Example 19
Source File: DualCameraPreview.java    From AndroidUsbCamera with Apache License 2.0 5 votes vote down vote up
private void hideNavigationBar() {
    View decorView = getWindow().getDecorView();
    // Hide both the navigation bar and the status bar.
    // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
    // a general rule, you should design your app to hide the status bar whenever you
    // hide the navigation bar.
    int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

    decorView.setSystemUiVisibility(uiOptions);
}
 
Example 20
Source File: TabMainActivity.java    From imsdk-android with MIT License 5 votes vote down vote up
private void initAction() {
        if (Build.VERSION.SDK_INT >= 21) {
            View decorView = getWindow().getDecorView();
            int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
            decorView.setSystemUiVisibility(option);
            getWindow().setStatusBarColor(Color.TRANSPARENT);
        }
//        ActionBar actionBar = getSupportActionBar();
//        actionBar.hide();
    }