List of usage examples for android.view Window setNavigationBarColor
public abstract void setNavigationBarColor(@ColorInt int color);
From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java
@Override public void onCreate(Bundle savedInstanceState) { SharedPreferences Sp = PreferenceManager.getDefaultSharedPreferences(this); super.onCreate(savedInstanceState); setContentView(R.layout.prefsfrag);/* w w w . ja v a 2 s .c o m*/ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(), getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab))); setTaskDescription(taskDescription); } setSupportActionBar(toolbar); getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_HOME_AS_UP | android.support.v7.app.ActionBar.DISPLAY_SHOW_TITLE); getSupportActionBar().setBackgroundDrawable( getColorPreference().getDrawable(ColorUsage.getPrimary(MainActivity.currentTab))); if (SDK_INT == 20 || SDK_INT == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor( getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab))); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.preferences) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (SDK_INT >= 21) { boolean colourednavigation = Sp.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(PreferenceUtils.getStatusColor( getColorPreference().getColorAsString(ColorUsage.getPrimary(MainActivity.currentTab)))); if (colourednavigation) window.setNavigationBarColor(PreferenceUtils.getStatusColor( getColorPreference().getColorAsString(ColorUsage.getPrimary(MainActivity.currentTab)))); } if (savedInstanceState != null) { selectedItem = savedInstanceState.getInt(KEY_CURRENT_FRAG_OPEN, 0); } selectItem(selectedItem); }
From source file:com.amaze.carbonfilemanager.activities.DbViewer.java
@Override public void onCreate(Bundle savedInstanceState) { this.checkStorage = false; super.onCreate(savedInstanceState); if (getAppTheme().equals(AppTheme.DARK)) { setTheme(R.style.appCompatDark); getWindow().getDecorView().setBackgroundColor(Utils.getColor(this, R.color.holo_dark_background)); }/*ww w. j a va2s . c om*/ setContentView(R.layout.activity_db_viewer); toolbar = (android.support.v7.widget.Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) ContextCompat.getDrawable(this, R.mipmap.ic_launcher)).getBitmap(), getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab))); setTaskDescription(taskDescription); } getSupportActionBar().setBackgroundDrawable( getColorPreference().getDrawable(ColorUsage.getPrimary(MainActivity.currentTab))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (SDK_INT == 20 || SDK_INT == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor( getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab))); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.parentdb) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (SDK_INT >= 21) { boolean colourednavigation = sharedPref.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(PreferenceUtils.getStatusColor( getColorPreference().getColorAsString(ColorUsage.getPrimary(MainActivity.currentTab)))); if (colourednavigation) window.setNavigationBarColor(PreferenceUtils.getStatusColor( getColorPreference().getColorAsString(ColorUsage.getPrimary(MainActivity.currentTab)))); } path = getIntent().getStringExtra("path"); pathFile = new File(path); listView = (ListView) findViewById(R.id.listView); load(pathFile); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); DbViewerFragment fragment = new DbViewerFragment(); Bundle bundle = new Bundle(); bundle.putString("table", arrayList.get(position)); fragment.setArguments(bundle); fragmentTransaction.add(R.id.content_frame, fragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); } }); }
From source file:com.vuze.android.remote.activity.LoginActivity.java
@SuppressWarnings("deprecation") @Override/*from w ww .j av a 2s. c o m*/ protected void onCreate(Bundle savedInstanceState) { // These are an attempt to make the gradient look better on some // android devices. It doesn't on the ones I tested, but it can't hurt to // have it here, right? getWindow().setFormat(PixelFormat.RGBA_8888); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); // in Activity's onCreate() for instance w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); w.setNavigationBarColor(ContextCompat.getColor(this, R.color.login_grad_color_2)); } } AndroidUtilsUI.onCreate(this); super.onCreate(savedInstanceState); if (AndroidUtils.DEBUG) { Log.d(TAG, "LoginActivity intent = " + getIntent() + "/" + getIntent().getDataString()); } appPreferences = VuzeRemoteApp.getAppPreferences(); setContentView(R.layout.activity_login); textAccessCode = (EditText) findViewById(R.id.editTextAccessCode); assert textAccessCode != null; RemoteProfile lastUsedRemote = appPreferences.getLastUsedRemote(); if (lastUsedRemote != null && lastUsedRemote.getRemoteType() == RemoteProfile.TYPE_LOOKUP && lastUsedRemote.getAC() != null) { textAccessCode.setText(lastUsedRemote.getAC()); textAccessCode.selectAll(); } textAccessCode.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { loginButtonClicked(v); return true; } }); TextView tvLoginCopyright = (TextView) findViewById(R.id.login_copyright); if (tvLoginCopyright != null) { AndroidUtilsUI.linkify(tvLoginCopyright); } TextView tvLoginGuide = (TextView) findViewById(R.id.login_guide); setupGuideText(tvLoginGuide); tvLoginGuide.setFocusable(false); TextView tvLoginGuide2 = (TextView) findViewById(R.id.login_guide2); setupGuideText(tvLoginGuide2); View coreArea = findViewById(R.id.login_core_area); if (coreArea != null) { coreArea.setVisibility(VuzeRemoteApp.isCoreAllowed() ? View.VISIBLE : View.GONE); } ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(R.drawable.ic_launcher); } }
From source file:com.mishiranu.dashchan.ui.gallery.GalleryActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void applyStatusNavigationTranslucency() { if (C.API_LOLLIPOP) { Window window = getWindow(); int color = ACTION_BAR_COLOR; window.setStatusBarColor(color); window.setNavigationBarColor(color); window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); }/*from w w w .j av a2 s . c o m*/ }
From source file:org.smssecure.smssecure.ConversationListFragment.java
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = getActivity().getMenuInflater(); if (archive)/*ww w. ja va 2s . co m*/ inflater.inflate(R.menu.conversation_list_batch_unarchive, menu); else inflater.inflate(R.menu.conversation_list_batch_archive, menu); inflater.inflate(R.menu.conversation_list_batch, menu); inflater.inflate(R.menu.conversation_send_drafts, menu); mode.setTitle(R.string.conversation_fragment_cab__batch_selection_mode); mode.setSubtitle(null); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getActivity().getWindow(); window.setStatusBarColor(getResources().getColor(R.color.action_mode_status_bar)); window.setNavigationBarColor(getResources().getColor(android.R.color.black)); } return true; }
From source file:com.amaze.filemanager.activities.Preferences.java
@Override public void onCreate(Bundle savedInstanceState) { SharedPreferences Sp = PreferenceManager.getDefaultSharedPreferences(this); fabSkin = PreferenceUtils.getAccentString(Sp); int th = Integer.parseInt(Sp.getString("theme", "0")); theme = th == 2 ? PreferenceUtils.hourOfDay() : th; // setting accent theme if (Build.VERSION.SDK_INT >= 21) { switch (fabSkin) { case "#F44336": if (theme == 0) setTheme(R.style.pref_accent_light_red); else/*from w ww .j ava 2s .c o m*/ setTheme(R.style.pref_accent_dark_red); break; case "#e91e63": if (theme == 0) setTheme(R.style.pref_accent_light_pink); else setTheme(R.style.pref_accent_dark_pink); break; case "#9c27b0": if (theme == 0) setTheme(R.style.pref_accent_light_purple); else setTheme(R.style.pref_accent_dark_purple); break; case "#673ab7": if (theme == 0) setTheme(R.style.pref_accent_light_deep_purple); else setTheme(R.style.pref_accent_dark_deep_purple); break; case "#3f51b5": if (theme == 0) setTheme(R.style.pref_accent_light_indigo); else setTheme(R.style.pref_accent_dark_indigo); break; case "#2196F3": if (theme == 0) setTheme(R.style.pref_accent_light_blue); else setTheme(R.style.pref_accent_dark_blue); break; case "#03A9F4": if (theme == 0) setTheme(R.style.pref_accent_light_light_blue); else setTheme(R.style.pref_accent_dark_light_blue); break; case "#00BCD4": if (theme == 0) setTheme(R.style.pref_accent_light_cyan); else setTheme(R.style.pref_accent_dark_cyan); break; case "#009688": if (theme == 0) setTheme(R.style.pref_accent_light_teal); else setTheme(R.style.pref_accent_dark_teal); break; case "#4CAF50": if (theme == 0) setTheme(R.style.pref_accent_light_green); else setTheme(R.style.pref_accent_dark_green); break; case "#8bc34a": if (theme == 0) setTheme(R.style.pref_accent_light_light_green); else setTheme(R.style.pref_accent_dark_light_green); break; case "#FFC107": if (theme == 0) setTheme(R.style.pref_accent_light_amber); else setTheme(R.style.pref_accent_dark_amber); break; case "#FF9800": if (theme == 0) setTheme(R.style.pref_accent_light_orange); else setTheme(R.style.pref_accent_dark_orange); break; case "#FF5722": if (theme == 0) setTheme(R.style.pref_accent_light_deep_orange); else setTheme(R.style.pref_accent_dark_deep_orange); break; case "#795548": if (theme == 0) setTheme(R.style.pref_accent_light_brown); else setTheme(R.style.pref_accent_dark_brown); break; case "#212121": if (theme == 0) setTheme(R.style.pref_accent_light_black); else setTheme(R.style.pref_accent_dark_black); break; case "#607d8b": if (theme == 0) setTheme(R.style.pref_accent_light_blue_grey); else setTheme(R.style.pref_accent_dark_blue_grey); break; case "#004d40": if (theme == 0) setTheme(R.style.pref_accent_light_super_su); else setTheme(R.style.pref_accent_dark_super_su); break; } } else { if (theme == 1) { setTheme(R.style.appCompatDark); } else { setTheme(R.style.appCompatLight); } } super.onCreate(savedInstanceState); setContentView(R.layout.prefsfrag); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); skin = PreferenceUtils.getPrimaryColorString(Sp); if (Build.VERSION.SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(), Color.parseColor(skin)); ((Activity) this).setTaskDescription(taskDescription); } skinStatusBar = PreferenceUtils.getStatusColor(skin); setSupportActionBar(toolbar); getSupportActionBar().setDisplayOptions(android.support.v7.app.ActionBar.DISPLAY_HOME_AS_UP | android.support.v7.app.ActionBar.DISPLAY_SHOW_TITLE); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); int sdk = Build.VERSION.SDK_INT; if (sdk == 20 || sdk == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(skin)); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.preferences) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (Build.VERSION.SDK_INT >= 21) { boolean colourednavigation = Sp.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor((PreferenceUtils.getStatusColor(skin))); if (colourednavigation) window.setNavigationBarColor((PreferenceUtils.getStatusColor(skin))); } selectItem(0); }
From source file:org.smssecure.smssecure.ConversationListFragment.java
@Override public void onDestroyActionMode(ActionMode mode) { getListAdapter().initializeBatchMode(false); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getActivity().getWindow(); TypedArray color = getActivity().getTheme() .obtainStyledAttributes(new int[] { android.R.attr.statusBarColor }); window.setStatusBarColor(color.getColor(0, Color.BLACK)); window.setNavigationBarColor(getResources().getColor(android.R.color.black)); color.recycle();/* ww w. jav a 2s. c o m*/ } actionMode = null; }
From source file:com.hellofyc.base.app.activity.BaseActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void setStatusBarColorTransparent() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); window.setNavigationBarColor(Color.TRANSPARENT); }//w w w .j av a2 s.c om }
From source file:com.filemanager.free.activities.TextReader.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Sp = PreferenceManager.getDefaultSharedPreferences(this); if (theme1 == 1) { getWindow().getDecorView().setBackgroundColor(ContextCompat.getColor(c, R.color.holo_dark_background)); }//ww w . j av a2s. c o m setContentView(R.layout.search); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); skin = PreferenceUtils.getPrimaryColorString(Sp); findViewById(R.id.lin).setBackgroundColor(Color.parseColor(skin)); if (Build.VERSION.SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("File Manager", ((BitmapDrawable) ContextCompat.getDrawable(c, R.mipmap.ic_launcher)).getBitmap(), Color.parseColor(skin)); ((Activity) this).setTaskDescription(taskDescription); } int skinStatusBar = PreferenceUtils.getStatusColor(skin); assert (getSupportActionBar()) != null; getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(skin))); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (Build.VERSION.SDK_INT == 20 || Build.VERSION.SDK_INT == 19) { SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(Color.parseColor(skin)); FrameLayout.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) findViewById(R.id.texteditor) .getLayoutParams(); SystemBarTintManager.SystemBarConfig config = tintManager.getConfig(); p.setMargins(0, config.getStatusBarHeight(), 0, 0); } else if (Build.VERSION.SDK_INT >= 21) { boolean colourednavigation = Sp.getBoolean("colorednavigation", true); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor((PreferenceUtils.getStatusColor(skin))); if (colourednavigation) window.setNavigationBarColor((PreferenceUtils.getStatusColor(skin))); } mInput = (EditText) findViewById(R.id.fname); scrollView = (ScrollView) findViewById(R.id.editscroll); try { if (getIntent().getData() != null) { uri = getIntent().getData(); mFile = new File(getIntent().getData().getPath()); } else mFile = new File(getIntent().getStringExtra("path")); } catch (Exception e) { mFile = null; } String fileName = null; try { if (uri.getScheme().equals("file")) { fileName = uri.getLastPathSegment(); } else { Cursor cursor = null; try { cursor = getContentResolver().query(uri, new String[] { MediaStore.Images.ImageColumns.DISPLAY_NAME }, null, null, null); if (cursor != null && cursor.moveToFirst()) { fileName = cursor .getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DISPLAY_NAME)); } } finally { if (cursor != null) { cursor.close(); } } } } catch (Exception e) { e.printStackTrace(); } if (fileName == null || fileName.trim().length() == 0) fileName = f.getName(); getSupportActionBar().setTitle(fileName); mInput.addTextChangedListener(this); try { if (theme1 == 1) mInput.setBackgroundColor(ContextCompat.getColor(c, R.color.holo_dark_background)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); } catch (Exception ignored) { } if (savedInstanceState != null) { mOriginal = savedInstanceState.getString(KEY_ORIGINAL_TEXT); int index = savedInstanceState.getInt(KEY_INDEX); mInput.setText(savedInstanceState.getString(KEY_MODIFIED_TEXT)); mInput.setScrollY(index); } else { load(mFile); } }
From source file:org.smssecure.smssecure.ConversationActivity.java
private void setActionBarColor(MaterialColor color) { getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color.toActionBarColor(this))); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.setStatusBarColor(color.toStatusBarColor(this)); window.setNavigationBarColor(getResources().getColor(android.R.color.black)); }//from w w w.j av a 2 s . c o m }