List of usage examples for android.widget PopupWindow dismiss
public void dismiss()
From source file:Main.java
public static void dismiss(PopupWindow window) { if (null != window) window.dismiss(); }
From source file:Main.java
public static boolean tryToClosePopupWindow(PopupWindow popupWindow) { if (popupWindow != null && popupWindow.isShowing()) { popupWindow.dismiss(); return true; }/*from w w w . ja va 2 s . com*/ return false; }
From source file:Main.java
public static void toggle(PopupWindow window, View view) { if (null != window) { if (window.isShowing()) window.dismiss(); else//from www . j ava 2 s. co m window.showAsDropDown(view); } }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showInstructions(View view) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText("Press record to begin recording enrollment"); PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true);//from w w w. jav a2s . com popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void showMessage(View view, String message) { Activity parent = (Activity) context; View spinnerView = LayoutInflater.from(parent).inflate(R.layout.instructions_popup, null); TextView textView = (TextView) spinnerView.findViewById(R.id.phraseText); textView.setText(message);/*from ww w .jav a 2 s .c o m*/ PopupWindow popupWindow = new PopupWindow(spinnerView, 500, 500); popupWindow.setFocusable(true); popupWindow.showAtLocation(view, Gravity.CENTER, 0, 0); final PopupWindow finalPopupWindow = popupWindow; new android.os.Handler().postDelayed(new Runnable() { public void run() { finalPopupWindow.dismiss(); } }, 3000); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void setKnurldEnrollment(View view) { Activity parent = (Activity) context; final View layoutView = LayoutInflater.from(parent).inflate(R.layout.knurld_setup, null); final PopupWindow loadingWindow = showLoadingPopup(layoutView); new Thread(new Runnable() { @Override/* w ww . ja va 2 s. co m*/ public void run() { knurldService.startEnrollment(); runOnUiThread(new Runnable() { @Override public void run() { loadingWindow.dismiss(); } }); } }).start(); showInstructions(layoutView); }
From source file:com.knurld.dropboxdemo.KnurldActivity.java
public void updateKnurldEnrollment(View view) { Activity parent = (Activity) context; final View layoutView = LayoutInflater.from(parent).inflate(R.layout.knurld_setup, null); final PopupWindow loadingWindow = showLoadingPopup(layoutView); new Thread(new Runnable() { @Override/*from ww w.j a v a2 s . co m*/ public void run() { final boolean isEnrolled = knurldService.enroll(); runOnUiThread(new Runnable() { @Override public void run() { if (isEnrolled) { loadingWindow.dismiss(); showMessage(layoutView, "Enrollment completed!"); } else { loadingWindow.dismiss(); showMessage(layoutView, "Enrollment failed, please record enrollment again"); } } }); } }).start(); }
From source file:com.android.talkbacktests.testsession.PopupViewTest.java
/** * Shows a PopupWindow at the anchor view with given window height and list size. *///w ww . ja v a2 s .co m private void showPopupWindow(View button, int height, int listSize, boolean useDefaultInflater) { final Context context = button.getContext(); final ListView listView = new ListView(context); final BaseAdapter adapter; if (useDefaultInflater) { adapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, android.R.id.text1, createSampleArray(listSize)); } else { adapter = new MyAdapter(button.getContext(), createSampleArray(listSize)); } listView.setAdapter(adapter); listView.setVerticalScrollBarEnabled(true); listView.setBackgroundColor(0xFFFFFF); final PopupWindow window = new PopupWindow(listView, ViewGroup.LayoutParams.WRAP_CONTENT, height, true); window.setBackgroundDrawable(context.getResources().getDrawable(android.R.drawable.editbox_background)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { if (window.isShowing()) { window.dismiss(); } } }); PopupWindowCompat.showAsDropDown(window, button, 0, 0, Gravity.NO_GRAVITY); }
From source file:com.survivingwithandroid.pegboard.DreamPinsActivity.java
@Override public void onClearSelected() { closeMenu();//from w w w .j a va 2 s. c o m LayoutInflater inf = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inf.inflate(R.layout.popclear_layout, null, false); final PopupWindow pw = new PopupWindow(v); pw.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT); pw.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT); TextView yesTxt = (TextView) v.findViewById(R.id.dlgYes); TextView noTxt = (TextView) v.findViewById(R.id.dlgNo); noTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); } }); yesTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); pinTableFrag.clearBoard(); } }); pw.showAtLocation(v, Gravity.CENTER, 0, 0); }
From source file:com.survivingwithandroid.pegboard.DreamPinsActivity.java
@Override public void onSaveSelected() { closeMenu();/*from w w w .j a v a2s .c o m*/ LayoutInflater inf = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inf.inflate(R.layout.popsave_layout, null, false); final PopupWindow pw = new PopupWindow(v); pw.setFocusable(true); pw.setWidth(RelativeLayout.LayoutParams.WRAP_CONTENT); pw.setHeight(RelativeLayout.LayoutParams.WRAP_CONTENT); final EditText edt = (EditText) v.findViewById(R.id.edtFileName); TextView saveTxt = (TextView) v.findViewById(R.id.dlgSave); TextView cancelTxt = (TextView) v.findViewById(R.id.dlgCancel); cancelTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); } }); saveTxt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pw.dismiss(); Bitmap b = pinTableFrag.createBitmap(); try { ImageUtility.saveImage(b, edt.getEditableText().toString(), DreamPinsActivity.this); } catch (SaveFileException sfe) { Toast.makeText(DreamPinsActivity.this, getResources().getText(R.string.msgSaveFileError), Toast.LENGTH_LONG).show(); } } }); pw.showAtLocation(v, Gravity.CENTER, 0, 0); }