Beispiel #1
0
 @OnClick({
   R.id.layout_back,
   R.id.img_fate_icon,
   R.id.btn_jiahei,
   R.id.img_fate_dislike,
   R.id.img_fate_like
 })
 protected void widgetClick(View v) {
   // TODO Auto-generated method stub
   switch (v.getId()) {
     case R.id.layout_back: // 返回
       context.finish();
       break;
     case R.id.img_fate_icon:
       StatService.onEvent(context, "click-nvshenxiu-img", "eventLabel", 1);
       if (person != null) {
         Intent perintent = new Intent(context, FragmentToActivity.class);
         perintent.putExtra("who", "personal");
         perintent.putExtra("user_id", person.getUser_id());
         perintent.putExtra("distance", "");
         context.startActivity(perintent);
       }
       break;
     case R.id.btn_jiahei:
       Intent intent = new Intent(context, MyShowUploadActivity.class);
       intent.putExtra("type", 1);
       context.startActivity(intent);
       break;
     case R.id.img_fate_dislike:
       if (BasicUtils.isFastDoubleClick()) {
         return;
       }
       StatService.onEvent(context, "click-no-dating-button", "eventLabel", 1);
       getHttpData(1);
       break;
     case R.id.img_fate_like:
       if (BasicUtils.isFastDoubleClick()) {
         return;
       }
       StatService.onEvent(context, "click-dating-button", "eventLabel", 1);
       if (person != null) {
         Intent perintent = new Intent(context, FragmentToActivity.class);
         perintent.putExtra("who", "personal");
         perintent.putExtra("user_id", person.getUser_id());
         perintent.putExtra("distance", "");
         context.startActivity(perintent);
       }
       getHttpData(2);
       break;
     default:
       break;
   }
 }
Beispiel #2
0
 @Override
 public void onItemClick(AdapterView<?> arg0, View view, int pos, long arg3) {
   // TODO Auto-generated method stub
   try {
     Intent intent = new Intent();
     intent.setAction("jimome.action.sendtext");
     intent.putExtra("text", baseJson.getTexts()[pos]);
     context.sendBroadcast(intent);
     context.finish();
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Beispiel #3
0
 private void setView() {
   try {
     relayout_fate.startAnimation(AnimationUtils.loadAnimation(context, R.anim.fate_alpha));
     ImageLoadUtils.imageLoader.displayImage(
         person.getUrl(), img_fate_icon, ImageLoadUtils.options);
     // tv_fate_location.setText(person.getCity());
     tv_fate_location.setText(Conf.city);
     tv_fate_name.setText(person.getNick());
     tv_fate_age.setText(person.getAge() + StringUtils.getResourse(R.string.str_sui));
     tv_fate_likenum.setText(
         person.getGreeted_nums() + StringUtils.getResourse(R.string.str_fate_likenum));
     if (person.getHeight().trim().equals("")) tv_fate_height.setText("");
     else tv_fate_height.setText(person.getHeight() + "cm");
     tv_fate_picnum.setText(
         person.getPhoto_nums() + StringUtils.getResourse(R.string.str_iconuntil));
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Beispiel #4
0
  private void getHttpData(final int type) {
    int cache_time = 0;
    String key = "";
    RequestParams params = new RequestParams();
    try {
      params.addQueryStringParameter("cur_user", Conf.userID);
      params.addQueryStringParameter("gender", Conf.gender); // Conf.gender

      if (type == 1) {
        key = "show";
      } else {
        key = "show/praise";
        params.addQueryStringParameter("user_id", person.getUser_id());
        params.addQueryStringParameter("photo_id", person.getPhoto_id());
      }
    } catch (Exception e) {
      // TODO: handle exception
    }
    // Log.e("上传参数", params.toString());
    params.addHeader("Authorization", PreferenceHelper.readString(context, "auth", "token"));
    CacheRequest.requestGET(
        context,
        key,
        params,
        key,
        cache_time,
        new CacheRequestCallBack() {

          @Override
          public void onFail(HttpException e, String result, String json) {
            // TODO Auto-generated method stub
            if (mDialog != null) {
              mDialog.dismiss();
            }
            ExitManager.getScreenManager().intentLogin(context, e.getExceptionCode() + "");
            if (json.equals("")) {
              BasicUtils.toast(StringUtils.getResourse(R.string.str_net_register));
              return;
            }
          }

          @Override
          public void onData(String json) {
            // TODO Auto-generated method stub
            if (mDialog != null) {
              mDialog.dismiss();
            }
            if (json.equals("")) {
              return;
            }
            try {
              person = new Gson().fromJson(json, BaseJson.class);
              if (person.getStatus() != null && person.getStatus().equals("200")) {
                setView();
                if (type == 2) {
                  BasicUtils.toast(StringUtils.getResourse(R.string.str_intro_call));
                }
              }
            } catch (Exception e) {
              // TODO Auto-generated catch block
            }
          }
        });
    // kjh.get(url, params, new HttpCallBack() {
    //
    // @Override
    // public void onSuccess(Object obj) {
    // // TODO Auto-generated method stub
    //
    // try {
    // person = new Gson().fromJson(obj.toString(), BaseJson.class);
    // if (person.getStatus() != null
    // && person.getStatus().equals("200")) {
    // setView();
    // if (type == 2) {
    // ViewInject
    // .toast(getString(R.string.str_intro_call));
    // }
    // }
    // } catch (Exception e) {
    // // TODO Auto-generated catch block
    // } finally {
    // if (mDialog != null) {
    // mDialog.dismiss();
    // }
    // }
    //
    // }
    //
    // @Override
    // public void onLoading(long count, long current) {
    // // TODO Auto-generated method stub
    // }
    //
    // @Override
    // public void onFailure(Throwable t, int errorNo, String strMsg) {
    // // TODO Auto-generated method stub
    // if (mDialog != null) {
    // mDialog.dismiss();
    // }
    // ExitManager.getScreenManager().intentLogin(context,
    // StringUtils.httpRsponse(t.toString()));
    // }
    //
    // });
  }