List of usage examples for android.view Window addFlags
public void addFlags(int flags)
From source file:com.smedic.tubtub.Pane.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public void setStatusBarColor(int color) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(color); }/* w w w.j a v a 2s. co m*/ }
From source file:com.experiments.whereapp.application.home.activities.HomeActivity.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override//from www.ja v a 2 s . c o m public void makeStatusBarTransparent() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return; Window window = getWindow(); window.getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { window.setStatusBarColor(Color.TRANSPARENT); } else { window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } }
From source file:com.vuze.android.remote.activity.LoginActivity.java
@SuppressWarnings("deprecation") @Override/*from ww w . j av a 2 s . 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.citrus.sdk.CitrusActivity.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void setActionBarBackground() { // Set primary color if (mColorPrimary != null && mActionBar != null) { mActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(mColorPrimary))); }/*w ww . ja v a 2s.c o m*/ // Set action bar color. Available only on android version Lollipop or higher. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && mColorPrimaryDark != null) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.parseColor(mColorPrimaryDark)); } }
From source file:com.example.h156252.connected_cars.CarGrid.java
/** Called when the activity is first created. */ @Override//from w ww . ja v a 2 s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.content_car_grid); try { Window window = getWindow(); // clear FLAG_TRANSLUCENT_STATUS flag: window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // finally change the color window.setStatusBarColor(Color.rgb(0, 0, 0)); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.rgb(0, 0, 0))); } catch (Exception e) { // Toast.makeText(getApplicationContext(),"Exception in actionbar "+e.getLocalizedMessage(),Toast.LENGTH_SHORT).show(); } session = new SessionManagement(this); tts = new TextToSpeech(this, this); //Toast.makeText(getApplicationContext(),"Entering activity",Toast.LENGTH_SHORT).show(); Intent intent = getIntent(); String result = intent.getStringExtra(HomeScreen.EXTRA_MESSAGE); //Toast.makeText(getApplicationContext(),"obtaining result: " +result,Toast.LENGTH_SHORT).show(); ArrayList<String> listdata = new ArrayList<String>(); try { JSONArray jArray = new JSONArray(result); if (jArray != null) { for (int i = 0; i < jArray.length(); i++) { String jstr = jArray.get(i).toString(); JSONObject jObj = new JSONObject(jstr); String id = jObj.getString("id"); //String phone = jObj.getString("phone"); String brand = jObj.getString("text"); String text = jObj.getString("cartext"); String carno = jObj.getString("carnum"); String color = jObj.getString("color"); //String isDone = jObj.getString("isDone"); String result_combine = "CAR " + i + ":\nCar id : #" + id + "*\n" + "License No. : " + carno + "\n" + "Color : " + color + "\n" + "Brand : " + brand + "\n" + "Text behind car : " + text; String rr = "Success " + result_combine; //Toast.makeText(getApplicationContext(),rr,Toast.LENGTH_SHORT).show(); String own_id = session.getID(); if (!(id.equals(own_id))) listdata.add(result_combine); } } } catch (Exception e) { //Toast.makeText(getApplicationContext(),e.getLocalizedMessage(),Toast.LENGTH_SHORT).show(); } //Toast.makeText(getApplicationContext(),"out of json",Toast.LENGTH_SHORT).show(); final GridView gridview = (GridView) findViewById(R.id.gridview); // final String[] items = new String[] { "Item1", "Item2", "Item3","Item4", "Item5", "Item6", "Item7", "Item8" }; ArrayAdapter<String> ad = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, listdata); //Toast.makeText(getApplicationContext(),"setting array adapter",Toast.LENGTH_SHORT).show(); //gridview.setBackgroundColor(Color.GRAY); gridview.setNumColumns(2); gridview.setGravity(Gravity.CENTER); gridview.setAdapter(ad); gridview.setBackgroundColor(Color.GRAY); //Toast.makeText(getApplicationContext(),"setting grid view",Toast.LENGTH_SHORT).show(); gridview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { // TODO Auto-generated method stub // Toast.makeText(getApplicationContext(), "" + arg2,Toast.LENGTH_SHORT).show(); //Toast.makeText(getApplicationContext(),"Prompting speech",Toast.LENGTH_SHORT).show(); try { String s = ((TextView) v).getText().toString(); int start = 0; // '(' position in string int end = 0; // ')' position in string for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '#') // Looking for '(' position in string start = i; else if (s.charAt(i) == '*') // Looking for ')' position in string end = i; } receiver_id = s.substring(start + 1, end); //Toast.makeText(getApplicationContext(), "ID: " + receiver_id, Toast.LENGTH_SHORT).show(); //promptSpeechInput(); } catch (Exception e) { // Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } //receiver_id = grid_text.substring(grid_text.indexOf("#") + 1, grid_text.indexOf("#")); //Toast.makeText(getApplicationContext(),receiver_id,Toast.LENGTH_SHORT).show(); try { promptSpeechInput(); } catch (Exception e) { //Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } try { Intent intent_rate = new Intent(getApplicationContext(), RateDriving.class); intent_rate.putExtra(EXTRA_MESSAGE, receiver_id); startActivity(intent_rate); } catch (Exception e) { //Toast.makeText(getApplicationContext(), e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } //new VoiceTask().execute("http://myfirst.au-syd.mybluemix.net/api/Items"); } }); }
From source file:com.mishiranu.dashchan.ui.gallery.GalleryActivity.java
@Override public void setScreenOnFixed(boolean fixed) { Window window = getWindow(); if (fixed) {/* w w w . j av a 2 s.co m*/ window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } else { window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } }
From source file:com.berniesanders.fieldthebern.MainActivity.java
@TargetApi(21) void setStatusBarColor(int color) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(color);//from w ww . j a v a2 s. c om }
From source file:zxing.util.CaptureActivity.java
License:asdf
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.capture);/*from w ww . j av a 2 s.c om*/ backButton = (Button) findViewById(R.id.cancel_capture); backButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub CaptureActivity.this.finish(); Intent backIntent = new Intent(CaptureActivity.this, MainActivity.class); startActivity(backIntent); } }); hasSurface = false; // historyManager = new HistoryManager(this); // historyManager.trimHistory(); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); ambientLightManager = new AmbientLightManager(this); PreferenceManager.setDefaultValues(this, R.xml.preferences, false); }
From source file:org.mariotaku.twidere.activity.support.LinkHandlerActivity.java
private void requestWindowFeatures(Window window, int linkId, Uri uri) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { window.addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); }// w w w . ja v a 2 s . c o m final int transitionRes; switch (linkId) { case LINK_ID_USER: { transitionRes = R.transition.transition_user; break; } // case LINK_ID_STATUS: { // transitionRes = R.transition.transition_status; // break; // } default: { transitionRes = 0; break; } } if (transitionRes != 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !ThemeUtils.isTransparentBackground(getCurrentThemeBackgroundOption())) { Utils.setSharedElementTransition(this, window, transitionRes); } }