leiyun пре 3 година
родитељ
комит
667e17699a
4 измењених фајлова са 32 додато и 16 уклоњено
  1. +15
    -12
      app/src/main/java/com/yzx/escreen/MainActivity.kt
  2. +15
    -3
      app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt
  3. +1
    -1
      app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt
  4. +1
    -0
      app/src/main/java/com/yzx/escreen/widget/BaseDialog.kt

+ 15
- 12
app/src/main/java/com/yzx/escreen/MainActivity.kt Прегледај датотеку

@@ -122,18 +122,20 @@ class MainActivity : BaseActivity<BasePresenter<*>>(), NetworkUtils.OnNetworkSta
} }


private fun showNetworkError(){ private fun showNetworkError(){
val builder = QMUIDialog.MessageDialogBuilder(this)

builder.setMessage("你还没有连接网络,请先连接网络!")
.setTitle("温馨提示")
.addAction("去设置"
) { dialog, index ->
NetworkUtils.openWirelessSettings()
}
.setCancelable(false)
.setCanceledOnTouchOutside(false)
netErrorDialog = builder.show()
netErrorDialog?.hideNavigationBar()
if(!NetworkUtils.isConnected()){ //无网提示
val builder = QMUIDialog.MessageDialogBuilder(this)

builder.setMessage("你还没有连接网络,请先连接网络!")
.setTitle("温馨提示")
.addAction("去设置"
) { dialog, index ->
NetworkUtils.openWirelessSettings()
}
.setCancelable(false)
.setCanceledOnTouchOutside(false)
netErrorDialog = builder.show()
netErrorDialog?.hideNavigationBar()
}
} }


private fun showNetworkLoading(){ private fun showNetworkLoading(){
@@ -184,6 +186,7 @@ class MainActivity : BaseActivity<BasePresenter<*>>(), NetworkUtils.OnNetworkSta
dismiss() dismiss()
} }
} }
viewPager2.removeCallbacks(netLoadingRun)
if (!User.isLogin()) { if (!User.isLogin()) {
WebActivity.active(this, "${Config.OA_URL}/login?logout=1") WebActivity.active(this, "${Config.OA_URL}/login?logout=1")
finish() finish()


+ 15
- 3
app/src/main/java/com/yzx/escreen/fragment/HomeFragment.kt Прегледај датотеку

@@ -310,8 +310,17 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
if (index >= 0) { if (index >= 0) {
mShowDialogList.removeAt(dialogIndex) mShowDialogList.removeAt(dialogIndex)
} }
val showItem = mShowDialogList.find { !it.showed }
showItem?.apply {
show()
}

}
val showList = mShowDialogList.filter { it.showed }
if(showList.isEmpty()){
dialog.show()
dialog.showed = true
} }
dialog.show()
dialog.hideNavigationBar() dialog.hideNavigationBar()
dialog.setLeaveId(detail.id) dialog.setLeaveId(detail.id)
mShowDialogList.add(dialog) mShowDialogList.add(dialog)
@@ -485,8 +494,11 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView,
} }


override fun onLeaveIDsSuccess(list: MutableList<LeaveID>) { override fun onLeaveIDsSuccess(list: MutableList<LeaveID>) {
for (leaveID in list) {
mPresenter?.getDetail(leaveID.id)

list.forEachIndexed { index, leaveID ->
pageTv.postDelayed({
mPresenter?.getDetail(leaveID.id)
},500L*index)
} }
} }




+ 1
- 1
app/src/main/java/com/yzx/escreen/presenter/HomePresenter.kt Прегледај датотеку

@@ -48,9 +48,9 @@ class HomePresenter(view: HomeView) : BasePresenter<HomeView>(view) {
.tag(this) .tag(this)
.execute(object : JsonCallBack<YzxResponse<LeaveID>>() { .execute(object : JsonCallBack<YzxResponse<LeaveID>>() {
override fun onSuccess(response: Response<YzxResponse<LeaveID>>?) { override fun onSuccess(response: Response<YzxResponse<LeaveID>>?) {
LogUtils.d(response)
if (response?.isSuccessful == true) { if (response?.isSuccessful == true) {
mView?.onLeaveIDsSuccess(response.body().list) mView?.onLeaveIDsSuccess(response.body().list)
LogUtils.d("getLeaveShowIds",response.body().list)
} }
} }




+ 1
- 0
app/src/main/java/com/yzx/escreen/widget/BaseDialog.kt Прегледај датотеку

@@ -6,6 +6,7 @@ import android.content.Context
class BaseDialog(context: Context, themeResId: Int, res: Int) : Dialog(context, themeResId) { class BaseDialog(context: Context, themeResId: Int, res: Int) : Dialog(context, themeResId) {
private var res: Int = 0 private var res: Int = 0
private var leaveId:Int = 0 private var leaveId:Int = 0
var showed = false


init { init {
setContentView(res) setContentView(res)


Loading…
Откажи
Сачувај