List of usage examples for android.view Window setFlags
public void setFlags(int flags, int mask)
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
private void showErrorDialog(String strTitle) { hideTopDialog();/*from ww w . ja v a2 s . co m*/ if (dlgError == null) dlgError = new UniMagTopDialog(this); try { Window win = dlgError.getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); dlgError.setTitle("ERROR"); dlgError.setContentView(R.layout.dlgtopview); TextView myTV = (TextView) dlgError.findViewById(R.id.TView_Info); myTV.setText("There was an error when swiping the card."); dlgError.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { return false; } return true; } }); dlgError.show(); } catch (Exception ex) { ex.printStackTrace(); dlgError = null; } }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
private void showTopDialog(String strTitle) { hideTopDialog();// w w w . j a v a2 s . c om if (dlgTopShow == null) dlgTopShow = new UniMagTopDialog(this); try { Window win = dlgTopShow.getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); dlgTopShow.setTitle("Initializing Device..."); dlgTopShow.setContentView(R.layout.dlgtopview); TextView myTV = (TextView) dlgTopShow.findViewById(R.id.TView_Info); myTV.setText(popupDialogMsg); dlgTopShow.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { return false; } return true; } }); dlgTopShow.show(); } catch (Exception ex) { ex.printStackTrace(); dlgTopShow = null; } }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
private void showSwipeTopDialog() { hideSwipeTopDialog();//from w w w.j av a 2s. c om try { if (dlgSwipeTopShow == null) dlgSwipeTopShow = new UniMagTopDialog(this); Window win = dlgSwipeTopShow.getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); dlgSwipeTopShow.setTitle("Swipe Card"); dlgSwipeTopShow.setContentView(R.layout.dlgswipetopview); TextView myTV = (TextView) dlgSwipeTopShow.findViewById(R.id.TView_Info); Button myBtn = (Button) dlgSwipeTopShow.findViewById(R.id.btnCancel); myTV.setText(popupDialogMsg); myBtn.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { if (itemStartSC != null) itemStartSC.setEnabled(true); //stop swipe myUniMagReader.stopSwipeCard(); if (readerType == 2) isWaitingForCommandResult = true; if (dlgSwipeTopShow != null) { statusText = "Swipe card cancelled."; msrData = null; dlgSwipeTopShow.dismiss(); } } }); dlgSwipeTopShow.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { return false; } return true; } }); dlgSwipeTopShow.show(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.example.android.bluepayandroidsdk.MainActivity.java
private void showYesNoDialog() { hideSwipeTopDialog();//from w w w . j ava 2 s.c o m try { if (dlgYESNOTopShow == null) dlgYESNOTopShow = new UniMagTopDialogYESNO(this); Window win = dlgYESNOTopShow.getWindow(); win.setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); dlgYESNOTopShow.setTitle("Warning"); dlgYESNOTopShow.setContentView(R.layout.dlgtopview2bnt); TextView myTV = (TextView) dlgYESNOTopShow.findViewById(R.id.TView_Info); myTV.setTextColor(0xFF0FF000); Button myBtnYES = (Button) dlgYESNOTopShow.findViewById(R.id.btnYes); Button myBtnNO = (Button) dlgYESNOTopShow.findViewById(R.id.btnNo); // myTV.setText("Warrning, Now will Update Firmware if you press 'YES' to update, or 'No' to cancel"); myTV.setText( "Upgrading the firmware might cause the device to not work properly. \nAre you sure you want to continue? "); myBtnYES.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { updateFirmware_exTools(); dlgYESNOTopShow.dismiss(); } }); myBtnNO.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { dlgYESNOTopShow.dismiss(); } }); dlgYESNOTopShow.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if ((keyCode == KeyEvent.KEYCODE_BACK)) { return false; } return true; } }); dlgYESNOTopShow.show(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:org.smilec.smile.student.CourseList.java
public void addimage() { //galleryidx = 1; // in order to retain information chkimg = 1;/*from ww w . j a v a 2 s.com*/ /**************************************************** * This is the part which worked as an image dialog * *****************************************************/ add_pic_d = new AddPictureDialog(CourseList.this); add_pic_d.setActivity(_act); Window window = add_pic_d.getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND); //add_pic_d.setTitle("Touch the picture for selection"); add_pic_d.setTitle(R.string.img_dialog_title); add_pic_d.setContentView(R.layout.addpicdialog); add_pic_d.show(); add_pic_d.setOnDismissListener((CourseList) _act); smile.overrideFonts(CourseList.this, add_pic_d.findViewById(android.R.id.content).getRootView()); //add_pic_g.onStart(); }
From source file:jackpal.androidterm.Term.java
private void updatePrefs() { ActivityCompat.invalidateOptionsMenu(this); mUseKeyboardShortcuts = mSettings.getUseKeyboardShortcutsFlag(); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); setFunctionKeyVisibility();/* ww w . j a v a 2 s. c o m*/ mViewFlipper.updatePrefs(mSettings); for (View v : mViewFlipper) { ((EmulatorView) v).setDensity(metrics); ((TermView) v).updatePrefs(mSettings); setPreIMEShortsuts((EmulatorView) v); if (mSettings.useCookedIME() == false) { ((EmulatorView) v).setIMECtrlBeginBatchEditDisable(false); } } if (mTermSessions != null) { for (TermSession session : mTermSessions) { ((GenericTermSession) session).updatePrefs(mSettings); } } { Window win = getWindow(); WindowManager.LayoutParams params = win.getAttributes(); final int FULLSCREEN = WindowManager.LayoutParams.FLAG_FULLSCREEN; int desiredFlag = mSettings.showStatusBar() ? 0 : FULLSCREEN; if (desiredFlag != (params.flags & FULLSCREEN) || (AndroidCompat.SDK >= 11 && mActionBarMode != mSettings.actionBarMode())) { if (mAlreadyStarted) { // Can't switch to/from fullscreen after // starting the activity. restart(); } else { win.setFlags(desiredFlag, FULLSCREEN); if (mActionBarMode >= TermSettings.ACTION_BAR_MODE_HIDES) { if (mActionBar != null) { mActionBar.hide(); } } } } } int orientation = mSettings.getScreenOrientation(); int o = 0; if (orientation == 0) { o = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; } else if (orientation == 1) { o = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; } else if (orientation == 2) { o = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; } else { /* Shouldn't be happened. */ } setRequestedOrientation(o); }
From source file:org.mozilla.gecko.GeckoApp.java
public void setFullScreen(final boolean fullscreen) { mMainHandler.post(new Runnable() { public void run() { // Hide/show the system notification bar Window window = getWindow(); window.setFlags(fullscreen ? WindowManager.LayoutParams.FLAG_FULLSCREEN : 0, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (Build.VERSION.SDK_INT >= 11) window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0); }//from ww w . j av a2s. c o m }); }
From source file:com.processing.core.PApplet.java
/** Called with the activity is first created. */ @Override/*from ww w .j a v a 2 s. co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // println("PApplet.onCreate()"); if (DEBUG) println("onCreate() happening here: " + Thread.currentThread().getName()); Window window = getWindow(); // Take up as much area as possible requestWindowFeature(Window.FEATURE_NO_TITLE); window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN); // This does the actual full screen work window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); displayWidth = dm.widthPixels; displayHeight = dm.heightPixels; // println("density is " + dm.density); // println("densityDpi is " + dm.densityDpi); if (DEBUG) println("display metrics: " + dm); //println("screen size is " + screenWidth + "x" + screenHeight); // LinearLayout layout = new LinearLayout(this); // layout.setOrientation(LinearLayout.VERTICAL | LinearLayout.HORIZONTAL); // viewGroup = new ViewGroup(); // surfaceView.setLayoutParams(); // viewGroup.setLayoutParams(LayoutParams.) // RelativeLayout layout = new RelativeLayout(this); // RelativeLayout overallLayout = new RelativeLayout(this); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT); //lp.addRule(RelativeLayout.RIGHT_OF, tv1.getId()); // layout.setGravity(RelativeLayout.CENTER_IN_PARENT); int sw = sketchWidth(); int sh = sketchHeight(); if (sketchRenderer().equals(JAVA2D)) { surfaceView = new SketchSurfaceView(this, sw, sh); } else if (sketchRenderer().equals(P2D) || sketchRenderer().equals(P3D)) { surfaceView = new SketchSurfaceViewGL(this, sw, sh, sketchRenderer().equals(P3D)); } // g = ((SketchSurfaceView) surfaceView).getGraphics(); // surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight())); // layout.addView(surfaceView); // surfaceView.setVisibility(1); // println("visibility " + surfaceView.getVisibility() + " " + SurfaceView.VISIBLE); // layout.addView(surfaceView); // AttributeSet as = new AttributeSet(); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(layout, as); // lp.addRule(android.R.styleable.ViewGroup_Layout_layout_height, // layout.add //lp.addRule(, arg1) //layout.addView(surfaceView, sketchWidth(), sketchHeight()); // new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, // RelativeLayout.LayoutParams.FILL_PARENT); if (sw == displayWidth && sh == displayHeight) { // If using the full screen, don't embed inside other layouts window.setContentView(surfaceView); } else { // If not using full screen, setup awkward view-inside-a-view so that // the sketch can be centered on screen. (If anyone has a more efficient // way to do this, please file an issue on Google Code, otherwise you // can keep your "talentless hack" comments to yourself. Ahem.) RelativeLayout overallLayout = new RelativeLayout(this); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.addRule(RelativeLayout.CENTER_IN_PARENT); LinearLayout layout = new LinearLayout(this); layout.addView(surfaceView, sketchWidth(), sketchHeight()); overallLayout.addView(layout, lp); window.setContentView(overallLayout); } /* // Here we use Honeycomb API (11+) to hide (in reality, just make the status icons into small dots) // the status bar. Since the core is still built against API 7 (2.1), we use introspection to get // the setSystemUiVisibility() method from the view class. Method visibilityMethod = null; try { visibilityMethod = surfaceView.getClass().getMethod("setSystemUiVisibility", new Class[] { int.class}); } catch (NoSuchMethodException e) { // Nothing to do. This means that we are running with a version of Android previous to Honeycomb. } if (visibilityMethod != null) { try { // This is equivalent to calling: //surfaceView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN); // The value of View.STATUS_BAR_HIDDEN is 1. visibilityMethod.invoke(surfaceView, new Object[] { 1 }); } catch (InvocationTargetException e) { } catch (IllegalAccessException e) { } } window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); */ // layout.addView(surfaceView, lp); // surfaceView.setLayoutParams(new LayoutParams(sketchWidth(), sketchHeight())); // RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams() // layout.addView(surfaceView, new LayoutParams(arg0) // TODO probably don't want to set these here, can't we wait for surfaceChanged()? // removing this in 0187 // width = screenWidth; // height = screenHeight; // int left = (screenWidth - iwidth) / 2; // int right = screenWidth - (left + iwidth); // int top = (screenHeight - iheight) / 2; // int bottom = screenHeight - (top + iheight); // surfaceView.setPadding(left, top, right, bottom); // android:layout_width // window.setContentView(surfaceView); // set full screen // code below here formerly from init() //millisOffset = System.currentTimeMillis(); // moved to the variable declaration finished = false; // just for clarity // this will be cleared by draw() if it is not overridden looping = true; redraw = true; // draw this guy once // firstMotion = true; Context context = getApplicationContext(); sketchPath = context.getFilesDir().getAbsolutePath(); // Looper.prepare(); handler = new Handler(); // println("calling loop()"); // Looper.loop(); // println("done with loop() call, will continue..."); start(); }