List of usage examples for android.widget PopupWindow setOutsideTouchable
public void setOutsideTouchable(boolean touchable)
Controls whether the pop-up will be informed of touch events outside of its window.
From source file:Main.java
public static PopupWindow showPopWindow(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null; popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width);/* ww w .ja v a 2s . c om*/ } popupWindow.setOutsideTouchable(true); popupWindow.showAsDropDown(targetView); return popupWindow; }
From source file:Main.java
public static PopupWindow showPopWindow2(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null; popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width);/*from ww w .jav a2s. c o m*/ } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); return popupWindow; }
From source file:Main.java
public static PopupWindow showPopWindow3(Context context, View targetView, View contentView, Integer width) { PopupWindow popupWindow = null; popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); if (width != null) { popupWindow.setWidth(width);//from ww w . j a v a 2 s . com } popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); return popupWindow; }
From source file:org.zywx.wbpalmstar.plugin.uexscrawl.PhotoScrawlActivity.java
private void showPopWindow(SeekBar seekBar, View relativeView) { int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); seekBar.measure(w, h);/*from w ww . ja v a2 s. c o m*/ PopupWindow popupWindow = new PopupWindow(seekBar); popupWindow.setBackgroundDrawable(new ColorDrawable()); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setWidth(seekBar.getMeasuredWidth()); popupWindow.setHeight(EUExUtil.dipToPixels(120)); popupWindow.showAtLocation(mImageContentLayout, Gravity.BOTTOM, relativeView.getLeft() - mImageContentLayout.getWidth() / 2 + relativeView.getWidth() / 2, mCloseLayout.getHeight() + relativeView.getHeight() + 50); }
From source file:org.zywx.wbpalmstar.plugin.uexscrawl.PhotoScrawlActivity.java
private void showColorChoosePop() { LinearLayout linearLayout = new LinearLayout(this); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); int margin = EUExUtil.dipToPixels(8); lp.setMargins(margin / 2, margin, margin / 2, margin); linearLayout.setLayoutParams(lp);/*from ww w. jav a2 s . c o m*/ linearLayout.setOrientation(LinearLayout.HORIZONTAL); for (int color : colors) { linearLayout.addView(getColorImageView(color)); } HorizontalScrollView scrollView = new HorizontalScrollView(this); LinearLayout.LayoutParams scrollLp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); scrollView.setLayoutParams(scrollLp); scrollView.addView(linearLayout); int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); scrollView.measure(w, h); PopupWindow popupWindow = new PopupWindow(scrollView); popupWindow.setBackgroundDrawable(new ColorDrawable()); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setWidth(mImageContentLayout.getWidth()); popupWindow.setHeight(scrollView.getMeasuredHeight()); popupWindow.showAtLocation(mImageContentLayout, Gravity.BOTTOM, 0, mCloseLayout.getHeight() + mBrushLayout.getHeight() + popupWindow.getHeight()); }
From source file:com.kccomy.orgar.ui.note.NoteFragment.java
private void initPopupWindow() { View popupWindowView = getActivity().getLayoutInflater().inflate(R.layout.popup_window_share, null); //??/*from ww w .ja v a 2 s . co m*/ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addCategory(Intent.CATEGORY_DEFAULT); shareIntent.setType("text/plain"); PackageManager packageManager = getContext().getPackageManager(); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(shareIntent, PackageManager.GET_RESOLVED_FILTER); // RecyclerAdapter RecyclerView recyclerView = (RecyclerView) popupWindowView.findViewById(R.id.popup_widow_share_recycler); ShareAdapter shareAdapter = new ShareAdapter(packageManager); shareAdapter.setData(resolveInfos); shareAdapter.setAppIconClickListener(shareListener); recyclerView.setAdapter(shareAdapter); recyclerView .setLayoutManager(new GridLayoutManager(getContext(), 2, LinearLayoutManager.HORIZONTAL, false)); // ?PopupWindow popupWindowView.setFocusable(true); popupWindowView.setFocusableInTouchMode(true); PopupWindow popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000)); popupWindow.setAnimationStyle(R.style.anim_menu_bottombar); setWindowAlpha(0.5f); popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { setWindowAlpha(1f); } }); popupWindow.showAtLocation(getActivity().getLayoutInflater().inflate(R.layout.fragment_note, null), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); }
From source file:fr.univsavoie.ltp.client.map.Popup.java
/** * Afficher sur la map un popup qui affiche les * informations de l'utilisateur connect. */// w ww .java 2 s . co m public final void popupDisplayUserInfos() { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; int popupWidth = (int) (width * 0.75); //int popupHeight = height / 2; // Inflate the popup_layout.xml LinearLayout viewGroup = (LinearLayout) this.activity.findViewById(R.id.popupAccount); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_account, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupUserInfos = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupUserInfos.setBackgroundDrawable(new BitmapDrawable()); popupUserInfos.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupUserInfos.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); } }); /* * Evenements composants du PopupWindow */ // Ecouteur d'vnement sur le bouton pour se dconnecter Button close = (Button) layout.findViewById(R.id.close); close.setOnClickListener(new OnClickListener() { public void onClick(View v) { popupUserInfos.dismiss(); } }); }
From source file:fr.univsavoie.ltp.client.map.Popup.java
/** * Afficher une boite au milieu de la carte si aucun utilisateur est connects * pour proposer a l'invit, de se connecter ou s'incrire aupres du service LTP. *///w ww.j a va 2 s .c o m public final void popupGuest() { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; //final int height = dm.heightPixels; int popupWidth = (int) (width * 0.75); //int popupHeight = height / 2; // Inflate the popup_layout.xml LinearLayout viewGroup = (LinearLayout) this.activity.findViewById(R.id.popupGuest); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_guest, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupGuest = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupGuest.setBackgroundDrawable(new BitmapDrawable()); popupGuest.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupGuest.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); } }); /* * Evenements composants du PopupWindow */ // Ecouteur d'vnement sur le bouton des paramtres Button btLogin = (Button) layout.findViewById(R.id.btnPopupLogin); btLogin.setOnClickListener(new OnClickListener() { public void onClick(View view) { // La constante CODE_MON_ACTIVITE reprsente lidentifiant de la requte // (requestCode) qui sera utilis plus tard pour identifier lactivit // renvoyant la valeur de retour. Intent i = new Intent(activity, LoginActivity.class); activity.startActivityForResult(i, 1); popupGuest.dismiss(); } }); // Ecouteur d'vnement sur le bouton des paramtres Button btSignup = (Button) layout.findViewById(R.id.btnPopupSignup); btSignup.setOnClickListener(new OnClickListener() { public void onClick(View view) { // La constante CODE_MON_ACTIVITE reprsente lidentifiant de la requte // (requestCode) qui sera utilis plus tard pour identifier lactivit // renvoyant la valeur de retour. Intent i = new Intent(activity, SignupActivity.class); activity.startActivityForResult(i, 3); popupGuest.dismiss(); } }); // Ecouteur d'vnement sur le bouton pour fermer l'application Button close = (Button) layout.findViewById(R.id.btnPopupClose); close.setOnClickListener(new OnClickListener() { public void onClick(View v) { popupGuest.dismiss(); } }); }
From source file:fr.univsavoie.ltp.client.map.Popup.java
/** * Afficher sur la map un popup qui propose a l'utilisateur * de mettre a jours son status//from ww w . j a v a2 s . c om */ public final void popupPublishStatus() { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; int popupWidth = (int) (width * 0.75); //int popupHeight = height / 2; // Inflate the popup_layout.xml ScrollView viewGroup = (ScrollView) this.activity.findViewById(R.id.popupStatus); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_set_status, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupPublishStatus = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupPublishStatus.setBackgroundDrawable(new BitmapDrawable()); popupPublishStatus.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupPublishStatus.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); } }); /* * Evenements composants du PopupWindow */ // Ecouteur d'vnement sur le bouton pour se dconnecter Button publish = (Button) layout.findViewById(R.id.btStatusPublish); publish.setOnClickListener(new OnClickListener() { public void onClick(View v) { EditText userStatus = (EditText) layout.findViewById(R.id.fieldUserStatus); if (userStatus.getText().toString().length() == 0) { Toast.makeText(activity, "Impossible de publi ton status !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); } else if (userStatus.getText().toString().length() < 3) { Toast.makeText(activity, "Impossible de publi ton status !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); } else { String json = "{\"ltp\":{\"application\":\"Client LTP\",\"status\":{\"lon\" : \"" + String.valueOf(activity.getLongitude()) + "\",\"lat\" : \"" + String.valueOf(activity.getLatitude()) + "\",\"content\" : \"" + userStatus.getText().toString() + "\"}}}"; activity.getSession().postJSON("https://jibiki.univ-savoie.fr/ltpdev/rest.php/api/1/statuses", "STATUSES", json); Toast.makeText(activity, "Status mise a jours !", Toast.LENGTH_LONG).show(); popupPublishStatus.dismiss(); // Actualise les marqueurs activity.displayFriends(); } } }); }
From source file:fr.univsavoie.ltp.client.map.Popup.java
public final void popupGetStatus(JSONArray pStatusesArray) { DisplayMetrics dm = new DisplayMetrics(); this.activity.getWindowManager().getDefaultDisplay().getMetrics(dm); //final int height = dm.heightPixels; final int width = dm.widthPixels; final int height = dm.heightPixels; int popupWidth = (int) (width * 0.75); int popupHeight = height; // Inflate the popup_layout.xml ScrollView viewGroup = (ScrollView) this.activity.findViewById(R.id.popupGetStatus); LayoutInflater layoutInflater = (LayoutInflater) this.activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = layoutInflater.inflate(R.layout.popup_get_status, viewGroup); layout.setBackgroundResource(R.drawable.popup_gradient); // Crer le PopupWindow final PopupWindow popupPublishStatus = new PopupWindow(layout, popupWidth, LayoutParams.WRAP_CONTENT, true); popupPublishStatus.setBackgroundDrawable(new BitmapDrawable()); popupPublishStatus.setOutsideTouchable(true); // Some offset to align the popup a bit to the right, and a bit down, relative to button's position. final int OFFSET_X = 0; final int OFFSET_Y = 0; // Displaying the popup at the specified location, + offsets. this.activity.findViewById(R.id.layoutMain).post(new Runnable() { public void run() { popupPublishStatus.showAtLocation(layout, Gravity.CENTER, OFFSET_X, OFFSET_Y); }/*from w w w. j av a 2 s . com*/ }); /* * Evenements composants du PopupWindow */ // Find the ListView resource. ListView mainListView = (ListView) layout.findViewById(R.id.listViewStatus); ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); SimpleAdapter adapter = new SimpleAdapter(this.activity, list, R.layout.custom_row_view, new String[] { "content", "lat", "lon" }, new int[] { R.id.text1, R.id.text2, R.id.text3 }); try { // Appel REST pour recuperer les status de l'utilisateur connect //Session session = new Session(this.activity); //session.parseJSONUrl("https://jibiki.univ-savoie.fr/ltpdev/rest.php/api/1/statuses", "STATUSES", "GET"); // Parser la liste des amis dans le OverlayItem ArrayList HashMap<String, String> temp; for (int i = 0; (i < 6); i++) { // Obtenir le status JSONObject status = pStatusesArray.getJSONObject(i); temp = new HashMap<String, String>(); temp.put("content", status.getString("content")); temp.put("lat", String.valueOf(status.getDouble("lat"))); temp.put("lon", String.valueOf(status.getDouble("lon"))); list.add(temp); } } catch (JSONException jex) { Log.e("Catch", "popupGetStatus / JSONException : " + jex.getStackTrace()); } catch (Exception ex) { Log.e("Catch", "popupGetStatus / Exception : " + ex.getLocalizedMessage()); } mainListView.setAdapter(adapter); }