List of usage examples for android.view Window addFlags
public void addFlags(int flags)
From source file:se.droidgiro.scanner.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); currentInvoice = new Invoice(); channel = getIntent().getStringExtra("channel"); if (channel == null) finish();//from w ww . j a v a 2s.co m Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.capture); this.eraseButton = (Button) this.findViewById(R.id.send_erase); this.eraseButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (currentInvoice != null) sendInvoice(CaptureActivity.this, currentInvoice); // if (currentInvoice != null && currentInvoice.isComplete()) { scanButton.setText(getString(R.string.scan_state_scan)); handler.sendEmptyMessage(R.id.pause); paused = true; // } if (currentInvoice != null) currentInvoice.initFields(); resultListHandler.clear(); // handler.sendEmptyMessage(R.id.new_invoice); onContentChanged(); } }); this.scanButton = (Button) this.findViewById(R.id.pause); this.scanButton.setText(getString(R.string.scan_state_pause)); this.scanButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (paused) { paused = false; handler.sendEmptyMessage(R.id.resume); scanButton.setText(getString(R.string.scan_state_pause)); } else { paused = true; handler.sendEmptyMessage(R.id.pause); scanButton.setText(getString(R.string.scan_state_scan)); } } }); resultListHandler = new ResultListHandler(this); List<ResultListHandler.ListItem> resultList = resultListHandler.getList(); ResultListAdapter adapter = new ResultListAdapter(this, R.layout.result_list_item, resultList); setListAdapter(adapter); CameraManager.init(getApplication()); viewfinderView = (ViewfinderView) findViewById(R.id.viewfinder_view); handler = null; hasSurface = false; }
From source file:co.com.parsoniisolutions.custombottomsheetbehavior.lib.MergedAppBarLayoutBehavior.java
private void setStatusBarBackgroundVisible(boolean visible) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (visible) { Window window = ((Activity) mContext).getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.colorPrimaryDark)); } else {/*w ww. j a va 2s . c o m*/ Window window = ((Activity) mContext).getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(ContextCompat.getColor(mContext, android.R.color.transparent)); } } }
From source file:com.android.gallery3d.app.AbstractGalleryActivity.java
private void toggleStatusBarByOrientation() { if (mDisableToggleStatusBar) return;// w ww. ja va 2 s . com Window win = getWindow(); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { win.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { win.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } }
From source file:ua.com.spacetv.mycookbook.fragments.FragSettings.java
/** * Application of the chosen theme on the fly * * @param parent parent/* www .j av a 2 s. c o m*/ * @param view view * @param position position * @param id id */ @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { //set default INDIGO theme int colorPrimaryDark = R.color.colorPrimaryDark; //status bar int colorPrimary = R.color.colorPrimary; //tool bar int colorPrimaryBackground = R.color.colorPrimaryBackground; //main background int colorTheme = R.style.IndigoTheme; //name of color theme switch (position) { case PINK: colorPrimaryDark = R.color.pinkColorPrimaryDark; colorPrimary = R.color.pinkColorPrimary; colorPrimaryBackground = R.color.pinkColorPrimaryBackground; colorTheme = R.style.PinkTheme; break; case PURPLE: colorPrimaryDark = R.color.purpleColorPrimaryDark; colorPrimary = R.color.purpleColorPrimary; colorPrimaryBackground = R.color.purpleColorPrimaryBackground; colorTheme = R.style.PurpleTheme; break; case DEEP_PURPLE: colorPrimaryDark = R.color.deepPurpleColorPrimaryDark; colorPrimary = R.color.deepPurpleColorPrimary; colorPrimaryBackground = R.color.deepPurpleColorPrimaryBackground; colorTheme = R.style.DeepPurpleTheme; break; case RED: colorPrimaryDark = R.color.redColorPrimaryDark; colorPrimary = R.color.redColorPrimary; colorPrimaryBackground = R.color.redColorPrimaryBackground; colorTheme = R.style.RedTheme; break; case BLUE: colorPrimaryDark = R.color.bluePrimaryDark; colorPrimary = R.color.bluePrimary; colorPrimaryBackground = R.color.bluePrimaryBackground; colorTheme = R.style.BlueTheme; break; case LIGHT_BLUE: colorPrimaryDark = R.color.lightBluePrimaryDark; colorPrimary = R.color.lightBluePrimary; colorPrimaryBackground = R.color.lightBluePrimaryBackground; colorTheme = R.style.LightBlueTheme; break; case CYAN: colorPrimaryDark = R.color.cyanPrimaryDark; colorPrimary = R.color.cyanPrimary; colorPrimaryBackground = R.color.cyanPrimaryBackground; colorTheme = R.style.CyanTheme; break; case TEAL: colorPrimaryDark = R.color.tealColorPrimaryDark; colorPrimary = R.color.tealColorPrimary; colorPrimaryBackground = R.color.tealColorPrimaryBackground; colorTheme = R.style.TealTheme; break; case GREEN: colorPrimaryDark = R.color.greenColorPrimaryDark; colorPrimary = R.color.greenColorPrimary; colorPrimaryBackground = R.color.greenColorPrimaryBackground; colorTheme = R.style.GreenTheme; break; case LIGHT_GREEN: colorPrimaryDark = R.color.lightGreenColorPrimaryDark; colorPrimary = R.color.lightGreenColorPrimary; colorPrimaryBackground = R.color.lightGreenColorPrimaryBackground; colorTheme = R.style.LightGreenTheme; break; case LIME: colorPrimaryDark = R.color.limeColorPrimaryDark; colorPrimary = R.color.limeColorPrimary; colorPrimaryBackground = R.color.limeColorPrimaryBackground; colorTheme = R.style.LimeTheme; break; case YELLOW: colorPrimaryDark = R.color.yellowColorPrimaryDark; colorPrimary = R.color.yellowColorPrimary; colorPrimaryBackground = R.color.yellowColorPrimaryBackground; colorTheme = R.style.YellowTheme; break; case AMBER: colorPrimaryDark = R.color.amberColorPrimaryDark; colorPrimary = R.color.amberColorPrimary; colorPrimaryBackground = R.color.amberColorPrimaryBackground; colorTheme = R.style.AmberTheme; break; case ORANGE: colorPrimaryDark = R.color.orangeColorPrimaryDark; colorPrimary = R.color.orangeColorPrimary; colorPrimaryBackground = R.color.orangeColorPrimaryBackground; colorTheme = R.style.OrangeTheme; break; case DEEP_ORANGE: colorPrimaryDark = R.color.deepOrangeColorPrimaryDark; colorPrimary = R.color.deepOrangeColorPrimary; colorPrimaryBackground = R.color.deepOrangeColorPrimaryBackground; colorTheme = R.style.DeepOrangeTheme; break; case BROWN: colorPrimaryDark = R.color.brownColorPrimaryDark; colorPrimary = R.color.brownColorPrimary; colorPrimaryBackground = R.color.brownColorPrimaryBackground; colorTheme = R.style.BrownTheme; break; case GREY: colorPrimaryDark = R.color.greyColorPrimaryDark; colorPrimary = R.color.greyColorPrimary; colorPrimaryBackground = R.color.greyColorPrimaryBackground; colorTheme = R.style.GreyTheme; break; case BLUE_GREY: colorPrimaryDark = R.color.blueGreyColorPrimaryDark; colorPrimary = R.color.blueGreyColorPrimary; colorPrimaryBackground = R.color.blueGreyColorPrimaryBackground; colorTheme = R.style.BlueGreyTheme; break; case BLACK_WHITE: colorPrimaryDark = R.color.blackWhiteColorPrimaryDark; colorPrimary = R.color.blackWhiteColorPrimary; colorPrimaryBackground = R.color.blackWhiteColorPrimaryBackground; colorTheme = R.style.BlackWhiteTheme; break; } int colorStatusBar = ContextCompat.getColor(mContext, colorPrimaryDark); int colorToolbar = ContextCompat.getColor(mContext, colorPrimary); mColorBackground = ContextCompat.getColor(mContext, colorPrimaryBackground); MainActivity.mHeaderNavigationDrawerLayout.setBackgroundColor(colorToolbar); getActivity().setTheme(colorTheme); //Getting status bar if Lolipop+ if (Build.VERSION.SDK_INT >= 21) { Window window = getActivity().getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(colorStatusBar); } MainActivity.mToolbar.setBackgroundColor(colorToolbar); if (MainActivity.mFrameLayout != null) if (isBackgroundWhite) { MainActivity.mFrameLayout.setBackgroundColor(Color.WHITE); } else MainActivity.mFrameLayout.setBackgroundColor(mColorBackground); }
From source file:com.amti.vela.bluetoothlegatt.bluetooth.DeviceScanActivity.java
void initGui() { leScanHandler = new Handler(); //widgets/*from ww w . j av a2 s. c o m*/ deviceListView = (ListView) findViewById(R.id.listView); swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); mLeDevicesList = new ArrayList<BluetoothDevice>(); devicesAdapter = new CustomListAdapter(this, R.layout.custom_listview_item); deviceListView.setAdapter(devicesAdapter); // Configure the refreshing colors swipeContainer.setColorSchemeResources(R.color.action_bar_light_blue, R.color.swipe_refresh_dark_green, android.R.color.holo_orange_light, android.R.color.holo_red_light); notificationEnableDialog = new AlertDialog.Builder(DeviceScanActivity.this); notificationEnableDialog.setMessage("This app wants to enable notification access in the settings app.") .setPositiveButton("OK", notificationDialogClickListener) .setNegativeButton("Cancel", notificationDialogClickListener).setCancelable(false); //action bar Toolbar actionBarToolBar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(actionBarToolBar); actionBarToolBar.setTitle("Choose a Device"); actionBarToolBar.setTitleTextColor(ContextCompat.getColor(this, R.color.action_bar_text_gray)); //status bar color Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { window.setStatusBarColor(ContextCompat.getColor(this, R.color.action_bar_dark_blue)); } deviceListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapter, View v, int position, long arg3) { BluetoothDevice device = mLeDevicesList.get(position); if (device == null) return; final Intent intent = new Intent(DeviceScanActivity.this, MainActivity.class); String deviceName = device.getName() == null ? "Unknown Device" : device.getName(); intent.putExtra(MainActivity.EXTRAS_DEVICE, deviceName + "\n" + device.getAddress()); if (mScanning) { scanLeDevice(false); mScanning = false; } if (notificationListenerInit()) ; startActivity(intent); } }); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // Your code to refresh the list here. // Make sure you call swipeContainer.setRefreshing(false) // once the bt request has completed successfully clearDevices(); scanLeDevice(true); } }); }
From source file:com.google.zxing.client.android.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(EUExUtil.getResLayoutID("plugin_uexscanner_capture_layout")); if (getIntent() != null) { DataJsonVO data = (DataJsonVO) getIntent().getSerializableExtra(JsConst.DATA_JSON); if (data != null) { mData = data;// w w w . j a v a 2 s . co m } else { mData = new DataJsonVO(); } } hasSurface = false; inactivityTimer = new InactivityTimer(this); ambientLightManager = new AmbientLightManager(this); mConRel = (RelativeLayout) findViewById(EUExUtil.getResIdID("plugin_uexscanner_content_rel")); initConView(); mHandler = new ScanPicHandler(Looper.getMainLooper()); }
From source file:com.dtr.zxing.activity.CaptureActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); setContentView(R.layout.activity_qr_scan); scanPreview = (SurfaceView) findViewById(R.id.capture_preview); scanContainer = (RelativeLayout) findViewById(R.id.capture_container); scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view); scanLine = (ImageView) findViewById(R.id.capture_scan_line); mFlash = (ImageView) findViewById(R.id.capture_flash); mFlash.setOnClickListener(this); inactivityTimer = new InactivityTimer(this); beepManager = new BeepManager(this); TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f); animation.setDuration(4500);//www. ja v a 2s .c o m animation.setRepeatCount(-1); animation.setRepeatMode(Animation.RESTART); scanLine.startAnimation(animation); }
From source file:com.jun.elephant.ui.main.MainActivity.java
/** * ???/* w w w . jav a 2 s .com*/ * @param colorValue */ private void changeStatusColor(int colorValue) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(ContextCompat.getColor(this, colorValue)); } }
From source file:com.mooo.ziggypop.candconline.SettingsActivity.java
/** * Sets the actionbar and the status bar (if the build allows it) to the provided color id. * @param colorResourceId The id of the color to which the bars will be set. *///from w w w .j a va 2 s .c om private void setBarColors(int colorResourceId) { // Set the action bar. mToolBar.setBackgroundResource(colorResourceId); //Set the status bar. Window window = getWindow(); // clear FLAG_TRANSLUCENT_STATUS flag: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); // add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //Set the status bar color if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(colorResourceId)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) window.setStatusBarColor(getResources().getColor(colorResourceId, getTheme())); }
From source file:com.ferid.app.classroom.statistics.StatisticalListActivity.java
/** * Set status bar colour on graph visibility change *//*from www. j a va 2 s.com*/ private void setStatusBarColour() { if (Build.VERSION.SDK_INT >= 21) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); if (graphLayout.getVisibility() == View.VISIBLE) { Configuration configuration = getResources().getConfiguration(); if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { window.setStatusBarColor(ContextCompat.getColor(this, R.color.materialLightGreen)); } else if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { window.setStatusBarColor(ContextCompat.getColor(this, R.color.colourPrimaryDark)); } } else { window.setStatusBarColor(ContextCompat.getColor(this, R.color.colourPrimaryDark)); } } }