Пример #1
0
  /** 获取消息数据 */
  public void getData(String name) {
    String user = MySharedData.sharedata_ReadString(context, "UserId");
    String hash = SiteHelper.MD5(user + Const.UrlHashKey).toLowerCase();
    String url =
        Const.getStoreInfo
            + "?userId="
            + user
            + "&hash="
            + hash
            + "&StoreId="
            + StoreId
            + "&Type="
            + name;

    // 这里需要分析服务器回传的json格式数据,
    try {
      String reStr = HttpHelper.getJsonData(context, url);
      JSONObject reObject = new JSONObject(reStr);
      if (reObject.getInt("status") == 1) {
        context.getData(reStr);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #2
0
  public void showAsDropDown(View parent) {

    popupWindow.showAsDropDown(
        parent, 10, context.getResources().getDimensionPixelSize(R.dimen.popmenu_yoff));
    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);
    popupWindow.update();
  }
Пример #3
0
  public PopMenu3(ChatMainActivity context, String StoreId) {
    this.context = context;
    this.StoreId = StoreId;
    itemList = new ArrayList<String>(5);

    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.popmenu, null);

    listView = (ListView) view.findViewById(R.id.listView);
    listView.setAdapter(new PopAdapter());
    listView.setOnItemClickListener(this);

    popupWindow =
        new PopupWindow(
            view,
            context.getResources().getDimensionPixelSize(R.dimen.popmenu_width),
            LayoutParams.WRAP_CONTENT);

    popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
  }