Bladeren bron

[이벤트][Common] 이벤트 추천컨텐츠 태그형 구현

Hasemi 7 jaren geleden
bovenliggende
commit
4e69238d8c

+ 34 - 5
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventSelectRecommendTagAdapter.java

@@ -1,12 +1,17 @@
 package kr.co.zumo.app.lifeplus.view.screen.event;
 
 import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
 
 import java.util.List;
 
-import kr.co.zumo.app.lifeplus.bean.api.LifeplusContentsBean;
+import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.TextImageBean;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
-import kr.co.zumo.app.lifeplus.view.screen.my.bucketlist.BucketListDetailAdapter;
 
 /**
  * EventSelectRecommendTagAdapter
@@ -18,10 +23,34 @@ import kr.co.zumo.app.lifeplus.view.screen.my.bucketlist.BucketListDetailAdapter
  * @history 하세미   [2019-01-10]   [최초 작성]
  * @since 2019-01-10
  */
-public class EventSelectRecommendTagAdapter extends BucketListDetailAdapter {
+public class EventSelectRecommendTagAdapter extends RecyclerView.Adapter<EventSelectRecommendViewHolder> {
 
+  private Context context;
+  private List<TextImageBean> beans;
+  private IEventListener listener;
+  private LayoutInflater inflater;
 
-  public EventSelectRecommendTagAdapter(Context context, List<LifeplusContentsBean> beans, IEventListener listener) {
-    super(context, beans, listener);
+  public EventSelectRecommendTagAdapter(Context context, List<TextImageBean> beans, IEventListener listener) {
+    this.context = context;
+    this.beans = beans;
+    this.listener = listener;
+    this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+  }
+
+  @NonNull
+  @Override
+  public EventSelectRecommendViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+    View view = inflater.inflate(R.layout.event_select_recommend_tag_item_view, parent, false);
+    return new EventSelectRecommendViewHolder(view);
+  }
+
+  @Override
+  public void onBindViewHolder(@NonNull EventSelectRecommendViewHolder holder, int position) {
+      holder.init(listener , beans.get(position));
+  }
+
+  @Override
+  public int getItemCount() {
+    return beans.size();
   }
 }

+ 27 - 10
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventSelectRecommendTagHolder.java

@@ -1,10 +1,13 @@
 package kr.co.zumo.app.lifeplus.view.screen.event;
 
-import android.net.Uri;
+import android.content.Context;
+import android.graphics.Rect;
 import android.support.constraint.ConstraintLayout;
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.widget.CheckBox;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -13,7 +16,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import kr.co.zumo.app.R;
-import kr.co.zumo.app.lifeplus.bean.api.LifeplusContentsBean;
+import kr.co.zumo.app.lifeplus.bean.TextImageBean;
+import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
 
@@ -35,7 +39,9 @@ public class EventSelectRecommendTagHolder extends EventDetailView {
   private LinearLayout linearLayoutContents;
   private RecyclerView recyclerViewEventList;
   private ConstraintLayout layoutNothing;
-  private List<LifeplusContentsBean> beans;
+  private List<TextImageBean> beans;
+  private LayoutInflater inflater;
+
 
   public EventSelectRecommendTagHolder(View itemView) {
     super(itemView);
@@ -49,14 +55,28 @@ public class EventSelectRecommendTagHolder extends EventDetailView {
 
   @Override
   public void init(IEventListener listener) {
+    inflater = (LayoutInflater) itemView.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     imageViewBackGround.setImageDrawable(itemView.getResources().getDrawable(R.drawable.img_bestbucket_banner_1));
     textViewEventTitle.setText("한화님이 좋아하는 데이트 유형은?");
     textViewSelectTitle.setText("#신나는 #실내 #따뜻한분위기\n#매콤달콤한 소스의 닭요리");
     setDummyData();
+
+    View view = inflater.inflate(R.layout.tag, linearLayoutContents, false);
+    CheckBox checkBox = view.findViewById(R.id.check_box);
+    checkBox.setText(String.format("#%s", "tag"));
+    linearLayoutContents.addView(view);
+
+    recyclerViewEventList.addItemDecoration(new RecyclerView.ItemDecoration() {
+      @Override
+      public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
+        outRect.top = ResourceUtil.dpToPx(10);
+        outRect.bottom = ResourceUtil.dpToPx(10);
+      }
+    });
     recyclerViewEventList.setAdapter(new EventSelectRecommendTagAdapter(itemView.getContext(), beans, new IEventListener() {
       @Override
       public void onEvent(Event event) {
-        listener.onEvent(event);
+
       }
     }));
     recyclerViewEventList.setLayoutManager(new LinearLayoutManager(itemView.getContext(), LinearLayoutManager.VERTICAL, false));
@@ -64,11 +84,8 @@ public class EventSelectRecommendTagHolder extends EventDetailView {
 
   private void setDummyData() {
     beans = new ArrayList<>();
-    LifeplusContentsBean bean = new LifeplusContentsBean();
-    Uri uri = Uri.parse("android.resource://" + itemView.getContext().getPackageName() + "/drawable/banner_bg_1");
-    bean.setImageUrl(uri.toString());
-    bean.setSubTitle("subTitle");
-    bean.setTitle("title");
-    beans.add(bean);
+    for (int i = 0; i < 10; i++) {
+      beans.add(new TextImageBean(R.drawable.banner_bg_1, R.string.life_plus));
+    }
   }
 }

+ 43 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/event/EventSelectRecommendViewHolder.java

@@ -0,0 +1,43 @@
+package kr.co.zumo.app.lifeplus.view.screen.event;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.TextImageBean;
+import kr.co.zumo.app.lifeplus.view.IEventListener;
+
+/**
+ * EventSelectRecommendViewHolder
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2019-01-10]   [최초 작성]
+ * @since 2019-01-10
+ */
+public class EventSelectRecommendViewHolder extends RecyclerView.ViewHolder {
+
+  private ImageView imageViewContents;
+  private TextView textViewContents;
+  private CheckBox checkBoxLike;
+  private CheckBox checkBoxBookmark;
+
+
+  public EventSelectRecommendViewHolder(View itemView) {
+    super(itemView);
+    imageViewContents = itemView.findViewById(R.id.image_view_book_mark);
+    textViewContents = itemView.findViewById(R.id.text_view_book_mark_title);
+    checkBoxLike = itemView.findViewById(R.id.like_check);
+    checkBoxBookmark = itemView.findViewById(R.id.book_mark_check);
+  }
+
+  public void init(IEventListener listener, TextImageBean bean) {
+    imageViewContents.setImageResource(bean.getImageResource());
+    textViewContents.setText(bean.getTextResource());
+  }
+}

+ 1 - 1
app/src/main/res/layout/custom_square_check_box.xml

@@ -19,7 +19,7 @@
     android:paddingEnd="17dp"
     android:paddingBottom="7dp"
     android:saveEnabled="false"
-    android:text="dkdldkdkdkdkdk"
+    tools:text="dkdldkdkdkdkdk"
     android:textAlignment="center"
     android:textColor="@drawable/my_faq_radio_text_selector"
     android:textSize="12sp"

+ 93 - 0
app/src/main/res/layout/event_select_recommend_tag_item_view.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
+  android:layout_width="match_parent"
+  android:layout_height="wrap_content">
+
+  <android.support.constraint.ConstraintLayout
+    android:id="@+id/fifth_layout"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    app:layout_constraintBottom_toBottomOf="parent"
+    app:layout_constraintEnd_toEndOf="parent"
+    app:layout_constraintStart_toStartOf="parent"
+    app:layout_constraintTop_toTopOf="parent">
+
+    <ImageView
+      android:id="@+id/image_view_book_mark"
+      android:layout_width="124dp"
+      android:layout_height="93dp"
+      android:scaleType="centerCrop"
+      app:layout_constraintBottom_toBottomOf="parent"
+      app:layout_constraintEnd_toStartOf="@+id/text_view_book_mark_title"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintTop_toTopOf="parent"
+      tools:src="@drawable/img_bestbucket_banner_1"/>
+
+    <TextView
+      android:id="@+id/text_view_book_mark_title"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_marginStart="18dp"
+      android:layout_marginTop="16dp"
+      android:lineSpacingExtra="6sp"
+      android:textColor="@color/C000000"
+      android:textSize="14sp"
+      app:layout_constraintBottom_toTopOf="@id/layout_like_bookmark"
+      app:layout_constraintStart_toEndOf="@+id/image_view_book_mark"
+      app:layout_constraintTop_toTopOf="parent"
+      app:layout_goneMarginBottom="27dp"
+      app:layout_goneMarginTop="27dp"
+      tools:text="@string/book_mark_default_text2"
+      />
+
+    <android.support.constraint.ConstraintLayout
+      android:id="@+id/layout_like_bookmark"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:layout_marginStart="14dp"
+      android:layout_marginTop="8dp"
+      android:layout_marginEnd="208dp"
+      android:layout_marginBottom="16dp"
+      app:layout_constraintHorizontal_bias="1.0"
+      app:layout_constraintStart_toEndOf="@+id/image_view_book_mark"
+      app:layout_constraintTop_toBottomOf="@+id/text_view_book_mark_title"
+      >
+
+      <CheckBox
+        android:id="@+id/like_check"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@null"
+        android:button="@null"
+        android:drawableLeft="@drawable/custom_like_check"
+        android:paddingStart="6dp"
+        android:paddingEnd="4dp"
+        android:saveEnabled="false"
+        android:text=""
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_bias="0.0"/>
+
+      <CheckBox
+        android:id="@+id/book_mark_check"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:background="@null"
+        android:button="@null"
+        android:drawableLeft="@drawable/custom_book_mark_check"
+        android:paddingStart="4dp"
+        android:paddingEnd="6dp"
+        android:saveEnabled="false"
+        android:text=""
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/like_check"
+        app:layout_constraintTop_toTopOf="parent"/>
+
+    </android.support.constraint.ConstraintLayout>
+  </android.support.constraint.ConstraintLayout>
+</android.support.constraint.ConstraintLayout>
+

+ 8 - 6
app/src/main/res/layout/event_select_type_recommend_tag.xml

@@ -73,26 +73,26 @@
             android:id="@+id/text_view_event_title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_marginTop="91dp"
             android:lineSpacingExtra="8sp"
             android:textColor="@color/CFFFFFF"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
             android:textSize="21sp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
-            android:layout_marginTop="91dp"
             tools:text="한화님이 좋아하는 데이트 유형은?"/>
 
           <TextView
             android:id="@+id/text_view_select_title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
             android:gravity="center_horizontal"
             android:lineSpacingExtra="5.5sp"
             android:textColor="@color/CC3C3C3"
             android:textSize="14sp"
-            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
-            android:layout_marginTop="8dp"
+            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/text_view_event_title"
             tools:text="#신나는 #실내 #따뜻한분위기
 #매콤달콤한 소스의 닭요리"/>
@@ -153,9 +153,11 @@
       android:id="@+id/recycler_view_event_list_detail"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginTop="10dp"
+      android:layout_marginTop="17dp"
       android:clipToPadding="false"
+      android:paddingStart="25dp"
       android:paddingTop="15dp"
+      android:paddingEnd="25dp"
       app:layout_behavior="@string/appbar_scrolling_view_behavior"
       />