feat(review): 添加审核成功弹窗提示功能
- 在ReviewActivity中引入AlertDialog、Handler和LayoutInflater依赖 - 添加successDialog和uiHandler成员变量用于弹窗管理 - 实现showSuccessDialogThenFinish方法显示成功确认弹窗 - 在同意和回退操作成功后调用弹窗显示而非直接finish - 添加弹窗资源文件dialog_review.xml和背景样式bg_dialog - 修改activity_fo.xml中的提示文本增加查看权限说明 - 在onDestroy中清理弹窗和Handler防止内存泄漏
这个提交包含在:
父节点
d6eb9bd3bd
当前提交
cae7604cf0
@ -1,5 +1,9 @@
|
|||||||
package com.nova.brain.glass.ui
|
package com.nova.brain.glass.ui
|
||||||
|
|
||||||
|
import android.app.AlertDialog
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.view.LayoutInflater
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.nova.brain.glass.R
|
import com.nova.brain.glass.R
|
||||||
import com.nova.brain.glass.databinding.ActivityReviewBinding
|
import com.nova.brain.glass.databinding.ActivityReviewBinding
|
||||||
@ -31,6 +35,8 @@ class ReviewActivity : BaseListFormLayoutNormalActivity<ItemItem, ItemListVM, Ac
|
|||||||
|
|
||||||
private var isSubmitting = false
|
private var isSubmitting = false
|
||||||
private var submitDisposable: Disposable? = null
|
private var submitDisposable: Disposable? = null
|
||||||
|
private var successDialog: AlertDialog? = null
|
||||||
|
private val uiHandler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
private val workProcessInstanceId: String by lazy {
|
private val workProcessInstanceId: String by lazy {
|
||||||
intent.getStringExtra("workProcessInstanceId").orEmpty()
|
intent.getStringExtra("workProcessInstanceId").orEmpty()
|
||||||
@ -78,6 +84,8 @@ class ReviewActivity : BaseListFormLayoutNormalActivity<ItemItem, ItemListVM, Ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
uiHandler.removeCallbacksAndMessages(null)
|
||||||
|
successDialog?.dismiss()
|
||||||
submitDisposable?.dispose()
|
submitDisposable?.dispose()
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
@ -142,8 +150,7 @@ class ReviewActivity : BaseListFormLayoutNormalActivity<ItemItem, ItemListVM, Ac
|
|||||||
.doFinally { isSubmitting = false }
|
.doFinally { isSubmitting = false }
|
||||||
.subscribe({ response ->
|
.subscribe({ response ->
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
"已同意".showMessage()
|
showSuccessDialogThenFinish()
|
||||||
finish()
|
|
||||||
} else {
|
} else {
|
||||||
(if (response.msg.isBlank()) "同意失败" else response.msg).showMessage()
|
(if (response.msg.isBlank()) "同意失败" else response.msg).showMessage()
|
||||||
}
|
}
|
||||||
@ -186,8 +193,7 @@ class ReviewActivity : BaseListFormLayoutNormalActivity<ItemItem, ItemListVM, Ac
|
|||||||
.doFinally { isSubmitting = false }
|
.doFinally { isSubmitting = false }
|
||||||
.subscribe({ response ->
|
.subscribe({ response ->
|
||||||
if (response.status == 200) {
|
if (response.status == 200) {
|
||||||
"已回退".showMessage()
|
showSuccessDialogThenFinish()
|
||||||
finish()
|
|
||||||
} else {
|
} else {
|
||||||
(if (response.msg.isBlank()) "回退失败" else response.msg).showMessage()
|
(if (response.msg.isBlank()) "回退失败" else response.msg).showMessage()
|
||||||
}
|
}
|
||||||
@ -196,6 +202,24 @@ class ReviewActivity : BaseListFormLayoutNormalActivity<ItemItem, ItemListVM, Ac
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showSuccessDialogThenFinish() {
|
||||||
|
successDialog?.dismiss()
|
||||||
|
val contentView = LayoutInflater.from(this).inflate(R.layout.dialog_review, null)
|
||||||
|
successDialog = AlertDialog.Builder(this)
|
||||||
|
.setView(contentView)
|
||||||
|
.setCancelable(false)
|
||||||
|
.create()
|
||||||
|
.also { dialog ->
|
||||||
|
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
|
dialog.show()
|
||||||
|
}
|
||||||
|
uiHandler.postDelayed({
|
||||||
|
successDialog?.dismiss()
|
||||||
|
successDialog = null
|
||||||
|
finish()
|
||||||
|
}, 1000L)
|
||||||
|
}
|
||||||
|
|
||||||
private val adapter = object : CommonPagedAdapter<ItemItem>(R.layout.item_item) {
|
private val adapter = object : CommonPagedAdapter<ItemItem>(R.layout.item_item) {
|
||||||
override fun convert(holder: ViewHolder, item: ItemItem, position: Int) {
|
override fun convert(holder: ViewHolder, item: ItemItem, position: Int) {
|
||||||
holder
|
holder
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#ff40FF5E" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
|
<solid android:color="#000000" />
|
||||||
|
<padding
|
||||||
|
android:bottom="5dp"
|
||||||
|
android:left="10dp"
|
||||||
|
android:right="10dp"
|
||||||
|
android:top="5dp" />
|
||||||
|
</shape>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
android:layout_marginBottom="56dp"
|
android:layout_marginBottom="56dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:lineSpacingExtra="6dp"
|
android:lineSpacingExtra="6dp"
|
||||||
android:text="双击或语音输入“返回”返回上级页面"
|
android:text="当前任务只有查看权限\n双击或语音输入“返回”返回上级页面"
|
||||||
android:textColor="#4AFE59"
|
android:textColor="#4AFE59"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:id="@+id/tv_message"
|
||||||
|
android:layout_width="340dp"
|
||||||
|
android:layout_height="159dp"
|
||||||
|
android:background="@drawable/bg_dialog">
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:gravity="center"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:src="@mipmap/icon_review"/>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center|start"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="处理成功"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="#40FF5E"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv"/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="正在返回列表页"
|
||||||
|
android:textColor="#40FF5E"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/iv"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 3.8 KiB |
正在加载...
在新工单中引用
屏蔽一个用户