Browse Source

1.优化消息内容展示弹窗UI

王鹏鹏 2 years ago
parent
commit
5e93f01e65

+ 14 - 9
baselib/src/main/java/com/yingyangfly/baselib/dialog/MessageDialog.kt

@@ -43,16 +43,13 @@ class MessageDialog : DialogFragment() {
     override fun onStart() {
         super.onStart()
         dialog?.window?.setLayout(
-            ViewGroup.LayoutParams.MATCH_PARENT,
-            ViewGroup.LayoutParams.MATCH_PARENT
+            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT
         )
         dialog?.window?.setBackgroundDrawableResource(R.color.transparent)
     }
 
     override fun onCreateView(
-        inflater: LayoutInflater,
-        container: ViewGroup?,
-        savedInstanceState: Bundle?
+        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
     ): View? {
         immersionBar {
             hideBar(BarHide.FLAG_HIDE_BAR)
@@ -69,15 +66,23 @@ class MessageDialog : DialogFragment() {
     private fun findId(rootView: View) {
         tvTitle = rootView.findViewById(R.id.tvTitle)
         tvContent = rootView.findViewById(R.id.tvContent)
-        tvTitle?.text = if (TextUtils.isEmpty(title).not()) {
-            title
+        tvTitle?.text = if (TextUtils.isEmpty(content).not()) {
+            if (TextUtils.isEmpty(title).not()) {
+                title
+            } else {
+                "提示"
+            }
         } else {
-            ""
+            "提示"
         }
         tvContent?.text = if (TextUtils.isEmpty(content).not()) {
             content
         } else {
-            ""
+            if (TextUtils.isEmpty(title).not()) {
+                title
+            } else {
+                ""
+            }
         }
         btnConform = rootView.findViewById(R.id.btnConform)
     }