Bläddra i källkod

1.添加有未读消息状态接口和UI

王鹏鹏 2 år sedan
förälder
incheckning
44d7c9dced

+ 11 - 2
push/src/main/java/com/yingyang/push/activity/MessgeListActivity.kt

@@ -1,5 +1,6 @@
 package com.yingyang.push.activity
 
+import android.text.TextUtils
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.yingyang.push.adapter.PushListAdapter
 import com.yingyang.push.adapter.PushTypeAdapter
@@ -42,7 +43,10 @@ class MessgeListActivity : BaseMVVMActivity<ActivityMessgeListBinding, PushViewM
             //消息列表
             rvPush.adapter = pushListAdapter
             pushListAdapter.onPushClickListener = { bean ->
-                updateReadMsg("")
+                if (TextUtils.equals("0", bean.status).not()) {
+                    updateReadMsg(bean.id)
+                }
+                JumpUtil.jumpActivityWithUrl(RouterUrlCommon.WEB_VIEW_INTERACTION_JS, bean.msgUrl)
             }
         }
     }
@@ -54,6 +58,11 @@ class MessgeListActivity : BaseMVVMActivity<ActivityMessgeListBinding, PushViewM
     }
 
     override fun initData() {
+
+    }
+
+    override fun onResume() {
+        super.onResume()
         getPushList()
         getMeaageList()
     }
@@ -102,7 +111,7 @@ class MessgeListActivity : BaseMVVMActivity<ActivityMessgeListBinding, PushViewM
         viewModel.updateReadMsg(msgId, fail = {
             it.toast()
         }, success = {
-            getMeaageList()
+
         })
     }
 

+ 14 - 6
push/src/main/java/com/yingyang/push/adapter/PushListAdapter.kt

@@ -2,6 +2,7 @@ package com.yingyang.push.adapter
 
 import android.annotation.SuppressLint
 import android.graphics.Typeface
+import android.text.TextUtils
 import com.yingyang.push.R
 import com.yingyang.push.databinding.ItemPushListBinding
 import com.yingyang.push.databinding.ItemPushTypeBinding
@@ -9,6 +10,7 @@ import com.yingyang.push.entity.PushMessageBean
 import com.yingyang.push.entity.PushMessageTypeBean
 import com.yingyangfly.baselib.adapter.BaseDataBindingAdapter
 import com.yingyangfly.baselib.ext.setOnSingleClickListener
+import com.yingyangfly.baselib.ext.setTextColorResource
 
 /**
  * 推送类型adapter
@@ -18,8 +20,6 @@ class PushListAdapter(override val layoutId: Int = R.layout.item_push_list) :
 
     var onPushClickListener: ((bean: PushMessageBean) -> Unit)? = null
 
-    private var currentPosition = 0
-
     @SuppressLint("NotifyDataSetChanged")
     override fun onBindViewHolder(
         binding: ItemPushListBinding,
@@ -27,11 +27,19 @@ class PushListAdapter(override val layoutId: Int = R.layout.item_push_list) :
         position: Int
     ) {
         binding.data = item
-        if (currentPosition == position) {
-            binding.imageTips.setBackgroundResource(R.drawable.selector_push_radio_checked)
+        if (TextUtils.equals("缴费提醒", item.msgType)) {
+            binding.imageTips.setBackgroundResource(R.mipmap.icon_notify_pay)
+        } else if (TextUtils.equals("报告提醒", item.msgType)) {
+            binding.imageTips.setBackgroundResource(R.mipmap.icon_notify_text)
         } else {
-            binding.imageTips.setBackgroundResource(R.drawable.selector_push_radio_unchecked)
-
+            binding.imageTips.setBackgroundResource(R.mipmap.icon_notify_remind)
+        }
+        if (TextUtils.equals("0", item.status)) {
+            binding.tvStatus.text = "已读"
+            binding.tvStatus.setTextColorResource(R.color.color_FF4A76FF)
+        } else {
+            binding.tvStatus.text = "未读"
+            binding.tvStatus.setTextColorResource(R.color.color_FFFF2B2B)
         }
         binding.messageLayout.setOnSingleClickListener {
             notifyDataSetChanged()

+ 9 - 3
push/src/main/java/com/yingyang/push/entity/PushMessageBean.kt

@@ -4,7 +4,13 @@ package com.yingyang.push.entity
  * 消息通知列表bean
  */
 data class PushMessageBean(
-    val dictLabel: String,
-    val dictType: String,
-    val dictValue: String
+    val createTime: String,
+    val id: String,
+    val msgTitle: String,
+    val msgType: String,//提醒类型
+    val msgUrl: String,
+    val orgCode: String,
+    val orgName: String,
+    val status: String,
+    val updateTime: String
 )

+ 2 - 1
push/src/main/res/layout/activity_messge_list.xml

@@ -96,7 +96,8 @@
                     <androidx.recyclerview.widget.RecyclerView
                         android:id="@+id/rvPush"
                         android:layout_width="match_parent"
-                        android:layout_height="match_parent" />
+                        android:layout_height="match_parent"
+                        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
 
                 </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 

+ 19 - 2
push/src/main/res/layout/item_push_list.xml

@@ -21,16 +21,29 @@
 
         <androidx.appcompat.widget.AppCompatImageView
             android:id="@+id/imageTips"
-            android:layout_width="@dimen/dimen_27dp"
-            android:layout_height="@dimen/divider_32px"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/divider_24px"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintLeft_toLeftOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/pushType"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/divider_8px"
+            android:text="@{data.msgType}"
+            android:textColor="@color/color_FF4A76FF"
+            android:textSize="@dimen/divider_28px"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintLeft_toRightOf="@+id/imageTips"
+            app:layout_constraintTop_toTopOf="parent" />
+
         <TextView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:text="@{data.msgTitle}"
             android:textColor="@color/color_FF4A76FF"
             android:textSize="@dimen/divider_24px"
             app:layout_constraintBottom_toBottomOf="parent"
@@ -44,18 +57,22 @@
             android:layout_height="wrap_content"
             android:layout_marginTop="@dimen/divider_23px"
             android:layout_marginEnd="@dimen/divider_35px"
+            android:text="@{data.createTime}"
             android:textColor="@color/color_FF2B70FF"
             android:textSize="@dimen/divider_20px"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
         <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tvStatus"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginTop="@dimen/divider_4px"
             android:layout_marginEnd="@dimen/divider_35px"
+            android:layout_marginBottom="@dimen/divider_23px"
             android:textColor="@color/color_FFFF2B2B"
             android:textSize="@dimen/divider_20px"
+            app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintRight_toRightOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/tvDate" />
 

BIN
push/src/main/res/mipmap-xxhdpi/icon_notify_pay.png


BIN
push/src/main/res/mipmap-xxhdpi/icon_notify_remind.png


BIN
push/src/main/res/mipmap-xxhdpi/icon_notify_text.png


+ 5 - 6
workbenches/src/main/java/com/yingyang/workbenches/leisurebrain/LeisureBrainActivity.kt

@@ -21,12 +21,11 @@ class LeisureBrainActivity :
     }
 
     override fun initListener() {
-        binding.btnPlay.setOnClickListener {
-            if (url.isNotEmpty()) {
-//                url = "http://60.205.201.7/123.mp4"
-                JumpUtil.jumpActivityWithUrl(RouterUrlCommon.videoPlayer, url)
-            }
-        }
+//        binding.btnPlay.setOnClickListener {
+//            if (url.isNotEmpty()) {
+//                JumpUtil.jumpActivityWithUrl(RouterUrlCommon.videoPlayer, url)
+//            }
+//        }
 
         binding.layoutHead.setOnSingleClickListener {
             JumpUtil.jumpActivity(RouterUrlCommon.workbenches)

+ 0 - 10
workbenches/src/main/res/layout/activity_leisure_brain.xml

@@ -39,16 +39,6 @@
                 android:textStyle="bold" />
         </LinearLayout>
 
-        <Button
-            android:id="@+id/btnPlay"
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/divider_80px"
-            android:text="播放"
-            android:textColor="@android:color/black"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintLeft_toLeftOf="parent"
-            app:layout_constraintRight_toRightOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
 
     </androidx.constraintlayout.widget.ConstraintLayout>