浏览代码

[마이][Common] 북마크 클릭 이벤트 추가 및 버킷리스트 미리보기 오류사항 수정

Hasemi 7 年之前
父节点
当前提交
6b9fc82c3d

+ 2 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/bucketlist/MyBucketListAdapter.java

@@ -3,6 +3,7 @@ package kr.co.zumo.app.lifeplus.view.screen.my.bucketlist;
 import android.content.Context;
 import android.support.annotation.NonNull;
 import android.support.v7.widget.RecyclerView;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -32,6 +33,7 @@ public class MyBucketListAdapter extends RecyclerView.Adapter<MyBucketListViewHo
   public MyBucketListAdapter(Context context, List<BucketWithTagBean> myBucketListBeanList, IEventListener listener) {
     this.context = context;
     this.myBucketListBeanList = myBucketListBeanList;
+    Log.e("APP#  MyBucketListAdapter | MyBucketListAdapter", "|" + myBucketListBeanList.size());
     this.listener = listener;
   }
 

+ 23 - 93
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/main/MyMainFragment.java

@@ -6,6 +6,8 @@ import android.support.annotation.Nullable;
 import android.support.constraint.ConstraintLayout;
 import android.support.design.widget.TabLayout;
 import android.support.v4.view.ViewPager;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -22,7 +24,9 @@ import kr.co.zumo.app.lifeplus.bean.api.BucketBean;
 import kr.co.zumo.app.lifeplus.bean.api.BucketWithTagBean;
 import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
 import kr.co.zumo.app.lifeplus.view.Event;
+import kr.co.zumo.app.lifeplus.view.IEventListener;
 import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
+import kr.co.zumo.app.lifeplus.view.screen.my.bucketlist.MyBucketListAdapter;
 import kr.co.zumo.app.lifeplus.view.screen.my.bucketlist.MyBucketListBannerPagerAdapter;
 
 /**
@@ -50,21 +54,7 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
   protected ConstraintLayout layoutLikeBookmark2;
 
   protected ConstraintLayout layoutMyBucketListPreview;
-  protected ConstraintLayout layoutBucketCardView1;
-  protected ConstraintLayout layoutBucketCardView2;
-
-  protected TextView textViewBucketCardViewTitle1;
-  protected TextView textViewBucketCardViewTitle2;
-
-  protected TextView textViewBucket1HashTag1;
-  protected TextView textViewBucket1HashTag2;
-
-  protected TextView textViewBucket2HashTag1;
-  protected TextView textViewBucket2HashTag2;
-
-
-  protected ImageView imageViewCheckedBucket1;
-  protected ImageView imageViewCheckedBucket2;
+  protected RecyclerView recyclerViewBucketListPreview;
 
   protected ConstraintLayout layoutMemberHeader;
   protected ConstraintLayout layoutGuestHeader;
@@ -104,21 +94,9 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
     arrowBucket = findViewById(R.id.image_view_arrow_bucket_list);
     textBucketLabel = findViewById(R.id.text_view_exists_bucket_list);
 
-    imageViewCheckedBucket1 = findViewById(R.id.image_view_bucket_check1);
-    imageViewCheckedBucket2 = findViewById(R.id.image_view_bucket_check2);
 
     layoutMyBucketListPreview = findViewById(R.id.layout_my_bucket_list_preview);
-    layoutBucketCardView1 = findViewById(R.id.my_bucket_list_card_view1);
-    layoutBucketCardView2 = findViewById(R.id.my_bucket_list_card_view2);
-
-
-    textViewBucketCardViewTitle1 = findViewById(R.id.text_view_my_bucket_title1);
-    textViewBucketCardViewTitle2 = findViewById(R.id.text_view_my_bucket_title2);
-    textViewBucket1HashTag1 = findViewById(R.id.text_view_bucket_hash_tag1);
-    textViewBucket1HashTag2 = findViewById(R.id.text_view_bucket_hash_tag2);
-    textViewBucket2HashTag1 = findViewById(R.id.text_view_bucket2_hash_tag1);
-    textViewBucket2HashTag2 = findViewById(R.id.text_view_bucket2_hash_tag2);
-
+    recyclerViewBucketListPreview = findViewById(R.id.recycler_view_bucket_preview);
 
     findViewById(R.id.text_view_my_coin).setOnClickListener(view -> {presenter.onEvent(new Event.Builder(Event.MY_COIN_MAIN).build());});
     findViewById(R.id.image_view_my_coin_arrow).setOnClickListener(view -> {presenter.onEvent(new Event.Builder(Event.MY_COIN_MAIN).build());});
@@ -191,6 +169,8 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
       layoutLikeBookmark2.setVisibility(View.VISIBLE);
       Glide.with(imageViewBookmark2).load(bookmarkBeans.get(1).getImageUrl()).into(imageViewBookmark2);
 
+      textViewBookmarkCount.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.BOOK_MARK_LIST).build()));
+
       textViewBookmark1.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.BOOK_MARK).index(0).build()));
       imageViewBookmark1.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.BOOK_MARK).index(0).build()));
 
@@ -247,74 +227,24 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
 
   @Override
   public void drawMyBucketList(ArrayList<BucketWithTagBean> myBucketBeans) {
-    if (myBucketBeans.size() == 0) {
-      layoutMyBucketListPreview.setVisibility(View.GONE);
-    }
-    else if (myBucketBeans.size() == 1) {
-      layoutMyBucketListPreview.setVisibility(View.VISIBLE);
-      layoutBucketCardView1.setVisibility(View.VISIBLE);
-      layoutBucketCardView2.setVisibility(View.GONE);
-      textViewBucketCardViewTitle1.setText(myBucketBeans.get(0).getTitle());
-      layoutBucketCardView1.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.DETAIL).index(0).build()));
-
-      if (myBucketBeans.get(0).isCompleted()) {
-        layoutBucketCardView1.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));
+    ArrayList<BucketWithTagBean> previewBucketList = new ArrayList<>();
+    int count = 0;
+    for (int i = 0; i < myBucketBeans.size(); ++i) {
+      if (!myBucketBeans.get(i).isCompleted()) {
+        if (count < 2) {
+          previewBucketList.add(myBucketBeans.get(i));
+        }
+        count++;
       }
-      else {
-        layoutBucketCardView1.setBackground(getResources().getDrawable(R.drawable.faq_answer_border));
-      }
-
-      imageViewCheckedBucket1.setVisibility(myBucketBeans.get(0).isCompleted() ? View.VISIBLE : View.INVISIBLE);
-      if (myBucketBeans.get(0).getTagList().size() == 1) {
-        textViewBucket1HashTag1.setText(myBucketBeans.get(0).getTagList().get(0).getTagName());
-      }
-
     }
-    else {
-      layoutMyBucketListPreview.setVisibility(View.VISIBLE);
-      layoutBucketCardView1.setVisibility(View.VISIBLE);
-      layoutBucketCardView2.setVisibility(View.VISIBLE);
-      textViewBucketCardViewTitle1.setText(myBucketBeans.get(0).getTitle());
-      textViewBucketCardViewTitle2.setText(myBucketBeans.get(1).getTitle());
-      layoutBucketCardView1.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.DETAIL).index(0).build()));
-      layoutBucketCardView2.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.DETAIL).index(1).build()));
-
-      if (myBucketBeans.get(0).isCompleted()) {
-        layoutBucketCardView1.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));
+    MyBucketListAdapter adapter = new MyBucketListAdapter(getActivity(), previewBucketList, new IEventListener() {
+      @Override
+      public void onEvent(Event event) {
+        presenter.onEvent(new Event.Builder(Event.DETAIL).build());
       }
-      else {
-        layoutBucketCardView1.setBackground(getResources().getDrawable(R.drawable.faq_answer_border));
-      }
-
-      if (myBucketBeans.get(1).isCompleted()) {
-        layoutBucketCardView2.setBackgroundColor(getResources().getColor(R.color.CE5E5E5));
-      }
-      else {
-        layoutBucketCardView2.setBackground(getResources().getDrawable(R.drawable.faq_text_border));
-      }
-
-      imageViewCheckedBucket1.setVisibility(myBucketBeans.get(0).isCompleted() ? View.VISIBLE : View.INVISIBLE);
-      imageViewCheckedBucket2.setVisibility(myBucketBeans.get(1).isCompleted() ? View.VISIBLE : View.INVISIBLE);
-
-
-      if (myBucketBeans.get(0).getTagList().size() == 1) {
-        textViewBucket1HashTag1.setText(String.format("#%s", myBucketBeans.get(0).getTagList().get(0).getTagName()));
-      }
-      else if (myBucketBeans.get(0).getTagList().size() == 2) {
-        textViewBucket1HashTag1.setText(String.format("#%s",myBucketBeans.get(0).getTagList().get(0).getTagName()));
-        textViewBucket1HashTag2.setText(String.format("#%s",myBucketBeans.get(0).getTagList().get(1).getTagName()));
-      }
-
-      if (myBucketBeans.get(1).getTagList().size() == 1) {
-        textViewBucket2HashTag1.setText(String.format("#%s",myBucketBeans.get(0).getTagList().get(0).getTagName()));
-        //textViewBucket1HashTag2.setText(myBucketBeans.get(0).getTagList().get(1).getTagName());
-      }
-      else if (myBucketBeans.get(1).getTagList().size() == 2) {
-        textViewBucket2HashTag1.setText(String.format("#%s",myBucketBeans.get(1).getTagList().get(0).getTagName()));
-        textViewBucket2HashTag2.setText(String.format("#%s",myBucketBeans.get(1).getTagList().get(1).getTagName()));
-      }
-    }
-
+    });
+    recyclerViewBucketListPreview.setLayoutManager(new GridLayoutManager(getActivity(), 2));
+    recyclerViewBucketListPreview.setAdapter(adapter);
   }
 
   /**

+ 11 - 157
app/src/main/res/layout/fragment_my_main.xml

@@ -5,7 +5,7 @@
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
-  tools:layout_marginTop="-700dp"
+  tools:layout_marginTop="-900dp"
   android:orientation="vertical">
 
   <android.support.constraint.ConstraintLayout
@@ -594,165 +594,19 @@
 
     <android.support.constraint.ConstraintLayout
       android:id="@+id/layout_my_bucket_list_preview"
-      tools:visibility="visible"
-      android:layout_width="match_parent"
-      android:layout_height="wrap_content"
+      app:layout_constraintStart_toStartOf="parent"
+      app:layout_constraintEnd_toEndOf="parent"
       android:layout_marginStart="25dp"
-      android:layout_marginTop="25dp"
       android:layout_marginEnd="25dp"
-      android:visibility="gone"
-      app:layout_constraintEnd_toEndOf="parent"
-      app:layout_constraintStart_toStartOf="parent"
-      app:layout_constraintTop_toBottomOf="@+id/layout_best_bucket">
-
-      <android.support.constraint.Guideline
-        android:id="@+id/guide_line"
-        android:layout_width="1dp"
-        android:orientation="vertical"
-        app:layout_constraintGuide_begin="148dp"
-        android:layout_height="match_parent"/>
-      <android.support.constraint.ConstraintLayout
-        android:id="@+id/my_bucket_list_card_view1"
-        android:layout_width="148dp"
-        android:layout_height="148dp"
-        android:background="@drawable/faq_text_border"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toStartOf="@+id/guide_line"
-        >
-
-        <TextView
-          android:id="@+id/text_view_my_bucket_title1"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_marginStart="38dp"
-          android:layout_marginTop="30dp"
-          android:layout_marginEnd="23dp"
-          android:ellipsize="end"
-          android:lineSpacingExtra="6sp"
-          android:maxWidth="87dp"
-          android:maxLines="3"
-          android:textColor="@color/C000000"
-          android:textSize="14sp"
-          app:layout_constraintEnd_toEndOf="parent"
-          app:layout_constraintStart_toStartOf="parent"
-          app:layout_constraintTop_toTopOf="parent"
-          tools:text="나를 위한\n명품시계\n구매하기"/>
-
-        <TextView
-          android:id="@+id/text_view_bucket_hash_tag1"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_marginStart="38dp"
-          android:layout_marginBottom="29dp"
-          android:layout_toEndOf="@+id/text_view_bucket_hash_tag2"
-          android:lineSpacingExtra="4sp"
-          android:textColor="#666666"
-          android:textSize="11sp"
-          app:layout_constraintBottom_toBottomOf="parent"
-          app:layout_constraintStart_toStartOf="parent"
-          tools:text="#시계"/>
-
-        <TextView
-          android:id="@+id/text_view_bucket_hash_tag2"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_alignStart="@+id/text_view_my_bucket_title1"
-          android:layout_marginStart="5dp"
-          android:layout_marginBottom="29dp"
-          android:lineSpacingExtra="4sp"
-          android:textColor="@color/C666666"
-          android:textSize="11sp"
-          app:layout_constraintBottom_toBottomOf="parent"
-          app:layout_constraintStart_toEndOf="@+id/text_view_bucket_hash_tag1"
-          tools:layout_editor_absoluteX="72dp"
-          tools:text="#구매하기"/>
-
-        <ImageView
-          android:id="@+id/image_view_bucket_check1"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_alignTop="@+id/text_view_my_bucket_title1"
-          android:layout_alignParentStart="true"
-          android:layout_marginStart="23dp"
-          android:layout_marginTop="5dp"
-          android:layout_marginEnd="5dp"
-          app:layout_constraintEnd_toStartOf="@+id/text_view_my_bucket_title1"
-          app:layout_constraintStart_toStartOf="parent"
-          app:layout_constraintTop_toTopOf="@+id/text_view_my_bucket_title1"
-          app:srcCompat="@drawable/icon_bucket_complete"/>
-      </android.support.constraint.ConstraintLayout>
-
-      <android.support.constraint.ConstraintLayout
-        android:id="@+id/my_bucket_list_card_view2"
-        android:layout_width="148dp"
-        android:layout_height="148dp"
-        android:background="@drawable/faq_text_border"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toEndOf="@+id/guide_line">
-
-        <TextView
-          android:id="@+id/text_view_my_bucket_title2"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_marginStart="38dp"
-          android:layout_marginTop="30dp"
-          android:layout_marginEnd="23dp"
-          android:ellipsize="end"
-          android:lineSpacingExtra="6sp"
-          android:maxWidth="87dp"
-          android:maxLines="3"
-          android:text="나를 위한\n명품시계\n구매하기"
-          android:textColor="@color/C000000"
-          android:textSize="14sp"
-          app:layout_constraintEnd_toEndOf="parent"
-          app:layout_constraintStart_toStartOf="parent"
-          app:layout_constraintTop_toTopOf="parent"/>
-
-        <TextView
-          android:id="@+id/text_view_bucket2_hash_tag1"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_marginStart="38dp"
-          android:layout_marginBottom="29dp"
-          android:layout_toEndOf="@+id/text_view_bucket2_hash_tag2"
-          android:lineSpacingExtra="4sp"
-          android:text="#시계"
-          android:textColor="#666666"
-          android:textSize="11sp"
-          android:visibility="gone"
-          app:layout_constraintBottom_toBottomOf="parent"
-          app:layout_constraintStart_toStartOf="parent"/>
-
-        <TextView
-          android:id="@+id/text_view_bucket2_hash_tag2"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_alignStart="@+id/text_view_my_bucket_title2"
-          android:layout_marginStart="5dp"
-          android:layout_marginBottom="29dp"
-          android:lineSpacingExtra="4sp"
-          android:text="#구매하기"
-          android:textColor="@color/C666666"
-          android:textSize="11sp"
-          android:visibility="gone"
-          app:layout_constraintBottom_toBottomOf="parent"
-          app:layout_constraintStart_toEndOf="@+id/text_view_bucket2_hash_tag1"
-          tools:layout_editor_absoluteX="72dp"/>
+      android:layout_marginTop="20dp"
+      app:layout_constraintTop_toBottomOf="@+id/layout_best_bucket"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+      <android.support.v7.widget.RecyclerView
+        android:id="@+id/recycler_view_bucket_preview"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
 
-        <ImageView
-          android:id="@+id/image_view_bucket_check2"
-          android:layout_width="wrap_content"
-          android:layout_height="wrap_content"
-          android:layout_alignTop="@+id/text_view_my_bucket_title2"
-          android:layout_alignParentStart="true"
-          android:layout_marginStart="23dp"
-          android:layout_marginTop="5dp"
-          android:layout_marginEnd="5dp"
-          app:layout_constraintEnd_toStartOf="@+id/text_view_my_bucket_title2"
-          app:layout_constraintStart_toStartOf="parent"
-          app:layout_constraintTop_toTopOf="@+id/text_view_my_bucket_title2"
-          app:srcCompat="@drawable/icon_bucket_complete"/>
-      </android.support.constraint.ConstraintLayout>
     </android.support.constraint.ConstraintLayout>
 
     <android.support.constraint.ConstraintLayout