List of usage examples for android.view Window clearFlags
public void clearFlags(int flags)
From source file:org.kaaproject.kaa.demo.photoframe.MainActivity.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void setLightsOutMode(boolean enabled) { final Window window = getWindow(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { if (enabled) { window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else {// ww w.j av a 2 s . c om window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } } else { window.getDecorView().setSystemUiVisibility(enabled ? View.SYSTEM_UI_FLAG_FULLSCREEN : 0); } }
From source file:org.kaaproject.kaa.demo.photoframe.activities.SlideshowActivity.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void setLightsOutMode(boolean enabled) { final Window window = getWindow(); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { if (enabled) { window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else {/* ww w . j av a2 s. co m*/ window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } } else { window.getDecorView().setSystemUiVisibility(enabled ? View.SYSTEM_UI_FLAG_FULLSCREEN : 0); } }
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. j a va 2 s . c o m*/ @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.amsterdam.marktbureau.makkelijkemarkt.MainActivity.java
/** * Replace the container framelayout with the login fragment *//* w w w.j a v a 2 s. c om*/ public void replaceLoginFragment() { if (getSupportActionBar() != null) { // clear the statusbar transparency if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } // show the toolbar mToolbar.setVisibility(View.VISIBLE); } // replace the fragment using the fragmentmanager mLoginFragment = new LoginFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.container, mLoginFragment, LOGIN_FRAGMENT_TAG); // add the fragment name to the backstack to support the back-button transaction.addToBackStack(LoginFragment.class.getSimpleName()); // execute the transaction transaction.commit(); }
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);/*ww w. j a v 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: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 ww w . j av a 2 s . c o m*/ }
From source file:com.phonegap.bossbolo.plugin.statusbar.StatusBar.java
private void setStatusBarBackgroundColor(final String colorPref) { if (Build.VERSION.SDK_INT >= 21) { if (colorPref != null && !colorPref.isEmpty()) { final Window window = cordova.getActivity().getWindow(); // Method and constants not available on all SDKs but we want to be able to compile this code with any SDK window.clearFlags(0x04000000); // SDK 19: WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(0x80000000); // SDK 21: WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); try { // Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21 window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref)); } catch (IllegalArgumentException ignore) { Log.e(TAG, "Invalid hexString argument, use f.i. '#999999'"); } catch (Exception ignore) { // this should not happen, only in case Android removes this method in a version > 21 Log.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT); }/*from w w w. ja v a2s . c om*/ } } }
From source file:de.gebatzens.ggvertretungsplan.GGApp.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void setStatusBarColor(Window w) { w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setStatusBarColor(GGApp.GG_APP.provider.getDarkColor()); }
From source file:de.gebatzens.ggvertretungsplan.GGApp.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void setStatusBarColorTransparent(Window w) { w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setStatusBarColor(getResources().getColor(R.color.transparent)); }
From source file:br.com.hotforms.StatusBarManager.java
public synchronized void setColor(final int r, final int g, final int b) { final Activity activity = this.cordova.getActivity(); final Window window = activity.getWindow(); this.cordova.getActivity().runOnUiThread(new Runnable() { @Override/*from w w w .jav a2s . c o m*/ public void run() { window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(android.graphics.Color.rgb(r, g, b)); } }); }