[fix] 防止页面重复弹出被销毁

This commit is contained in:
yangyakun
2022-09-08 11:21:52 +08:00
parent ce0a7f2884
commit 7ca1dc1595
2 changed files with 14 additions and 1 deletions

View File

@@ -40,6 +40,13 @@ object TaxiLoginModel{
.registerCarLocationChangedListener(TAG, mCarLocationChangedListener2)
}
fun hasInit():Boolean{
if(mContext==null&& iTaxiLoginCallback==null){
return false;
}
return true
}
// 自车定位
private val mCarLocationChangedListener2 = IMogoCarLocationChangedListener2 { location ->
mLongitude = location.longitude

View File

@@ -29,15 +29,18 @@ class TaxiLoginPresenter(view: TaxiLoginDialogFragment?) :
private var countDownDisposable: Disposable? = null
init {
TaxiLoginModel.init(AbsMogoApplication.getApp())
initListeners()
}
private fun initListeners() {
TaxiLoginModel.init(AbsMogoApplication.getApp())
TaxiLoginModel.setiTaxiLoginCallback(this)
}
fun getPhoneCode(phone:String){
if(!TaxiLoginModel.hasInit()){
initListeners()
}
if (!RegexUtils.isMobileExact(phone)) {
ToastUtils.showShort(R.string.module_och_taxi_login_phone_error)
mView?.inputPhoneError()
@@ -91,6 +94,9 @@ class TaxiLoginPresenter(view: TaxiLoginDialogFragment?) :
}
fun gotoLogin(phone: String, code: String) {
if(!TaxiLoginModel.hasInit()){
initListeners()
}
if (!RegexUtils.isMobileExact(phone)) {
ToastUtils.showShort(R.string.module_och_taxi_login_phone_error)
mView?.inputPhoneError()