List of usage examples for android.graphics.drawable BitmapDrawable BitmapDrawable
@Deprecated
public BitmapDrawable()
From source file:com.roamprocess1.roaming4world.ui.messages.MessageActivity.java
private void commonPopupWindowDisplay(PopupWindow popupWindow, View tabMenu, int x, int y) { popupWindow.setFocusable(true);/*from w w w .j av a 2 s . c o m*/ popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setIgnoreCheekPress(); popupWindow.setOutsideTouchable(true); popupWindow.showAsDropDown(tabMenu, x, y); }
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 ww w. ja v a 2 s . c om }); /* * 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); }
From source file:com.watch.customer.ui.ShopListActivity.java
@SuppressWarnings("deprecation") private void showSectionPop(int width, int height, final int secindex) { layout = (LinearLayout) LayoutInflater.from(ShopListActivity.this).inflate(R.layout.popup_category, null); section_list = (ListView) layout.findViewById(R.id.section_list); section_grid = (GridView) layout.findViewById(R.id.section_grid); section_list.setOnItemClickListener(this); section_grid.setOnItemClickListener(this); if (secindex == 1) {// 2grid section_grid.setVisibility(View.VISIBLE); section_list.setVisibility(View.GONE); secAdapter = new SectionAdapter(ShopListActivity.this, secArr2, selectPos[secindex], secindex); section_grid.setAdapter(secAdapter); } else {// w w w . j a va 2 s .c o m section_grid.setVisibility(View.GONE); section_list.setVisibility(View.VISIBLE); if (secindex == 0) { secAdapter = new SectionAdapter(ShopListActivity.this, secArr1, selectPos[secindex], secindex); } else { secAdapter = new SectionAdapter(ShopListActivity.this, secArr3, selectPos[secindex], secindex); } section_list.setAdapter(secAdapter); } mPopWin = new PopupWindow(layout, width, LayoutParams.WRAP_CONTENT, true); mPopWin.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { // TODO Auto-generated method stub selectSecCheck(4); } }); mPopWin.setBackgroundDrawable(new BitmapDrawable()); mPopWin.showAsDropDown(text1, 0, 0); mPopWin.update(); }
From source file:com.zia.freshdocs.widget.adapter.CMISAdapter.java
/** * Display file information/*from ww w .j a va 2s . c o m*/ * * @param context */ public void showFileInfo(Context context, int position, boolean isFile) { final NodeRef ref = getItem(position); try { //We need to get the instance of the LayoutInflater, use the context of this activity LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //Inflate the view from a predefined XML layout View layout = inflater.inflate(R.layout.file_info_dialog, null, false); // create a WRAP_CONTENT PopupWindow PopupWindow mPopUp = new PopupWindow(layout, WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, true); mPopUp.setBackgroundDrawable(new BitmapDrawable()); mPopUp.setOutsideTouchable(true); // display the popup in the center mPopUp.showAtLocation(layout, Gravity.CENTER, 0, 0); TextView title = (TextView) layout.findViewById(R.id.dialog_title); if (isFile) title.setText(context.getString(R.string.str_file_information)); else title.setText(context.getString(R.string.str_folder_information)); UITableView tableView = (UITableView) layout.findViewById(R.id.tableView); ViewItem viewItem; if (ref.getName() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_name), ref.getName()); tableView.addViewItem(viewItem); } if (ref.getCreateBy() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_created_by), ref.getCreateBy()); tableView.addViewItem(viewItem); } if (ref.getLastModificationDate() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_last_modification_date), ref.getLastModificationDate()); tableView.addViewItem(viewItem); } if (ref.getLastModifiedBy() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_last_modified_by), ref.getLastModifiedBy()); tableView.addViewItem(viewItem); } if (ref.getContent() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_content), ref.getContent()); tableView.addViewItem(viewItem); } if (ref.getContentType() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_content_type), ref.getContentType()); tableView.addViewItem(viewItem); } if (ref.getObjectId() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_object_id), ref.getObjectId()); tableView.addViewItem(viewItem); } if (ref.getParentId() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_parent_id), ref.getParentId()); tableView.addViewItem(viewItem); } if (ref.getVersion() != null) { viewItem = Utils.createCustomView(context, context.getString(R.string.str_version), ref.getVersion()); tableView.addViewItem(viewItem); } tableView.commit(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.watch.customer.ui.ShopListActivity.java
@SuppressWarnings("deprecation") private void showAreaPop(int width, int height) { layout = (LinearLayout) LayoutInflater.from(ShopListActivity.this).inflate(R.layout.popup_area, null); area_grid = (GridView) layout.findViewById(R.id.area_grid); area_grid.setOnItemClickListener(this); mAreaAdapter = new AreaAdapter(); area_grid.setAdapter(mAreaAdapter);/*from w w w . j a v a2s . c o m*/ mPopWin = new PopupWindow(layout, width, LayoutParams.WRAP_CONTENT, true); View area_loc = (LinearLayout) layout.findViewById(R.id.area_loc); area_loc.setOnClickListener(this); mPopWin.setBackgroundDrawable(new BitmapDrawable()); mPopWin.showAsDropDown(findViewById(R.id.head), 0, 0); mPopWin.update(); }
From source file:bruce.kk.brucetodos.MainActivity.java
/** * ???// w w w. jav a 2 s .c o m * * @param position */ private void modifyItem(final int position) { final UnFinishItem item = dataList.get(position); LogDetails.d(item); LinearLayout linearLayout = new LinearLayout(MainActivity.this); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); linearLayout.setLayoutParams(layoutParams); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setBackgroundColor(getResources().getColor(android.R.color.black)); final EditText editText = new EditText(MainActivity.this); editText.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); editText.setTextColor(getResources().getColor(android.R.color.holo_green_light)); editText.setHint(item.content); editText.setHintTextColor(getResources().getColor(android.R.color.holo_orange_dark)); linearLayout.addView(editText); Button btnModify = new Button(MainActivity.this); btnModify.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); btnModify.setText(""); btnModify.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); btnModify.setTextColor(getResources().getColor(android.R.color.holo_blue_bright)); btnModify.setBackgroundColor(getResources().getColor(android.R.color.black)); linearLayout.addView(btnModify); Button btnDeleteItem = new Button(MainActivity.this); btnDeleteItem.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); btnDeleteItem.setText(""); btnDeleteItem.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); btnDeleteItem.setTextColor(getResources().getColor(android.R.color.holo_blue_bright)); btnDeleteItem.setBackgroundColor(getResources().getColor(android.R.color.black)); linearLayout.addView(btnDeleteItem); final PopupWindow popupWindow = new PopupWindow(linearLayout, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setBackgroundDrawable(new BitmapDrawable()); // ? popupWindow.setTouchable(true); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(contentMain, Gravity.CENTER, 0, 0); btnModify.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LogDetails.d(": " + editText.getText().toString()); if (!TextUtils.isEmpty(editText.getText().toString().trim())) { Date date = new Date(); item.content = editText.getText().toString().trim(); item.modifyDay = date; item.finishDay = null; ProgressDialogUtils.showProgressDialog(); presenter.modifyItem(item); dataList.set(position, item); refreshData(true); popupWindow.dismiss(); } else { Toast.makeText(MainActivity.this, "~", Toast.LENGTH_SHORT).show(); } } }); btnDeleteItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dataList.remove(position); presenter.deleteItem(item); refreshData(false); popupWindow.dismiss(); } }); }
From source file:com.sft.blackcatapp.SearchCoachActivity.java
private void showPopupWindow(View parent) { if (popupWindow == null) { View view = View.inflate(mContext, R.layout.pop_window, null); TextView c1Car = (TextView) view.findViewById(R.id.pop_window_one); c1Car.setText(R.string.c1_automatic_gear_car); TextView c2Car = (TextView) view.findViewById(R.id.pop_window_two); c2Car.setText(R.string.c2_manual_gear_car); c1Car.setOnClickListener(this); c2Car.setOnClickListener(this); popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); }// w w w . j a va 2 s .co m popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); // Back??? popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAsDropDown(parent); }
From source file:com.lykj.weixun.ui.chat.ui.ContactListFragment.java
public void setPopuWindow(View view) { // //from ww w . j av a 2 s.c o m View inflateView = LayoutInflater.from(getContext()).inflate(R.layout.popu_meu, null); // window = new PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); window.setTouchable(true); window.setFocusable(true); window.setBackgroundDrawable(new BitmapDrawable());//?? // window.setContentView(inflateView); // popWindow???true int[] location = new int[2]; inflateView.getLocationOnScreen(location); window.setOutsideTouchable(true); window.showAsDropDown(view);//v? window.showAtLocation(inflateView, Gravity.NO_GRAVITY, location[0] + inflateView.getWidth() - 20, location[1]); inflateView.findViewById(R.id.popuMeu_group).setOnClickListener(this); inflateView.findViewById(R.id.popuMeu_friend).setOnClickListener(this); inflateView.findViewById(R.id.popuMeu_sweep).setOnClickListener(this); window.setTouchInterceptor(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // popupwindowpopupwindow // true?touch // ? PopupWindowonTouchEvent?dismiss if (event.getAction() == MotionEvent.ACTION_OUTSIDE) { window.dismiss(); return true; } return false; } }); }
From source file:com.sft.blackcatapp.SearchCoachActivity.java
private void showOpenCityPopupWindow(View parent) { if (openCityPopupWindow == null) { LinearLayout popWindowLayout = (LinearLayout) View.inflate(mContext, R.layout.pop_window, null); popWindowLayout.removeAllViews(); // LinearLayout popWindowLayout = new LinearLayout(mContext); popWindowLayout.setOrientation(LinearLayout.VERTICAL); ListView OpenCityListView = new ListView(mContext); OpenCityListView.setDividerHeight(0); OpenCityListView.setCacheColorHint(android.R.color.transparent); OpenCityListView.setOnItemClickListener(new OnItemClickListener() { @Override/*from w ww . j av a2s . c om*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { OpenCityVO selectCity = openCityList.get(position); System.out.println(selectCity.getName()); cityname = selectCity.getName().replace("", ""); licensetype = ""; coachname = ""; ordertype = "0"; index = 1; obtainCaoch(); openCityPopupWindow.dismiss(); openCityPopupWindow = null; } }); LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); popWindowLayout.addView(OpenCityListView, param); OpenCityAdapter openCityAdapter = new OpenCityAdapter(mContext, openCityList); OpenCityListView.setAdapter(openCityAdapter); openCityPopupWindow = new PopupWindow(popWindowLayout, 130, LayoutParams.WRAP_CONTENT); } openCityPopupWindow.setFocusable(true); openCityPopupWindow.setOutsideTouchable(true); // Back??? openCityPopupWindow.setBackgroundDrawable(new BitmapDrawable()); openCityPopupWindow.showAsDropDown(parent); }
From source file:com.example.SmartBoard.DrawingView.java
public void onDrawRectangle(Canvas canvas) { Paint paint = drawPaint;//from w w w . ja v a 2 s .co m if (points[3] == null) //point4 null when user did not touch and move on screen. return; int left, top, right, bottom; left = points[0].x; top = points[0].y; right = points[0].x; bottom = points[0].y; for (int i = 1; i < points.length; i++) { left = left > points[i].x ? points[i].x : left; top = top > points[i].y ? points[i].y : top; right = right < points[i].x ? points[i].x : right; bottom = bottom < points[i].y ? points[i].y : bottom; } //draw stroke paint.setStyle(Paint.Style.STROKE); // paint.setColor(Color.parseColor("#AADB1255")); paint.setStrokeWidth(5); if (finished) { Rect rect = new Rect(left + colorballs.get(0).getWidthOfBall() / 2, top + colorballs.get(0).getWidthOfBall() / 2, right + colorballs.get(2).getWidthOfBall() / 2, bottom + colorballs.get(2).getWidthOfBall() / 2); JSONObject objectProperties = new JSONObject(); String key = UUID.randomUUID().toString(); try { objectProperties.put("type", "Rectangle"); objectProperties.put("clientId", client.getClientId()); objectProperties.put("id", key); objectProperties.put("color", drawPaint.getColor()); objectProperties.put("size", 5); objectProperties.put("dimens", rect.flattenToString()); } catch (JSONException e) { } objectDrawables.put(key, objectProperties); mqtt.publishRectangle(objectProperties); //reset to start drawing again points = new Point[4]; colorballs.clear(); return; } //temporary canvas drawing on resize mode canvas.drawRect(left + colorballs.get(0).getWidthOfBall() / 2, top + colorballs.get(0).getWidthOfBall() / 2, right + colorballs.get(2).getWidthOfBall() / 2, bottom + colorballs.get(2).getWidthOfBall() / 2, paint); //draw the corners BitmapDrawable bitmap = new BitmapDrawable(); // draw the balls on the canvas paint.setTextSize(18); paint.setStrokeWidth(0); for (int i = 0; i < colorballs.size(); i++) { ColorBall ball = colorballs.get(i); canvas.drawBitmap(ball.getBitmap(), ball.getX(), ball.getY(), paint); // System.out.println("RectMode"); canvas.drawText("" + (i + 1), ball.getX(), ball.getY(), paint); } }