Пример #1
0
 @Override
 protected void onResume() {
   super.onResume();
   isopengesture = sp_opengesture.getBoolean("isopengesture", false);
   if (isopengesture) {
     switch1.setChecked(true);
   } else {
     switch1.setChecked(false);
   }
 }
Пример #2
0
  @Override
  public void initView() {
    riv_account = (RoundImageView) findViewById(R.id.riv_account);
    btn_logout = (Button) findViewById(R.id.btn_logout);
    rl_alterpasswd = (RelativeLayout) findViewById(R.id.rl_alterpasswd);
    rl_message = (RelativeLayout) findViewById(R.id.rl_message);
    rl_openhuifu = (RelativeLayout) findViewById(R.id.rl_openhuifu);
    rl_update = (RelativeLayout) findViewById(R.id.rl_update);
    rl_fb = (RelativeLayout) findViewById(R.id.rl_fb);
    rl_bank = (RelativeLayout) findViewById(R.id.rl_bank);
    rl_contact = (RelativeLayout) findViewById(R.id.rl_contact);
    switch1 = (UISwitchButton) findViewById(R.id.switch_1);
    tv_version = (TextView) findViewById(R.id.tv_version);
    tv_username = (TextView) findViewById(R.id.tv_username);
    tv_phone = (TextView) findViewById(R.id.tv_phone);
    tv_openhuifu = (TextView) findViewById(R.id.tv_openhuifu);
    tv_bangka = (TextView) findViewById(R.id.tv_bangka);
    tv_renzheng = (TextView) findViewById(R.id.tv_renzheng);
    iv_redround = (ImageView) findViewById(R.id.iv_redround);

    if (megTotal > 0) {
      iv_redround.setVisibility(View.VISIBLE);
    } else {
      iv_redround.setVisibility(View.INVISIBLE);
    }
    //		tv_username.setText("欢迎您,"+loginname);
    tv_v = (TextView) findViewById(R.id.tv_v);
    tv_loggingname = (TextView) findViewById(R.id.tv_loggingname);
    tv_loggingname.setText(loginname);

    //		if(userAccountType != null && userAccountType.equals("0")){
    //			rl_openhuifu.setClickable(true);
    //			rl_openhuifu.setOnClickListener(this);
    //			tv_openhuifu.setText("马上开通");
    //			tv_openhuifu.setTextColor(Color.RED);
    //		}else{
    //			rl_openhuifu.setClickable(false);
    //			tv_openhuifu.setText("已开通");
    //			tv_openhuifu.setTextColor(Color.GRAY);
    //		}
    if (cardType != null && cardType.equals("0")) {
      tv_bangka.setText("未绑定");
    } else {
      tv_bangka.setText("已绑定");
    }

    isopengesture = sp_opengesture.getBoolean("isopengesture", false);
    if (isopengesture) {
      switch1.setChecked(true);
    } else {
      switch1.setChecked(false);
    }

    switch1.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
          @Override
          public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            if (!isChecked) // 第一个开关关闭
            {
              isopengesture = false;
              SharedPreferences.Editor editor = sp_opengesture.edit();
              editor.clear();
              editor.commit();
              editor.putBoolean("isopengesture", isopengesture);

              editor.commit();
              Log.i("isopengesture", "" + isopengesture);
              Intent in1 = new Intent(ActAccountCenter.this, GestureVerifyActivity.class);
              in1.putExtra("flag", "close");
              ActAccountCenter.this.startActivity(in1);
              overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            } else // 第一个开关打开
            {
              isopengesture = true;
              SharedPreferences.Editor editor = sp_opengesture.edit();
              editor.clear();
              editor.commit();
              editor.putBoolean("isopengesture", isopengesture);
              editor.commit();
              Log.i("isopengesture", "" + isopengesture);
              Intent in2 = new Intent(ActAccountCenter.this, GestureEditActivity.class);
              in2.putExtra("flag", "open");
              ActAccountCenter.this.startActivityForResult(in2, 0x01);
              overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
          }
        });
  }