private void initView() {
    tvSubmit.setVisibility(
        getIntent().getExtras().getInt("fromType") == 1 ? View.GONE : View.VISIBLE);
    tvLeft.setVisibility(View.GONE);
    llBack.setVisibility(View.VISIBLE);
    if (getIntent().hasExtra("bean")) {
      prizeBean = (PrizeBean) getIntent().getSerializableExtra("bean");
    }
    numbers = getIntent().getExtras().getString("Numbers");

    if (GSJHApp.getInstance().getOneUserBean().getRecmobile() != null) {
      etMobile.setText(mobile);
    }
    if (GSJHApp.getInstance().getOneUserBean().getRecname() != null) {
      etName.setText(name);
    }
    if (GSJHApp.getInstance().getOneUserBean().getAddress() != null) {
      etStreet.setText(address_data.replaceAll("P", ""));
    }
    tvTitle.setText("收货信息");
  }
 private void initView() {
   tvLeft.setVisibility(View.GONE);
   llBack.setVisibility(View.VISIBLE);
   tvTitle.setText("安全中心");
   tvMobile.setText(GSJHApp.getInstance().getOneUserBean().getMobile());
 }
/** Created by xpy on 2015-08-31. */
public class MineUserInfoAddressReplaceActivity extends BaseActivity
    implements View.OnClickListener {
  private final String mPage = "收货信息";

  @ViewInject(R.id.common_title_txt)
  TextView tvTitle;

  @ViewInject(R.id.common_title_left_txt)
  TextView tvLeft;

  @ViewInject(R.id.common_title_back_ll)
  LinearLayout llBack;

  @ViewInject(R.id.address_mobile)
  TextView etMobile;

  @ViewInject(R.id.address_street)
  TextView etStreet;

  @ViewInject(R.id.confirm_to_pay)
  TextView tvSubmit;

  @ViewInject(R.id.ll_come_to_next)
  RelativeLayout llComeToNext;

  @ViewInject(R.id.address_name)
  TextView etName;

  PrizeBean prizeBean;

  CityPicker cityPicker;

  String name = GSJHApp.getInstance().getOneUserBean().getRecname();
  String address_data = GSJHApp.getInstance().getOneUserBean().getAddress();
  String mobile = GSJHApp.getInstance().getOneUserBean().getRecmobile();
  String numbers = "";

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityUtil.getInstance().addActivity(this);
    setContentView(R.layout.activity_mine_user_info_address_replace);
    ViewUtils.inject(this);
    initView();
    setListener();
  }

  private void setListener() {
    llBack.setOnClickListener(this);
    tvSubmit.setOnClickListener(this);
    llComeToNext.setOnClickListener(this);
  }

  private void initView() {
    tvSubmit.setVisibility(
        getIntent().getExtras().getInt("fromType") == 1 ? View.GONE : View.VISIBLE);
    tvLeft.setVisibility(View.GONE);
    llBack.setVisibility(View.VISIBLE);
    if (getIntent().hasExtra("bean")) {
      prizeBean = (PrizeBean) getIntent().getSerializableExtra("bean");
    }
    numbers = getIntent().getExtras().getString("Numbers");

    if (GSJHApp.getInstance().getOneUserBean().getRecmobile() != null) {
      etMobile.setText(mobile);
    }
    if (GSJHApp.getInstance().getOneUserBean().getRecname() != null) {
      etName.setText(name);
    }
    if (GSJHApp.getInstance().getOneUserBean().getAddress() != null) {
      etStreet.setText(address_data.replaceAll("P", ""));
    }
    tvTitle.setText("收货信息");
  }

  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.common_title_back_ll:
        finish();
        break;
      case R.id.confirm_to_pay:
        HttpHelper.getInstance(this)
            .buyPrize(
                prizeBean.getId(),
                numbers,
                new RequestCallBack<Object>() {
                  @Override
                  public void onSuccess(ResponseInfo<Object> responseInfo) {
                    Log.e("hss", "buy prize===" + responseInfo.result.toString());
                    if (Utils.isEmpty(responseInfo.result.toString())) {
                      ActivityUtil.getInstance().finishToActivity(MarketMallActivity.class);
                    }

                    if (responseInfo.result.toString().equals("\"余额不足\"")) {
                      final CommonDialog commonDialog =
                          new CommonDialog(MineUserInfoAddressReplaceActivity.this);
                      commonDialog.setTitleVisible(false);
                      commonDialog.setContent("余额不足");
                      commonDialog.setButtonText("取消", "充值");
                      commonDialog.setButtonClick(
                          new CommonDialog.ButtonClickListener() {
                            @Override
                            public void sureListener() {
                              Intent intent =
                                  new Intent(
                                      MineUserInfoAddressReplaceActivity.this,
                                      PayChongActivity.class);
                              startActivity(intent);
                              commonDialog.dismiss();
                            }

                            @Override
                            public void cancelListener() {
                              commonDialog.dismiss();
                            }
                          });
                      commonDialog.show();
                      setDialogWidth(commonDialog);
                    }
                  }

                  @Override
                  public void onFailure(HttpException e, String s) {}
                });
        break;
      case R.id.ll_come_to_next:
        Intent change_the_address =
            new Intent(MineUserInfoAddressReplaceActivity.this, MineUserInfoAddressActivity.class);
        change_the_address.putExtra("name", etName.getText().toString());
        change_the_address.putExtra("mobile", etMobile.getText().toString());
        change_the_address.putExtra("address", address_data);
        Log.e("hss", "address_data_raw" + address_data);
        startActivityForResult(change_the_address, 1);

        break;
    }
  }

  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 1 && resultCode == RESULT_OK) {
      String name = data.getExtras().getString("name");
      String mobile = data.getExtras().getString("mobile");
      String address = data.getExtras().getString("address");
      address_data = address;
      Log.e("hss", "now mobile+address" + mobile + address);
      etStreet.setText(address.replaceAll("P", ""));
      etMobile.setText(mobile);
      etName.setText(name);
    }
  }

  @Override
  protected void onResume() {
    super.onResume();
    resume(mPage);
  }

  @Override
  protected void onPause() {
    super.onPause();
    pause(mPage);
  }
}