Parcourir la source

1.修改通知消息布局。

20241218TB223FC(测试jar包)
wangwanlei il y a 11 mois
Parent
révision
a764857eef

+ 1
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt Voir le fichier

@@ -625,7 +625,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
625 625
                         titleTv.text = msgBean.title
626 626
                         contentTv.text = msgBean.content
627 627
                     } catch (e: Exception) {
628
-
628
+                        LogShow("解析失败"+e.toString())
629 629
                     }
630 630
                     closeBtn.setOnClickListener {
631 631
                         dialog.dismiss()

+ 15
- 3
app/src/main/res/layout/layout_notice_dialog.xml Voir le fichier

@@ -20,25 +20,37 @@
20 20
         android:gravity="center_horizontal"
21 21
         android:orientation="vertical"
22 22
         android:padding="15dp">
23
+
23 24
         <androidx.core.widget.NestedScrollView
24 25
             android:layout_width="match_parent"
25 26
             android:layout_height="0dp"
26 27
             android:layout_weight="1">
28
+
27 29
             <androidx.appcompat.widget.LinearLayoutCompat
28 30
                 android:layout_width="match_parent"
29
-                android:layout_height="match_parent">
31
+                android:layout_height="match_parent"
32
+                android:orientation="vertical">
33
+
30 34
                 <TextView
31 35
                     android:id="@+id/dialog_title_tv"
32 36
                     android:layout_width="match_parent"
33 37
                     android:layout_height="wrap_content"
34
-                    android:layout_weight="1" />
38
+                    android:layout_weight="1"
39
+                    android:gravity="center"
40
+                    android:textColor="#253A70"
41
+                    android:textSize="22sp" />
35 42
 
36 43
                 <TextView
37 44
                     android:id="@+id/dialog_content_tv"
38 45
                     android:layout_width="match_parent"
39
-                    android:layout_height="wrap_content" />
46
+                    android:layout_height="wrap_content"
47
+                    android:layout_marginTop="10dp"
48
+                    android:gravity="center"
49
+                    android:textColor="#253A70"
50
+                    android:textSize="14sp" />
40 51
             </androidx.appcompat.widget.LinearLayoutCompat>
41 52
         </androidx.core.widget.NestedScrollView>
53
+
42 54
         <Button
43 55
             android:id="@+id/dialog_close_btn"
44 56
             android:layout_width="350dp"

+ 12
- 1
websocket/src/main/java/com/xhly/websocket/utils/SocketPushUtils.kt Voir le fichier

@@ -5,6 +5,7 @@ import com.xhly.corelib.eventbus.UIEvent
5 5
 import com.xhly.corelib.utils.GsonUtils
6 6
 import com.xhly.corelib.utils.LogShow
7 7
 import com.xhly.websocket.bean.WebSocketData
8
+import org.json.JSONObject
8 9
 
9 10
 object SocketPushUtils {
10 11
     fun dealPushMessage(content: String) {
@@ -22,7 +23,17 @@ object SocketPushUtils {
22 23
                         //发送消息 body{userid,username,msg}
23 24
                         var msg=""
24 25
                         if (socketData.body!=null){
25
-                            msg=socketData.body.toString()
26
+                           try {
27
+                               val jsonObject = JSONObject(content)
28
+                               val body = jsonObject.get("body").toString()
29
+                               val jsonMsg = JSONObject(body)
30
+                               val toString = jsonMsg.get("msg").toString()
31
+                               if (!toString.isNullOrBlank()){
32
+                                   msg=toString
33
+                               }
34
+                           }catch (e:Exception){
35
+
36
+                           }
26 37
                         }
27 38
                         UIEvent(Const.CODE2001.toString()).setMessage(msg).post()
28 39
                     }

Chargement…
Annuler
Enregistrer