Browse Source

1.修改通知消息布局。

20241218TB223FC(测试jar包)
wangwanlei 11 months ago
parent
commit
a764857eef

+ 1
- 1
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

625
                         titleTv.text = msgBean.title
625
                         titleTv.text = msgBean.title
626
                         contentTv.text = msgBean.content
626
                         contentTv.text = msgBean.content
627
                     } catch (e: Exception) {
627
                     } catch (e: Exception) {
628
-
628
+                        LogShow("解析失败"+e.toString())
629
                     }
629
                     }
630
                     closeBtn.setOnClickListener {
630
                     closeBtn.setOnClickListener {
631
                         dialog.dismiss()
631
                         dialog.dismiss()

+ 15
- 3
app/src/main/res/layout/layout_notice_dialog.xml View File

20
         android:gravity="center_horizontal"
20
         android:gravity="center_horizontal"
21
         android:orientation="vertical"
21
         android:orientation="vertical"
22
         android:padding="15dp">
22
         android:padding="15dp">
23
+
23
         <androidx.core.widget.NestedScrollView
24
         <androidx.core.widget.NestedScrollView
24
             android:layout_width="match_parent"
25
             android:layout_width="match_parent"
25
             android:layout_height="0dp"
26
             android:layout_height="0dp"
26
             android:layout_weight="1">
27
             android:layout_weight="1">
28
+
27
             <androidx.appcompat.widget.LinearLayoutCompat
29
             <androidx.appcompat.widget.LinearLayoutCompat
28
                 android:layout_width="match_parent"
30
                 android:layout_width="match_parent"
29
-                android:layout_height="match_parent">
31
+                android:layout_height="match_parent"
32
+                android:orientation="vertical">
33
+
30
                 <TextView
34
                 <TextView
31
                     android:id="@+id/dialog_title_tv"
35
                     android:id="@+id/dialog_title_tv"
32
                     android:layout_width="match_parent"
36
                     android:layout_width="match_parent"
33
                     android:layout_height="wrap_content"
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
                 <TextView
43
                 <TextView
37
                     android:id="@+id/dialog_content_tv"
44
                     android:id="@+id/dialog_content_tv"
38
                     android:layout_width="match_parent"
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
             </androidx.appcompat.widget.LinearLayoutCompat>
51
             </androidx.appcompat.widget.LinearLayoutCompat>
41
         </androidx.core.widget.NestedScrollView>
52
         </androidx.core.widget.NestedScrollView>
53
+
42
         <Button
54
         <Button
43
             android:id="@+id/dialog_close_btn"
55
             android:id="@+id/dialog_close_btn"
44
             android:layout_width="350dp"
56
             android:layout_width="350dp"

+ 12
- 1
websocket/src/main/java/com/xhly/websocket/utils/SocketPushUtils.kt View File

5
 import com.xhly.corelib.utils.GsonUtils
5
 import com.xhly.corelib.utils.GsonUtils
6
 import com.xhly.corelib.utils.LogShow
6
 import com.xhly.corelib.utils.LogShow
7
 import com.xhly.websocket.bean.WebSocketData
7
 import com.xhly.websocket.bean.WebSocketData
8
+import org.json.JSONObject
8
 
9
 
9
 object SocketPushUtils {
10
 object SocketPushUtils {
10
     fun dealPushMessage(content: String) {
11
     fun dealPushMessage(content: String) {
22
                         //发送消息 body{userid,username,msg}
23
                         //发送消息 body{userid,username,msg}
23
                         var msg=""
24
                         var msg=""
24
                         if (socketData.body!=null){
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
                         UIEvent(Const.CODE2001.toString()).setMessage(msg).post()
38
                         UIEvent(Const.CODE2001.toString()).setMessage(msg).post()
28
                     }
39
                     }

Loading…
Cancel
Save