...
|
...
|
@@ -9,6 +9,8 @@ import androidx.appcompat.widget.Toolbar |
|
|
import androidx.lifecycle.Observer
|
|
|
import androidx.lifecycle.ViewModelProvider
|
|
|
import androidx.viewbinding.ViewBinding
|
|
|
import com.br_technology.electricityandroid.util.pos_id
|
|
|
import com.br_technology.electricityandroid.util.token
|
|
|
import com.br_technology.securitytrain_master.R
|
|
|
import com.br_technology.securitytrain_master.base.common.CommonUtil
|
|
|
import com.br_technology.securitytrain_master.base.common.State
|
...
|
...
|
@@ -17,6 +19,7 @@ import com.br_technology.securitytrain_master.base.common.callback.EmptyCallBack |
|
|
import com.br_technology.securitytrain_master.base.common.callback.LoadingCallBack
|
|
|
import com.br_technology.securitytrain_master.base.view.BaseViewModel
|
|
|
import com.br_technology.securitytrain_master.expand.statusBarHeight
|
|
|
import com.br_technology.securitytrain_master.ui.view.login.activity.AccountLoginActivity
|
|
|
import com.kingja.loadsir.callback.SuccessCallback
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -98,6 +101,12 @@ abstract class BaseLifeCycleActivity<VM : BaseViewModel<*>, VB : ViewBinding>(pr |
|
|
loadService.showCallback(EmptyCallBack::class.java)
|
|
|
}
|
|
|
|
|
|
private fun toLogin() {
|
|
|
token = ""
|
|
|
pos_id = 0
|
|
|
startActivity(AccountLoginActivity::class.java)
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分发应用状态
|
|
|
*/
|
...
|
...
|
@@ -109,10 +118,9 @@ abstract class BaseLifeCycleActivity<VM : BaseViewModel<*>, VB : ViewBinding>(pr |
|
|
StateType.LOADING -> showLoading()
|
|
|
StateType.ERROR -> showTip(it.message)
|
|
|
StateType.NETWORK_ERROR -> showError("网络出现问题啦")
|
|
|
// StateType.NOT_LOGIN -> showError("请重新登录",401)
|
|
|
StateType.NOT_LOGIN -> toLogin()
|
|
|
StateType.TIP -> showTip(it.message)
|
|
|
StateType.EMPTY -> showEmpty()
|
|
|
else -> {}
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
|