예제 #1
0
 @Override
 public void onErrorResponse(VolleyError error) {
   cancleDialog();
   error.printStackTrace();
   try {
     Log.e("Volley", new String(error.networkResponse.data, "GBK"));
   } catch (UnsupportedEncodingException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   MyUtil.alert("Çë¼ì²éÍøÂçºóÖØÊÔ", getContext());
 }
예제 #2
0
 private void setHeight() { // 设置gridview自适应高度
   ListAdapter listAdapter = MyGrid.getAdapter();
   if (listAdapter == null) {
     return;
   }
   int height = 0;
   for (int i = 0; i < listAdapter.getCount() / 2; i++) {
     View listItem = listAdapter.getView(i, null, MyGrid);
     listItem.measure(0, 0);
     height = height + listItem.getMeasuredHeight();
   }
   MyGrid.getLayoutParams().height = height + MyUtil.dip2px(this, 50);
 }
예제 #3
0
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_help_buy);
    ImageView btn_back = (ImageView) findViewById(R.id.btn_back);
    btn_back.setOnClickListener(this);
    TextView tv_title = (TextView) findViewById(R.id.tv_title);
    tv_title.setText("帮我买");

    MyGrid = (GridView) findViewById(R.id.MyGrid);
    MyGrid.setSelector(new BitmapDrawable());
    type = getIntent().getIntExtra("type", type_help_buy);
    adapter = new Adapter_HomeGrid(this, type);
    MyGrid.setAdapter(adapter);
    MyGrid.setOnItemClickListener(this);

    img_dingzhi = (ImageView) findViewById(R.id.img_dingzhi);
    img_dingzhi.setOnClickListener(this);
    if (type == type_help_handle) {
      Drawable d = getResources().getDrawable(R.drawable.img_help_2);
      BitmapDrawable bd = (BitmapDrawable) d;
      img_dingzhi.setImageBitmap(
          MyUtil.resizeBitmap(bd.getBitmap(), MyUtil.getWindowSize(this)[0]));
    } else {
      Drawable d = getResources().getDrawable(R.drawable.help_buy_bottom);
      BitmapDrawable bd = (BitmapDrawable) d;
      img_dingzhi.setImageBitmap(
          MyUtil.resizeBitmap(bd.getBitmap(), MyUtil.getWindowSize(this)[0]));
    }
    helpbuy_other = new ArrayList<String>();
    helpbuy_other.add("我的水果");
    helpbuy_other.add("我的超市");
    helpbuy_other.add("我的宠物");
    helpbuy_other.add("我的酒柜");
    helpbuy_other.add("我的鲜花");
    helpbuy_other.add("我的爱爱");
    helpbuy_other.add("我的药房");
  }
예제 #4
0
 @Override
 public void onClick(View v) {
   if (v.getId() == R.id.btn_login) {
     if (tv_name.getText().toString().equals("")) {
       Toast.makeText(getContext(), "ÇëÊäÈëÄúµÄÊÖ»úºÅ", Toast.LENGTH_LONG).show();
     } else if (tv_password.getText().toString().equals("")) {
       Toast.makeText(getContext(), "ÇëÊäÈëÃÜÂë", Toast.LENGTH_LONG).show();
     } else {
       LoadingDialog.showWindow(getContext());
       MyHttp http = new MyHttp(getContext());
       Map<String, String> params = new HashMap<String, String>();
       params.put("phone", tv_name.getText().toString());
       params.put("pwd", MyUtil.stringToMD5(tv_password.getText().toString()));
       String url = UrlUtil.getUrl("login_pwd", UrlUtil.Service);
       http.Http_post(url, params, this);
     }
   }
 }