Example usage for android.view Window addFlags

List of usage examples for android.view Window addFlags

Introduction

In this page you can find the example usage for android.view Window addFlags.

Prototype

public void addFlags(int flags) 

Source Link

Document

Convenience function to set the flag bits as specified in flags, as per #setFlags .

Usage

From source file:org.getlantern.firetweet.activity.support.HomeActivity.java

/**
 * Called when the context is first created.
 *//* www . j  a  v  a 2  s .c  o  m*/
@Override
protected void onCreate(final Bundle savedInstanceState) {
    final Window window = getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    super.onCreate(savedInstanceState);
    if (!isDatabaseReady(this)) {
        Toast.makeText(this, R.string.preparing_database_toast, Toast.LENGTH_SHORT).show();
        finish();
        return;
    }

    ha = this;

    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    mTwitterWrapper = getTwitterWrapper();
    mReadStateManager = FiretweetApplication.getInstance(this).getReadStateManager();
    mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mMultiSelectHandler = new MultiSelectEventHandler(this);
    mHotKeyHandler = new HotKeyHandler(this);
    mMultiSelectHandler.dispatchOnCreate();
    final long[] accountIds = getAccountIds(this);
    if (accountIds.length == 0) {
        final Intent signInIntent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
        signInIntent.setClass(this, SignInActivity.class);
        startActivity(signInIntent);
        finish();

        final Context context = this;
        Lantern.start(context);

        return;
    } else {
        notifyAccountsChanged();
    }
    final Intent intent = getIntent();
    if (openSettingsWizard()) {
        finish();
        return;
    }
    setContentView(R.layout.activity_home);
    setSupportActionBar(mActionBar);
    sendBroadcast(new Intent(BROADCAST_HOME_ACTIVITY_ONCREATE));
    final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false);
    mTabDisplayOption = getTabDisplayOptionInt(this);

    final Context context = this;

    Lantern.start(context);

    mColorStatusFrameLayout.setOnFitSystemWindowsListener(this);
    ThemeUtils.applyBackground(mTabIndicator);
    mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, 1);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setOffscreenPageLimit(3);
    mTabIndicator.setViewPager(mViewPager);
    mTabIndicator.setOnPageChangeListener(this);
    if (mTabDisplayOption != 0) {
        mTabIndicator.setTabDisplayOption(mTabDisplayOption);
    } else {
        mTabIndicator.setTabDisplayOption(TabPagerIndicator.ICON);
    }
    mTabIndicator.setDisplayBadge(mPreferences.getBoolean(KEY_UNREAD_COUNT, true));
    mActionsButton.setOnClickListener(this);
    mActionsButton.setOnLongClickListener(this);
    mEmptyTabHint.setOnClickListener(this);

    setupSlidingMenu();
    setupBars();
    initUnreadCount();
    updateActionsButton();
    updateSmartBar();
    updateSlidingMenuTouchMode();

    if (savedInstanceState == null) {
        //if (refreshOnStart) {
        mTwitterWrapper.refreshAll();
        //}
        if (intent.getBooleanExtra(EXTRA_OPEN_ACCOUNTS_DRAWER, false)) {
            openAccountsDrawer();
        }
    }
    mPagerPosition = Float.NaN;
    setupHomeTabs();

    final int initialTabPosition = handleIntent(intent, savedInstanceState == null);
    setTabPosition(initialTabPosition);
}

From source file:com.xgf.inspection.qrcode.google.zxing.client.CaptureActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.capture);/*w w w .  j av a  2s .c o  m*/
    mContext = CaptureActivity.this;

    hasSurface = false;
    historyManager = new HistoryManager(this);
    historyManager.trimHistory();
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);

    mBackIv = (ImageView) findViewById(R.id.qr_back_iv);
    mBackIv.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            CaptureActivity.this.finish();
        }
    });

    // TODO
    // add
    mQrUploadTv = (TextView) findViewById(R.id.qr_upload_tv);

    mQrUploadTv.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mIsHasUpload) {
                uploadData();
            }
            // Intent intent = new Intent(getApplicationContext(),
            // UploadService.class);
            // getApplicationContext().startService(intent);
        }
    });
    isHasUpload();

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    mNowAction = getIntent().getAction();
    // showHelpOnFirstLaunch();
}

From source file:com.wanikani.androidnotifier.WebReviewActivity.java

@Override
protected void onResume() {
    Window window;

    super.onResume();

    window = getWindow();//from ww w  . ja v a 2  s.c  om
    if (SettingsActivity.getLockScreen(this))
        window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    else
        window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    if (SettingsActivity.getResizeWebview(this))
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    else
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    visible = true;

    selectKeyboard();

    applyMuteSettings();
    applySingleSettings();

    showHWAccelMessage();

    wv.acquire();

    kbstatus.apply(this);

    if (rtask != null)
        rtask.resume();
}

From source file:org.billthefarmer.tuner.MainActivity.java

void getPreferences() {
    // Load preferences

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

    // Set preferences
    if (audio != null) {
        audio.input = Integer.parseInt(preferences.getString(PREF_INPUT, "0"));
        audio.reference = preferences.getInt(PREF_REFERENCE, 440);
        audio.transpose = Integer.parseInt(preferences.getString(PREF_TRANSPOSE, "0"));

        audio.filter = preferences.getBoolean(PREF_FILTER, false);
        audio.downsample = preferences.getBoolean(PREF_DOWNSAMPLE, false);
        audio.multiple = preferences.getBoolean(PREF_MULTIPLE, false);
        audio.screen = preferences.getBoolean(PREF_SCREEN, false);
        audio.strobe = preferences.getBoolean(PREF_STROBE, false);
        audio.zoom = preferences.getBoolean(PREF_ZOOM, true);

        // Check screen
        if (audio.screen) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }//from   www. j  ava2  s .  co m

        else {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        }

        // Check for strobe before setting colours
        if (strobe != null) {
            strobe.colour = Integer.valueOf(preferences.getString(PREF_COLOUR, "0"));

            if (strobe.colour == 3) {
                JSONArray custom;

                try {
                    custom = new JSONArray(preferences.getString(PREF_CUSTOM, null));

                    strobe.foreground = custom.getInt(0);
                    strobe.background = custom.getInt(1);
                }

                catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            // Ensure the view dimensions have been set
            if (strobe.width > 0 && strobe.height > 0)
                strobe.createShaders();
        }
    }
}

From source file:org.billthefarmer.tuner.MainActivity.java

@Override
public boolean onLongClick(View v) {
    // Get id//  w  w  w. j a  v  a  2 s  . c  o m
    int id = v.getId();
    switch (id) {
    // Spectrum
    case R.id.spectrum:
        audio.downsample = !audio.downsample;

        if (audio.downsample)
            showToast(R.string.downsample_on);
        else
            showToast(R.string.downsample_off);
        break;

    // Display
    case R.id.display:
        audio.multiple = !audio.multiple;

        if (audio.multiple)
            showToast(R.string.multiple_on);

        else
            showToast(R.string.multiple_off);
        break;

    // Meter
    case R.id.meter:
        audio.screen = !audio.screen;

        if (audio.screen)
            showToast(R.string.screen_on);

        else
            showToast(R.string.screen_off);

        Window window = getWindow();

        if (audio.screen)
            window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

        else
            window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        break;
    }
    return true;
}

From source file:com.achep.acdisplay.acdisplay.AcDisplayActivity.java

@SuppressLint("NewApi")
private void populateFlags(boolean windowHasFocus) {
    Window window = getWindow();
    View decorView = window.getDecorView();

    int windowFlags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;

    if (windowHasFocus) {
        int visibilityUi = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | View.SYSTEM_UI_FLAG_LOW_PROFILE;

        if (mConfig.isFullScreen()) {
            // Hide status bar if fullscreen mode is enabled.
            visibilityUi = visibilityUi | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_FULLSCREEN;
        }/*from  w w  w.  ja  va2  s.c  o m*/

        if (Device.hasKitKatApi()) {
            // Hide navigation bar and flag sticky.
            visibilityUi = visibilityUi | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        decorView.setSystemUiVisibility(visibilityUi);
        window.addFlags(windowFlags);

        mTimeout.resume();
        mTimeout.setTimeoutDelayed(mConfig.getTimeoutNormal(), true);
    } else {
        int visibilityUi = decorView.getSystemUiVisibility();
        if (Device.hasKitKatApi()) {
            // Clear immersive sticky flag.
            // Hopefully it will fix annoying Android feature: IMMERSIVE_PANIC
            visibilityUi ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }

        decorView.setSystemUiVisibility(visibilityUi);
        window.clearFlags(windowFlags);

        mTimeout.setTimeoutDelayed(mConfig.getTimeoutNormal(), true);
        mTimeout.pause();
    }
}

From source file:org.mariotaku.twidere.activity.support.HomeActivity.java

/**
 * Called when the context is first created.
 *///  w  w  w. j ava 2s.  c o  m
@Override
protected void onCreate(final Bundle savedInstanceState) {
    final Window window = getWindow();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    super.onCreate(savedInstanceState);
    if (!isDatabaseReady(this)) {
        Toast.makeText(this, R.string.preparing_database_toast, Toast.LENGTH_SHORT).show();
        finish();
        return;
    }
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    mTwitterWrapper = getTwitterWrapper();
    final TwidereApplication app = TwidereApplication.getInstance(this);
    mReadStateManager = app.getReadStateManager();
    mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mMultiSelectHandler = new MultiSelectEventHandler(this);
    mMultiSelectHandler.dispatchOnCreate();
    //        if (!Utils.hasAccount(this)) {
    //            final Intent signInIntent = new Intent(INTENT_ACTION_TWITTER_LOGIN);
    //            signInIntent.setClass(this, SignInActivity.class);
    //            startActivity(signInIntent);
    //            finish();
    //            return;
    //        } else {
    //            notifyAccountsChanged();
    //        }
    final Intent intent = getIntent();
    if (openSettingsWizard()) {
        finish();
        return;
    }
    setContentView(R.layout.activity_home);
    setSupportActionBar(mActionBar);
    sendBroadcast(new Intent(BROADCAST_HOME_ACTIVITY_ONCREATE));
    final boolean refreshOnStart = mPreferences.getBoolean(KEY_REFRESH_ON_START, false);
    int tabDisplayOptionInt = getTabDisplayOptionInt(this);

    mTabColumns = getResources().getInteger(R.integer.default_tab_columns);

    mColorStatusFrameLayout.setOnFitSystemWindowsListener(this);
    mPagerAdapter = new SupportTabsAdapter(this, getSupportFragmentManager(), mTabIndicator, mTabColumns);
    mViewPager.setAdapter(mPagerAdapter);
    //        mViewPager.setOffscreenPageLimit(3);
    mTabIndicator.setViewPager(mViewPager);
    mTabIndicator.setOnPageChangeListener(this);
    mTabIndicator.setColumns(mTabColumns);
    if (tabDisplayOptionInt == 0) {
        tabDisplayOptionInt = TabPagerIndicator.ICON;
    }
    mTabIndicator.setTabDisplayOption(tabDisplayOptionInt);
    mTabIndicator.setTabExpandEnabled((tabDisplayOptionInt & TabPagerIndicator.LABEL) == 0);
    mTabIndicator.setDisplayBadge(mPreferences.getBoolean(KEY_UNREAD_COUNT, true));
    mTabIndicator.updateAppearance();

    mActionsButton.setOnClickListener(this);
    mActionsButton.setOnLongClickListener(this);
    mEmptyTabHint.setOnClickListener(this);

    ThemeUtils.setCompatContentViewOverlay(this, new EmptyDrawable());
    ViewCompat.setElevation(mActionBarContainer, ThemeUtils.getSupportActionBarElevation(this));
    ViewSupport.setOutlineProvider(mActionBarContainer, ViewOutlineProviderCompat.BACKGROUND);
    final View windowOverlay = findViewById(R.id.window_overlay);
    ViewSupport.setBackground(windowOverlay,
            ThemeUtils.getNormalWindowContentOverlay(this, getCurrentThemeResourceId()));

    setupSlidingMenu();
    setupBars();
    showDataProfilingRequest();
    initUnreadCount();
    updateActionsButton();
    updateSlidingMenuTouchMode();
    getDelegate().setKeyListener(new ThemedAppCompatDelegateFactory.KeyListener() {
        @Override
        public boolean onKeyDown(int keyCode, KeyEvent event) {
            return false;
        }

        @Override
        public boolean onKeyUp(int keyCode, KeyEvent event) {
            // Steal MENU key event
            switch (keyCode) {
            case KeyEvent.KEYCODE_MENU: {
                if (mSlidingMenu != null) {
                    mSlidingMenu.toggle(true);
                    return true;
                }
                break;
            }
            }
            return false;
        }
    });

    if (savedInstanceState == null) {
        if (refreshOnStart) {
            mTwitterWrapper.refreshAll(getActivatedAccountIds());
        }
        if (intent.getBooleanExtra(EXTRA_OPEN_ACCOUNTS_DRAWER, false)) {
            openAccountsDrawer();
        }
    }
    setupHomeTabs();

    final int initialTabPosition = handleIntent(intent, savedInstanceState == null);
    setTabPosition(initialTabPosition);

    startService(new Intent(this, StreamingService.class));
}

From source file:com.crearo.gpslogger.GpsMainActivity.java

public void setUpToolbar() {
    try {// ww  w.  ja  va  2  s  .c  o m
        Toolbar toolbar = getToolbar();
        setSupportActionBar(toolbar);
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayShowTitleEnabled(false);
        }

        //Deprecated in Lollipop but required if targeting 4.x
        SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(getApplicationContext(),
                R.array.gps_main_views, R.layout.spinner_dropdown_item);
        getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
        getSupportActionBar().setListNavigationCallbacks(spinnerAdapter, this);
        getSupportActionBar().setSelectedNavigationItem(getUserSelectedNavigationItem());

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
    } catch (Exception ex) {
        //http://stackoverflow.com/questions/26657348/appcompat-v7-v21-0-0-causing-crash-on-samsung-devices-with-android-v4-2-2
        LOG.error("Thanks for this, Samsung", ex);
    }

}

From source file:org.godotengine.godot.Godot.java

@Override
protected void onCreate(Bundle icicle) {

    super.onCreate(icicle);
    Window window = getWindow();
    //window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);

    //check for apk expansion API
    if (true) {//from w  w w.java  2  s  .c  om
        boolean md5mismatch = false;
        command_line = getCommandLine();
        String main_pack_md5 = null;
        String main_pack_key = null;

        List<String> new_args = new LinkedList<String>();

        for (int i = 0; i < command_line.length; i++) {

            boolean has_extra = i < command_line.length - 1;
            if (command_line[i].equals("--use_depth_32")) {
                use_32_bits = true;
            } else if (command_line[i].equals("--debug_opengl")) {
                use_debug_opengl = true;
            } else if (command_line[i].equals("--use_immersive")) {
                use_immersive = true;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // check if the application runs on an android 4.4+
                    window.getDecorView().setSystemUiVisibility(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
                            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

                    UiChangeListener();
                }
            } else if (command_line[i].equals("--use_apk_expansion")) {
                use_apk_expansion = true;
            } else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
                main_pack_md5 = command_line[i + 1];
                i++;
            } else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
                main_pack_key = command_line[i + 1];
                SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
                Editor editor = prefs.edit();
                editor.putString("store_public_key", main_pack_key);

                editor.apply();
                i++;
            } else if (command_line[i].trim().length() != 0) {
                new_args.add(command_line[i]);
            }
        }

        if (new_args.isEmpty()) {
            command_line = null;
        } else {

            command_line = new_args.toArray(new String[new_args.size()]);
        }
        if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
            //check that environment is ok!
            if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                //show popup and die
            }

            // Build the full path to the app's expansion files
            try {
                expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
                expansion_pack_path += "/main."
                        + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + "."
                        + this.getPackageName() + ".obb";
            } catch (Exception e) {
                e.printStackTrace();
            }

            File f = new File(expansion_pack_path);

            boolean pack_valid = true;

            if (!f.exists()) {

                pack_valid = false;

            } else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
                pack_valid = false;
                try {
                    f.delete();
                } catch (Exception e) {
                }
            }

            if (!pack_valid) {

                Intent notifierIntent = new Intent(this, this.getClass());
                notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);

                PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifierIntent,
                        PendingIntent.FLAG_UPDATE_CURRENT);

                int startResult;
                try {
                    startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(
                            getApplicationContext(), pendingIntent, GodotDownloaderService.class);

                    if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
                        // This is where you do set up to display the download
                        // progress (next step)
                        mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this,
                                GodotDownloaderService.class);

                        setContentView(com.godot.game.R.layout.downloading_expansion);
                        mPB = (ProgressBar) findViewById(com.godot.game.R.id.progressBar);
                        mStatusText = (TextView) findViewById(com.godot.game.R.id.statusText);
                        mProgressFraction = (TextView) findViewById(com.godot.game.R.id.progressAsFraction);
                        mProgressPercent = (TextView) findViewById(com.godot.game.R.id.progressAsPercentage);
                        mAverageSpeed = (TextView) findViewById(com.godot.game.R.id.progressAverageSpeed);
                        mTimeRemaining = (TextView) findViewById(com.godot.game.R.id.progressTimeRemaining);
                        mDashboard = findViewById(com.godot.game.R.id.downloaderDashboard);
                        mCellMessage = findViewById(com.godot.game.R.id.approveCellular);
                        mPauseButton = (Button) findViewById(com.godot.game.R.id.pauseButton);
                        mWiFiSettingsButton = (Button) findViewById(com.godot.game.R.id.wifiSettingsButton);

                        return;
                    } else {
                    }
                } catch (NameNotFoundException e) {
                    // TODO Auto-generated catch block
                }
            }
        }
    }

    mCurrentIntent = getIntent();

    initializeGodot();

    //instanceSingleton( new GodotFacebook(this) );
}

From source file:com.saphion.stencilweather.activities.MainActivity.java

public void setToolBarColor(int color) {
    try {/*from w  w  w. j ava  2 s. c o m*/
        //            findViewById(R.id.appbar).setBackgroundColor(color);
        toolbar.setBackgroundColor(Color.TRANSPARENT);

        Integer colorFrom = Color.TRANSPARENT;
        Drawable background = findViewById(R.id.appbar).getBackground();
        if (background instanceof ColorDrawable)
            colorFrom = ((ColorDrawable) background).getColor();
        Integer colorTo = color;
        ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
        colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

            @Override
            public void onAnimationUpdate(ValueAnimator animator) {
                findViewById(R.id.appbar).setBackgroundColor((Integer) animator.getAnimatedValue());
                findViewById(R.id.appbarGraph).setBackgroundColor((Integer) animator.getAnimatedValue());
            }

        });
        colorAnimation.setDuration(350);
        colorAnimation.start();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

            color = (color & 0xfefefefe) >> 1;

            window.setStatusBarColor(color);
        }

    } catch (Exception ignored) {
    }
}