Commit d0c3418d authored by jianglx's avatar jianglx

新版个人中心,修改手机号码

parent d513b651
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
......@@ -77,7 +76,6 @@ android {
//api 'com.just.agentweb:filechooser:4.0.3-beta'
//api 'com.just.agentweb:download:4.0.3-beta'
//百度定位
api files('libs/BaiduLBS_Android.jar')
//bugly
......
......@@ -32,6 +32,7 @@ public class PickerPresenter extends CommonPresenter {
public final int TYPE_CAMERA_CROP_CODE = 1003;//照相并裁剪
public final int TYPE_ALBUM_CROP_CODE = 1004;//相册并裁剪
public final int TYPE_CROP_CODE = 1005;//裁剪后的结果
private String cameraUrl;
private File imageFile;
private Uri cropUri;
......
package com.ruiwenliu.wrapper.bean;
import com.google.gson.annotations.SerializedName;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.io.Serializable;
......@@ -46,8 +45,14 @@ public class UserInfoBean extends BaseBean implements Serializable {
private String wxOpenid;
//微信unionid
private String unionid;
// 微信
private String wxNickname ;
//qq
private String openid;
// QQ昵称
private String qqNickname ;
// 支付宝昵称
private String aliPayNickName ;
//状态:0-启用,1-禁用
private Integer status;
//身份证号
......@@ -85,6 +90,10 @@ public class UserInfoBean extends BaseBean implements Serializable {
private String positionName;// 职位名称
private boolean isBindAliPay; //是否绑定支付宝
private boolean isBindWx ; // 是否绑定过微信
private boolean isBindQQ ; // 是否绑定过QQ;
public Integer getId() {
return id;
......@@ -301,5 +310,53 @@ public class UserInfoBean extends BaseBean implements Serializable {
public void setBigIcon(String bigIcon) {
this.bigIcon = bigIcon;
}
public boolean isBindAliPay() {
return isBindAliPay;
}
public void setBindAliPay(boolean bindAliPay) {
isBindAliPay = bindAliPay;
}
public String getWxNickname() {
return wxNickname;
}
public void setWxNickname(String wxNickname) {
this.wxNickname = wxNickname;
}
public String getQqNickname() {
return qqNickname;
}
public void setQqNickname(String qqNickname) {
this.qqNickname = qqNickname;
}
public String getAliPayNickName() {
return aliPayNickName;
}
public void setAliPayNickName(String aliPayNickName) {
this.aliPayNickName = aliPayNickName;
}
public boolean isBindWx() {
return isBindWx;
}
public void setBindWx(boolean bindWx) {
isBindWx = bindWx;
}
public boolean isBindQQ() {
return isBindQQ;
}
public void setBindQQ(boolean bindQQ) {
isBindQQ = bindQQ;
}
}
}
......@@ -41,4 +41,24 @@ public class IsAppInstall {
}
return false;
}
/**
* 判断qq是否可用
*
* @param context
* @return
*/
public static boolean isZfbClientAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
if (pn.equals("com.eg.android.AlipayGphone")) {
return true;
}
}
}
return false;
}
}
......@@ -163,4 +163,10 @@ public class ApiConfig {
public static String HTTP_URL_PRICE_BASEORDER = RvFrameConfig.HOST + "/api/order/baseOrder/";
public static String HTTP_URL_PRERENT_DAYS = RvFrameConfig.HOST + "/api/app/cofig/app/unauth/types?types=999";
public static String HTTP_URL_CHECK_MOBILE_CODE = RvFrameConfig.HOST + "/api/admin/api/app/unauth/checkMobilecode";
public static String HTTP_URL_UPDATE_PHONE = RvFrameConfig.HOST + "/api/auth/jwt/updUsername";
public static String HTTP_URL_USER_BIND = RvFrameConfig.HOST + "/api/admin/app/user/bind";
}
......@@ -3,7 +3,7 @@
package="com.rv.rvmine">
<application>
<activity android:name=".fragment.MyReleasePatFragment"></activity>
<activity android:name=".fragment.MyReleasePatFragment" />
<activity
android:name=".personal.IDCardCertificationShowActivity"
android:screenOrientation="portrait" />
......@@ -13,7 +13,9 @@
<activity
android:name=".traveler.MyReleaseActivity"
android:screenOrientation="portrait" />
<activity android:name="com.rv.version.activity.UpdateAppActivity" />
<activity android:name=".traveler.AccountSafeActivity" />
<activity android:name=".traveler.BindPhoneActivity" />
<activity android:name=".traveler.AlterNickNameActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -4,10 +4,15 @@ import android.annotation.SuppressLint;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -93,7 +98,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
TextView tvLogin;
@BindView(R2.id.tv_verified)
TextView tvVerified;
// @BindView(R2.id.tv_membership_level)
// @BindView(R2.id.tv_membership_level)
// TextView tvMembershipLevel;
@BindView(R2.id.tv_member_hint)
TextView tvMemberHint;
......@@ -115,14 +120,16 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
Banner mineBanner;
@BindView(R2.id.refresh)
SimpleRefreshLayout mSimpleRefreshLayout;
@BindView(R2.id.tv_user_identity)
TextView tvUserIdentity;
// @BindView(R2.id.tv_user_identity)
// TextView tvUserIdentity;
@BindView(R2.id.tv_integral)
TextView tvIntegral;
@BindView(R2.id.tv_wallet)
TextView tvWallet;
@BindView(R2.id.tv_coupon)
TextView tvCoupon;
@BindView(R2.id.tv_capacity)
TextView tvCapacity;
private UserInfoBean.UserInfo info;
......@@ -149,14 +156,14 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
tvNickname.setVisibility(View.GONE);
((View) ivMember.getParent()).setVisibility(View.GONE);
((View) ivMember.getParent().getParent()).setVisibility(View.GONE);
tvLogin.setVisibility(View.VISIBLE);
tvVerified.setVisibility(View.GONE);
tvViewPrivileges.setText("查看会员特权");
mSimpleRefreshLayout.setPullDownEnable(false);
} else {
tvNickname.setVisibility(View.VISIBLE);
((View) ivMember.getParent()).setVisibility(View.VISIBLE);
((View) ivMember.getParent().getParent()).setVisibility(View.VISIBLE);
// ivMember.setVisibility(View.VISIBLE);
tvLogin.setVisibility(View.GONE);
tvVerified.setVisibility(View.VISIBLE);
......@@ -172,7 +179,6 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
setMember(userInfo);
}
}
private void initRefresh() {
......@@ -256,7 +262,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
@OnClick({R2.id.iv_avatar, R2.id.tv_login, R2.id.tv_verified, R2.id.rl_item_to_be_paid, R2.id.rl_item_staying, R2.id.iv_item_message,
R2.id.rl_item_traveling, R2.id.rl_item_completed, R2.id.rl_item_collection, R2.id.rl_item_my_release,
R2.id.iv_item_setting, R2.id.ll_item_view_privileges, R2.id.rl_item_order_all, R2.id.ll_item_integral, R2.id.ll_item_wallet,
R2.id.ll_item_coupon, R2.id.ll_item_promotion, R2.id.rl_item_check_in, R2.id.rl_item_travel_management})
R2.id.ll_item_coupon, R2.id.ll_item_promotion, R2.id.rl_item_check_in, R2.id.rl_item_travel_management,R2.id.tv_nickname})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.iv_item_setting) {
......@@ -267,7 +273,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
if (isLogin()) return;
showToast("该功能还在开发中。。。");
} else if (id == R.id.iv_avatar) {
} else if (id == R.id.iv_avatar || id == R.id.tv_nickname) {
//头像
if (isLogin()) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
......@@ -384,16 +390,21 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
ivAvatar.setBackgroundResource(0);
ivAvatar.setImageResource(R.drawable.common_icon_avatar_default);
tvNickname.setVisibility(View.GONE);
((View) ivMember.getParent()).setVisibility(View.GONE);
((View) ivMember.getParent().getParent()).setVisibility(View.GONE);
// ivMember.setVisibility(View.GONE);
tvLogin.setVisibility(View.VISIBLE);
tvVerified.setVisibility(View.GONE);
tvUserIdentity.setVisibility(View.GONE);
// tvUserIdentity.setVisibility(View.GONE);
tvViewPrivileges.setText("查看会员特权");
// tvMembershipLevel.setText("会员中心");
tvMemberHint.setText("免费用车- -天");
tvIntegral.setText("0");
tvWallet.setText("0");
SpannableString s = new SpannableString("¥ 0");
s.setSpan(new AbsoluteSizeSpan(10, true), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s.setSpan(new AbsoluteSizeSpan(20, true), 1, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s.setSpan(new ForegroundColorSpan(Color.parseColor("#171413")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
tvWallet.setText(s);
tvCoupon.setText("0");
mSimpleRefreshLayout.setPullDownEnable(false);
}
......@@ -522,7 +533,12 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
private void profitData(InfoProfitBean bean) {
if (bean != null && bean.getData() != null) {
tvIntegral.setText(bean.getData().getTotalPoint());
tvWallet.setText(bean.getData().getBalance());
SpannableString s = new SpannableString("¥ "+bean.getData().getBalance());
s.setSpan(new AbsoluteSizeSpan(10, true), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s.setSpan(new AbsoluteSizeSpan(20, true), 1, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
s.setSpan(new ForegroundColorSpan(Color.parseColor("#171413")), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
tvWallet.setText(s);
tvCoupon.setText(bean.getData().getCouponNumber());
}
}
......@@ -534,6 +550,7 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
if (info != null) {
GlideManager.getInstance(_mActivity).loadImage(info.getHeadimgurl(), ivAvatar);
tvNickname.setText(info.getNickname());
tvCapacity.setText(info.getPositionName());
//更新实名信息
UtilsManager.getInstance(OkGoUtil.application).setSharePreferencesSave(SPConstance.USER_JSON).putString(SPConstance.USER_JSON_USERINFO, JSON.toJSONString(info)).commit();
if (info.getCertificationStatus() == 0) { //实名认证状态:0-未认证,1-已认证
......@@ -548,26 +565,25 @@ public class MineFragment extends BaseFragment<CommonPresenter> implements Simpl
} else {
ivMember.setVisibility(View.GONE);
}
if (TextUtils.isEmpty(info.getPositionName())) {
tvUserIdentity.setVisibility(View.GONE);
} else {
tvUserIdentity.setText(info.getPositionName());
tvUserIdentity.setVisibility(View.VISIBLE);
}
// if (TextUtils.isEmpty(info.getPositionName())) {
// tvUserIdentity.setVisibility(View.GONE);
// } else {
// tvUserIdentity.setText(info.getPositionName());
// tvUserIdentity.setVisibility(View.VISIBLE);
//
// }
setMember(info);
}
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
tvNickname.setVisibility(View.GONE);
((View) ivMember.getParent()).setVisibility(View.GONE);
((View) ivMember.getParent().getParent()).setVisibility(View.GONE);
// ivMember.setVisibility(View.GONE);
tvLogin.setVisibility(View.VISIBLE);
tvVerified.setVisibility(View.GONE);
} else {
tvNickname.setVisibility(View.VISIBLE);
((View) ivMember.getParent()).setVisibility(View.VISIBLE);
((View) ivMember.getParent().getParent()).setVisibility(View.VISIBLE);
// ivMember.setVisibility(View.VISIBLE);
tvLogin.setVisibility(View.GONE);
tvVerified.setVisibility(View.VISIBLE);
......
package com.rv.rvmine;
public interface SwitchFragmentListener {
void setTitle(String title) ;
void next();
void changeSuccess(String phone);
}
package com.rv.rvmine.bean;
public class AccountBindDto {
private String openId;
private String unionId;
private String nickName;
private String type;
private String code;
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public AccountBindDto(String openId, String unionId, String nickName, String type, String code) {
this.openId = openId;
this.unionId = unionId;
this.nickName = nickName;
this.type = type;
this.code = code;
}
public AccountBindDto(String openId, String unionId, String nickName, String type) {
this.openId = openId;
this.unionId = unionId;
this.nickName = nickName;
this.type = type;
}
}
package com.rv.rvmine.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
public class BindCallBackBean extends BaseBean {
private String data ;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
package com.rv.rvmine.fragment;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.rvmine.SwitchFragmentListener;
import butterknife.BindView;
public class BindPhoneFirstFragment extends BaseFragment<CommonPresenter> {
@BindView(R2.id.tv_phone)
TextView tvPhone;
@BindView(R2.id.btn_update_phone)
Button btnUpdatePhone;
private String phone;
@Override
public int getViewLayout() {
return R.layout.fragment_bind_phone_first;
}
@Override
protected void initView(Bundle savedInstanceState) {
((SwitchFragmentListener) _mActivity).setTitle("绑定手机号");
phone = getArguments().getString("phone");
if (!TextUtils.isEmpty(phone))
tvPhone.setText(phone);
btnUpdatePhone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((SwitchFragmentListener) _mActivity).next();
}
});
}
@Override
protected void loadData(Bundle savedInstanceState) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
}
}
package com.rv.rvmine.fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.base.utils.tools.android.NetworkUtil;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.util.RxJavaManager;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.login.bean.SendCodeBean;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.rvmine.SwitchFragmentListener;
import java.util.LinkedHashMap;
import java.util.Map;
import butterknife.BindView;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
public class BindPhoneSecondFragment extends BaseFragment<CommonPresenter> {
@BindView(R2.id.tv_phone)
TextView tvPhone;
@BindView(R2.id.tv_get_code)
TextView tvGetCode;
@BindView(R2.id.et_phone_code)
EditText etPhoneCode;
@BindView(R2.id.btn_next)
Button btnNext;
private String phone;
private Disposable mDisposable;
@Override
public int getViewLayout() {
return R.layout.fragment_bind_phone_second;
}
@Override
protected void initView(Bundle savedInstanceState) {
((SwitchFragmentListener) _mActivity).setTitle("验证手机号");
phone = getArguments().getString("phone");
if (!TextUtils.isEmpty(phone))
tvPhone.setText(phone);
etPhoneCode.addTextChangedListener(watcher);
tvGetCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(getPhone())) {
showToast(getString(com.rv.home.R.string.rv_phone_hint));
return;
}
if (getPhone().length() != 11) {
showToast("手机号码不正确");
return;
}
sendCode();
}
});
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(getPhone()) || getPhone().length() != 11) {
showToast("手机号码不正确");
return;
}
if (TextUtils.isEmpty(getCode())) {
showToast("短信验证码为空");
return;
}
checkMobilecode();
}
});
}
/**
* 获得手机号
*
* @return
*/
private String getPhone() {
return phone;
}
private String getCode() {
return etPhoneCode.getText().toString().trim();
}
/**
* 发送验证码
*/
private void sendCode() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("username", getPhone());
map.put("type", 4);
mPresenter.postData(0, ApiConfig.HTTP_URL_SEND_CODE, SendCodeBean.class, map, true);
}
/**
* 发送验证码
*/
private void checkMobilecode() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("phone", getPhone());
map.put("mobilecode", getCode());
mPresenter.getData(1, ApiConfig.HTTP_URL_CHECK_MOBILE_CODE, BaseBean.class, map, true);
}
@Override
protected void loadData(Bundle savedInstanceState) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
showToast(getString(com.rv.home.R.string.rv_phone_code_toast));
sendCode(60);
} else if (requestType == 1) {
((SwitchFragmentListener) _mActivity).next();
}
}
@Override
public void onShowError(String errorMsg, int errorType) {
if (getContext() != null && !NetworkUtil.isNetworkAvailable(getContext())) {
showToast("网络异常,请检察您的网络");
return;
}
if (!TextUtils.isEmpty(errorMsg))
showToast(errorMsg);
}
/**
* 发送验证码
*
* @param timeLong 验证码时长
*/
private void sendCode(final int timeLong) {
RxJavaManager.getInstance().sendCode(timeLong, new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
tvGetCode.setEnabled(false);
}
}, new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
mDisposable = d;
}
@Override
public void onNext(Long aLong) {
tvGetCode.setText("" + aLong + "s");
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
tvGetCode.setEnabled(true);
tvGetCode.setText(getString(com.rv.home.R.string.rv_login_rest));
}
});
}
/**
* 停止计时
*/
public void stopCarousel() {
if (mDisposable != null && !mDisposable.isDisposed()) {
mDisposable.dispose();
}
}
@Override
public void onStop() {
super.onStop();
stopCarousel();
}
private TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(getCode()) && getCode().length() >= 4) {
btnNext.setBackgroundResource(R.drawable.shape_rv_bg_fdc349);
} else {
btnNext.setBackgroundResource(R.drawable.shape_rv_bg_fde6b5);
}
}
@Override
public void afterTextChanged(Editable s) {
}
};
}
package com.rv.rvmine.fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.base.utils.tools.android.NetworkUtil;
import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseFragment;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.util.RxJavaManager;
import com.rv.component.utils.DateUtils;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.login.bean.SendCodeBean;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.rvmine.SwitchFragmentListener;
import com.rv.rvmine.bean.BindCallBackBean;
import com.yuyife.okgo.OkGoUtil;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import butterknife.BindView;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
public class BindPhoneThirdFragment extends BaseFragment<CommonPresenter> {
@BindView(R2.id.et_phone)
EditText etPhone;
@BindView(R2.id.et_phone_code)
EditText etPhoneCode;
@BindView(R2.id.tv_get_code)
TextView tvGetCode;
@BindView(R2.id.btn_next)
Button btnNext;
private String oldPhone;
private Disposable mDisposable;
@Override
public int getViewLayout() {
return R.layout.fragment_bind_phone_third;
}
@Override
protected void initView(Bundle savedInstanceState) {
oldPhone = getArguments().getString("phone");
((SwitchFragmentListener) _mActivity).setTitle("验证手机号");
etPhoneCode.addTextChangedListener(watcher);
etPhone.addTextChangedListener(watcher);
tvGetCode.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 获取短信验证码
if (TextUtils.isEmpty(getPhone())) {
showToast(getString(com.rv.home.R.string.rv_phone_hint));
return;
}
if (getPhone().length() != 11) {
showToast("手机号码不正确");
return;
}
if (getPhone().equals(oldPhone)) {
showToast("新号码不能与旧号码一样");
return;
}
sendCode();
}
});
btnNext.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (TextUtils.isEmpty(getPhone()) || getPhone().length() != 11) {
showToast("手机号码不正确");
return;
}
if (TextUtils.isEmpty(getCode())) {
showToast("短信验证码为空");
return;
}
updateMobile();
// ((SwitchFragmentListener) _mActivity).changeSuccess(oldPhone);
}
});
}
@Override
protected void loadData(Bundle savedInstanceState) {
}
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
showToast(getString(com.rv.home.R.string.rv_phone_code_toast));
sendCode(60);
} else if (requestType == 1) {
showToast("手机号更改成功");
BindCallBackBean bean = (BindCallBackBean) result;
if (!TextUtils.isEmpty(bean.getData()))
OkGoUtil.setToken(bean.getData(), DateUtils.getCurDate());
((SwitchFragmentListener) _mActivity).changeSuccess(getPhone());
}
}
@Override
public void onShowError(String errorMsg, int errorType) {
if (getContext() != null && !NetworkUtil.isNetworkAvailable(getContext())) {
showToast("网络异常,请检察您的网络");
return;
}
if (!TextUtils.isEmpty(errorMsg))
showToast(errorMsg);
}
/**
* 获得手机号
*
* @return
*/
private String getPhone() {
return etPhone.getText().toString().trim();
}
private String getCode() {
return etPhoneCode.getText().toString().trim();
}
/**
* 发送验证码
*
* @param timeLong 验证码时长
*/
private void sendCode(final int timeLong) {
RxJavaManager.getInstance().sendCode(timeLong, new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
tvGetCode.setEnabled(false);
}
}, new Observer<Long>() {
@Override
public void onSubscribe(Disposable d) {
mDisposable = d;
}
@Override
public void onNext(Long aLong) {
tvGetCode.setText("" + aLong + "s");
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
tvGetCode.setEnabled(true);
tvGetCode.setText(getString(com.rv.home.R.string.rv_login_rest));
}
});
}
/**
* 发送验证码
*/
private void sendCode() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("username", getPhone());
mPresenter.postData(0, ApiConfig.HTTP_URL_SEND_CODE, SendCodeBean.class, map, true);
}
private void updateMobile() {
if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
Map<String, String> head = new HashMap<>();
head.put("Authorization", OkGoUtil.getToken());
Map<String, String> body = new HashMap<>();
body.put("username", getPhone());
body.put("mobilecode", getCode());
mPresenter.postData(RvFrameConfig.HOST, 1, ApiConfig.HTTP_URL_UPDATE_PHONE, BindCallBackBean.class, body, head, true);
}
}
/**
* 停止计时
*/
public void stopCarousel() {
if (mDisposable != null && !mDisposable.isDisposed()) {
mDisposable.dispose();
}
}
@Override
public void onStop() {
super.onStop();
stopCarousel();
}
private TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(getPhone()) && getPhone().length() == 11 && !TextUtils.isEmpty(getCode()) && getCode().length() >= 4) {
btnNext.setBackgroundResource(R.drawable.shape_rv_bg_fdc349);
} else {
btnNext.setBackgroundResource(R.drawable.shape_rv_bg_fde6b5);
}
}
@Override
public void afterTextChanged(Editable s) {
}
};
}
package com.rv.rvmine.traveler;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.alipay.sdk.app.AuthTask;
import com.frame.rv.config.RvFrameConfig;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.bean.UserInfoBean;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.IsAppInstall;
import com.rv.component.utils.RvCache;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.login.LoginRvActivity;
import com.rv.home.rv.module.ui.login.RegisteredActivity;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.rvmine.bean.AccountBindDto;
import com.rv.rvmine.bean.BindCallBackBean;
import com.umeng.socialize.UMAuthListener;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.utils.SocializeUtils;
import com.xxrv.wallet.api.WalletApi;
import com.xxrv.wallet.bean.AuthResult;
import com.xxrv.wallet.bean.WalletAuthInfoBean;
import com.yuyife.okgo.OkGoUtil;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import butterknife.BindView;
import butterknife.OnClick;
public class AccountSafeActivity extends BaseStatusActivity<CommonPresenter> implements UMAuthListener {
private static final int REQUEST_CODE_BIND_PHONE = 1001;
@BindView(R2.id.tv_phone)
TextView tvPhone;
@BindView(R2.id.tv_qq)
TextView tvQQ;
@BindView(R2.id.tv_wx)
TextView tvWx;
@BindView(R2.id.tv_zfb)
TextView tvZfb;
private UserInfoBean bean; // 用户信息
private boolean hasBindQQ; // 是否已经绑定QQ;
private boolean hasBindWX; // 是否已经绑定微信
private boolean hasBindZfb; // 是否已经绑定支付宝
public ProgressDialog dialog;
private int bindType; // 1 qq;2 微信;3支付宝
@Override
public void onShowResult(int requestType, BaseBean result) {
if (requestType == 0) {
bean = (UserInfoBean) result;
setUserInfo();
} else if (requestType == 1) {
alipayAuthV2((WalletAuthInfoBean) result);
} else if (requestType == 5) {
if (bindType == 0) return;
dealBindResult((BindCallBackBean) result);
}
}
@Override
protected int setLayout() {
return R.layout.activity_account_safe;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("账号与安全");
dialog = new ProgressDialog(this);
}
@OnClick({R2.id.rl_item_phone, R2.id.rl_update_pwd, R2.id.rl_qq, R2.id.rl_wx, R2.id.rl_zfb})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.rl_item_phone) { // 修改手机号码
//修改密码
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(mActivity, 0));
return;
}
Intent intent = new Intent(mActivity, BindPhoneActivity.class);
intent.putExtra("user", bean);
startActivityForResult(intent, REQUEST_CODE_BIND_PHONE);
} else if (id == R.id.rl_update_pwd) {
//修改密码
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(mActivity, 0));
return;
}
startActivity(RegisteredActivity.getIntent(mActivity, 1, 0));
} else if (id == R.id.rl_qq) {
if (hasBindQQ) {
showToast("您已绑定过QQ");
return;
}
//绑定qq
if (!IsAppInstall.isQQClientAvailable(mActivity)) {
showToast("亲,您QQ还没有安装呢");
return;
}
bindType = 1;
bindThirdParty(SHARE_MEDIA.QQ);
} else if (id == R.id.rl_zfb) {
if (hasBindZfb) {
showToast("您已绑定过支付宝");
return;
}
if (!IsAppInstall.isZfbClientAvailable(mActivity)) {
showToast("亲,您支付宝还没有安装呢");
return;
}
bindType = 3;
getAuthInfo();
} else if (id == R.id.rl_wx) {
if (hasBindWX) {
showToast("您已绑定过微信");
return;
}
if (!IsAppInstall.isZfbClientAvailable(mActivity)) {
showToast("亲,您微信还没有安装呢");
return;
}
bindType = 2;
bindThirdParty(SHARE_MEDIA.WEIXIN);
}
}
private void getAuthInfo() {
Map<String, Object> map = new LinkedHashMap<>();
map.put("apiName", "com.xinxin.rv");
map.put("appName", "滴房车");
mPresenter.getData(RvFrameConfig.HOST, 1, WalletApi.HTTP_URL_WALLET_UNAUTH_GETPARAM, WalletAuthInfoBean.class, map, false);
}
private void bindThirdParty(SHARE_MEDIA share_media) {
UMShareAPI.get(mActivity).getPlatformInfo(mActivity, share_media, this);
}
@Override
protected void loadData(Bundle savedInstanceState, Intent intent) {
super.loadData(savedInstanceState, intent);
getUser();
}
private void getUser() {
bean = (UserInfoBean) RvCache.getInstance().get(CacheEnum.USER);
if (bean != null) {
setUserInfo();
} else {
getUserData();
}
}
private void dealBindResult(BindCallBackBean bindCallBackBean) {
if (bindType == 1) {
hasBindQQ = true;
tvQQ.setTextColor(Color.parseColor("#171413"));
tvQQ.setText(TextUtils.isEmpty(bindCallBackBean.getData()) ? "已绑定" : bindCallBackBean.getData());
bean.getData().setBindQQ(true);
bean.getData().setQqNickname(bindCallBackBean.getData());
} else if (bindType == 2) {
hasBindWX = true;
tvWx.setTextColor(Color.parseColor("#171413"));
tvWx.setText(TextUtils.isEmpty(bindCallBackBean.getData()) ? "已绑定" : bindCallBackBean.getData());
bean.getData().setBindWx(true);
bean.getData().setWxNickname(bindCallBackBean.getData());
} else if (bindType == 3) {
hasBindZfb = true;
tvZfb.setTextColor(Color.parseColor("#171413"));
tvZfb.setText(TextUtils.isEmpty(bindCallBackBean.getData()) ? "已绑定" : bindCallBackBean.getData());
bean.getData().setBindAliPay(true);
bean.getData().setAliPayNickName(bindCallBackBean.getData());
}
RvCache.getInstance().save(bean, CacheEnum.USER);
showToast("授权绑定成功!");
}
/**
* 获取用户信息请求
*/
private void getUserData() {
Map<String, Object> headMap = new LinkedHashMap<>();
if (OkGoUtil.getToken() != null) {
headMap.put("Authorization", OkGoUtil.getToken());
mPresenter.getDataHead(RvFrameConfig.ADMIN_POST, 0, ApiConfig.HTTP_URL_APP_USER_INFO, UserInfoBean.class, headMap, false);
}
}
private void setUserInfo() {
String phone = bean.getData().getUsername();
if (!TextUtils.isEmpty(phone)) {
tvPhone.setText(phone);
}
setQqInfo();
setWxInfo();
setZfbInfo();
}
private void setQqInfo() {
hasBindWX = bean.getData().isBindWx();
if (hasBindWX) {
String wx = bean.getData().getWxNickname();
tvWx.setTextColor(Color.parseColor("#171413"));
tvWx.setText(!TextUtils.isEmpty(wx) ? wx : "已绑定");
} else {
tvWx.setTextColor(Color.parseColor("#cccccc"));
tvWx.setText("去授权绑定QQ");
}
}
private void setWxInfo() {
hasBindQQ = bean.getData().isBindQQ();
if (hasBindQQ) {
String qq = bean.getData().getQqNickname();
tvQQ.setTextColor(Color.parseColor("#171413"));
tvQQ.setText(!TextUtils.isEmpty(qq) ? qq : "已绑定");
} else {
tvQQ.setTextColor(Color.parseColor("#cccccc"));
tvQQ.setText("去授权绑定微信");
}
}
private void setZfbInfo() {
hasBindZfb = bean.getData().isBindAliPay();
if (hasBindZfb) {
String zfb = bean.getData().getAliPayNickName();
tvZfb.setTextColor(Color.parseColor("#171413"));
tvZfb.setText(!TextUtils.isEmpty(zfb) ? zfb : "已绑定");
} else {
tvZfb.setTextColor(Color.parseColor("#cccccc"));
tvZfb.setText("去授权绑定支付宝");
}
}
@Override
public void onDestroy() {
super.onDestroy();
RvCache.getInstance().save(bean, CacheEnum.USER);
UMShareAPI.get(mActivity).release();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
UMShareAPI.get(mActivity).onSaveInstanceState(outState);
}
private void authorize(AccountBindDto dto) {
if (!TextUtils.isEmpty(OkGoUtil.getToken())) {
Map<String, String> heads = new HashMap<>();
heads.put("Authorization", OkGoUtil.getToken());
mPresenter.postBodyData(5, ApiConfig.HTTP_URL_USER_BIND, BindCallBackBean.class, dto, heads, true);
}
}
@Override
public void onStart(SHARE_MEDIA share_media) {
SocializeUtils.safeShowDialog(dialog);
}
@Override
public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
if (dialog != null) {
SocializeUtils.safeCloseDialog(dialog);
}
String type = share_media.getName();
AccountBindDto bindDto = null;
if (share_media != null && "wxsession".equals(type)) { // 微信
String openid = map.get("openid");
String unionid = map.get("unionid");
String nickName = map.get("name");
bindDto = new AccountBindDto(openid, unionid, nickName, "wx");
authorize(bindDto);
} else if (share_media != null && "qq".equals(type)) {
String mQQOpenid = map.get("openid");
String nickName = map.get("name");
bindDto = new AccountBindDto(mQQOpenid, null, nickName, "q");
authorize(bindDto);
}
// Set<String> keys = map.keySet();
// Log.e("key", "----------------------------------------start---------------------------------");
// for (String key : keys) {
// Log.i(key, " value=" + map.get(key));
// }
//// Log.e("key", "----------------------------------------end---------------------------------");
}
@Override
public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
SocializeUtils.safeCloseDialog(dialog);
showToast(mActivity.getString(com.rv.home.R.string.rv_login_authorization_failure) + throwable.getMessage());
}
@Override
public void onCancel(SHARE_MEDIA share_media, int i) {
SocializeUtils.safeCloseDialog(dialog);
}
/**
* 支付宝授权
*/
private void alipayAuthV2(final WalletAuthInfoBean bean) {
Runnable authRunnable = new Runnable() {
@Override
public void run() {
// 构造AuthTask 对象
AuthTask authTask = new AuthTask(AccountSafeActivity.this);
// 调用授权接口,获取授权结果
Map<String, String> result = authTask.authV2(bean.getData(), true);
Message msg = new Message();
msg.what = 0;
msg.obj = result;
mHandler.sendMessage(msg);
}
};
// 必须异步调用
Thread authThread = new Thread(authRunnable);
authThread.start();
}
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
@SuppressWarnings("unused")
public void handleMessage(Message msg) {
switch (msg.what) {
case 0: {
@SuppressWarnings("unchecked")
Map<String, String> values = (Map<String, String>) msg.obj;
AuthResult authResult = new AuthResult(values, true);
String resultStatus = authResult.getResultStatus();
// 判断resultStatus 为“9000”且result_code
// 为“200”则代表授权成功,具体状态码代表含义可参考授权接口文档
if (TextUtils.equals(resultStatus, "9000") && TextUtils.equals(authResult.getResultCode(), "200")) {
// 传入,则支付账户为该授权账户
AccountBindDto bindDto = new AccountBindDto(authResult.getAlipayOpenId(), null, null, "aliPay", authResult.getAuthCode());
authorize(bindDto);
// putAlipayCode(authResult.getAlipayOpenId(), authResult.getAuthCode());
// showToast("授权成功!");
} else {
// 其他状态值则为授权失败
}
break;
}
default:
break;
}
}
};
// private void putAlipayCode(String openId, String code) {
// Map<String, Object> headMap = new LinkedHashMap<>();
// if (OkGoUtil.getToken() != null)
// headMap.put("Authorization", OkGoUtil.getToken());
// Map<String, Object> map = new LinkedHashMap<>();
// map.put("code", code);
// mPresenter.getData(RvFrameConfig.HOST, 3, WalletApi.HTTP_URL_WALLET_ALIPAY_GETUSERINFO, BaseBean.class, map, headMap, false);
// }
// private void getAccountNumber() {
// Map<String, Object> headMap = new LinkedHashMap<>();
// if (OkGoUtil.getToken() != null)
// headMap.put("Authorization", OkGoUtil.getToken());
// mPresenter.getDataHead(RvFrameConfig.HOST, 4, WalletApi.HTTP_URL_WALLET_ACCOUNT_NUMBER, AccountNumberListBean.class, headMap, false);
// }
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_BIND_PHONE) {
if (RESULT_OK == resultCode) {
String phone = data.getStringExtra("phone");
bean.getData().setUsername(phone);
if (!TextUtils.isEmpty(phone)) {
tvPhone.setText(phone);
}
}
} else
UMShareAPI.get(this).onActivityResult(requestCode, resultCode, data);
}
}
package com.rv.rvmine.traveler;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import butterknife.BindView;
public class AlterNickNameActivity extends BaseStatusActivity<CommonPresenter> {
@BindView(R2.id.et_nickname)
EditText etNickname;
@Override
protected int setLayout() {
return R.layout.activity_alter_nick_name;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("个人资料");
titleView.setText(R.id.tv_title_right, "保存");
titleView.setTextColor(R.id.tv_title_right, Color.parseColor("#666666"));
titleView.setChildClickListener(R.id.tv_title_right, new View.OnClickListener() {
@Override
public void onClick(View v) {
upUserinfo();
}
});
String nickName = intent.getStringExtra("nick");
if (!TextUtils.isEmpty(nickName)) {
etNickname.setText(nickName);
if (nickName.length() <= 32) {
etNickname.setSelection(nickName.length());
} else {
etNickname.setSelection(32);
}
}
}
private void upUserinfo() {
if (TextUtils.isEmpty(getNickName())) {
showToast("昵称不能为空");
}
Intent intent = new Intent();
intent.putExtra("nick", getNickName());
setResult(RESULT_OK, intent);
finish();
}
private String getNickName() {
return etNickname.getText().toString().trim();
}
@Override
public void onShowResult(int requestType, BaseBean result) {
}
}
package com.rv.rvmine.traveler;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.base.presenter.CommonPresenter;
import com.ruiwenliu.wrapper.bean.UserInfoBean;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache;
import com.rv.rvmine.R;
import com.rv.rvmine.SwitchFragmentListener;
import com.rv.rvmine.fragment.BindPhoneFirstFragment;
import com.rv.rvmine.fragment.BindPhoneSecondFragment;
import com.rv.rvmine.fragment.BindPhoneThirdFragment;
public class BindPhoneActivity extends BaseStatusActivity<CommonPresenter> implements SwitchFragmentListener {
private int currentPage = 1;
private UserInfoBean bean;
private BindPhoneFirstFragment firstFragment;
private BindPhoneSecondFragment secondFragment;
private BindPhoneThirdFragment thirdFragment;
private boolean isChanged;
@Override
protected int setLayout() {
return R.layout.activity_bind_phone;
}
@Override
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
bean = (UserInfoBean) intent.getSerializableExtra("user");
firstFragment = new BindPhoneFirstFragment();
if (bean != null) {
Bundle bundle = new Bundle();
bundle.putString("phone", bean.getData().getUsername());
firstFragment.setArguments(bundle);
}
getSupportFragmentManager().beginTransaction().replace(R.id.fl_content, firstFragment)
.addToBackStack(null).commit();
}
@Override
public void onShowResult(int requestType, BaseBean result) {
}
@Override
public void setTitle(String title) {
if (!TextUtils.isEmpty(title))
titleView.setTitle(title);
}
@Override
public void next() {
switch (currentPage) {
case 1:
secondFragment = new BindPhoneSecondFragment();
if (bean != null) {
Bundle bundle = new Bundle();
bundle.putString("phone", bean.getData().getUsername());
secondFragment.setArguments(bundle);
}
getSupportFragmentManager().beginTransaction().replace(R.id.fl_content, secondFragment)
.addToBackStack(null).commit();
currentPage = 2;
break;
case 2:
thirdFragment = new BindPhoneThirdFragment();
if (bean != null) {
Bundle bundle = new Bundle();
bundle.putString("phone", bean.getData().getUsername());
thirdFragment.setArguments(bundle);
}
getSupportFragmentManager().beginTransaction().replace(R.id.fl_content, thirdFragment)
.addToBackStack(null).commit();
currentPage = 3;
break;
}
}
@Override
public void changeSuccess(String phone) {
isChanged = true;
bean.getData().setUsername(phone);
RvCache.getInstance().save(bean, CacheEnum.USER);
Bundle bundle = new Bundle();
bundle.putString("phone", bean.getData().getUsername());
firstFragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.fl_content, firstFragment)
.addToBackStack(null).commit();
currentPage = 1;
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public void finish() {
if (currentPage > 1) {
getSupportFragmentManager().popBackStack();
currentPage -= 1;
} else {
if (isChanged) {
Intent intent = new Intent();
intent.putExtra("phone", bean.getData().getUsername());
setResult(RESULT_OK,intent);
}
super.finish();
}
}
}
......@@ -11,7 +11,6 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.base.utils.ui.datetime.selector.util.TextUtil;
......@@ -28,18 +27,14 @@ import com.ruiwenliu.wrapper.util.glide.GlideManager;
import com.ruiwenliu.wrapper.util.permission.RxPermission;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.component.dialog.PickerDialog;
import com.rv.component.utils.IsAppInstall;
import com.rv.component.utils.MyTextWatcher;
import com.rv.component.utils.CacheEnum;
import com.rv.component.utils.RvCache;
import com.rv.home.rv.module.ApiConfig;
import com.rv.home.rv.module.ui.main.home.bean.ImageUploadBean;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import com.rv.rvmine.dialog.ChooseGenderDialog;
import com.rv.rvmine.rxbusevent.UserInfoEvent;
import com.umeng.socialize.UMAuthListener;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.utils.SocializeUtils;
import com.yuyife.okgo.OkGoUtil;
import java.io.File;
......@@ -61,44 +56,35 @@ import pub.devrel.easypermissions.AppSettingsDialog;
/**
* 个人资料
*/
public class PersonalInformationActivity extends BaseStatusActivity<PickerPresenter> implements UMAuthListener {
public class PersonalInformationActivity extends BaseStatusActivity<PickerPresenter> {
public final int TYPE_ALTER_NICK = 1006;
@BindView(R2.id.iv_avatar)
RoundImageView ivAvatar;
@BindView(R2.id.et_nickname)
EditText etNickname;
@BindView(R2.id.et_name)
EditText etName;
@BindView(R2.id.tv_nickname)
TextView tvNickname;
@BindView(R2.id.tv_date_of_birth)
TextView tvDateOfBirth;
@BindView(R2.id.tv_sex)
TextView tvSex;
@BindView(R2.id.et_phone)
EditText etPhone;
@BindView(R2.id.et_id_card)
EditText etIdCard;
@BindView(R2.id.tv_binding_qq)
TextView tvBindingQq;
@BindView(R2.id.tv_binding_wx)
TextView tvBindingWx;
@BindView(R2.id.ll_item_binding_qq)
LinearLayout llItemBindingQq;
@BindView(R2.id.ll_item_binding_wechat)
LinearLayout llItemBindingWechat;
private UserInfoBean.UserInfo info;
private String ivAvatarUrl;
public ProgressDialog dialog;
private int mLoginType;
private String mName;
private int sex;// 0-女,1-男
private String mQQOpenid;
private String mWXOpenid;
private String mUnionid;
private String mHeadImg;
private String aliCode;
private String birthday = "";
private static final int SDK_AUTH_FLAG = 2;
private boolean hasNickName;
public static Intent getIntent(Context context, UserInfoBean.UserInfo info) {
return new Intent(context, PersonalInformationActivity.class)
......@@ -114,14 +100,26 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
titleView.setTitle("个人资料");
titleView.setText(R.id.tv_title_right, "保存");
titleView.setTextColor(R.id.tv_title_right, Color.parseColor("#666666"));
titleView.setChildClickListener(R.id.tv_title_right, new View.OnClickListener() {
@Override
public void onClick(View v) {
upUserinfo();
}
});
tvNickname.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent in = new Intent(PersonalInformationActivity.this, AlterNickNameActivity.class);
if (hasNickName) {
in.putExtra("nick", tvNickname.getText().toString().trim());
}
startActivityForResult(in, TYPE_ALTER_NICK);
}
});
dialog = new ProgressDialog(this);
info = (UserInfoBean.UserInfo) intent.getSerializableExtra("userinfo");
info = ((UserInfoBean) RvCache.getInstance().get(CacheEnum.USER)).getData();
// info = (UserInfoBean.UserInfo) intent.getSerializableExtra("userinfo");
if (info != null) {
ivAvatarUrl = info.getHeadimgurl();
mWXOpenid = info.getWxOpenid();
......@@ -129,18 +127,10 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
mQQOpenid = info.getOpenid();
GlideManager.getInstance(mActivity).loadImage(info.getHeadimgurl(), ivAvatar);
if (info.getNickname() != null) {
etNickname.setText(info.getNickname());
if (!TextUtils.isEmpty(info.getNickname())) {
if (info.getNickname().length() <= 32) {
etNickname.setSelection(info.getNickname().length());
} else {
etNickname.setSelection(32);
}
}
}
if (info.getRealname() != null) {
etName.setText(info.getRealname());
hasNickName = true;
tvNickname.setText(info.getNickname());
tvNickname.setTextColor(getResources().getColor(R.color.colorMain));
}
if (info.getBirthday() != null) {
birthday = info.getBirthday();
......@@ -159,25 +149,6 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
if (info.getUsername() != null) {
etPhone.setText(info.getUsername());
}
if (info.getIdNumber() != null) {
etIdCard.setText(info.getIdNumber());
}
if (TextUtils.isEmpty(info.getWxOpenid())) {
tvBindingWx.setText("去授权绑定微信");
llItemBindingWechat.setEnabled(true);
} else {
tvBindingWx.setText("已绑定");
llItemBindingWechat.setEnabled(false);
}
if (TextUtils.isEmpty(info.getOpenid())) {
tvBindingQq.setText("去授权绑定QQ");
llItemBindingQq.setEnabled(true);
} else {
tvBindingQq.setText("已绑定");
llItemBindingQq.setEnabled(false);
}
}
}
......@@ -209,13 +180,20 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
String url = mPresenter.gerCameraStoreUrl();
GlideManager.getInstance(mActivity).loadImage(url, ivAvatar);
uploadFile(new File(mPresenter.gerCameraStoreUrl()), "camera");
} else {
UMShareAPI.get(mActivity).onActivityResult(requestCode, resultCode, data);
} else if (requestCode == TYPE_ALTER_NICK && resultCode == RESULT_OK) {
if (data != null) {
String nickName = data.getStringExtra("nick");
if (!TextUtils.isEmpty(nickName)) {
hasNickName = true;
tvNickname.setText(nickName);
tvNickname.setTextColor(getResources().getColor(R.color.colorMain));
}
}
}
}
@OnClick({R2.id.rl_item_avatar, R2.id.ll_item_date_of_birth, R2.id.ll_item_sex, R2.id.ll_item_binding_qq, R2.id.ll_item_binding_wechat})
@OnClick({R2.id.rl_item_avatar, R2.id.ll_item_date_of_birth, R2.id.ll_item_sex})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.rl_item_avatar) {
......@@ -228,27 +206,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
} else if (id == R.id.ll_item_sex) {
//性别
chooseGender();
} else if (id == R.id.ll_item_binding_qq) {
//绑定qq
if (!IsAppInstall.isQQClientAvailable(mActivity)) {
showToast("亲,您QQ还没有安装呢");
return;
}
bindThirdParty(SHARE_MEDIA.QQ);
} else if (id == R.id.ll_item_binding_wechat) {
//绑定微信
if (!IsAppInstall.isWeixinAvilible(mActivity)) {
showToast("亲,您微信还没有安装呢");
return;
}
bindThirdParty(SHARE_MEDIA.WEIXIN);
}
}
private void bindThirdParty(SHARE_MEDIA share_media) {
UMShareAPI.get(mActivity).getPlatformInfo(mActivity, share_media, this);
}
private void chooseGender() {
......@@ -266,13 +224,13 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.cb_man) {
if (id == R.id.cb_man || id == R.id.rl_man) {
sex = 1;
helper.setChecked(R.id.cb_girl, false);
} else if (id == R.id.cb_girl) {
} else if (id == R.id.cb_girl|| id == R.id.rl_woman) {
sex = 0;
helper.setChecked(R.id.cb_man, false);
} else if (id == R.id.tv_ok) {
}
if (sex == 0) { // 0-女,1-男
tvSex.setText("女");
} else if (sex == 1) {
......@@ -280,8 +238,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
}
dismiss();
}
}
}, R.id.cb_man, R.id.cb_girl, R.id.tv_ok);
}, R.id.cb_man, R.id.cb_girl,R.id.rl_man,R.id.rl_woman);
}
}.show();
}
......@@ -342,7 +299,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
break;
}
}else{
} else {
new AppSettingsDialog.Builder(PersonalInformationActivity.this).
setTitle("需要获取相机权限、存储权限")
.setRationale("如果没有此权限,此应用程序可能无法正常工作,是否打开设置修改该应用权限")
......@@ -362,7 +319,6 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
}
}
/**
* 上传文件
*
......@@ -388,7 +344,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
private void upUserinfo() {
String nickName = etNickname.getText().toString().trim();
String nickName = tvNickname.getText().toString().trim();
if (TextUtil.isEmpty(nickName)) {
showToast("昵称不为空!");
return;
......@@ -402,7 +358,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
if (info == null) {
return;
}
mPresenter.postBodyData(RvFrameConfig.ADMIN_POST, 1, ApiConfig.HTTP_URL_UPUSER_EDIT, BaseBean.class, new UserInfo(info.getId() + "", info.getUserid() + "", info.getUsername(), "0", nickName, info.getRealname(), ivAvatarUrl, birthday, sex, mWXOpenid, mUnionid, mQQOpenid), getHeadMap(), true);
mPresenter.postBodyData(RvFrameConfig.ADMIN_POST, 1, ApiConfig.HTTP_URL_UPUSER_EDIT, BaseBean.class, new UserInfo(info.getId() + "", info.getUserid() + "", info.getUsername(), "0", nickName, info.getRealname(), ivAvatarUrl, birthday, sex, mWXOpenid, mUnionid, mQQOpenid, aliCode), getHeadMap(), true);
// mPresenter.postBodyData(RvFrameConfig.ADMIN_POST, 1, ApiConfig.HTTP_URL_UPUSER_EDIT, BaseBean.class, new UserInfo(info.getId() + "", info.getUserid() + "", info.getUsername(), "0", nickName, info.getRealname(), ivAvatarUrl, birthday, sex, "", "", ""), getHeadMap(), true);
}
......@@ -413,51 +369,15 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
return headMap;
}
@Override
public void onStart(SHARE_MEDIA share_media) {
SocializeUtils.safeShowDialog(dialog);
}
@Override
public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> data) {
if (dialog != null) {
SocializeUtils.safeCloseDialog(dialog);
}
mHeadImg = data.get("iconurl");
mLoginType = share_media.getName().equals("qq") ? 1 : 0;
if (mLoginType == 0) {
mUnionid = data.get("unionid");
mWXOpenid = data.get("openid");
tvBindingWx.setText("已绑定");
} else {
mQQOpenid = data.get("openid");
tvBindingQq.setText("已绑定");
}
mName = data.get("name");
}
@Override
public void onError(SHARE_MEDIA share_media, int i, Throwable t) {
SocializeUtils.safeCloseDialog(dialog);
showToast(mActivity.getString(com.rv.home.R.string.rv_login_authorization_failure) + t.getMessage());
}
@Override
public void onCancel(SHARE_MEDIA share_media, int i) {
SocializeUtils.safeCloseDialog(dialog);
}
@Override
public void onDestroy() {
super.onDestroy();
UMShareAPI.get(mActivity).release();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
UMShareAPI.get(mActivity).onSaveInstanceState(outState);
}
@Override
......@@ -481,8 +401,9 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
private String wxOpenid;
private String unionid;
private String openid;
private String aliCode;
public UserInfo(String id, String userid, String username, String status, String nickname, String realname, String headimgurl, String birthday, int sex, String wxOpenid, String unionid, String openid) {
public UserInfo(String id, String userid, String username, String status, String nickname, String realname, String headimgurl, String birthday, int sex, String wxOpenid, String unionid, String openid, String aliCode) {
this.id = id;
this.userid = userid;
this.username = username;
......@@ -495,6 +416,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
this.wxOpenid = wxOpenid;
this.unionid = unionid;
this.openid = openid;
this.aliCode = aliCode;
}
public String getId() {
......@@ -592,6 +514,14 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
public void setOpenid(String openid) {
this.openid = openid;
}
public String getAliCode() {
return aliCode;
}
public void setAliCode(String aliCode) {
this.aliCode = aliCode;
}
}
......
......@@ -76,10 +76,10 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> impleme
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
tvOutSign.setText("立即登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_bg_shallow_dark_yellow_circle);
// tvOutSign.setBackgroundResource(R.drawable.shape_rv_bg_shallow_dark_yellow_circle);
} else {
tvOutSign.setText("退出登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
// tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
}
DownListenerManager.getInstance().addDownListener(this);
......@@ -99,7 +99,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> impleme
@Override
public void onNext(LoginSuccessfulEvent event) {
tvOutSign.setText("退出登录");
tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
// tvOutSign.setBackgroundResource(R.drawable.shape_rv_button_light_gray);
}
});
}
......@@ -142,18 +142,20 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> impleme
DownListenerManager.getInstance().removeDownListener(this);
}
@OnClick({R2.id.rl_item_change_password, R2.id.ll_item_app_push, R2.id.rl_item_clear_cache, R2.id.rl_item_check_for_updates, R2.id.rl_item_about_us, R2.id.tv_out_sign})
@OnClick({R2.id.rl_item_account_safe, R2.id.ll_item_app_push, R2.id.rl_item_clear_cache, R2.id.rl_item_check_for_updates, R2.id.rl_item_about_us, R2.id.tv_out_sign})
public void onViewClicked(View view) {
int id = view.getId();
if (id == R.id.rl_item_change_password) {
if (id == R.id.rl_item_account_safe) {
//修改密码
if (TextUtils.isEmpty(OkGoUtil.getToken())) {
startActivity(LoginRvActivity.getIntent(mActivity, 0));
return;
}
startActivity(RegisteredActivity.getIntent(mActivity, 1, 0));
startActivity(new Intent(mActivity, AccountSafeActivity.class));
// startActivity(RegisteredActivity.getIntent(mActivity, 1, 0));
} else if (id == R.id.ll_item_app_push) {
//App推送消息
......@@ -164,6 +166,7 @@ public class SettingActivity extends BaseStatusActivity<CommonPresenter> impleme
deleteDir(Environment.getExternalStorageDirectory() + "/photo/crop");
showToast("清理成功!");
} else if (id == R.id.rl_item_check_for_updates) {
if (!DownListenerManager.getInstance().isDown())
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffffffff" />
<stroke android:width="1dp" android:color="#ffcccccc" />
<corners android:topLeftRadius="80dp" android:topRightRadius="80dp" android:bottomLeftRadius="80dp" android:bottomRightRadius="80dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_10" />
<solid android:color="#f2f2f2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_40" />
<solid android:color="#F3EADC" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_30" />
<solid android:color="#fbf9e8" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_100" />
<solid android:color="#fdc349" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/size_100" />
<solid android:color="#fde6b5" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorLine"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWrite"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<RelativeLayout
android:id="@+id/rl_item_phone"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="手机号"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="手机号"
android:textColor="@color/colorMain"
android:drawablePadding="3dp"
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_update_pwd"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="登录密码"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<ImageView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/common_icon_rig_black_gray" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:background="@color/colorWrite"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<RelativeLayout
android:id="@+id/rl_qq"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="QQ"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_qq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:drawablePadding="@dimen/size_3"
android:text="去授权绑定QQ"
android:textColor="#CCCCCC"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_wx"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="微信"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_wx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:drawablePadding="@dimen/size_3"
android:text="去授权绑定微信"
android:textColor="#CCCCCC"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_zfb"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="支付宝"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_zfb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:drawablePadding="@dimen/size_3"
android:text="去授权绑定支付宝"
android:textColor="#CCCCCC"
android:textSize="@dimen/sp_16" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F5F5F5"
tools:context=".traveler.AlterNickNameActivity">
<EditText
android:id="@+id/et_nickname"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/colorWrite"
android:ellipsize="end"
android:hint="请输入昵称"
android:maxLength="32"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/sp_14" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".traveler.BindPhoneActivity">
<FrameLayout
android:id="@+id/fl_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
......@@ -129,11 +129,22 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/size_15"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/text_10"
android:orientation="horizontal"
android:gravity="center_vertical"
android:visibility="gone">
<LinearLayout
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_rv_bg_fbf9e8"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_member"
android:layout_width="@dimen/size_15"
......@@ -149,6 +160,21 @@
android:textSize="@dimen/text_10" />
</LinearLayout>
<TextView
android:id="@+id/tv_capacity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/shape_rv_bg_f3eadc"
android:paddingLeft="5dp"
android:paddingTop="1dp"
android:paddingRight="5dp"
android:paddingBottom="1dp"
android:textColor="#ffd6b263"
android:textSize="@dimen/text_10" />
</LinearLayout>
<TextView
android:id="@+id/tv_login"
android:layout_width="wrap_content"
......
......@@ -50,20 +50,21 @@
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<EditText
android:id="@+id/et_nickname"
<TextView
android:id="@+id/tv_nickname"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:background="@null"
android:drawableRight="@drawable/common_icon_rig_black"
android:drawablePadding="3dp"
android:ellipsize="end"
android:gravity="right|center_vertical"
android:hint="请输入昵称"
android:maxLength="32"
android:singleLine="true"
android:ellipsize="end"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:text="请输入昵称"
android:textColor="@color/colorGray"
android:textSize="@dimen/text_16" />
</LinearLayout>
</LinearLayout>
......@@ -80,19 +81,18 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical"
android:visibility="gone">
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="姓名"
android:text="手机号"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<EditText
android:id="@+id/et_name"
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
......@@ -100,11 +100,14 @@
android:background="@null"
android:enabled="false"
android:gravity="right|center_vertical"
android:hint="请输入姓名"
android:maxLength="10"
android:hint="请输入手机号"
android:inputType="phone|number"
android:maxLength="11"
android:maxLines="1"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
......@@ -179,149 +182,5 @@
android:src="@drawable/common_icon_rig_black" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="手机号"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<EditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:background="@null"
android:enabled="false"
android:gravity="right|center_vertical"
android:hint="请输入手机号"
android:inputType="phone|number"
android:maxLength="11"
android:maxLines="1"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/text_16" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="身份证号"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<EditText
android:id="@+id/et_id_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:background="@null"
android:enabled="false"
android:gravity="right|center_vertical"
android:hint="请输入身份证号"
android:maxLength="18"
android:maxLines="1"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/text_16" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_15"
android:background="@color/colorWrite"
android:orientation="vertical"
android:paddingLeft="@dimen/size_15"
android:paddingRight="@dimen/size_15">
<LinearLayout
android:id="@+id/ll_item_binding_qq"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="QQ"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_binding_qq"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:hint="去授权绑定QQ"
android:text=""
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/text_16" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_8"
android:src="@drawable/common_icon_rig_black" />
</LinearLayout>
<include layout="@layout/common_line" />
<LinearLayout
android:id="@+id/ll_item_binding_wechat"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:gravity="center_vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="微信"
android:textColor="@color/text_Main"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_binding_wx"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/size_15"
android:layout_weight="1"
android:gravity="right|center_vertical"
android:hint="去授权绑定微信"
android:text=""
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/text_16" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_8"
android:src="@drawable/common_icon_rig_black" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -14,7 +14,7 @@
android:paddingRight="@dimen/size_15">
<RelativeLayout
android:id="@+id/rl_item_change_password"
android:id="@+id/rl_item_account_safe"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
......@@ -22,7 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="修改密码"
android:text="账号与安全"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
......@@ -31,7 +31,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/common_icon_rig_black" />
android:src="@drawable/common_icon_rig_black_gray" />
</RelativeLayout>
<include layout="@layout/common_line" />
......@@ -78,7 +78,7 @@
android:paddingRight="@dimen/size_15">
<RelativeLayout
android:id="@+id/rl_item_clear_cache"
android:id="@+id/rl_item_check_for_updates"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
......@@ -86,22 +86,26 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="清除缓存"
android:text="检查更新"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<ImageView
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/common_icon_rig_black" />
android:drawableRight="@drawable/common_icon_rig_black_gray"
android:drawablePadding="@dimen/size_3"
android:textColor="#171413"
android:textSize="@dimen/sp_12" />
</RelativeLayout>
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_item_check_for_updates"
android:id="@+id/rl_item_clear_cache"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50">
......@@ -109,19 +113,16 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="检查更新"
android:text="清除缓存"
android:textColor="@color/colorMain"
android:textSize="@dimen/text_16" />
<TextView
android:id="@+id/tv_version"
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:drawablePadding="@dimen/size_3"
android:textColor="#999999"
android:textSize="@dimen/sp_12" />
android:src="@drawable/common_icon_rig_black_gray" />
</RelativeLayout>
<include layout="@layout/common_line" />
......@@ -144,7 +145,7 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/common_icon_rig_black" />
android:src="@drawable/common_icon_rig_black_gray" />
</RelativeLayout>
</LinearLayout>
......@@ -153,13 +154,12 @@
android:id="@+id/tv_out_sign"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:layout_marginLeft="@dimen/size_20"
android:layout_marginTop="@dimen/size_70"
android:layout_marginRight="@dimen/size_20"
android:background="@drawable/shape_rv_button_light_gray"
android:layout_marginTop="@dimen/size_15"
android:background="@color/colorWrite"
android:gravity="center"
android:text="退出登录"
android:textColor="@color/colorWrite" />
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="@dimen/size_100"
android:layout_height="@dimen/size_100"
android:layout_marginTop="@dimen/size_50"
android:src="@drawable/icon_bind_phone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="绑定的手机号码"
android:textColor="#666666"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" />
<Button
android:id="@+id/btn_update_phone"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginLeft="27dp"
android:layout_marginTop="52dp"
android:layout_marginRight="27dp"
android:background="@drawable/shape_rv_bg_bind_phone_button"
android:gravity="center"
android:text="更换手机号"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/size_20"
android:paddingRight="@dimen/size_20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/size_20"
android:text="更换手机号前,需先验证当前绑定手机号"
android:textColor="@color/text_Gray"
android:textSize="@dimen/sp_14" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:textColor="@color/colorMain"
android:textSize="@dimen/sp_14" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="26sp"
android:background="@drawable/shape_rv_bg_f2f2f2"
android:orientation="horizontal">
<EditText
android:layout_marginLeft="@dimen/dp_10"
android:id="@+id/et_phone_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/colorGrayBg"
android:gravity="center_vertical|left"
android:hint="请输入验证码"
android:inputType="number"
android:maxLength="6"
android:paddingLeft="3dp"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/sp_14" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_12"
android:layout_marginBottom="@dimen/text_12"
android:background="@color/text_Gray" />
<TextView
android:id="@+id/tv_get_code"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:gravity="center"
android:text="获取验证码"
android:textColor="@color/colorMain"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="@+id/btn_next"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="31dp"
android:background="@drawable/shape_rv_bg_fde6b5"
android:gravity="center"
android:text="下一步"
android:textColor="@color/colorWrite"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/size_20"
android:paddingRight="@dimen/size_20">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="@dimen/size_30"
android:background="@drawable/shape_rv_bg_f2f2f2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="13dp"
android:gravity="center"
android:text="+86"
android:textColor="#3A3938"
android:textSize="@dimen/sp_14" />
<EditText
android:id="@+id/et_phone"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginRight="@dimen/dp_10"
android:layout_weight="1"
android:background="@color/colorGrayBg"
android:gravity="center_vertical|left"
android:hint="请输入新绑定的手机号"
android:inputType="phone"
android:maxLength="11"
android:paddingLeft="13dp"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/sp_14" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="26sp"
android:background="@drawable/shape_rv_bg_f2f2f2"
android:orientation="horizontal">
<EditText
android:maxLength="8"
android:id="@+id/et_phone_code"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_10"
android:layout_weight="1"
android:background="@color/colorGrayBg"
android:gravity="center_vertical|left"
android:hint="请输入验证码"
android:inputType="number"
android:paddingLeft="3dp"
android:textColor="@color/colorMain"
android:textColorHint="@color/colorGray"
android:textSize="@dimen/sp_14" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/size_12"
android:layout_marginBottom="@dimen/text_12"
android:background="@color/text_Gray" />
<TextView
android:id="@+id/tv_get_code"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:gravity="center"
android:text="获取验证码"
android:textColor="@color/colorMain"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="@+id/btn_next"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_marginTop="@dimen/dp_40"
android:background="@drawable/shape_rv_bg_fde6b5"
android:gravity="center"
android:text="完成"
android:textColor="@color/colorWrite"
android:textSize="@dimen/sp_16" />
</LinearLayout>
......@@ -4,49 +4,75 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_40"
android:layout_marginRight="@dimen/size_40"
android:background="@color/colorWrite"
android:background="@drawable/shape_rv_bg_write"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/size_130"
<TextView
android:gravity="center"
android:orientation="horizontal">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/text_12"
android:layout_marginBottom="@dimen/size_15"
android:text="性别"
android:textColor="@color/colorMain"
android:textSize="@dimen/size_20" />
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_man"
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_20"
android:text="男"
android:textColor="@color/colorMain"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginRight="@dimen/size_15"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:id="@+id/cb_man"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@drawable/selector_rv_check"
android:enabled="true"
android:text="男"
android:textSize="@dimen/text_16"
android:paddingLeft="@dimen/size_5"
android:button="@drawable/selector_rv_check" />
android:textSize="@dimen/text_16" />
</RelativeLayout>
<include layout="@layout/common_line" />
<RelativeLayout
android:id="@+id/rl_woman"
android:layout_width="match_parent"
android:layout_height="48dp">
<TextView
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/size_20"
android:text="女"
android:textColor="@color/colorMain"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox
android:layout_marginRight="@dimen/size_15"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:id="@+id/cb_girl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/size_100"
android:button="@drawable/selector_rv_check"
android:enabled="true"
android:text="女"
android:paddingLeft="@dimen/size_5"
android:textSize="@dimen/text_16"
android:button="@drawable/selector_rv_check" />
</LinearLayout>
<include layout="@layout/common_line" />
<TextView
android:id="@+id/tv_ok"
android:layout_width="match_parent"
android:layout_height="@dimen/size_50"
android:background="@color/gray_FFB74B"
android:gravity="center"
android:text="确认" />
android:textSize="@dimen/text_16" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -31,4 +31,13 @@ public class WalletApi {
//提现详情
public static String HTTP_URL_WALLET_WITHDRAWDETAIL = RvFrameConfig.HOST_H5_DETAIL + "/h5/appHtml/view/withdrawDetail.html";
//获取支付宝授权信息authInfo
public static String HTTP_URL_WALLET_UNAUTH_GETPARAM = RvFrameConfig.HOST + "/api/universal/info/app/unauth/getParam";
//提交支付宝code
public static String HTTP_URL_WALLET_ALIPAY_GETUSERINFO = RvFrameConfig.HOST + "/api/admin/alipay/getUserInfo";
//获取帐号信息
public static String HTTP_URL_WALLET_ACCOUNT_NUMBER = RvFrameConfig.HOST + "/api/admin/alipay/get";
}
package com.xxrv.wallet.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
import java.io.Serializable;
import java.util.List;
/**
* 获取支付账号列表
*/
public class AccountNumberListBean extends BaseBean {
private List<DataBean> data;
private boolean rel;
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public boolean isRel() {
return rel;
}
public void setRel(boolean rel) {
this.rel = rel;
}
public static class DataBean implements Serializable {
private String id;// ":6,
private int userId;//":75,
private String txAlipay;//":"2088212169302286",
private int isDefault;//":0,
private long crtTime;//":1571125067723,
private int isDel;//":0,
private String nickname;//":"PeakLin",
private int type;//":1
private boolean check;
public boolean getCheck() {
return check;
}
public void setCheck(boolean check) {
this.check = check;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getTxAlipay() {
return txAlipay;
}
public void setTxAlipay(String txAlipay) {
this.txAlipay = txAlipay;
}
public int getIsDefault() {
return isDefault;
}
public void setIsDefault(int isDefault) {
this.isDefault = isDefault;
}
public long getCrtTime() {
return crtTime;
}
public void setCrtTime(long crtTime) {
this.crtTime = crtTime;
}
public int getIsDel() {
return isDel;
}
public void setIsDel(int isDel) {
this.isDel = isDel;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
}
package com.xxrv.wallet.bean; import android.text.TextUtils; import java.util.Map; public class AuthResult { private String resultStatus; private String result; private String memo; private String resultCode; private String authCode; private String alipayOpenId; public AuthResult(Map<String, String> rawResult, boolean removeBrackets) { if (rawResult == null) { return; } for (String key : rawResult.keySet()) { if (TextUtils.equals(key, "resultStatus")) { resultStatus = rawResult.get(key); } else if (TextUtils.equals(key, "result")) { result = rawResult.get(key); } else if (TextUtils.equals(key, "memo")) { memo = rawResult.get(key); } } String[] resultValue = result.split("&"); for (String value : resultValue) { if (value.startsWith("alipay_open_id")) { alipayOpenId = removeBrackets(getValue("alipay_open_id=", value), removeBrackets); continue; } if (value.startsWith("auth_code")) { authCode = removeBrackets(getValue("auth_code=", value), removeBrackets); continue; } if (value.startsWith("result_code")) { resultCode = removeBrackets(getValue("result_code=", value), removeBrackets); continue; } } } private String removeBrackets(String str, boolean remove) { if (remove) { if (!TextUtils.isEmpty(str)) { if (str.startsWith("\"")) { str = str.replaceFirst("\"", ""); } if (str.endsWith("\"")) { str = str.substring(0, str.length() - 1); } } } return str; } @Override public String toString() { return "authCode={" + authCode + "}; resultStatus={" + resultStatus + "}; memo={" + memo + "}; result={" + result + "}"; } private String getValue(String header, String data) { return data.substring(header.length(), data.length()); } public String getResultStatus() { return resultStatus; } public String getMemo() { return memo; } public String getResult() { return result; } public String getResultCode() { return resultCode; } public String getAuthCode() { return authCode; } public String getAlipayOpenId() { return alipayOpenId; }}
\ No newline at end of file
package com.xxrv.wallet.bean;
import com.ruiwenliu.wrapper.base.BaseBean;
public class WalletAuthInfoBean extends BaseBean {
private String data;
private boolean rel;
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public boolean isRel() {
return rel;
}
public void setRel(boolean rel) {
this.rel = rel;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment