fix: 增加loading对话框
This commit is contained in:
parent
c3c9c85e28
commit
d4c791b8d9
@ -20,8 +20,8 @@ android {
|
||||
applicationId "com.navinfo.volvo"
|
||||
minSdk 24
|
||||
targetSdk 32
|
||||
versionCode 2
|
||||
versionName "20230112"
|
||||
versionCode 3
|
||||
versionName "20230327"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
@ -5,6 +5,7 @@ import android.content.DialogInterface
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
@ -85,7 +86,16 @@ class ObtainMessageFragment : BaseFragment() {
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private lateinit var voiceView: VoicePlayerView
|
||||
private lateinit var loadingDialog: AlertDialog
|
||||
private val loadingDialog by lazy {
|
||||
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleLarge)
|
||||
progressBar.indeterminateDrawable.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN)
|
||||
val dialog = AlertDialog.Builder(requireContext())
|
||||
.setView(progressBar)
|
||||
.setCancelable(false)
|
||||
.create()
|
||||
dialog.window!!.setBackgroundDrawable(ColorDrawable(0))
|
||||
dialog
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
@ -686,14 +696,6 @@ class ObtainMessageFragment : BaseFragment() {
|
||||
} else {
|
||||
messageData.version = "0" // 预约发送
|
||||
}
|
||||
if (loadingDialog == null) {
|
||||
val progressBar = ProgressBar(context, null, android.R.attr.progressBarStyleLarge)
|
||||
progressBar.indeterminateDrawable.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN)
|
||||
loadingDialog = AlertDialog.Builder(requireContext())
|
||||
.setView(progressBar)
|
||||
.setCancelable(false)
|
||||
.create()
|
||||
}
|
||||
loadingDialog.show()
|
||||
// 开始网络提交数据
|
||||
if (obtainMessageViewModel.getMessageLiveData().value?.id == 0L) { // 如果网络id为空,则调用更新操作
|
||||
|
Loading…
x
Reference in New Issue
Block a user