Quellcode durchsuchen

修改学生端首页关注逻辑

Pq vor 2 Jahren
Ursprung
Commit
2110cbd52c

+ 6 - 4
student/src/main/java/com/cooleshow/student/adapter/HomeRecommendTalentAdapter.java

@@ -48,11 +48,13 @@ public class HomeRecommendTalentAdapter extends BaseQuickAdapter<RecommendTalent
         }
         TextView tv_focus = holder.getView(R.id.tv_focus);
 
-        if (data.isFocus) {
-            tv_focus.setBackgroundResource(R.drawable.shape_border_f0f0f0_1dp);
-            tv_focus.setTextColor(getContext().getResources().getColor(R.color.color_999999));
+        if (data.watch) {
+            tv_focus.setText("已关注");
+            tv_focus.setBackgroundResource(com.cooleshow.base.R.drawable.shape_border_f0f0f0_1dp);
+            tv_focus.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
         } else {
-            tv_focus.setBackgroundResource(R.drawable.shape_2dc7aa_12dp);
+            tv_focus.setText("关注");
+            tv_focus.setBackgroundResource(com.cooleshow.base.R.drawable.shape_2dc7aa_12dp);
             tv_focus.setTextColor(getContext().getResources().getColor(R.color.white));
         }
     }

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

@@ -81,5 +81,5 @@ public class RecommendTalentListBean {
     public String username;
     public String videoDate;
     public String workUnit;
-    public boolean isFocus;
+    public boolean watch;
 }

+ 2 - 2
student/src/main/java/com/cooleshow/student/ui/main/NewHomeFragment.java

@@ -231,8 +231,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
                     //关注
                     if (position < mRecommendTalentAdapter.getData().size()) {
                         RecommendTalentListBean data = mRecommendTalentAdapter.getData().get(position);
-                        if (presenter != null) {
-                            presenter.followTeacher(data.isFocus ? Constants.STUDENT_FOCUS_TEACHER_STATUS_NORMAL : Constants.STUDENT_FOCUS_TEACHER_STATUS_FOLLOW, String.valueOf(data.userId));
+                        if (presenter != null && !data.watch) {
+                            presenter.followTeacher(Constants.STUDENT_FOCUS_TEACHER_STATUS_FOLLOW, String.valueOf(data.userId));
                         }
                     }
                 }