[6.6.0]
[创建任务添加loading]
This commit is contained in:
@@ -15,4 +15,6 @@ public interface IBusLinesCallback {
|
||||
void onBusLineTasks(List<BusQueryLineTaskResponse.Result> o, int position,boolean autoRefresh);
|
||||
|
||||
void onRefreshSuccess(long currentTimeStamp);
|
||||
|
||||
void onChangeLineIdFail();
|
||||
}
|
||||
|
||||
@@ -250,6 +250,7 @@ object BusLineModel {
|
||||
|
||||
override fun startFail(msg: String) {
|
||||
ToastUtils.showShort("选择任务失败:$msg")
|
||||
mBusLinesCallback?.onChangeLineIdFail()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@@ -53,9 +53,8 @@ class BusLinePresenter(view: BusSwitchLineView?) : Presenter<BusSwitchLineView?>
|
||||
override fun onChangeLineIdSuccess() {
|
||||
clearBusStationDatas()
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
mView!!.onChangeLineIdSuccess()
|
||||
}
|
||||
mView?.startTaskState(true)
|
||||
mView?.onChangeLineIdSuccess()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
@@ -108,6 +107,10 @@ class BusLinePresenter(view: BusSwitchLineView?) : Presenter<BusSwitchLineView?>
|
||||
mView?.refreshDate(DateTimeUtil.formatLongToString(currentTimeStamp,DateTimeUtil.yyyy_MM_dd_HH_mm_ss))
|
||||
}
|
||||
|
||||
override fun onChangeLineIdFail() {
|
||||
mView?.startTaskState(false)
|
||||
}
|
||||
|
||||
fun refreshTask() {
|
||||
BusLineModel.refreshTask()
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.och.weaknet.ui
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.Point
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
@@ -9,6 +11,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -28,6 +31,8 @@ import com.mogo.och.weaknet.ui.adapter.OpenItemAnimator
|
||||
import com.mogo.och.weaknet.ui.adapter.SwitchLineAdapter
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.aciv_refresh_task
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.actv_last_refresh_date
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.pb_start_task
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.tv_start_task
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,7 +49,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
private lateinit var mClose: ImageView
|
||||
private lateinit var mNoDatasView: ConstraintLayout
|
||||
private lateinit var mLinesListView: RecyclerView
|
||||
private lateinit var mLineCommitBtn: TextView
|
||||
private lateinit var mLineCommitBtn: LinearLayout
|
||||
private lateinit var mAdapter: SwitchLineAdapter
|
||||
private lateinit var linearLayoutManager:LinearLayoutManager
|
||||
private val mData: MutableList<BusQueryLinesResponse.Result> = ArrayList()
|
||||
@@ -105,6 +110,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
animator?.start()
|
||||
}
|
||||
mPresenter?.setRefreshTime()
|
||||
pb_start_task.progressTintList = ColorStateList.valueOf(Color.WHITE)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,6 +220,7 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 有无数据UI显示
|
||||
* @param b
|
||||
@@ -240,12 +247,35 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
if (v.id == R.id.switch_line_btn_commit) {
|
||||
if(mAdapter.checkLine!=null&&mAdapter.checkTask!=null){
|
||||
mPresenter?.commitSwitchLineId(mAdapter.checkTask!!,mAdapter.checkLine!!)
|
||||
mPresenter?.let {
|
||||
it.commitSwitchLineId(mAdapter.checkTask!!,mAdapter.checkLine!!)
|
||||
startTaskLoading()
|
||||
}
|
||||
}else{
|
||||
ToastUtils.showLong("请选择任务")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun startTaskState(success: Boolean) {
|
||||
pb_start_task.visibility = View.GONE
|
||||
if(success){
|
||||
tv_start_task.text = "创建成功"
|
||||
}else{
|
||||
tv_start_task.text = "创建失败"
|
||||
UiThreadHandler.postDelayed({
|
||||
tv_start_task.text = "确定"
|
||||
},1_000)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun startTaskLoading(){
|
||||
pb_start_task.visibility = View.VISIBLE
|
||||
tv_start_task.text = "创建中"
|
||||
}
|
||||
|
||||
|
||||
override fun onDestroy() {
|
||||
mPresenter!!.removeListener()
|
||||
super.onDestroy()
|
||||
|
||||
@@ -20,5 +20,7 @@ public interface BusSwitchLineView extends IView {
|
||||
void onBusLineTasks(List<BusQueryLineTaskResponse.Result> o, int position,boolean autoRefresh);
|
||||
|
||||
void refreshDate(@Nullable String formatLongToString);
|
||||
|
||||
void startTaskState(boolean b);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
android:visibility="gone"
|
||||
android:id="@+id/upload_btn_commit_progress"
|
||||
android:progressBackgroundTint="@color/white"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
|
||||
@@ -69,7 +69,8 @@
|
||||
android:layout_marginTop="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_30"/>
|
||||
|
||||
<TextView
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/switch_line_btn_commit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_80"
|
||||
@@ -78,12 +79,26 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_marginBottom="@dimen/bus_switch_line_btn_margin_b"
|
||||
android:textSize="@dimen/dp_42"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@string/bus_switch_line_btn_txt"
|
||||
android:background="@drawable/bus_switch_line_btn_commit"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/bus_switch_line_btn_commit"/>
|
||||
android:layout_marginBottom="@dimen/bus_switch_line_btn_margin_b">
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_start_task"
|
||||
android:progressBackgroundTint="@color/white"
|
||||
android:visibility="gone"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView
|
||||
android:id="@+id/tv_start_task"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_42"
|
||||
android:textColor="@android:color/white"
|
||||
android:text="@string/bus_switch_line_btn_txt"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user