diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/ErrorView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/ErrorView.kt
new file mode 100644
index 0000000000..2a6eb669fb
--- /dev/null
+++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/ErrorView.kt
@@ -0,0 +1,64 @@
+package com.mogo.och.common.module.wigets.commonview
+
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import androidx.constraintlayout.widget.ConstraintLayout
+import com.mogo.eagle.core.utilcode.kotlin.onClick
+import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
+import com.mogo.map.listener.IMogoMapListener
+import com.mogo.och.common.module.R
+import com.mogo.och.common.module.utils.ResourcesUtils
+import kotlinx.android.synthetic.main.common_error_view.view.tv_error_msg
+
+class ErrorView @JvmOverloads constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ defStyleAttr: Int = 0
+) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener {
+ companion object {
+ const val TAG = "LoadingMapStatusView"
+ }
+
+ private var emptyTitle:String = ""
+
+ var reloadLIstener:ReloadLIstener?=null
+
+ init {
+ LayoutInflater.from(context).inflate(R.layout.common_error_view, this, true)
+ try {
+ val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ErrorView)
+ emptyTitle = typedArray.getString(R.styleable.ErrorView_error_title)?:ResourcesUtils.getString(R.string.common_error_data)
+ typedArray.recycle()
+ } catch (e: Exception) {
+ e.printStackTrace()
+ }
+ tv_error_msg.text = emptyTitle
+ tv_error_msg.onClick {
+ reloadLIstener?.reload()
+ }
+ }
+
+ override fun onAttachedToWindow() {
+ super.onAttachedToWindow()
+ CallerLogger.d(TAG,"onAttachedToWindow")
+
+ }
+
+ override fun onVisibilityAggregated(isVisible: Boolean) {
+ super.onVisibilityAggregated(isVisible)
+
+ }
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ CallerLogger.d(TAG,"onDetachedFromWindow")
+ }
+
+ interface ReloadLIstener{
+ fun reload()
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/OCH/common/common/src/main/res/values/attrs.xml b/OCH/common/common/src/main/res/values/attrs.xml
index ab122895b6..cb8a13ade6 100644
--- a/OCH/common/common/src/main/res/values/attrs.xml
+++ b/OCH/common/common/src/main/res/values/attrs.xml
@@ -19,6 +19,11 @@
+
+
+
+
+
diff --git a/OCH/common/common/src/main/res/values/strings.xml b/OCH/common/common/src/main/res/values/strings.xml
index 4733549483..bfc3004bef 100644
--- a/OCH/common/common/src/main/res/values/strings.xml
+++ b/OCH/common/common/src/main/res/values/strings.xml
@@ -32,4 +32,5 @@
加载中……
暂无数据
+ 重新加载
\ No newline at end of file
diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt
index bb81f1a20a..82b008de2d 100644
--- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt
+++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/model/LineModel.kt
@@ -220,7 +220,15 @@ object LineModel {
override fun onError(e: Throwable) {
d(TAG, "commitSwitchLineId onError${e.printStackTrace()}")
- if (e is DataException) {
+ if(RepositoryManager.supportDb()) {
+ if (e is DataException) {
+ OchChainLogManager.writeChainLog("开始任务", "${e.message}")
+ ToastUtils.showShort("选择任务失败:${e.message}")
+ mBusLinesCallbackMap.forEach {
+ it.value.onChangeLineIdFail()
+ }
+ }
+ }else{
OchChainLogManager.writeChainLog("开始任务", "${e.message}")
ToastUtils.showShort("选择任务失败:${e.message}")
mBusLinesCallbackMap.forEach {
diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt
index 364b028deb..5b623e475d 100644
--- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt
+++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwitchLineView.kt
@@ -20,6 +20,7 @@ import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.wigets.WindowRelativeLayout
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
+import com.mogo.och.common.module.wigets.commonview.ErrorView
import com.mogo.och.shuttle.weaknet.R
import com.mogo.och.weaknet.model.LineModel
import com.mogo.och.weaknet.repository.RepositoryManager
@@ -29,6 +30,7 @@ import kotlinx.android.synthetic.main.shuttle_wadk_task_running.view.no_order_da
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.aciv_refresh_task
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.actv_last_refresh_date
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.include_empty
+import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.include_errorview
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.switch_line_rv
import me.jessyan.autosize.utils.AutoSizeUtils
@@ -99,6 +101,12 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
}
animator?.start()
}
+ include_errorview.reloadLIstener = object :ErrorView.ReloadLIstener{
+ override fun reload() {
+ viewbizModel?.showSwitchLineInfo()
+ }
+
+ }
}
/**
@@ -151,6 +159,7 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
*/
private fun showNoData(b: Boolean) {
BizLoopManager.runInMainThread{
+ include_errorview.visibility = View.GONE
if (b) {
switch_line_rv.visibility = View.GONE
include_empty.visibility = View.VISIBLE
@@ -173,8 +182,12 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
}
-
-
+ override fun onBusLinesChangeFaile() {
+ include_errorview.visibility = View.VISIBLE
+ switch_line_rv.visibility = View.GONE
+ include_empty.visibility = View.GONE
+ viewbizModel?.showSwitchLineInfoResult()
+ }
}
diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt
index 7be4a873e7..f9d6c98b0a 100644
--- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt
+++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/switchline/SwtichLineModel.kt
@@ -57,6 +57,7 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
override fun onError(e: Throwable) {
d(LineModel.TAG, "queryBusLines onError${e.printStackTrace()}")
+ viewCallback?.onBusLinesChangeFaile()
}
override fun onComplete() {
@@ -93,6 +94,7 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
fun startTaskState(success: Boolean)
fun onBusLinesChange(data: MutableList?,show:Boolean)
fun refreshDate(formatLongToString: String?)
+ fun onBusLinesChangeFaile()
}
override fun onRefreshSuccess(currentTimeStamp: Long) {
diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml
index 1c0e065ac9..3034b16cc9 100644
--- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml
+++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_switch_line.xml
@@ -60,4 +60,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
+
+
\ No newline at end of file