d
This commit is contained in:
@@ -15,6 +15,7 @@ import com.fenghoo.seven.R;
|
||||
import com.fenghoo.seven.dialog.LoadingDialogy;
|
||||
import com.fenghoo.seven.utils.StatusBarUtil;
|
||||
import com.fenghoo.seven.widget.TitleBar;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.hannesdorfmann.mosby3.mvp.MvpActivity;
|
||||
import com.hannesdorfmann.mosby3.mvp.MvpPresenter;
|
||||
import com.hannesdorfmann.mosby3.mvp.MvpView;
|
||||
@@ -41,13 +42,25 @@ public abstract class BaseTreeActivity<V extends MvpView, P extends MvpPresenter
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getLayoutId());
|
||||
mContext = this;
|
||||
StatusBarUtil.transparencyBar(this); //设置状态栏全透明
|
||||
StatusBarUtil.StatusBarLightMode(this); //设置白底黑字
|
||||
// StatusBarUtil.transparencyBar(this); //设置状态栏全透明
|
||||
// StatusBarUtil.StatusBarLightMode(this); //设置白底黑字
|
||||
|
||||
//初始化沉浸式
|
||||
initImmersionBar();
|
||||
initView();
|
||||
initData();
|
||||
initEvent();
|
||||
initNormalBack();
|
||||
}
|
||||
/**
|
||||
* 初始化沉浸式
|
||||
* Init immersion bar.
|
||||
*/
|
||||
protected void initImmersionBar() {
|
||||
//设置共同沉浸式样式
|
||||
ImmersionBar.with(this).navigationBarColor(R.color.colorPrimary).init();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取布局文件ID
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LoadingDialogy extends Dialog {
|
||||
}
|
||||
//显示dialog的方法
|
||||
public static LoadingDialogy showDialog(Context context , String content){
|
||||
dialog = new LoadingDialogy(context, R.style.loadingDialog ,content);//dialog样式
|
||||
dialog = new LoadingDialogy(context, R.style.avatar_dialog_style ,content);//dialog样式
|
||||
dialog.setContentView(R.layout.dialog_loading);//dialog布局文件
|
||||
dialog.setCanceledOnTouchOutside(false);//点击外部不允许关闭dialog
|
||||
return dialog;
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.fenghoo.seven.main.my.entity.loginInfoBean;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.fenghoo.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.fenghoo.seven.widget.TitleBar;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
/**
|
||||
* LoginActivity
|
||||
@@ -65,7 +66,6 @@ public class CodeLoginActivity extends BaseActivity implements ISmsCodeDialogVi
|
||||
};
|
||||
private TitleBar title_bar;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -74,8 +74,10 @@ public class CodeLoginActivity extends BaseActivity implements ISmsCodeDialogVi
|
||||
mPhoneTv = (TextView) findViewById(R.id.phone);
|
||||
mPhoneTvtwo = (TextView) findViewById(R.id.phonetwo);
|
||||
title_bar = (TitleBar) findViewById(R.id.title_bar);
|
||||
title_bar.hideline();
|
||||
initNormalBack();
|
||||
title_bar.setTitle("");
|
||||
ImmersionBar.with(this).statusBarDarkFont(true).init();//设置状态栏颜色
|
||||
mPhone = getIntent().getStringExtra("phone");
|
||||
entertype = getIntent().getStringExtra("entertype");
|
||||
// String template = "正在向%s发送短信验证码";
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.fenghoo.seven.R;
|
||||
import com.fenghoo.seven.base.BaseActivity;
|
||||
import com.fenghoo.seven.main.kehu.activity.ShowAty;
|
||||
import com.fenghoo.seven.widget.TitleBar;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
public class ForgetPasActivity extends BaseActivity implements View.OnClickListener {
|
||||
private TitleBar title_bar;
|
||||
@@ -29,7 +30,9 @@ public class ForgetPasActivity extends BaseActivity implements View.OnClickListe
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
ImmersionBar.with(this).statusBarDarkFont(true).init();//设置状态栏颜色
|
||||
title_bar = (TitleBar) findViewById(R.id.title_bar);
|
||||
title_bar.hideline();
|
||||
initNormalBack();
|
||||
title_bar.setTitle("");
|
||||
mEtPhone = (EditText) findViewById(R.id.et_phone);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.fenghoo.seven.main.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -14,6 +14,9 @@ import com.fenghoo.seven.base.BaseTreeActivity;
|
||||
import com.fenghoo.seven.main.activity.mvp.contract.LoginPasswordContract;
|
||||
import com.fenghoo.seven.main.activity.mvp.presenterImpl.LoginPasswordPresenterImpl;
|
||||
import com.fenghoo.seven.main.kehu.activity.ShowAty;
|
||||
import com.fenghoo.seven.utils.PhonenNumUtil;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -47,6 +50,8 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
private View view;
|
||||
private TextView login_tv_code;
|
||||
private TextView login_tv_forgetpas;
|
||||
private TextView tv_phone_error;
|
||||
private TextView tv_psw_error;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
@@ -55,8 +60,9 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mEtPhone = (EditText) findViewById(R.id.et_phone);
|
||||
et_pass = (EditText) findViewById(R.id.et_pass);
|
||||
ImmersionBar.with(this).statusBarDarkFont(true).init();//设置状态栏颜色
|
||||
mEtPhone = findViewById(R.id.et_phone);
|
||||
et_pass = findViewById(R.id.et_pass);
|
||||
mBtnLogin = (Button) findViewById(R.id.btn_login);
|
||||
mBtnLogin.setOnClickListener(this);
|
||||
login_tv_pas = (TextView) findViewById(R.id.login_tv_pas);
|
||||
@@ -66,10 +72,13 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
login_tv_code.setOnClickListener(this);
|
||||
login_tv_forgetpas = (TextView) findViewById(R.id.login_tv_forgetpas);
|
||||
login_tv_forgetpas.setOnClickListener(this);
|
||||
tv_phone_error = findViewById(R.id.tv_phone_error);
|
||||
tv_psw_error = findViewById(R.id.tv_psw_error);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
getPresenter().initData();
|
||||
@@ -84,7 +93,17 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.btn_login://登录
|
||||
getPresenter().login();
|
||||
|
||||
if(longintype.equals("0")){
|
||||
getPresenter().login();
|
||||
}else {
|
||||
boolean mobile = PhonenNumUtil.isMobile(getMobile());
|
||||
if(!mobile){
|
||||
ToastUtils.showToast(mContext,"输入的手机号不正确!");
|
||||
return;
|
||||
}
|
||||
ShowAty.CodeLoginActivity(LoginPasswordActivity.this,getMobile(),"0");
|
||||
}
|
||||
break;
|
||||
case R.id.login_tv_code://验证码登录
|
||||
if(longintype.equals("0")){
|
||||
@@ -94,7 +113,7 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
passWordLogin();
|
||||
longintype="0";
|
||||
}
|
||||
ShowAty.CodeLoginActivity(LoginPasswordActivity.this,"18133922183","0");
|
||||
|
||||
break;
|
||||
case R.id.login_tv_forgetpas://忘记密码
|
||||
ShowAty.ForgetPasActivity(LoginPasswordActivity.this);
|
||||
@@ -121,6 +140,7 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
|
||||
@Override
|
||||
public String getMobile() {
|
||||
|
||||
return mEtPhone.getText().toString();
|
||||
}
|
||||
|
||||
@@ -139,6 +159,26 @@ public class LoginPasswordActivity extends BaseTreeActivity<LoginPasswordContrac
|
||||
et_pass.setText(passWord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showphoneerro() {
|
||||
tv_phone_error.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showpassworderro() {
|
||||
tv_psw_error.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showphoneright() {
|
||||
tv_phone_error.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showpasswordright() {
|
||||
tv_psw_error.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSavePassword() {
|
||||
return false;
|
||||
|
||||
@@ -7,9 +7,11 @@ import android.os.Message;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.fenghoo.seven.R;
|
||||
import com.fenghoo.seven.base.BaseActivity;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.fenghoo.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
@@ -56,8 +58,10 @@ public class SplashActivity extends BaseActivity implements EasyPermissions.Perm
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//设置共同沉浸式样式
|
||||
ImmersionBar.with(this).navigationBarColor(R.color.colorPrimary).init();
|
||||
//将屏幕设置为全屏
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
methodRequiresTwoPermission();
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,34 @@ public class LoginPasswordContract {
|
||||
*/
|
||||
void setPassWord(String passWord);
|
||||
|
||||
/**
|
||||
* @description 显示手机号错误
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void showphoneerro();
|
||||
|
||||
/**
|
||||
* @description 显示密码错误
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void showpassworderro();
|
||||
|
||||
/**
|
||||
* @description 显示手机号正确
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void showphoneright();
|
||||
|
||||
/**
|
||||
* @description 显示密码正确
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void showpasswordright();
|
||||
|
||||
/**
|
||||
* 是否记住密码
|
||||
*
|
||||
|
||||
@@ -8,6 +8,9 @@ import com.fenghoo.seven.main.activity.mvp.contract.LoginPasswordContract;
|
||||
import com.fenghoo.seven.main.activity.mvp.model.LoginPasswordModelImpl;
|
||||
import com.fenghoo.seven.main.my.entity.loginInfoBean;
|
||||
import com.fenghoo.seven.network.ApiCallBack;
|
||||
import com.fenghoo.seven.utils.PhonenNumUtil;
|
||||
import com.fenghoo.seven.utils.StringUtils;
|
||||
import com.fenghoo.seven.utils.ToastUtils;
|
||||
import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter;
|
||||
import com.hannesdorfmann.mosby3.mvp.MvpPresenter;
|
||||
|
||||
@@ -46,12 +49,23 @@ public class LoginPasswordPresenterImpl extends MvpBasePresenter<LoginPasswordCo
|
||||
}
|
||||
//验证手机号码规范
|
||||
final String mobile = getView().getMobile();
|
||||
if (TextUtils.isEmpty(mobile) || mobile.length() != 11) {
|
||||
boolean mobilee = PhonenNumUtil.isMobile(mobile);
|
||||
if(!mobilee){
|
||||
getView().toast("请输入正确的手机号码");
|
||||
getView().showphoneerro();
|
||||
return;
|
||||
}else {
|
||||
getView().showphoneright();
|
||||
}
|
||||
//验证密码规范
|
||||
final String passWord = getView().getPassWord();
|
||||
if(StringUtils.isEmpty(passWord)) {
|
||||
getView().toast("请输入正确的密码");
|
||||
getView().showpassworderro();
|
||||
return;
|
||||
}else {
|
||||
getView().showpasswordright();
|
||||
}
|
||||
|
||||
getView().showProgressDialog("登录中...");
|
||||
mModel.login(mobile, passWord, new ApiCallBack<loginInfoBean>() {
|
||||
@@ -60,14 +74,21 @@ public class LoginPasswordPresenterImpl extends MvpBasePresenter<LoginPasswordCo
|
||||
if (getView() == null) {
|
||||
return;
|
||||
}
|
||||
getView().dismissProgressDialog();
|
||||
mModel.setLogin(true);
|
||||
mModel.saveUserInfo(data);
|
||||
Log.d("LoginPresenterImpl: ", data.toString());
|
||||
//记住密码
|
||||
// getView().dismissProgressDialog();
|
||||
if(data.getSuccess()==0){
|
||||
mModel.setLogin(true);
|
||||
mModel.saveUserInfo(data);
|
||||
Log.d("LoginPresenterImpl: ", data.toString());
|
||||
//记住密码
|
||||
// boolean savePassword = getView().isSavePassword();
|
||||
// mModel.savePassword(savePassword ? mobile : null, savePassword ? passWord : null);
|
||||
getView().startActivity(MainActivity.class);
|
||||
// getView().startActivity(MainActivity.class);
|
||||
}else {
|
||||
getView().toast(data.getMsg());
|
||||
getView().showphoneright();
|
||||
getView().showpasswordright();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -179,5 +179,4 @@ public class MyFragment
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.fenghoo.seven.utils.WidgetTools;
|
||||
import com.fenghoo.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.fenghoo.seven.widget.CircleImageView;
|
||||
import com.fenghoo.seven.wxapi.WXEntryActivity;
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
|
||||
@@ -38,6 +39,7 @@ public class PersonalProfileActivity extends BaseTreeActivity<PersonalProfileCon
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
ImmersionBar.with(this).statusBarColor(R.color.colorPrimary).statusBarDarkFont(true).init();//设置状态栏颜色
|
||||
setTitleBar(R.id.title_bar, getString(R.string.text_PersonalProfile), true, false, null);
|
||||
tv_banding = (TextView) findViewById(R.id.tv_banding);
|
||||
my_ima_head = (CircleImageView) findViewById(R.id.my_ima_head);
|
||||
|
||||
63
app/src/main/java/com/fenghoo/seven/utils/PhonenNumUtil.java
Normal file
63
app/src/main/java/com/fenghoo/seven/utils/PhonenNumUtil.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.fenghoo.seven.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* Created by 蔡雅楠 on 2018/5/11.
|
||||
*/
|
||||
|
||||
public class PhonenNumUtil {
|
||||
|
||||
public static String phoneNum(String phoneNum){
|
||||
String strPhoneNum = "";
|
||||
if(!TextUtils.isEmpty(phoneNum) && phoneNum.length() > 7 ){
|
||||
StringBuilder sb =new StringBuilder();
|
||||
for (int i = 0; i < phoneNum.length(); i++) {
|
||||
char c = phoneNum.charAt(i);
|
||||
if (i >= 3 && i <= 8) {
|
||||
sb.append('*');
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
strPhoneNum = sb.toString();
|
||||
}
|
||||
return strPhoneNum;
|
||||
}
|
||||
|
||||
public static String hidephonenum(String phoneNum){
|
||||
String strPhoneNum = "";
|
||||
if(!TextUtils.isEmpty(phoneNum)){
|
||||
StringBuilder sb =new StringBuilder();
|
||||
for (int i = 0; i < phoneNum.length(); i++) {
|
||||
char c = phoneNum.charAt(i);
|
||||
if (i >= 3) {
|
||||
sb.append('*');
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
strPhoneNum = sb.toString();
|
||||
}
|
||||
return strPhoneNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证手机格式
|
||||
*/
|
||||
public static boolean isMobile(String number) {
|
||||
/*
|
||||
移动:134、135、136、137、138、139、150、151、152、157(TD)、158、159、178(新)、182、184、187、188
|
||||
联通:130、131、132、152、155、156、185、186
|
||||
电信:133、153、170、173、177、180、181、189、(1349卫通)
|
||||
总结起来就是第一位必定为1,第二位必定为3或5或8,其他位置的可以为0-9
|
||||
*/
|
||||
String num = "[1][123456789]\\d{9}";//"[1]"代表第1位为数字1,"[34578]"代表第二位可以为3、4、5、7、8中的一个,"\\d{9}"代表后面是可以是0~9的数字,有9位。
|
||||
if (TextUtils.isEmpty(number)) {
|
||||
return false;
|
||||
} else {
|
||||
//matches():字符串是否在给定的正则表达式匹配
|
||||
return number.matches(num);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,14 @@ public class TitleBar extends RelativeLayout implements View.OnClickListener {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 隐藏横线
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public void hideline(){
|
||||
mVBottomLine.setVisibility(GONE);
|
||||
}
|
||||
private void initView(Context context) {
|
||||
mRootView = inflate(context, R.layout.widget_title_bar, this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user