浏览代码

修改消息盒子图标显示

Pq 8 月之前
父节点
当前提交
bba050a2da

+ 11 - 1
student/src/main/java/com/cooleshow/student/adapter/MessageBoxAdapter.java

@@ -1,5 +1,6 @@
 package com.cooleshow.student.adapter;
 
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
@@ -10,6 +11,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.module.BaseLoadMoreModule;
 import com.chad.library.adapter.base.module.LoadMoreModule;
 import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
 import com.cooleshow.base.utils.TimeUtils;
 import com.cooleshow.student.R;
 import com.cooleshow.student.bean.SystemMessageBean;
@@ -44,7 +46,15 @@ public class MessageBoxAdapter extends BaseQuickAdapter<SystemMessageBean.RowsBe
         } else {
             view_unread.setVisibility(View.GONE);
         }
-        switch (item.subType) {
+        loadIcon(im_type, item.img, item.subType);
+    }
+
+    private void loadIcon(ImageView im_type, String img, String subType) {
+        if(!TextUtils.isEmpty(img)){
+            GlideUtils.INSTANCE.loadImage(getContext(),img,im_type,R.drawable.icon_message_other);
+            return;
+        }
+        switch (subType) {
             case "TEACHER_AUTH":
                 //老师认证
                 im_type.setBackgroundResource(R.drawable.icon_message_teacher_auth);

+ 1 - 0
student/src/main/java/com/cooleshow/student/bean/SystemMessageBean.java

@@ -54,6 +54,7 @@ public class SystemMessageBean {
         public String subType;
         public String title;
         public String type;
+        public String img;
         public long userId;
     }
 }

+ 17 - 8
teacher/src/main/java/com/cooleshow/teacher/adapter/MessageBoxAdapter.java

@@ -1,5 +1,6 @@
 package com.cooleshow.teacher.adapter;
 
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.TextView;
@@ -10,6 +11,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.module.BaseLoadMoreModule;
 import com.chad.library.adapter.base.module.LoadMoreModule;
 import com.chad.library.adapter.base.viewholder.BaseViewHolder;
+import com.cooleshow.base.utils.GlideUtils;
 import com.cooleshow.base.utils.TimeUtils;
 import com.cooleshow.teacher.R;
 import com.cooleshow.teacher.bean.SystemMessageBean;
@@ -44,7 +46,21 @@ public class MessageBoxAdapter extends BaseQuickAdapter<SystemMessageBean.RowsBe
         } else {
             view_unread.setVisibility(View.GONE);
         }
-        switch (item.subType) {
+        loadIcon(im_type, item.img, item.subType);
+    }
+
+    @NonNull
+    @Override
+    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
+        return new BaseLoadMoreModule(baseQuickAdapter);
+    }
+
+    private void loadIcon(ImageView im_type, String img, String subType) {
+        if(!TextUtils.isEmpty(img)){
+            GlideUtils.INSTANCE.loadImage(getContext(),img,im_type,R.drawable.icon_message_other);
+            return;
+        }
+        switch (subType) {
             case "TEACHER_AUTH":
                 //老师认证
                 im_type.setBackgroundResource(R.drawable.icon_message_teacher_auth);
@@ -107,11 +123,4 @@ public class MessageBoxAdapter extends BaseQuickAdapter<SystemMessageBean.RowsBe
                 im_type.setBackgroundResource(R.drawable.icon_message_other);
                 break;
         }
-    }
-
-    @NonNull
-    @Override
-    public BaseLoadMoreModule addLoadMoreModule(@NonNull BaseQuickAdapter<?, ?> baseQuickAdapter) {
-        return new BaseLoadMoreModule(baseQuickAdapter);
-    }
 }

+ 1 - 0
teacher/src/main/java/com/cooleshow/teacher/bean/SystemMessageBean.java

@@ -54,6 +54,7 @@ public class SystemMessageBean {
         public String subType;
         public String title;
         public String type;
+        public String img;
         public long userId;
     }
 }