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:edu.mit.lastmite.insight_library.activity.SingleFragmentActivity.java

@SuppressWarnings("UnusedDeclaration")
public void setStatusBarColor(int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(color);
    }//from   ww w . j ava  2s.  co m
}

From source file:com.phonegap.bossbolo.plugin.statusbar.StatusBar.java

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 *///from w w  w  .ja  v a  2  s .  com
@Override
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
    Log.v(TAG, "StatusBar: initialization");
    super.initialize(cordova, webView);

    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            // Clear flag FLAG_FORCE_NOT_FULLSCREEN which is set initially
            // by the Cordova.
            Window window = cordova.getActivity().getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

            // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
            setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#46bff7"));
        }
    });
}

From source file:com.jins_meme.bridge.ProgressDialogFragment.java

@NonNull
@Override/* ww w.  ja  v  a2  s. c o  m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    String type = getArguments().getString("type");

    progress = new ProgressDialog(getActivity());

    Window window = progress.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);

    switch (type) {
    case "meme_scan":
        progress.setMax(100);
        progress.setMessage(getString(R.string.meme_scanning));
        progress.setTitle(getString(R.string.meme_scan_connect_title));
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setCancelable(false);
        /*
        progress.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel),
            new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
        if (mListener != null) {
          mListener.doNegativeClick("meme_connect");
        }
              }
            });
            */
        break;
    case "meme_connect":
        progress.setMax(100);
        progress.setMessage(getString(R.string.meme_scanning));
        progress.setTitle(getString(R.string.meme_scan_connect_title));
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setCancelable(false);
        progress.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.cancel), new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (mListener != null) {
                    mListener.doNegativeClick("meme_connect");
                }
            }
        });
        break;
    case "hue_search":
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setMessage(getString(R.string.hue_searching));
        progress.setCancelable(false);
        break;
    case "hue_connect":
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setMessage(getString(R.string.hue_push_link_button));
        progress.setCancelable(false);
        break;
    case "spotify_loading":
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setMessage(getString(R.string.spotify_loading));
        progress.setCancelable(false);
        break;
    }

    return progress;
}

From source file:org.schabi.terminightor.NightKillerActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_nightkiller);

    final Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
            | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
    window.addFlags(//  ww w. j av a 2s  .  c o m
            WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

    Bundle a = getIntent().getExtras();
    alarmId = a.getLong(Alarm.ID);
    alarmLabel = a.getString(Alarm.NAME);
    expectedNfcId = a.getByteArray(Alarm.NFC_TAG_ID);

    innerWave = (ImageView) findViewById(R.id.inner_wave_alarm);
    outerWave = (ImageView) findViewById(R.id.outer_wave_alarm);
    alarmLabelView = (TextView) findViewById(R.id.alarm_label_alarm);
    alarmLabelView.setText(alarmLabel);

    nfcAdapter = NfcAdapter.getDefaultAdapter(this);

    ignoreNfcTagId = PreferenceManager.getDefaultSharedPreferences(this)
            .getBoolean(this.getString(R.string.ignoreNfcId), false);

    Log.d(TAG, Long.toString(alarmId));
}

From source file:at.alladin.rmbt.android.terms.RMBTTermsActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);/*  w ww .  ja v  a 2s  . c  om*/

    boolean showTermsAndConditions = true;

    if (getIntent().getExtras() != null) {
        final String checkTypeName = getIntent().getExtras().getString(EXTRA_KEY_CHECK_TYPE, null);
        if (checkTypeName != null) {
            checkType = CheckType.valueOf(checkTypeName);
        }

        showTermsAndConditions = getIntent().getExtras().getBoolean(EXTRA_KEY_CHECK_TERMS_AND_COND, true);
    }

    final Window window = getWindow();
    window.setFormat(PixelFormat.RGBA_8888);
    window.addFlags(WindowManager.LayoutParams.FLAG_DITHER);

    if (savedInstanceState == null) {
        if (showTermsAndConditions) {
            showTermsCheck();
        } else {
            continueWorkflow();
        }
    }
}

From source file:com.thiagorosa.robotita.ActivityMain.java

@Override
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity);/*from  www .jav  a  2s.  c  o  m*/

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);

    if ((getResources().getConfiguration().screenLayout
            & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        } else {
            View decorView = getWindow().getDecorView();
            int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
            decorView.setSystemUiVisibility(uiOptions);
        }
    }

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(getResources().getColor(R.color.theme_secondary));
    }

    if (savedInstanceState == null) {
        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
            FragmentManager.BackStackEntry first = getSupportFragmentManager().getBackStackEntryAt(0);
            getSupportFragmentManager().popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
        }

        Fragment fragment = new FragmentMain();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_in_right,
                R.anim.slide_out_right);
        transaction.replace(R.id.fragment, fragment, "fragment");
        transaction.addToBackStack("main");
        transaction.commitAllowingStateLoss();

        if (!TextUtils.isEmpty(PreferencesManager.getDeviceMAC(getApplicationContext()))) {
            Bundle args = new Bundle();
            args.putString(FragmentDeviceList.EXTRA_MAC,
                    PreferencesManager.getDeviceMAC(getApplicationContext()));

            Fragment fragmentDevice = new FragmentDeviceList();
            fragmentDevice.setArguments(args);
            FragmentTransaction transactionDevice = getSupportFragmentManager().beginTransaction();
            transactionDevice.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left,
                    R.anim.slide_in_right, R.anim.slide_out_right);
            transactionDevice.replace(R.id.fragment, fragmentDevice, "fragment");
            transactionDevice.addToBackStack("device");
            transactionDevice.commitAllowingStateLoss();
        }
    }

}

From source file:com.procleus.brime.ui.GetStartedActivity.java

/**
 * Making notification bar transparent/*from   www  . j  av a  2 s . co  m*/
 */
private void changeStatusBarColor() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
    }
}

From source file:ru.yandex.subtitles.ui.activity.AbstractActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupLollipopStatusBarFlags() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }/*from w w w .  ja  va 2  s .  c  o  m*/
}

From source file:com.jwetherell.QRComm575.DecoderActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.decoder);//  ww w.j ava  2  s .  c  o m
    Log.v(TAG, "onCreate()");

    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    handler = null;
    hasSurface = false;
}

From source file:com.dw.bartinter.BarTinter.java

private void statusBar(final String colorPref) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (colorPref != null && !colorPref.isEmpty()) {
            final Window window = cordova.getActivity().getWindow();
            window.clearFlags(0x04000000);
            window.addFlags(0x80000000);
            try {
                window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window,
                        Color.parseColor(colorPref));
            } catch (IllegalArgumentException ignore) {
                Log.e(PLUGIN, "Invalid hexString argument.");
            } catch (Exception ignore) {
                Log.w(PLUGIN,/*from www. ja va  2s .  c  om*/
                        "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
            }
        }
    }
}