Пример #1
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));
          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {

            try {

              JSONObject userObject = response.getJSONObject("data");

              String userID = userObject.getString("member_id");
              editor.putString("member_id", userID);
              editor.putString("check_status", userObject.getString("check_status"));
              Log.i("user_id", userID);
              editor.putString("member_points", userObject.getString("member_points") + "");
              editor.putString(
                  "available_predeposit", userObject.getString("available_predeposit") + "");
              editor.putString("member_name", userObject.getString("member_name") + "");
              editor.putString("member_email", userObject.getString("member_email") + "");
              editor.putString("member_phone", userObject.getString("member_phone") + "");
              editor.putString("member_avatar", userObject.getString("member_avatar") + "");
              editor.putString("order_state_new", userObject.getString("order_state_new"));

              badge_new.setText(userObject.getString("order_state_new"));
              if (!userObject.getString("order_state_new").equals("0")) badge_new.show();

              badge_pay.setText(userObject.getString("order_state_pay"));
              if (!userObject.getString("order_state_pay").equals("0")) badge_pay.show();

              badge_send.setText(userObject.getString("order_state_send"));
              if (!userObject.getString("order_state_send").equals("0")) badge_send.show();

              badge_success.setText(userObject.getString("order_state_success"));
              if (!userObject.getString("order_state_success").equals("0")) badge_success.show();
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            editor.commit();
            String check = shared.getString("check_status", "0");
            if (check.equals("0")) {
              profile_check.setImageResource(R.drawable.profile_check);
            } else {
              profile_check.setImageResource(R.drawable.profile_checked);
            }
          }
        }
Пример #2
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));

          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {

            loadingPDialog.dismiss();

            AlertDialog.Builder builder = new Builder(getActivity());
            builder.setTitle("签到成功");

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {
                    profile_check.setImageResource(R.drawable.profile_checked);
                    HttpUtils.refreshUserInfo(res_refresh);
                  }
                });
            builder.create().show();

          } else {
            loadingPDialog.dismiss();
            String message = "";
            try {
              message = response.getString("message");
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            AlertDialog.Builder builder = new Builder(getActivity());
            builder.setTitle(message);

            builder.setNegativeButton(
                "确认",
                new DialogInterface.OnClickListener() {

                  public void onClick(DialogInterface dialog, int which) {}
                });
            builder.create().show();
            Log.i("check_fail", response.toString());
          }
        }
Пример #3
0
        @Override
        public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
          super.onSuccess(statusCode, headers, response);

          int result = 0;

          try {
            result = Integer.valueOf(response.getString("result"));
          } catch (NumberFormatException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          if (result == 1 && statusCode == 200) {
            Log.i("update", response.toString());
            JSONObject userObject;
            try {
              userObject = response.getJSONObject("data");
              shared = getActivity().getSharedPreferences("loginInfo", Activity.MODE_PRIVATE);
              editor = shared.edit();
              String userID = userObject.getString("member_id");
              editor.putString("member_id", userID);
              editor.putString("check_status", userObject.getString("check_status"));
              Log.i("user_id", userID);
              editor.putString("member_points", userObject.getString("member_points") + "");
              editor.putString(
                  "available_predeposit", userObject.getString("available_predeposit") + "");
              editor.putString("member_name", userObject.getString("member_name") + "");
              editor.putString("member_email", userObject.getString("member_email") + "");
              editor.putString("member_phone", userObject.getString("member_phone") + "");
              editor.putString("member_avatar", userObject.getString("member_avatar") + "");
            } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
            editor.commit();
            String avatar_head = shared.getString("member_avatar", "");
            String url = LandousAppConst.avatar_url_head + avatar_head;
            ImageLoader.getInstance()
                .displayImage(url, avatar_head_image, LandousApplication.options_circle);
          }
        }