1.修改密码UI对稿 2.修改密码bug fix 3.删除了一些登录相关无用代码
This commit is contained in:
@@ -525,11 +525,6 @@
|
|||||||
android:scheme="http" />
|
android:scheme="http" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
|
||||||
android:name=".ui.login.LoginActivity"
|
|
||||||
android:label="登录界面"
|
|
||||||
android:launchMode="singleTop"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.login.LoginPhoneActivity"
|
android:name=".ui.login.LoginPhoneActivity"
|
||||||
@@ -552,22 +547,11 @@
|
|||||||
android:label="绑定输入验证码界面"
|
android:label="绑定输入验证码界面"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
|
||||||
android:name=".ui.login.QQLoginSelectMemberTypeActivity"
|
|
||||||
android:label="QQ登录界面"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
<activity
|
|
||||||
android:name=".ui.login.ErbanQQMemberBindAndLoginActivity"
|
|
||||||
android:label="QQ绑定登录界面"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".UserGuideActivity"
|
android:name=".UserGuideActivity"
|
||||||
android:label="引导页"
|
android:label="引导页"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
<activity
|
|
||||||
android:name=".ui.login.RegisterActivity"
|
|
||||||
android:label="注册"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.user.ScrollingActivity"
|
android:name=".ui.user.ScrollingActivity"
|
||||||
android:label="@string/title_activity_scrolling"
|
android:label="@string/title_activity_scrolling"
|
||||||
@@ -629,10 +613,6 @@
|
|||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AVRoomTheme" />
|
android:theme="@style/AVRoomTheme" />
|
||||||
<activity
|
|
||||||
android:name=".ui.login.ForgetPswActivity"
|
|
||||||
android:label="找回密码"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.login.AddUserInfoActivity"
|
android:name=".ui.login.AddUserInfoActivity"
|
||||||
android:label="资料完善"
|
android:label="资料完善"
|
||||||
|
@@ -12,9 +12,7 @@ import com.yizhuan.erban.audio.AudioRecordActivity;
|
|||||||
import com.yizhuan.erban.audio.MyVoiceActivity;
|
import com.yizhuan.erban.audio.MyVoiceActivity;
|
||||||
import com.yizhuan.erban.audio.RecordingVoiceActivity;
|
import com.yizhuan.erban.audio.RecordingVoiceActivity;
|
||||||
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.login.ForgetPswActivity;
|
|
||||||
import com.yizhuan.erban.ui.login.ModifyInfoActivity;
|
import com.yizhuan.erban.ui.login.ModifyInfoActivity;
|
||||||
import com.yizhuan.erban.ui.login.RegisterActivity;
|
|
||||||
import com.yizhuan.erban.ui.setting.SettingActivity;
|
import com.yizhuan.erban.ui.setting.SettingActivity;
|
||||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.user.UserInfoModifyActivity;
|
import com.yizhuan.erban.ui.user.UserInfoModifyActivity;
|
||||||
@@ -65,18 +63,10 @@ public class UIHelper {
|
|||||||
mContext.startActivity(new Intent(mContext, UserGuideActivity.class));
|
mContext.startActivity(new Intent(mContext, UserGuideActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showRegisterAct(Context mContext) {
|
|
||||||
mContext.startActivity(new Intent(mContext, RegisterActivity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showSettingAct(Context mContext) {
|
public static void showSettingAct(Context mContext) {
|
||||||
mContext.startActivity(new Intent(mContext, SettingActivity.class));
|
mContext.startActivity(new Intent(mContext, SettingActivity.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void showForgetPswAct(Context mContext) {
|
|
||||||
mContext.startActivity(new Intent(mContext, ForgetPswActivity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showAddInfoAct(Context mContext) {
|
public static void showAddInfoAct(Context mContext) {
|
||||||
Intent intent = new Intent(mContext, AddUserInfoActivity.class);
|
Intent intent = new Intent(mContext, AddUserInfoActivity.class);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
@@ -58,13 +58,10 @@ import com.yizhuan.erban.common.widget.dialog.LoginPopupDialog;
|
|||||||
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
|
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
|
||||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||||
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.login.ErbanQQMemberBindAndLoginActivity;
|
|
||||||
import com.yizhuan.erban.ui.login.ForgetPswActivity;
|
|
||||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
|
||||||
import com.yizhuan.erban.ui.login.LoginCodeActivity;
|
import com.yizhuan.erban.ui.login.LoginCodeActivity;
|
||||||
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
||||||
import com.yizhuan.erban.ui.login.RegisterActivity;
|
|
||||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||||
|
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
|
||||||
import com.yizhuan.erban.ui.widget.DefaultToolBar;
|
import com.yizhuan.erban.ui.widget.DefaultToolBar;
|
||||||
import com.yizhuan.erban.ui.widget.dialog.OpenNobleGlobalNoticeDialog;
|
import com.yizhuan.erban.ui.widget.dialog.OpenNobleGlobalNoticeDialog;
|
||||||
import com.yizhuan.erban.utils.UserUtils;
|
import com.yizhuan.erban.utils.UserUtils;
|
||||||
@@ -953,7 +950,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
break;
|
break;
|
||||||
case CUSTOM_MSG_RED_PACKAGE:
|
case CUSTOM_MSG_RED_PACKAGE:
|
||||||
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND) {
|
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_RED_PACKAGE_RECEIVE_ALL_DIAMOND) {
|
||||||
if (this instanceof AddUserInfoActivity || this instanceof LoginActivity || UserUtils.getUserInfo() == null)
|
if (this instanceof AddUserInfoActivity || UserUtils.getUserInfo() == null)
|
||||||
return;
|
return;
|
||||||
RedPackageNotifyInfo notifyInfo = new Gson().fromJson(String.valueOf(baseProtocol.getData()), RedPackageNotifyInfo.class);
|
RedPackageNotifyInfo notifyInfo = new Gson().fromJson(String.valueOf(baseProtocol.getData()), RedPackageNotifyInfo.class);
|
||||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||||
@@ -1048,16 +1045,12 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
|||||||
*/
|
*/
|
||||||
private boolean isNeedToHandleBroadcastMessageActivity() {
|
private boolean isNeedToHandleBroadcastMessageActivity() {
|
||||||
List<Class> acts = new ArrayList<>();
|
List<Class> acts = new ArrayList<>();
|
||||||
acts.add(LoginActivity.class);
|
|
||||||
acts.add(LoginPhoneActivity.class);
|
acts.add(LoginPhoneActivity.class);
|
||||||
acts.add(LoginCodeActivity.class);
|
acts.add(LoginCodeActivity.class);
|
||||||
acts.add(ForgetPswActivity.class);
|
acts.add(ResetPasswordActivity.class);
|
||||||
acts.add(RegisterActivity.class);
|
|
||||||
acts.add(AddUserInfoActivity.class);
|
acts.add(AddUserInfoActivity.class);
|
||||||
acts.add(MiddleActivity.class);
|
acts.add(MiddleActivity.class);
|
||||||
acts.add(NimMiddleActivity.class);
|
acts.add(NimMiddleActivity.class);
|
||||||
acts.add(ErbanQQMemberBindAndLoginActivity.class);
|
|
||||||
|
|
||||||
|
|
||||||
for (Class act : acts) {
|
for (Class act : acts) {
|
||||||
if (this.getClass().isInstance(act)) {
|
if (this.getClass().isInstance(act)) {
|
||||||
|
@@ -4,7 +4,6 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.yizhuan.erban.guide.GuideActivity;
|
import com.yizhuan.erban.guide.GuideActivity;
|
||||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ public class LocationManager {
|
|||||||
public static void uploadLocation(Context context) {
|
public static void uploadLocation(Context context) {
|
||||||
|
|
||||||
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
||||||
|| UIUtils.isTopActivity(context, LoginActivity.class.getName())
|
|
||||||
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())) {
|
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@ import com.yizhuan.erban.guide.GuideActivity;
|
|||||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||||
import com.yizhuan.erban.radish.signin.view.SignInDialog;
|
import com.yizhuan.erban.radish.signin.view.SignInDialog;
|
||||||
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.radish.signin.SignInModel;
|
import com.yizhuan.xchat_android_core.radish.signin.SignInModel;
|
||||||
import com.yizhuan.xchat_android_core.radish.signin.bean.SignDetailInfo;
|
import com.yizhuan.xchat_android_core.radish.signin.bean.SignDetailInfo;
|
||||||
@@ -37,7 +36,6 @@ public class SignDialogTimeManager {
|
|||||||
}
|
}
|
||||||
//闪屏页,登录页,引导页,完善资料页不弹
|
//闪屏页,登录页,引导页,完善资料页不弹
|
||||||
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
||||||
|| UIUtils.isTopActivity(context, LoginActivity.class.getName())
|
|
||||||
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())) {
|
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
package com.yizhuan.erban.ui.login;
|
||||||
|
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@@ -1,174 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.style.ClickableSpan;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
|
||||||
import com.yizhuan.erban.databinding.ActivityErbanQqBindLoginBinding;
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.activity_erban_qq_bind_login)
|
|
||||||
public class ErbanQQMemberBindAndLoginActivity extends BaseBindingActivity<ActivityErbanQqBindLoginBinding> {
|
|
||||||
|
|
||||||
public static final String KEY_OPEN_ID = "key_open_id";
|
|
||||||
|
|
||||||
private String errorStr;
|
|
||||||
private String openid;
|
|
||||||
private AccountValidator accountValidator = new AccountValidator();
|
|
||||||
private PasswordValidator passwordValidator = new PasswordValidator();
|
|
||||||
private TextWatcher textWatcher = new TextWatcherWrapper() {
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
checkInput();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
|
|
||||||
public static void start(Context context, String openid) {
|
|
||||||
Intent intent = new Intent(context, ErbanQQMemberBindAndLoginActivity.class);
|
|
||||||
intent.putExtra(KEY_OPEN_ID, openid);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
mBinding.setClick(this);
|
|
||||||
if (getIntent() != null) {
|
|
||||||
this.openid = getIntent().getStringExtra(KEY_OPEN_ID);
|
|
||||||
}
|
|
||||||
mBinding.etAccount.addTextChangedListener(textWatcher);
|
|
||||||
mBinding.etPassword.addTextChangedListener(textWatcher);
|
|
||||||
|
|
||||||
String howToSetPwdTip = "如何设置密码?";
|
|
||||||
String howToSetPwdDescTip = context.getString(R.string.text_how_to_set_pwd, howToSetPwdTip);
|
|
||||||
SpannableString ss = new SpannableString(howToSetPwdDescTip);
|
|
||||||
int userAgreementTipIndex = howToSetPwdDescTip.indexOf(howToSetPwdTip);
|
|
||||||
ss.setSpan(new ClickableSpan() {
|
|
||||||
@Override
|
|
||||||
public void onClick(@NonNull View view) {
|
|
||||||
CommonWebViewActivity.start(context, UriProvider.JAVA_WEB_URL + XChatConstants.LOGIN_ERBAN_ACCOUNT_URL);
|
|
||||||
}
|
|
||||||
}, userAgreementTipIndex, userAgreementTipIndex + howToSetPwdTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)),
|
|
||||||
userAgreementTipIndex, userAgreementTipIndex + howToSetPwdTip.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
mBinding.tvLoginHint.setText(ss);
|
|
||||||
mBinding.tvLoginHint.setMovementMethod(new LinkMovementMethod());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
super.onClick(v);
|
|
||||||
switch (v.getId()) {
|
|
||||||
case R.id.btn_login:
|
|
||||||
final String account = mBinding.etAccount.getText().toString().toLowerCase();
|
|
||||||
final String password = mBinding.etPassword.getText().toString();
|
|
||||||
if (isOK(account, password)) {
|
|
||||||
|
|
||||||
showDialog("正在登录...", true, dialog -> {
|
|
||||||
});
|
|
||||||
|
|
||||||
AuthModel.get().loginForOldMember(
|
|
||||||
account,
|
|
||||||
password,
|
|
||||||
openid
|
|
||||||
)
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
dealWithLoginError(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
toast(errorStr);
|
|
||||||
}
|
|
||||||
StatisticManager.Instance().onEvent(this,
|
|
||||||
StatisticsProtocol.Event.EVENT_LOGIN_PHONE_CLICK, "点击手机号登录", null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dealWithLoginError(Throwable e) {
|
|
||||||
if (e instanceof BanAccountException) {
|
|
||||||
BanAccountException exception = (BanAccountException) e;
|
|
||||||
String text = "您的账号因" + exception.getMessage() + "被封禁\n解封时间:";
|
|
||||||
int start = text.length();
|
|
||||||
text += simpleDateFormat.format(new Date(exception.getDate()));
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(ErbanQQMemberBindAndLoginActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else {
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showDialog(String tip, boolean cancelable, DialogInterface.OnDismissListener listener) {
|
|
||||||
getDialogManager().showProgressDialog(ErbanQQMemberBindAndLoginActivity.this, tip, cancelable, cancelable, listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOK(String account, String password) {
|
|
||||||
if (!accountValidator.isValid(account)) {
|
|
||||||
errorStr = accountValidator.getErrorMessage();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!passwordValidator.isValid(password)) {
|
|
||||||
errorStr = passwordValidator.getErrorMessage();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkInput() {
|
|
||||||
if (accountValidator.isValid(mBinding.etAccount.getText().toString())
|
|
||||||
&& passwordValidator.isValid(mBinding.etPassword.getText().toString())) {
|
|
||||||
mBinding.btnLogin.setEnabled(true);
|
|
||||||
} else {
|
|
||||||
mBinding.btnLogin.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,172 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
|
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by zhouxiangfeng on 17/3/5.
|
|
||||||
*/
|
|
||||||
public class ForgetPswActivity extends BaseActivity implements View.OnClickListener {
|
|
||||||
private static final String TAG = "RegisterActivity";
|
|
||||||
private EditText phoneEt;
|
|
||||||
private Button getCodeBtn;
|
|
||||||
private EditText pswEt;
|
|
||||||
private EditText codeEt;
|
|
||||||
private Button btnModify;
|
|
||||||
private CodeDownTimer timer;
|
|
||||||
private AccountValidator accountValidator = new AccountValidator();
|
|
||||||
private PasswordValidator passwordValidator = new PasswordValidator();
|
|
||||||
private SMSCodeValidator smsCodeValidator = new SMSCodeValidator();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_forget_psw);
|
|
||||||
onFindViews();
|
|
||||||
onSetListener();
|
|
||||||
initTitleBar("");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
stopCountDownTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onFindViews() {
|
|
||||||
phoneEt = findViewById(R.id.et_phone);
|
|
||||||
pswEt = findViewById(R.id.et_password);
|
|
||||||
codeEt = findViewById(R.id.et_code);
|
|
||||||
getCodeBtn = findViewById(R.id.btn_get_code);
|
|
||||||
|
|
||||||
if (UserModel.get().getCacheLoginUserInfo() != null && !TextUtils.isEmpty(UserModel.get().getCacheLoginUserInfo().getPhone())) {
|
|
||||||
phoneEt.setText(UserModel.get().getCacheLoginUserInfo().getPhone());
|
|
||||||
phoneEt.clearFocus();
|
|
||||||
phoneEt.setFocusable(false);
|
|
||||||
phoneEt.setFocusableInTouchMode(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
btnModify = (Button) findViewById(R.id.btn_modify);
|
|
||||||
btnModify.setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSetListener() {
|
|
||||||
btnModify.setOnClickListener(this);
|
|
||||||
getCodeBtn.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
switch (v.getId()) {
|
|
||||||
case R.id.btn_modify:
|
|
||||||
if (!accountValidator.isValidToRegister(phoneEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String phone = phoneEt.getText().toString();
|
|
||||||
|
|
||||||
if (!passwordValidator.isValid(pswEt.getText().toString())) {
|
|
||||||
toast(passwordValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String psw = pswEt.getText().toString();
|
|
||||||
|
|
||||||
if (!smsCodeValidator.isValid(codeEt.getText().toString())) {
|
|
||||||
toast(smsCodeValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String sms_code = codeEt.getText().toString();
|
|
||||||
|
|
||||||
AuthModel.get().requestResetPsw(phone, sms_code, psw)
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
toast("重置密码成功!");
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case R.id.btn_get_code:
|
|
||||||
if (!accountValidator.isValidToRegister(phoneEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
phone = phoneEt.getText().toString();
|
|
||||||
|
|
||||||
CodeModel.get().sendCode(phone, CodeType.RESET_PSW)
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
toast(s);
|
|
||||||
startCountDownTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case R.id.iv_back:
|
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startCountDownTimer() {
|
|
||||||
stopCountDownTimer();
|
|
||||||
timer = new CodeDownTimer(getCodeBtn, 60000, 1000);
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopCountDownTimer() {
|
|
||||||
if (timer != null) {
|
|
||||||
timer.cancel();
|
|
||||||
timer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean needSteepStateBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setStatusBar() {
|
|
||||||
// super.setStatusBar();
|
|
||||||
StatusBarLightModes(true);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,401 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
|
|
||||||
import com.ishumei.smantifraud.SmAntiFraud;
|
|
||||||
import com.netease.mobsec.rjsb.watchman;
|
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.UIHelper;
|
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|
||||||
import com.yizhuan.erban.utils.KeyBoardUtils;
|
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.ShowPhoneCodeException;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.DeviceUuidFactory;
|
|
||||||
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author zhouxiangfeng
|
|
||||||
* @date 17/2/26
|
|
||||||
* @Deprecated use {@link com.yizhuan.erban.quick_pass.QuickPassLoginAct }
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public class LoginActivity extends BaseLoginAct implements View.OnClickListener {
|
|
||||||
|
|
||||||
private static final String TAG = "LoginActivity";
|
|
||||||
|
|
||||||
private EditText accountEt;
|
|
||||||
private EditText passwordEt;
|
|
||||||
private Button btnLogin;
|
|
||||||
private EditText codeEditText;
|
|
||||||
private Button getCodeButton;
|
|
||||||
|
|
||||||
private AccountValidator accountValidator = new AccountValidator();
|
|
||||||
private SMSCodeValidator smsCodeValidator = new SMSCodeValidator();
|
|
||||||
private CodeDownTimer timer;
|
|
||||||
private TextWatcher textWatcher = new TextWatcherWrapper() {
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
checkInput();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private boolean isSuperAdmin = false;
|
|
||||||
|
|
||||||
public static void start(Context context) {
|
|
||||||
Intent intent = new Intent(context, LoginActivity.class);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void startForResult(Activity context, int requestCode) {
|
|
||||||
Intent intent = new Intent(context, LoginActivity.class);
|
|
||||||
context.startActivityForResult(intent, requestCode); // startActivityForResult会导致singletop,singletask失效
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_login);
|
|
||||||
initTitleBar("");
|
|
||||||
onFindViews();
|
|
||||||
onSetListener();
|
|
||||||
// permission();
|
|
||||||
// showLoginTip();
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
AuthModel.get().isFromLogin = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onFindViews() {
|
|
||||||
accountEt = findViewById(R.id.et_account);
|
|
||||||
passwordEt = findViewById(R.id.et_password);
|
|
||||||
tvProtocol = findViewById(R.id.tv_protocol);
|
|
||||||
wxLogin = findViewById(R.id.img_wx_login);
|
|
||||||
qqLogin = findViewById(R.id.img_qq_login);
|
|
||||||
tvLoginTip = findViewById(R.id.tv_login_tip);
|
|
||||||
tvLoginQuickPass = findViewById(R.id.tv_login_quick_pass);
|
|
||||||
codeEditText = findViewById(R.id.et_code);
|
|
||||||
getCodeButton = findViewById(R.id.btn_get_code);
|
|
||||||
tvDesc = findViewById(R.id.tv_desc);
|
|
||||||
|
|
||||||
setProtocol();
|
|
||||||
|
|
||||||
codeEditText.setVisibility(View.GONE);
|
|
||||||
getCodeButton.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSetListener() {
|
|
||||||
btnLogin = findViewById(R.id.btn_login);
|
|
||||||
btnLogin.setOnClickListener(this);
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
findViewById(R.id.btn_register).setOnClickListener(this);
|
|
||||||
findViewById(R.id.btn_forget).setOnClickListener(this);
|
|
||||||
wxLogin.setOnClickListener(this);
|
|
||||||
qqLogin.setOnClickListener(this);
|
|
||||||
|
|
||||||
accountEt.addTextChangedListener(textWatcher);
|
|
||||||
passwordEt.addTextChangedListener(textWatcher);
|
|
||||||
codeEditText.addTextChangedListener(textWatcher);
|
|
||||||
|
|
||||||
getCodeButton.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkInput() {
|
|
||||||
if (!TextUtils.isEmpty(accountEt.getText().toString())
|
|
||||||
&& !TextUtils.isEmpty(passwordEt.getText().toString())) {
|
|
||||||
if (codeEditText.getVisibility() == View.VISIBLE) {
|
|
||||||
if (!smsCodeValidator.isValid(codeEditText.getText().toString())) {
|
|
||||||
toast(smsCodeValidator.getErrorMessage());
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
btnLogin.setEnabled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
btnLogin.setEnabled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
switch (v.getId()) {
|
|
||||||
case R.id.btn_login:
|
|
||||||
if (!accountValidator.isValid(accountEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final String account = accountEt.getText().toString().toLowerCase();
|
|
||||||
|
|
||||||
final String password = passwordEt.getText().toString();
|
|
||||||
|
|
||||||
if (codeEditText.getVisibility() == View.VISIBLE &&
|
|
||||||
!smsCodeValidator.isValid(codeEditText.getText().toString())) {
|
|
||||||
toast(smsCodeValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String smsCode = codeEditText.getText().toString();
|
|
||||||
|
|
||||||
KeyBoardUtils.hideKeyBoard(this, accountEt);
|
|
||||||
KeyBoardUtils.hideKeyBoard(this, passwordEt);
|
|
||||||
getDialogManager().showProgressDialog(this, "正在登录...");
|
|
||||||
// 易盾保护 token 登录
|
|
||||||
// String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
|
||||||
AuthModel.get().login(
|
|
||||||
account,
|
|
||||||
password,
|
|
||||||
smsCode,
|
|
||||||
"",
|
|
||||||
"")
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
mCompositeDisposable.add(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
dealWithLoginError(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
StatisticManager.Instance().onEvent(this,
|
|
||||||
StatisticsProtocol.Event.EVENT_LOGIN_PHONE_CLICK, "点击手机号登录", null);
|
|
||||||
break;
|
|
||||||
case R.id.btn_register:
|
|
||||||
UIHelper.showRegisterAct(LoginActivity.this);
|
|
||||||
StatisticManager.Instance().onEvent(this,
|
|
||||||
StatisticsProtocol.Event.EVENT_LOGIN_PHONE_REGISTER_CLICK, "手机立即注册按钮", null);
|
|
||||||
break;
|
|
||||||
case R.id.btn_forget:
|
|
||||||
UIHelper.showForgetPswAct(LoginActivity.this);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.img_wx_login:
|
|
||||||
wxLogin();
|
|
||||||
break;
|
|
||||||
case R.id.img_qq_login:
|
|
||||||
qqLogin();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.tv_protocol:
|
|
||||||
CommonWebViewActivity.start(this, UriProvider.getUserProtocolUrl());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.btn_get_code:
|
|
||||||
getSmsCode();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dealWithLoginError(Throwable e) {
|
|
||||||
if (!(e instanceof IsSuperAdminException)) {
|
|
||||||
String msg = e.getMessage();
|
|
||||||
StringBuilder eventLabel = new StringBuilder("登录注册页-登录失败");
|
|
||||||
if (!TextUtils.isEmpty(msg)) {
|
|
||||||
eventLabel.append(msg);
|
|
||||||
}
|
|
||||||
// 2004可以完整写入
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_LOGIN_FAILED_CLICK, eventLabel.toString());
|
|
||||||
}
|
|
||||||
if (e instanceof BanAccountException) {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
BanAccountException exception = (BanAccountException) e;
|
|
||||||
String text = "您的账号因" + exception.getMessage() + "被封禁\n解封时间:";
|
|
||||||
int start = text.length();
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
text += simpleDateFormat.format(new Date(exception.getDate()));
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else if (e instanceof ShowPhoneCodeException) {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
ShowPhoneCodeException showPhoneCodeException = (ShowPhoneCodeException) e;
|
|
||||||
boolean isShowPhoneCode = showPhoneCodeException.isShowPhoneCode();
|
|
||||||
if (isShowPhoneCode) {
|
|
||||||
// 需要显示验证码
|
|
||||||
if (codeEditText.getVisibility() == View.GONE) {
|
|
||||||
codeEditText.setVisibility(View.VISIBLE);
|
|
||||||
getCodeButton.setVisibility(View.VISIBLE);
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
toast(e.getMessage());
|
|
||||||
} else if (e instanceof IsSuperAdminException) {
|
|
||||||
isSuperAdmin = true;
|
|
||||||
// 需要显示验证码
|
|
||||||
if (codeEditText.getVisibility() == View.GONE) {
|
|
||||||
codeEditText.setVisibility(View.VISIBLE);
|
|
||||||
getCodeButton.setVisibility(View.VISIBLE);
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
} else {
|
|
||||||
stopCountDownTimer();
|
|
||||||
getCodeButton.setText("重新获取");
|
|
||||||
getCodeButton.setClickable(true);//重新获得点击
|
|
||||||
getCodeButton.setTextColor(getCodeButton.getResources().getColor(R.color.appColor)); //还原背景色
|
|
||||||
btnLogin.setEnabled(false);
|
|
||||||
}
|
|
||||||
toast(e.getMessage());
|
|
||||||
} else {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取验证码
|
|
||||||
*/
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
private void getSmsCode() {
|
|
||||||
getCodeButton.setText("获取中..");
|
|
||||||
String deviceId = DeviceUuidFactory.getDeviceId(this);
|
|
||||||
if (isSuperAdmin) {
|
|
||||||
CodeModel.get()
|
|
||||||
.sendCode(accountEt.getEditableText().toString(), CodeType.SUPER_ADMIN)
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
startCountDownTimer();
|
|
||||||
toast(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
toast(e.getMessage());
|
|
||||||
Logger.e(TAG, "获取短信失败!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
AuthModel.get()
|
|
||||||
.sendLoginCode(accountEt.getEditableText().toString(), 0)
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
startCountDownTimer();
|
|
||||||
toast(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
toast(e.getMessage());
|
|
||||||
Logger.e(TAG, "获取短信失败!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startCountDownTimer() {
|
|
||||||
stopCountDownTimer();
|
|
||||||
timer = new CodeDownTimer(getCodeButton, 60000, 1000);
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopCountDownTimer() {
|
|
||||||
if (timer != null) {
|
|
||||||
timer.cancel();
|
|
||||||
timer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
accountEt = null;
|
|
||||||
passwordEt = null;
|
|
||||||
super.onDestroy();
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册成功后发送过来的事件
|
|
||||||
*/
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void onLoginEvent(LoginEvent event) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
|
||||||
View view = getCurrentFocus();
|
|
||||||
boolean isPressEdit = false;
|
|
||||||
if (view instanceof EditText) {
|
|
||||||
if (event.getRawX() >= view.getX() && event.getRawX() <= view.getX() + view.getWidth() && event.getRawY() >= view.getY() && event.getRawY() <= view.getY() + view.getHeight()) {
|
|
||||||
isPressEdit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isPressEdit) {
|
|
||||||
hideIME();
|
|
||||||
}
|
|
||||||
return super.onTouchEvent(event);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -53,7 +53,7 @@ public class LoginPhoneActivity extends BaseActivity implements View.OnClickList
|
|||||||
|
|
||||||
public static void startForResult(Activity context, int requestCode) {
|
public static void startForResult(Activity context, int requestCode) {
|
||||||
Intent intent = new Intent(context, LoginPhoneActivity.class);
|
Intent intent = new Intent(context, LoginPhoneActivity.class);
|
||||||
context.startActivityForResult(intent, requestCode); // startActivityForResult会导致singletop,singletask失效
|
context.startActivityForResult(intent, requestCode); //
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -167,10 +167,6 @@ public class LoginPhoneActivity extends BaseActivity implements View.OnClickList
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleFinish() {
|
private void handleFinish() {
|
||||||
// if (!isBackLogin) {
|
|
||||||
// toast("请先绑定手机号");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
package com.yizhuan.erban.ui.login;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -12,29 +13,17 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class PasswordValidator {
|
public class PasswordValidator {
|
||||||
|
|
||||||
// private static final String REG = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,15}$";
|
private static final String REG = "^(?![0-9]+$)(?![a-zA-Z]+$)[a-z_A-Z0-9-.!@#$%\\\\^&*)(+={}\\[\\]/\",'<>~·`?:;|]{6,16}$";
|
||||||
// [a-z_A-Z0-9-\.!@#\$%\\\^&\*\)\(\+=\{\}\[\]\/",'<>~\·`\?:;|]
|
|
||||||
private static final String REG = "^(?![0-9]+$)(?![a-zA-Z]+$)[a-z_A-Z0-9-\\.!@#\\$%\\\\\\^&\\*\\)\\(\\+=\\{\\}\\[\\]\\/\",'<>~\\·`\\?:;|]{6,16}$";
|
|
||||||
// private static final String REG = "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z,.?!':@;\"/()-_=+]{6,15}$";
|
|
||||||
|
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
|
|
||||||
public PasswordValidator() {
|
public PasswordValidator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordValidator(@NonNull String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid(@NonNull String text) {
|
public boolean isValid(@NonNull String text) {
|
||||||
if (!TextUtils.isEmpty(text)) {
|
if (!TextUtils.isEmpty(text)) {
|
||||||
if (16 >= text.length() && text.length() >= 6) {
|
if (16 >= text.length() && text.length() >= 6) {
|
||||||
if (checkPwdFormat(text)) {
|
return true;
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
errorMessage = "密码同时需要是字母,数字的组合哦!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
errorMessage = "密码长度6-16个字符";
|
errorMessage = "密码长度6-16个字符";
|
||||||
return false;
|
return false;
|
||||||
@@ -45,9 +34,7 @@ public class PasswordValidator {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
public String getErrorMessage() {
|
||||||
return errorMessage;
|
return errorMessage;
|
||||||
|
@@ -1,135 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import android.text.Spannable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import com.ishumei.smantifraud.SmAntiFraud;
|
|
||||||
import com.netease.mobsec.rjsb.watchman;
|
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
|
||||||
import com.yizhuan.erban.databinding.ActivityQqLoginSelectMemberTypeBinding;
|
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.OldMemberException;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
|
|
||||||
@ActLayoutRes(R.layout.activity_qq_login_select_member_type)
|
|
||||||
public class QQLoginSelectMemberTypeActivity extends BaseBindingActivity<ActivityQqLoginSelectMemberTypeBinding> {
|
|
||||||
|
|
||||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
|
|
||||||
public static void start(Context context) {
|
|
||||||
context.startActivity(new Intent(context, QQLoginSelectMemberTypeActivity.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void init() {
|
|
||||||
mBinding.setClick(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
super.onClick(v);
|
|
||||||
switch (v.getId()) {
|
|
||||||
case R.id.tv_erban_member:
|
|
||||||
getDialogManager().showProgressDialog(this, "请稍后");
|
|
||||||
// 易盾保护 token
|
|
||||||
// String token = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
|
||||||
String token = "";
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
|
||||||
String shuMeiDeviceId = "";
|
|
||||||
AuthModel.get()
|
|
||||||
.qqLoginForErbanOldMember(token, shuMeiDeviceId)
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
mCompositeDisposable.add(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
if (e instanceof OldMemberException) {
|
|
||||||
OldMemberException exception = (OldMemberException) e;
|
|
||||||
ErbanQQMemberBindAndLoginActivity.start(QQLoginSelectMemberTypeActivity.this, ((OldMemberException) e).getOpenid());
|
|
||||||
finish();
|
|
||||||
} else {
|
|
||||||
dealWithLoginError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.tv_tutu_member:
|
|
||||||
getDialogManager().showProgressDialog(this, "请稍后");
|
|
||||||
// 易盾保护 token
|
|
||||||
// String tokenForQQ = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceIdForQQ = SmAntiFraud.getDeviceId();
|
|
||||||
AuthModel.get()
|
|
||||||
.qqLogin("", "")
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
mCompositeDisposable.add(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
dealWithLoginError(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
StatisticManager.Instance().onEvent(this,
|
|
||||||
StatisticsProtocol.Event.EVENT_LOGIN_QQ_CLICK, "点击qq登录", null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dealWithLoginError(Throwable e) {
|
|
||||||
if (e instanceof BanAccountException) {
|
|
||||||
BanAccountException exception = (BanAccountException) e;
|
|
||||||
String text = "您的账号因" + exception.getMessage() + "被封禁\n解封时间:";
|
|
||||||
int start = text.length();
|
|
||||||
text += simpleDateFormat.format(new Date(exception.getDate()));
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(QQLoginSelectMemberTypeActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else {
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,385 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.style.ClickableSpan;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
|
||||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
|
||||||
import com.ishumei.smantifraud.SmAntiFraud;
|
|
||||||
import com.netease.mobsec.rjsb.watchman;
|
|
||||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
|
||||||
import com.orhanobut.logger.Logger;
|
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseActivity;
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
|
||||||
import com.yizhuan.xchat_android_core.exception.FailReasonException;
|
|
||||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
|
||||||
import io.reactivex.SingleSource;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.functions.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by zhouxiangfeng on 17/3/5.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class RegisterActivity extends BaseActivity implements View.OnClickListener {
|
|
||||||
|
|
||||||
|
|
||||||
private static final String TAG = "RegisterActivity";
|
|
||||||
private ImageView ivBack;
|
|
||||||
private EditText phoneEt;
|
|
||||||
private Button getCodeBtn;
|
|
||||||
private EditText pswEt;
|
|
||||||
|
|
||||||
private EditText codeEt;
|
|
||||||
private Button btnRegister;
|
|
||||||
private TextView tvProtocol;
|
|
||||||
|
|
||||||
private String phone;
|
|
||||||
private String psw;
|
|
||||||
|
|
||||||
private ImageView ivGetRegisterCode;
|
|
||||||
private ImageView btnGetRegisterCode;
|
|
||||||
private ImageView registerCodeRefresh;
|
|
||||||
private EditText registerCode;
|
|
||||||
|
|
||||||
private AccountValidator accountValidator = new AccountValidator();
|
|
||||||
private PasswordValidator passwordValidator = new PasswordValidator();
|
|
||||||
private SMSCodeValidator smsCodeValidator = new SMSCodeValidator();
|
|
||||||
private CodeDownTimer timer;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_register);
|
|
||||||
onFindViews();
|
|
||||||
onSetListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
|
||||||
public void onFindViews() {
|
|
||||||
ivBack = findViewById(R.id.iv_back);
|
|
||||||
phoneEt = findViewById(R.id.et_phone);
|
|
||||||
pswEt = findViewById(R.id.et_password);
|
|
||||||
codeEt = findViewById(R.id.et_code);
|
|
||||||
getCodeBtn = findViewById(R.id.btn_get_code);
|
|
||||||
btnRegister = findViewById(R.id.btn_register);
|
|
||||||
tvProtocol = findViewById(R.id.tv_protocol);
|
|
||||||
|
|
||||||
String userAgreementTip = "《音游用户协议》";
|
|
||||||
String privacyAgreementDescTip = context.getString(R.string.text_login_protocol_2, userAgreementTip);
|
|
||||||
SpannableString ss = new SpannableString(privacyAgreementDescTip);
|
|
||||||
int userAgreementTipIndex = privacyAgreementDescTip.indexOf(userAgreementTip);
|
|
||||||
|
|
||||||
ss.setSpan(new ClickableSpan() {
|
|
||||||
@Override
|
|
||||||
public void onClick(@NonNull View view) {
|
|
||||||
CommonWebViewActivity.start(context, UriProvider.getUserProtocolUrl());
|
|
||||||
}
|
|
||||||
}, userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)),
|
|
||||||
userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(),
|
|
||||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
|
|
||||||
tvProtocol.setText(ss);
|
|
||||||
tvProtocol.setMovementMethod(new LinkMovementMethod());
|
|
||||||
|
|
||||||
ivGetRegisterCode = findViewById(R.id.iv_get_register_code);
|
|
||||||
btnGetRegisterCode = findViewById(R.id.btn_get_register_code);
|
|
||||||
registerCode = findViewById(R.id.et_register_code);
|
|
||||||
registerCodeRefresh = findViewById(R.id.iv_register_code_refresh);
|
|
||||||
ivGetRegisterCode.setVisibility(InitialModel.get().isCaptchaSwitch() ? View.VISIBLE : View.GONE);
|
|
||||||
btnGetRegisterCode.setVisibility(InitialModel.get().isCaptchaSwitch() ? View.VISIBLE : View.GONE);
|
|
||||||
registerCode.setVisibility(InitialModel.get().isCaptchaSwitch() ? View.VISIBLE : View.GONE);
|
|
||||||
registerCodeRefresh.setVisibility(InitialModel.get().isCaptchaSwitch() ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSetListener() {
|
|
||||||
ivBack.setOnClickListener(this);
|
|
||||||
btnRegister.setOnClickListener(this);
|
|
||||||
getCodeBtn.setOnClickListener(this);
|
|
||||||
// tvProtocol.setOnClickListener(this);
|
|
||||||
|
|
||||||
phoneEt.addTextChangedListener(new CheckInputTextWatcher());
|
|
||||||
pswEt.addTextChangedListener(new CheckInputTextWatcher());
|
|
||||||
codeEt.addTextChangedListener(new CheckInputTextWatcher());
|
|
||||||
|
|
||||||
btnGetRegisterCode.setOnClickListener(this);
|
|
||||||
ivGetRegisterCode.setOnClickListener(this);
|
|
||||||
registerCodeRefresh.setOnClickListener(this);
|
|
||||||
registerCode.addTextChangedListener(new CheckInputTextWatcher());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
stopCountDownTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
switch (v.getId()) {
|
|
||||||
case R.id.btn_register:
|
|
||||||
// 校验账号
|
|
||||||
if (!accountValidator.isValidToRegister(phoneEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
phone = phoneEt.getText().toString();
|
|
||||||
// 校验密码
|
|
||||||
if (!passwordValidator.isValid(pswEt.getText().toString())) {
|
|
||||||
toast(passwordValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
psw = pswEt.getText().toString();
|
|
||||||
// 校验短信验证码
|
|
||||||
if (!smsCodeValidator.isValid(codeEt.getText().toString())) {
|
|
||||||
toast(smsCodeValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String sms_code = codeEt.getText().toString();
|
|
||||||
// 校验图片验证码
|
|
||||||
String verificationCode = null;
|
|
||||||
if (InitialModel.get().isCaptchaSwitch()) {
|
|
||||||
if (TextUtils.isEmpty(registerCode.getText().toString())) {
|
|
||||||
toast(R.string.tips_register_verification_code_empty);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
verificationCode = registerCode.getText().toString();
|
|
||||||
}
|
|
||||||
// 易盾保护 token
|
|
||||||
// String token = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
|
||||||
// 易盾保护 token 登录
|
|
||||||
// String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
|
||||||
String token = "";
|
|
||||||
String yiDunLoginToken = "";
|
|
||||||
String shuMeiDeviceId = "";
|
|
||||||
getDialogManager().showProgressDialog(RegisterActivity.this, "正在注册...");
|
|
||||||
|
|
||||||
AuthModel.get().register(phone, sms_code, verificationCode, psw, token, shuMeiDeviceId)
|
|
||||||
.compose(bindToLifecycle())
|
|
||||||
.flatMap(new Function<String, SingleSource<String>>() {
|
|
||||||
@Override
|
|
||||||
public SingleSource<String> apply(String s) throws Exception {
|
|
||||||
Logger.d(s);
|
|
||||||
return AuthModel.get().login(phone, psw, yiDunLoginToken, shuMeiDeviceId);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
Logger.d(s);
|
|
||||||
toast("注册成功!");
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
String msg = e.getMessage();
|
|
||||||
if (!TextUtils.isEmpty(msg)) {
|
|
||||||
toast(msg);
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_LOGIN_REGISTRATION_FAILED_CLICK,"登录注册页-注册失败-" + msg);
|
|
||||||
}
|
|
||||||
if (e instanceof FailReasonException) {
|
|
||||||
FailReasonException failReasonException = (FailReasonException) e;
|
|
||||||
switch (failReasonException.getCode()) {
|
|
||||||
case AuthModel.VERIFY_CODE_ERROR:
|
|
||||||
refreshRegisterVerificationCode();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case R.id.btn_get_code:
|
|
||||||
if (!accountValidator.isValidToRegister(phoneEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
phone = phoneEt.getText().toString();
|
|
||||||
|
|
||||||
CodeModel.get().sendCode(phone, CodeType.REGISTER)
|
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
|
||||||
.subscribe(new SingleObserver<String>() {
|
|
||||||
@Override
|
|
||||||
public void onSubscribe(Disposable d) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(String s) {
|
|
||||||
startCountDownTimer();
|
|
||||||
toast(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e) {
|
|
||||||
toast(e.getMessage());
|
|
||||||
Logger.e(TAG, "获取短信失败!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case R.id.iv_back:
|
|
||||||
finish();
|
|
||||||
break;
|
|
||||||
case R.id.tv_protocol:
|
|
||||||
CommonWebViewActivity.start(this, UriProvider.getUserProtocolUrl());
|
|
||||||
break;
|
|
||||||
case R.id.iv_register_code_refresh:
|
|
||||||
case R.id.iv_get_register_code:
|
|
||||||
case R.id.btn_get_register_code:
|
|
||||||
refreshRegisterVerificationCode();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshRegisterVerificationCode() {
|
|
||||||
if (!accountValidator.isValidToRegister(phoneEt.getText().toString())) {
|
|
||||||
toast(accountValidator.getErrorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
phone = phoneEt.getText().toString();
|
|
||||||
AuthModel.get()
|
|
||||||
.getVerificationCode(phone)
|
|
||||||
.compose(RxHelper.bindActivity(this))
|
|
||||||
.subscribe((responseBody, throwable) -> {
|
|
||||||
if (throwable == null) {
|
|
||||||
btnGetRegisterCode.setVisibility(View.GONE);
|
|
||||||
ivGetRegisterCode.setVisibility(View.VISIBLE);
|
|
||||||
registerCode.setVisibility(View.VISIBLE);
|
|
||||||
GlideApp.with(RegisterActivity.this)
|
|
||||||
.load(BitmapFactory.decodeStream(responseBody.byteStream()))
|
|
||||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
|
||||||
.transforms(new CenterCrop(),
|
|
||||||
new RoundedCorners(context.getResources().getDimensionPixelOffset(R.dimen.dp_6)))
|
|
||||||
.into(ivGetRegisterCode);
|
|
||||||
} else {
|
|
||||||
toast(throwable.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startCountDownTimer() {
|
|
||||||
stopCountDownTimer();
|
|
||||||
timer = new CodeDownTimer(getCodeBtn, 60000, 1000);
|
|
||||||
timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopCountDownTimer() {
|
|
||||||
if (timer != null) {
|
|
||||||
timer.cancel();
|
|
||||||
timer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查值是否有效
|
|
||||||
*/
|
|
||||||
private void checkValueValid() {
|
|
||||||
String phone = phoneEt.getText().toString();
|
|
||||||
if (TextUtils.isEmpty(phone)) {
|
|
||||||
btnRegister.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InitialModel.get().isCaptchaSwitch()) {
|
|
||||||
String registerCodeText = registerCode.getText().toString();
|
|
||||||
if (TextUtils.isEmpty(registerCodeText)) {
|
|
||||||
btnRegister.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String code = codeEt.getText().toString();
|
|
||||||
if (TextUtils.isEmpty(code)) {
|
|
||||||
btnRegister.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String password = pswEt.getText().toString();
|
|
||||||
if (TextUtils.isEmpty(password)) {
|
|
||||||
btnRegister.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
btnRegister.setEnabled(true);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean needSteepStateBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setStatusBar() {
|
|
||||||
StatusBarLightModes(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查值
|
|
||||||
*/
|
|
||||||
private class CheckInputTextWatcher implements 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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {
|
|
||||||
checkValueValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,67 +0,0 @@
|
|||||||
package com.yizhuan.erban.ui.login;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
|
|
||||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by zhouxiangfeng on 2017/5/3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class SMSCodeValidator {
|
|
||||||
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
public SMSCodeValidator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public SMSCodeValidator(@NonNull String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isValidMobileNumber(String phone) {
|
|
||||||
if (phone == null || phone.length() != 5 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!isAllDigits(phone))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isAllDigits(String str) {
|
|
||||||
if (StringUtils.isEmpty(str)) return false;
|
|
||||||
for (int i = 0; i < str.length(); i++) {
|
|
||||||
char c = str.charAt(i);
|
|
||||||
if (c < '0' || c > '9') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid(@NonNull CharSequence text) {
|
|
||||||
if (!TextUtils.isEmpty(text)) {
|
|
||||||
char c = text.charAt(0);
|
|
||||||
|
|
||||||
if (text.length() != 5) {
|
|
||||||
errorMessage = "验证码长度为5个字符";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
errorMessage = "验证码不能为空!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -11,20 +11,22 @@ import com.coorchice.library.utils.LogUtils;
|
|||||||
import com.netease.nim.uikit.StatusBarUtil;
|
import com.netease.nim.uikit.StatusBarUtil;
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.UIHelper;
|
|
||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||||
import com.yizhuan.erban.databinding.ActivityModifyPwdBinding;
|
import com.yizhuan.erban.databinding.ActivityModifyPwdBinding;
|
||||||
import com.yizhuan.erban.ui.login.CodeDownTimer;
|
import com.yizhuan.erban.ui.login.CodeDownTimer;
|
||||||
import com.yizhuan.erban.ui.login.PasswordValidator;
|
import com.yizhuan.erban.ui.login.PasswordValidator;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
import com.yizhuan.xchat_android_core.code.CodeType;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
import io.reactivex.SingleObserver;
|
||||||
@@ -57,15 +59,13 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
mBinding.containerCode.setVisibility(View.GONE);
|
mBinding.containerCode.setVisibility(View.GONE);
|
||||||
mBinding.tvCodeTips.setVisibility(View.GONE);
|
|
||||||
type = getIntent().getIntExtra("type", 1);
|
type = getIntent().getIntExtra("type", 1);
|
||||||
if (type == PAY_PWD && !Objects.requireNonNull(UserModel.get().getCacheLoginUserInfo()).isBindPaymentPwd()) {
|
if (type == PAY_PWD && !Objects.requireNonNull(UserModel.get().getCacheLoginUserInfo()).isBindPaymentPwd()) {
|
||||||
type = FOGERT_PAY_PWD;
|
type = FOGERT_PAY_PWD;
|
||||||
isFirstSetPayPwd = true;
|
isFirstSetPayPwd = true;
|
||||||
mBinding.containerCode.setVisibility(View.VISIBLE);
|
mBinding.containerCode.setVisibility(View.VISIBLE);
|
||||||
mBinding.tvCodeTips.setVisibility(View.VISIBLE);
|
|
||||||
mBinding.tvCodeTips.setText("");
|
|
||||||
}
|
}
|
||||||
if (type == LOGIN_PWD) {
|
if (type == LOGIN_PWD) {
|
||||||
if (Objects.requireNonNull(UserModel.get().getCacheLoginUserInfo()).isBindPasswd()) {
|
if (Objects.requireNonNull(UserModel.get().getCacheLoginUserInfo()).isBindPasswd()) {
|
||||||
@@ -89,29 +89,27 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setModifyPwdUI() {
|
private void setModifyPwdUI() {
|
||||||
initWhiteTitleBar("修改登录密码");
|
initWhiteTitleBar("重置密码");
|
||||||
|
|
||||||
mBinding.edCurrentPwd.setTitleHint("原密码");
|
mBinding.edCurrentPwd.setTitleHint("原密码");
|
||||||
mBinding.edCurrentPwd.setEditHint("请输入当前登录密码");
|
mBinding.edCurrentPwd.setEditHint("输入原密码");
|
||||||
mBinding.edPwd.setTitleHint("新密码");
|
mBinding.edPwd.setTitleHint("新密码");
|
||||||
mBinding.edPwd.setEditHint("请输入新的登录密码");
|
mBinding.edPwd.setEditHint("输入新密码");
|
||||||
mBinding.edSurePwd.setTitleHint("确认密码");
|
mBinding.edSurePwd.setTitleHint("确认密码");
|
||||||
mBinding.edSurePwd.setEditHint("再次确认新的登录密码");
|
mBinding.edSurePwd.setEditHint("再次确认密码");
|
||||||
mBinding.tvPasswordTip.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLoginPwdUI() {
|
private void setLoginPwdUI() {
|
||||||
type = SET_LOGIN_PWD;
|
type = SET_LOGIN_PWD;
|
||||||
initWhiteTitleBar("设置登录密码");
|
initWhiteTitleBar("设置密码");
|
||||||
|
|
||||||
mBinding.edCurrentPwd.setVisibility(View.GONE);
|
mBinding.edCurrentPwd.setVisibility(View.GONE);
|
||||||
mBinding.btnForget.setVisibility(View.GONE);
|
mBinding.btnForget.setVisibility(View.GONE);
|
||||||
|
|
||||||
mBinding.edPwd.setTitleHint("设置密码");
|
mBinding.edPwd.setTitleHint("设置密码");
|
||||||
mBinding.edPwd.setEditHint("输入登录密码");
|
mBinding.edPwd.setEditHint("输入密码");
|
||||||
mBinding.edSurePwd.setTitleHint("确认密码");
|
mBinding.edSurePwd.setTitleHint("确认密码");
|
||||||
mBinding.edSurePwd.setEditHint("再次输入登录密码");
|
mBinding.edSurePwd.setEditHint("再次确认密码");
|
||||||
mBinding.tvPasswordTip.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setModifyPayPwdUI() {
|
private void setModifyPayPwdUI() {
|
||||||
@@ -122,7 +120,6 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
mBinding.edPwd.setEditHint("请输入新的支付密码");
|
mBinding.edPwd.setEditHint("请输入新的支付密码");
|
||||||
mBinding.edSurePwd.setTitleHint("确认密码");
|
mBinding.edSurePwd.setTitleHint("确认密码");
|
||||||
mBinding.edSurePwd.setEditHint("再次确认新的支付密码");
|
mBinding.edSurePwd.setEditHint("再次确认新的支付密码");
|
||||||
mBinding.tvPasswordTip.setVisibility(View.GONE);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +131,6 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
mBinding.edPwd.setEditHint("输入支付密码");
|
mBinding.edPwd.setEditHint("输入支付密码");
|
||||||
mBinding.edSurePwd.setTitleHint("确认密码");
|
mBinding.edSurePwd.setTitleHint("确认密码");
|
||||||
mBinding.edSurePwd.setEditHint("再次输入支付密码");
|
mBinding.edSurePwd.setEditHint("再次输入支付密码");
|
||||||
mBinding.tvPasswordTip.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setEditStyle() {
|
private void setEditStyle() {
|
||||||
@@ -159,18 +155,17 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
if (type == PAY_PWD) {
|
if (type == PAY_PWD) {
|
||||||
VerifyPhoneActivity.startForResult(this, true);
|
VerifyPhoneActivity.startForResult(this, true);
|
||||||
} else {
|
} else {
|
||||||
ResetPasswordActivity.start(context,ResetPasswordActivity.FROM_LOGIN);
|
ResetPasswordActivity.start(context, ResetPasswordActivity.FROM_LOGIN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.btn_get_code:
|
case R.id.btn_get_code:
|
||||||
mBinding.tvCodeTips.setText("");
|
|
||||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||||
if (userInfo == null || TextUtils.isEmpty(userInfo.getPhone())) {
|
if (userInfo == null || TextUtils.isEmpty(userInfo.getPhone())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mBinding.btnGetCode.setClickable(false);
|
mBinding.btnGetCode.setClickable(false);
|
||||||
AuthModel.get()
|
AuthModel.get()
|
||||||
.sendLoginCode(userInfo.getPhone(),CodeType.RESET_PSW)
|
.sendLoginCode(userInfo.getPhone(), CodeType.RESET_PSW)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
.subscribe(new SingleObserver<String>() {
|
.subscribe(new SingleObserver<String>() {
|
||||||
@@ -181,7 +176,6 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String s) {
|
public void onSuccess(String s) {
|
||||||
mBinding.tvCodeTips.setText(getString(R.string.send_code_success_tips, userInfo.getPhone()));
|
|
||||||
startCountDownTimer();
|
startCountDownTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +183,7 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
mBinding.btnGetCode.setClickable(true);
|
mBinding.btnGetCode.setClickable(true);
|
||||||
// finish();
|
// finish();
|
||||||
LogUtils.e( "获取短信失败!");
|
LogUtils.e("获取短信失败!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -344,6 +338,17 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onLogoutEvent(LogoutEvent event) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean needSteepStateBar() {
|
protected boolean needSteepStateBar() {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -3,7 +3,9 @@ package com.yizhuan.erban.ui.setting;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.coorchice.library.utils.LogUtils;
|
import com.coorchice.library.utils.LogUtils;
|
||||||
@@ -13,10 +15,12 @@ import com.yizhuan.erban.R;
|
|||||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||||
import com.yizhuan.erban.databinding.ActivityResetLoginPwdBinding;
|
import com.yizhuan.erban.databinding.ActivityResetLoginPwdBinding;
|
||||||
import com.yizhuan.erban.ui.login.CodeDownTimer;
|
import com.yizhuan.erban.ui.login.CodeDownTimer;
|
||||||
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
import com.yizhuan.xchat_android_core.code.CodeType;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||||
|
import com.yizhuan.xchat_android_library.utils.TextWatcherWrapper;
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
import io.reactivex.SingleObserver;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
@@ -32,6 +36,13 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
|
|
||||||
private CodeDownTimer timer;
|
private CodeDownTimer timer;
|
||||||
|
|
||||||
|
private final TextWatcher textWatcher = new TextWatcherWrapper() {
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
checkInput();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static void start(Context context, int type) {
|
public static void start(Context context, int type) {
|
||||||
Intent intent = new Intent(context, ResetPasswordActivity.class);
|
Intent intent = new Intent(context, ResetPasswordActivity.class);
|
||||||
intent.putExtra("from", type);
|
intent.putExtra("from", type);
|
||||||
@@ -42,7 +53,7 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
protected void init() {
|
protected void init() {
|
||||||
from = getIntent().getIntExtra("from", FROM_LOGIN);
|
from = getIntent().getIntExtra("from", FROM_LOGIN);
|
||||||
mBinding.setClick(this);
|
mBinding.setClick(this);
|
||||||
initWhiteTitleBar("重置登录密码");
|
initWhiteTitleBar("忘记密码");
|
||||||
|
|
||||||
if (from == FROM_LOGIN) {
|
if (from == FROM_LOGIN) {
|
||||||
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
if (UserModel.get().getCacheLoginUserInfo() != null) {
|
||||||
@@ -50,8 +61,19 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
}
|
}
|
||||||
mBinding.etPhone.setEnabled(false);
|
mBinding.etPhone.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
mBinding.etPhone.addTextChangedListener(textWatcher);
|
||||||
|
mBinding.edPassword.getEditText().addTextChangedListener(textWatcher);
|
||||||
|
mBinding.etCode.addTextChangedListener(textWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkInput() {
|
||||||
|
boolean enabled = !TextUtils.isEmpty(mBinding.etPhone.getText()) && mBinding.etPhone.getText().toString().trim().length() >= 7
|
||||||
|
&& !TextUtils.isEmpty(mBinding.edPassword.getText()) && mBinding.edPassword.getText().trim().length() >= 6
|
||||||
|
&& !TextUtils.isEmpty(mBinding.etCode.getText()) && mBinding.etCode.getText().toString().trim().length() >= 5;
|
||||||
|
mBinding.btnCommit.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
super.onClick(v);
|
super.onClick(v);
|
||||||
@@ -66,7 +88,7 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
}
|
}
|
||||||
mBinding.btnGetCode.setClickable(false);
|
mBinding.btnGetCode.setClickable(false);
|
||||||
AuthModel.get()
|
AuthModel.get()
|
||||||
.sendLoginCode(mBinding.etPhone.getText().toString(), from == FROM_LOGIN ?
|
.sendLoginCode(mBinding.etPhone.getText().toString().trim(), from == FROM_LOGIN ?
|
||||||
CodeType.RESET_PSW_LOGIN : CodeType.RESET_PSW_NOT_LOGIN)
|
CodeType.RESET_PSW_LOGIN : CodeType.RESET_PSW_NOT_LOGIN)
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
@@ -121,10 +143,9 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
|
|
||||||
getDialogManager().showProgressDialog(ResetPasswordActivity.this, "处理中...");
|
getDialogManager().showProgressDialog(ResetPasswordActivity.this, "处理中...");
|
||||||
AuthModel.get().requestResetPsw(
|
AuthModel.get().requestResetPsw(
|
||||||
mBinding.etPhone.getText().toString(),
|
mBinding.etPhone.getText().toString().trim(),
|
||||||
mBinding.etCode.getText().toString(),
|
mBinding.etCode.getText().toString().trim(),
|
||||||
mBinding.edPassword.getText()
|
mBinding.edPassword.getText().trim())
|
||||||
)
|
|
||||||
.compose(bindToLifecycle())
|
.compose(bindToLifecycle())
|
||||||
.subscribe(new SingleObserver<String>() {
|
.subscribe(new SingleObserver<String>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -137,6 +158,9 @@ public class ResetPasswordActivity extends BaseBindingActivity<ActivityResetLogi
|
|||||||
getDialogManager().dismissDialog();
|
getDialogManager().dismissDialog();
|
||||||
UserModel.get().updateCurrentUserInfo().subscribe();
|
UserModel.get().updateCurrentUserInfo().subscribe();
|
||||||
toast("修改成功");
|
toast("修改成功");
|
||||||
|
if (from == FROM_LOGIN) {
|
||||||
|
LogoutHelper.logout();
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@ import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|||||||
import com.yizhuan.erban.ui.withdraw.BinderAlipayActivity;
|
import com.yizhuan.erban.ui.withdraw.BinderAlipayActivity;
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
import com.yizhuan.xchat_android_core.UriProvider;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
|
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||||
@@ -38,6 +39,10 @@ import com.yizhuan.xchat_android_core.withdraw.bean.WithdrawInfo;
|
|||||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||||
import com.yizhuan.xchat_android_library.utils.file.JXFileUtils;
|
import com.yizhuan.xchat_android_library.utils.file.JXFileUtils;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import io.reactivex.SingleObserver;
|
import io.reactivex.SingleObserver;
|
||||||
@@ -54,11 +59,23 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
settingBinding = DataBindingUtil.setContentView(this, R.layout.activity_setting);
|
settingBinding = DataBindingUtil.setContentView(this, R.layout.activity_setting);
|
||||||
settingBinding.setClick(this);
|
settingBinding.setClick(this);
|
||||||
initWhiteTitleBar("设置");
|
initWhiteTitleBar("设置");
|
||||||
initView();
|
initView();
|
||||||
initData();
|
initData();
|
||||||
|
initListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initListeners() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
@@ -249,9 +266,9 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
|||||||
settingBinding.rlThird.setVisibility(View.GONE);
|
settingBinding.rlThird.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (cacheLoginUserInfo.isBindPasswd()) {
|
if (cacheLoginUserInfo.isBindPasswd()) {
|
||||||
settingBinding.tvLoginPwd.setText("重置登录密码");
|
settingBinding.tvLoginPwd.setText("重置密码");
|
||||||
} else {
|
} else {
|
||||||
settingBinding.tvLoginPwd.setText("设置登录密码");
|
settingBinding.tvLoginPwd.setText("设置密码");
|
||||||
}
|
}
|
||||||
if (!cacheLoginUserInfo.isBindPaymentPwd()) {
|
if (!cacheLoginUserInfo.isBindPaymentPwd()) {
|
||||||
settingBinding.tvPayModify.setText("设置");
|
settingBinding.tvPayModify.setText("设置");
|
||||||
@@ -278,4 +295,10 @@ public class SettingActivity extends BaseActivity implements View.OnClickListene
|
|||||||
StatusBarUtil.transparencyBar(this);
|
StatusBarUtil.transparencyBar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onLogoutEvent(LogoutEvent event) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -109,7 +109,7 @@ public class SuperEditText extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return editText.getText().toString();
|
return editText.getText() == null ? "" : editText.getText().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTitleHint(String title) {
|
public void setTitleHint(String title) {
|
||||||
|
@@ -6,7 +6,6 @@ import com.netease.nim.uikit.common.util.log.LogUtil;
|
|||||||
import com.yizhuan.erban.MiddleActivity;
|
import com.yizhuan.erban.MiddleActivity;
|
||||||
import com.yizhuan.erban.NimMiddleActivity;
|
import com.yizhuan.erban.NimMiddleActivity;
|
||||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||||
import com.yizhuan.erban.ui.login.ErbanQQMemberBindAndLoginActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
import com.yizhuan.xchat_android_core.pay.PaymentActivity;
|
||||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||||
|
|
||||||
@@ -29,7 +28,6 @@ public class ActWhiteListMrg {
|
|||||||
List<Class> acts = new ArrayList<>();
|
List<Class> acts = new ArrayList<>();
|
||||||
acts.add(MiddleActivity.class);
|
acts.add(MiddleActivity.class);
|
||||||
acts.add(NimMiddleActivity.class);
|
acts.add(NimMiddleActivity.class);
|
||||||
acts.add(ErbanQQMemberBindAndLoginActivity.class);
|
|
||||||
acts.add(PaymentActivity.class);
|
acts.add(PaymentActivity.class);
|
||||||
acts.add(SplashActivity.class);
|
acts.add(SplashActivity.class);
|
||||||
|
|
||||||
|
@@ -1,95 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout 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">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="click"
|
|
||||||
type="android.view.View.OnClickListener" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_login_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="85dp"
|
|
||||||
android:text="@string/text_login"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_login_hint"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:text="@string/text_how_to_set_pwd"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="13sp"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@id/tv_login_title"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_login_title" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_account"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="26dp"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:layout_marginRight="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_account_2"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_login_hint"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_password"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_password_2"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_account"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/et_account"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_account"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_login"
|
|
||||||
style="@style/style_login_btn"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:onClick="@{click}"
|
|
||||||
android:text="@string/text_bind_and_login"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_password" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
</layout>
|
|
@@ -1,129 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@color/white"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.yizhuan.erban.base.TitleBar
|
|
||||||
android:id="@+id/title_bar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="85dp"
|
|
||||||
android:text="@string/text_reset_password"
|
|
||||||
android:textColor="#ff333333"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias=".2" />
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_phone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_register_input_phone_number"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_code"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_require_code"
|
|
||||||
android:inputType="number"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/btn_get_code"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_phone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_phone"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_get_code"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="29dp"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginStart="@dimen/space_normal"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:text="@string/text_request_code"
|
|
||||||
android:textColor="@color/design_color"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/et_code"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_phone"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/et_code"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_password"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_phone"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_phone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_code"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:id="@+id/tv_password_tip"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
|
||||||
android:text="@string/register_password_strong_tip"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/sp_13"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_password"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_password"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_password" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_modify"
|
|
||||||
style="@style/style_login_btn"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:text="@string/text_reset_password_now"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_password_tip" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@@ -1,219 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@color/white">
|
|
||||||
|
|
||||||
<com.yizhuan.erban.base.TitleBar
|
|
||||||
android:id="@+id/title_bar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="65dp"
|
|
||||||
android:textColor="#ff333333"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="账号登录"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias=".2" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_desc"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:textColor="#ff333333"
|
|
||||||
android:textSize="13sp"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_account"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_account"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_desc"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_password"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_password"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_account"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_get_code"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="29dp"
|
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:text="@string/text_request_code"
|
|
||||||
android:textColor="@color/design_color"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/et_code"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_password"
|
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/et_code"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/et_code"
|
|
||||||
app:layout_constraintVertical_bias="0.748"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_code"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_require_code"
|
|
||||||
android:inputType="number"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/btn_get_code"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_password"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_password"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_login"
|
|
||||||
style="@style/style_login_btn"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="45dp"
|
|
||||||
android:text="@string/text_login"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/btn_forget" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/btn_register"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginEnd="3dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:text="@string/text_login_to_register"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/dp_13"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/et_password"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/btn_forget"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/btn_forget"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="4dp"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:text="@string/text_login_forget_password"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/dp_13"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/et_password"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/et_code"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_login_tip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginBottom="75dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="12dp"
|
|
||||||
android:text="其他登录方式"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:ignore="SpUsage"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/img_wx_login"
|
|
||||||
android:layout_width="33dp"
|
|
||||||
android:layout_height="33dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:src="@drawable/ic_login_wx"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/tv_login_tip"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_login_tip"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_login_tip" />
|
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/img_qq_login"
|
|
||||||
android:layout_width="33dp"
|
|
||||||
android:layout_height="33dp"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:src="@drawable/ic_login_qq"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/img_wx_login"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/tv_login_tip"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/tv_login_tip"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/img_wx_login" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_protocol"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:text="@string/text_login_protocol"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/dp_12"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/btn_login"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,53 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<variable
|
|
||||||
name="click"
|
|
||||||
type="android.view.View.OnClickListener" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/white"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="108dp"
|
|
||||||
android:text="@string/qq_login"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="25sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_erban_member"
|
|
||||||
android:layout_width="260dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginTop="86dp"
|
|
||||||
android:background="@drawable/shape_round_qq_login"
|
|
||||||
android:gravity="center"
|
|
||||||
android:onClick="@{click}"
|
|
||||||
android:text="@string/text_qq_login_erban_member"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_tutu_member"
|
|
||||||
android:layout_width="260dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginTop="30dp"
|
|
||||||
android:background="@drawable/shape_round_qq_login"
|
|
||||||
android:gravity="center"
|
|
||||||
android:onClick="@{click}"
|
|
||||||
android:text="@string/text_qq_login_tutu_member"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
</LinearLayout>
|
|
||||||
</layout>
|
|
@@ -1,220 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="@color/white"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_back"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="20dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:src="@drawable/ic_register_back"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="85dp"
|
|
||||||
android:text="@string/text_register"
|
|
||||||
android:textColor="#ff333333"
|
|
||||||
android:textSize="25sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintVertical_bias=".2" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_phone"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_register_input_phone_number"
|
|
||||||
android:inputType="phone"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_register_code"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_require_verification_code"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/iv_get_register_code"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/et_phone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_phone"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_get_register_code"
|
|
||||||
android:layout_width="133dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:background="@drawable/shape_round_ececec_radius_6dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="@dimen/dp_2"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/et_register_code"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_phone"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_register_code_refresh"
|
|
||||||
android:layout_width="@dimen/dp_20"
|
|
||||||
android:layout_height="@dimen/dp_20"
|
|
||||||
android:background="@drawable/register_verificaiton_code_refresh"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/iv_get_register_code"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/iv_get_register_code"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/btn_get_register_code"
|
|
||||||
android:layout_width="133dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginStart="@dimen/dp_15"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:src="@drawable/register_verification_code"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/et_register_code"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_phone"
|
|
||||||
tools:ignore="ContentDescription"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_code"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="8dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_require_code_2"
|
|
||||||
android:inputType="number"
|
|
||||||
android:maxLength="15"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_phone"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/et_phone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_register_code"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_get_code"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="29dp"
|
|
||||||
android:layout_marginStart="@dimen/space_normal"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:background="@color/transparent"
|
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:text="@string/text_request_code"
|
|
||||||
android:textColor="@color/design_color"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/et_code"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_phone"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/et_code"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_password"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:hint="@string/hint_login_password_2"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textColorHint="@color/color_b3b3b3"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_phone"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/et_phone"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_code"
|
|
||||||
tools:ignore="Autofill" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_password_tip"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="2dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
|
||||||
android:text="@string/register_password_strong_tip_2"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/sp_13"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/et_password"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/et_password"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/et_password" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_register"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginStart="38dp"
|
|
||||||
android:layout_marginTop="50dp"
|
|
||||||
android:layout_marginEnd="38dp"
|
|
||||||
android:background="@drawable/bg_login_button"
|
|
||||||
android:enabled="false"
|
|
||||||
android:text="@string/text_register_2"
|
|
||||||
android:textColor="@drawable/bg_login_button"
|
|
||||||
android:textSize="15sp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_password_tip"
|
|
||||||
tools:enabled="true" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_protocol"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginBottom="@dimen/dp_20"
|
|
||||||
android:textColor="#333333"
|
|
||||||
android:textSize="12sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:ignore="SpUsage"
|
|
||||||
tools:text="@string/text_login_protocol_2" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
@@ -13,7 +13,6 @@ import com.yizhuan.erban.friend.action.AbstractSelectFriendAction;
|
|||||||
import com.yizhuan.erban.module_hall.hall.activity.HallSearchActivity;
|
import com.yizhuan.erban.module_hall.hall.activity.HallSearchActivity;
|
||||||
import com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity;
|
import com.yizhuan.erban.module_hall.hall.activity.ModuleHallActivity;
|
||||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||||
import com.yizhuan.erban.utils.SpannableBuilder;
|
import com.yizhuan.erban.utils.SpannableBuilder;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
@@ -124,8 +123,7 @@ public class PwdCodeMgr {
|
|||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
public void handlePopPwdCodeWindow(Context context) {
|
public void handlePopPwdCodeWindow(Context context) {
|
||||||
//闪屏页不弹,登录页不弹
|
//闪屏页不弹,登录页不弹
|
||||||
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())) {
|
||||||
|| UIUtils.isTopActivity(context, LoginActivity.class.getName())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//noinspection ResultOfMethodCallIgnored
|
//noinspection ResultOfMethodCallIgnored
|
||||||
|
@@ -5,7 +5,6 @@ import android.content.Context;
|
|||||||
import com.yizhuan.erban.guide.GuideActivity;
|
import com.yizhuan.erban.guide.GuideActivity;
|
||||||
import com.yizhuan.erban.other.activity.SplashActivity;
|
import com.yizhuan.erban.other.activity.SplashActivity;
|
||||||
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
||||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||||
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
||||||
|
|
||||||
@@ -20,7 +19,6 @@ public class LotteryDialogManager {
|
|||||||
}
|
}
|
||||||
//闪屏页,登录页,引导页,完善资料页不弹
|
//闪屏页,登录页,引导页,完善资料页不弹
|
||||||
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
if (UIUtils.isTopActivity(context, SplashActivity.class.getName())
|
||||||
|| UIUtils.isTopActivity(context, LoginActivity.class.getName())
|
|
||||||
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())
|
|| UIUtils.isTopActivity(context, GuideActivity.class.getName())
|
||||||
|| UIUtils.isTopActivity(context, AddUserInfoActivity.class.getName())) {
|
|| UIUtils.isTopActivity(context, AddUserInfoActivity.class.getName())) {
|
||||||
return;
|
return;
|
||||||
|
@@ -94,7 +94,6 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
|
|||||||
wxLogin = findViewById(R.id.img_wx_login);
|
wxLogin = findViewById(R.id.img_wx_login);
|
||||||
tvLoginQuickPass = findViewById(R.id.tv_login_quick_pass);
|
tvLoginQuickPass = findViewById(R.id.tv_login_quick_pass);
|
||||||
qqLogin = findViewById(R.id.img_qq_login);
|
qqLogin = findViewById(R.id.img_qq_login);
|
||||||
tvLoginTip = findViewById(R.id.tv_login_tip);
|
|
||||||
tvDesc = findViewById(R.id.tv_desc);
|
tvDesc = findViewById(R.id.tv_desc);
|
||||||
phoneLogin = findViewById(R.id.img_phone_login);
|
phoneLogin = findViewById(R.id.img_phone_login);
|
||||||
setProtocol();
|
setProtocol();
|
||||||
|
@@ -859,7 +859,7 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
@Override
|
@Override
|
||||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||||
try {
|
try {
|
||||||
ServiceResult<String> serviceResult = api.requestSMSCode(
|
ServiceResult serviceResult = api.requestSMSCode(
|
||||||
phone,
|
phone,
|
||||||
String.valueOf(type)
|
String.valueOf(type)
|
||||||
).blockingGet();
|
).blockingGet();
|
||||||
@@ -890,7 +890,7 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
@Override
|
@Override
|
||||||
public void subscribe(SingleEmitter<String> e) throws Exception {
|
public void subscribe(SingleEmitter<String> e) throws Exception {
|
||||||
try {
|
try {
|
||||||
ServiceResult<String> serviceResult = api.requestResetPsw(
|
ServiceResult serviceResult = api.requestResetPsw(
|
||||||
phone,
|
phone,
|
||||||
sms_code,
|
sms_code,
|
||||||
DESAndBase64(newPsw)
|
DESAndBase64(newPsw)
|
||||||
@@ -1451,12 +1451,12 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
*/
|
*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("/acc/verification/code")
|
@POST("/acc/verification/code")
|
||||||
Single<ServiceResult<String>> requestSMSCode(@Field("phone") String phone,
|
Single<ServiceResult> requestSMSCode(@Field("phone") String phone,
|
||||||
@Field("type") String type);
|
@Field("type") String type);
|
||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST("/acc/pwd/reset")
|
@POST("/acc/pwd/reset")
|
||||||
Single<ServiceResult<String>> requestResetPsw(@Field("phone") String phone,
|
Single<ServiceResult> requestResetPsw(@Field("phone") String phone,
|
||||||
@Field("smsCode") String smsCode,
|
@Field("smsCode") String smsCode,
|
||||||
@Field("newPwd") String newPwd);
|
@Field("newPwd") String newPwd);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user