Browse Source

[컨텐츠상세][Common] 함께 본 콘텐츠 태그형 태그 노출 최대 3개 반영

Hasemi 6 years ago
parent
commit
af82b22724

+ 4 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/recommend/RecommendContentsView.java

@@ -61,9 +61,11 @@ public class RecommendContentsView extends ConstraintLayout {
   private void init(Context context) {
     LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     inflater.inflate(R.layout.recommend_contents_view, this);
-
+    textViewTitle = findViewById(R.id.text_view_title);
+    textViewSubTitle = findViewById(R.id.text_view_sub_title);
     recyclerViewRecommendContents = findViewById(R.id.recycler_view_recommend_contents);
     customIndicator = findViewById(R.id.custom_indicator);
+
     layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
 
     recyclerViewRecommendContents.addItemDecoration(new RecyclerView.ItemDecoration() {
@@ -117,6 +119,7 @@ public class RecommendContentsView extends ConstraintLayout {
 
   public void draw(Context context, List<WithShownItemBean> withItemList, IEventListener listener) {
     this.withItemList = withItemList;
+
     customIndicator.setIndicatorSetting(recyclerViewRecommendContents, R.color.C19000000, R.color.C000000, ResourceUtil.dpToPx(0));
     if (null == withItemList) {
       Log.e("APP#  RecommendContentsView | draw", "|" + "withItemList is null......");

+ 19 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/recommend/RecommendContentsViewHolder.java

@@ -41,6 +41,7 @@ public class RecommendContentsViewHolder extends RecyclerView.ViewHolder {
   private TextView textViewTitle;
   private TextView textViewTag1; //함께 보면 좋은 콘텐츠 태그 기반일때
   private TextView textViewTag2; //함께 보면 좋은 콘텐츠 태그 기반일때
+  private TextView textViewTag3; //함께 보면 좋은 콘텐츠 태그 기반일때
   private ImageView imageViewBackground;
   private View dim;
 
@@ -50,6 +51,7 @@ public class RecommendContentsViewHolder extends RecyclerView.ViewHolder {
     textViewTitle = itemView.findViewById(R.id.text_view_title);
     textViewTag1 = itemView.findViewById(R.id.text_view_tag1);
     textViewTag2 = itemView.findViewById(R.id.text_view_tag2);
+    textViewTag3 = itemView.findViewById(R.id.text_view_tag3);
     imageViewBackground = itemView.findViewById(R.id.image_view_background);
     dim = itemView.findViewById(R.id.view_dim);
     Visibler.invisible(dim);
@@ -62,7 +64,21 @@ public class RecommendContentsViewHolder extends RecyclerView.ViewHolder {
       List<TagBean> tagBeans = bean.getTagList();
       if (null != tagBeans) {
         TagBean tagBean;
-        if (tagBeans.size() > 1) {
+        if (tagBeans.size() > 2) {
+          tagBean = tagBeans.get(2);
+          if (null != tagBean) {
+            textViewTag3.setText(StringUtil.toTag(tagBean.getTagName()));
+          }
+          tagBean = tagBeans.get(1);
+          if (null != tagBean) {
+            textViewTag2.setText(StringUtil.toTag(tagBean.getTagName()));
+          }
+          tagBean = tagBeans.get(0);
+          if (null != tagBean) {
+            textViewTag1.setText(StringUtil.toTag(tagBean.getTagName()));
+          }
+        }
+        else if (tagBeans.size() > 1) {
           tagBean = tagBeans.get(1);
           if (null != tagBean) {
             textViewTag2.setText(StringUtil.toTag(tagBean.getTagName()));
@@ -71,6 +87,7 @@ public class RecommendContentsViewHolder extends RecyclerView.ViewHolder {
           if (null != tagBean) {
             textViewTag1.setText(StringUtil.toTag(tagBean.getTagName()));
           }
+          textViewTag3.setText("");
         }
         else if (tagBeans.size() > 0) {
           tagBean = tagBeans.get(0);
@@ -87,6 +104,7 @@ public class RecommendContentsViewHolder extends RecyclerView.ViewHolder {
       else {
         textViewTag1.setText("");
         textViewTag2.setText("");
+        textViewTag3.setText("");
       }
 
       imageViewBackground.setScaleType(ImageView.ScaleType.CENTER);

+ 13 - 0
app/src/main/res/layout/recomment_contents_view_item.xml

@@ -78,4 +78,17 @@
     app:layout_constraintBottom_toBottomOf="parent"
     app:layout_constraintStart_toEndOf="@+id/text_view_tag1"
     tools:text="#즐기는방법"/>
+
+  <TextView
+    android:id="@+id/text_view_tag3"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="7dp"
+    android:layout_marginBottom="18dp"
+    android:lineSpacingExtra="4sp"
+    android:textColor="@color/CFFFFFF"
+    android:textSize="11sp"
+    app:layout_constraintBottom_toBottomOf="parent"
+    app:layout_constraintStart_toEndOf="@+id/text_view_tag2"
+    tools:text="#즐기는방법"/>
 </android.support.constraint.ConstraintLayout>