List of usage examples for android.view Window setStatusBarColor
public abstract void setStatusBarColor(@ColorInt int color);
From source file:edu.uwp.alga.SplashActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override//from ww w.ja va2 s . co m protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //set status bar color if (Build.VERSION.SDK_INT >= 21) { // Call some material design APIs here Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(ContextCompat.getColor(this, R.color.WBackground)); } /*Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.spash); ImageView image = (ImageView)findViewById(R.id.image_splash); if(bitmap.getHeight()>=2048||bitmap.getWidth()>=2048){ DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int width = metrics.widthPixels; int height = metrics.heightPixels; bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); } image.setImageBitmap(bitmap);*/ new Handler().postDelayed(() -> { startActivity(new Intent(SplashActivity.this, MainActivity.class)); finish(); }, 1500); }
From source file:com.adithya321.sharesanalysis.fragments.ShareHoldingsFragment.java
@Nullable @Override/*from w w w. jav a2s.c om*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_share_holdings, container, false); Window window = getActivity().getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(R.color.blue_700)); ((AppCompatActivity) getActivity()).getSupportActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorAccent))); databaseHandler = new DatabaseHandler(getContext()); shareHoldingsRecyclerView = (RecyclerView) root.findViewById(R.id.share_holdings_recycler_view); setRecyclerViewAdapter(); return root; }
From source file:com.procleus.brime.ui.GetStartedActivity.java
/** * Making notification bar transparent/*from w w w. j a va 2s .c om*/ */ 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:com.adithya321.sharesanalysis.fragments.SummaryFragment.java
@Nullable @Override//from www . j a v a2 s.c om public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_summary, container, false); Window window = getActivity().getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark)); ((AppCompatActivity) getActivity()).getSupportActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary))); currentInvestmentsTV = (TickerView) root.findViewById(R.id.current_investments); netWorthTV = (TickerView) root.findViewById(R.id.net_worth); potentialProfitTV = (TickerView) root.findViewById(R.id.potential_profit); targetProfitTV = (TickerView) root.findViewById(R.id.target_profit); currentInvestmentsTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency()); netWorthTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency()); potentialProfitTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency()); targetProfitTV.setCharacterList(TickerUtils.getDefaultListForUSCurrency()); currentInvestmentsTV.setText("0"); netWorthTV.setText("0"); potentialProfitTV.setText("0"); targetProfitTV.setText("0"); databaseHandler = new DatabaseHandler(getContext()); sharesList = databaseHandler.getShares(); calculateValues(); return root; }
From source file:com.adithya321.sharesanalysis.fragments.FundFlowFragment.java
@Nullable @Override// w w w.j ava 2 s.c o m public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_fund_flow, container, false); Window window = getActivity().getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark)); ((AppCompatActivity) getActivity()).getSupportActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary))); databaseHandler = new DatabaseHandler(getContext()); fundIn = (TextView) root.findViewById(R.id.fund_in); fundOut = (TextView) root.findViewById(R.id.fund_out); fundsListView = (ListView) root.findViewById(R.id.funds_list_view); setViews(); FloatingActionButton addFundFab = (FloatingActionButton) root.findViewById(R.id.add_fund_fab); addFundFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final Dialog dialog = new Dialog(getContext()); dialog.setTitle("Add Fund Flow"); dialog.setContentView(R.layout.dialog_add_fund); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT); dialog.show(); Calendar calendar = Calendar.getInstance(); year_start = calendar.get(Calendar.YEAR); month_start = calendar.get(Calendar.MONTH) + 1; day_start = calendar.get(Calendar.DAY_OF_MONTH); final Button selectDate = (Button) dialog.findViewById(R.id.select_date); selectDate.setText(new StringBuilder().append(day_start).append("/").append(month_start).append("/") .append(year_start)); selectDate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Dialog dialog = new DatePickerDialog(getActivity(), onDateSetListener, year_start, month_start - 1, day_start); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { selectDate.setText(new StringBuilder().append(day_start).append("/") .append(month_start).append("/").append(year_start)); } }); dialog.show(); } }); final EditText amount = (EditText) dialog.findViewById(R.id.amount); Button addFundBtn = (Button) dialog.findViewById(R.id.add_fund_btn); addFundBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Fund fund = new Fund(); fund.setId(databaseHandler.getNextKey("fund")); String stringStartDate = year_start + " " + month_start + " " + day_start; DateFormat format = new SimpleDateFormat("yyyy MM dd", Locale.ENGLISH); try { Date date = format.parse(stringStartDate); fund.setDate(date); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Date", Toast.LENGTH_SHORT).show(); return; } try { fund.setAmount(Double.parseDouble(amount.getText().toString())); } catch (Exception e) { Toast.makeText(getActivity(), "Invalid Amount", Toast.LENGTH_SHORT).show(); return; } if (((RadioButton) dialog.findViewById(R.id.radioBtn_fund_in)).isChecked()) fund.setType("in"); else if (((RadioButton) dialog.findViewById(R.id.radioBtn_fund_out)).isChecked()) fund.setType("out"); else { Toast.makeText(getActivity(), "Invalid Fund Type", Toast.LENGTH_SHORT).show(); return; } databaseHandler.addFund(fund); setViews(); dialog.dismiss(); } }); } }); return root; }
From source file:org.catrobat.paintroid.WelcomeActivity.java
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 w w w . ja v a 2 s .c om }
From source file:org.docrj.smartcard.reader.MsgParseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent();//www . ja va2 s . co m Bundle b = intent.getBundleExtra("parsed_msg"); String msgText = b.getString("text"); mMsgName = b.getString("name"); mHtml = b.getString("html"); mActivityName = b.getString("activity"); mTestMode = b.getInt("test_mode"); setContentView(R.layout.activity_msg_parse); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // toolbar reference does not work for setting groupName getSupportActionBar().setTitle(mActivityName); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); TextView heading = (TextView) findViewById(R.id.heading); heading.setText(mMsgName); TextView contents = (TextView) findViewById(R.id.msg_text); contents.setText(msgText); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setStatusBarColor(getResources().getColor(R.color.primary_dark)); } }
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 w ww .j a v a 2 s . 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: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)); }