Ver código fonte

[공통][New] 좋아요 체크박스 애니메이션

hyodong.min 7 anos atrás
pai
commit
88ee0db02c

+ 15 - 11
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/LikeCheckbox.java

@@ -8,6 +8,7 @@ import android.support.constraint.ConstraintLayout;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
+import android.view.MotionEvent;
 import android.view.View;
 import android.widget.Checkable;
 import android.widget.ImageView;
@@ -45,27 +46,30 @@ public class LikeCheckbox extends ConstraintLayout implements Checkable {
       inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       View view = inflater.inflate(R.layout.checkbox_like, this);
       checkImage = view.findViewById(R.id.icon_like);
-      checkImage.setOnClickListener(view1 -> {setChecked(!isChecked);});
+      checkImage.setOnTouchListener(new View.OnTouchListener() {
+        @Override
+        public boolean onTouch(View v, MotionEvent event) {
+          if (event.getAction() == MotionEvent.ACTION_DOWN) {
+            setChecked(!isChecked, true);
+          }
+          return false;
+        }
+      });
     }
   }
 
   @Override
   public void setChecked(boolean isChecked) {
-    this.isChecked = isChecked;
-    if (isChecked) {
-      Log.e("APP#  LikeCheckbox | setChecked", "|" + "들어옴" + isChecked);
-      checkImage.setImageResource(R.drawable.icon_like_on);
-    }
-    else {
-      checkImage.setImageResource(R.drawable.icon_like_off);
-    }
+    setChecked(isChecked, false);
   }
 
-  public void setChecked(boolean isChecked, boolean isAnim) {
+  private void setChecked(boolean isChecked, boolean isAnim) {
+    Log.e("APP#  LikeCheckbox | setChecked", "|" + "들어옴 " + isChecked + "," + isAnim);
+
     this.isChecked = isChecked;
+
     if (isChecked) {
       if (isAnim) {
-        Log.e("APP#  LikeCheckbox | setChecked", "|" + "들어옴" + isChecked + "," + isAnim);
         LikeAnimation likeAnimation = new LikeAnimation();
         likeAnimation.show(checkImage);
       }

+ 0 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/main/IMyMainView.java

@@ -35,12 +35,8 @@ public interface IMyMainView extends IView {
 
   void setBookmarkContentsLiked(int index, boolean isChecked);
 
-  void setBookmarkContentsLiked(int index, boolean isChecked, boolean isAnim);
-
   void setBookmarkContentsBookmarked(int index, boolean isChecked);
 
-  void setBookmarkContentsBookmarked(int index, boolean isChecked, boolean isAnim);
-
   void setCoin(String coin);
 
   void setCoupon(String coupon);

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

@@ -9,7 +9,6 @@ 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.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -279,16 +278,6 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
     }
   }
 
-  @Override
-  public void setBookmarkContentsLiked(int index, boolean isChecked, boolean isAnim) {
-    if (index == 0) {
-      likeCheck1.setChecked(isChecked, isAnim);
-    }
-    else {
-      likeCheck2.setChecked(isChecked, isAnim);
-    }
-  }
-
 
   @Override
   public void setBookmarkContentsBookmarked(int index, boolean isChecked) {
@@ -300,18 +289,6 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
     }
   }
 
-  @Override
-  public void setBookmarkContentsBookmarked(int index, boolean isChecked, boolean isAnim) {
-    Log.e("APP#  MyMainFragment | setBookmarkContentsBookmarked", "|" + isChecked + "," + isAnim);
-
-    if (index == 0) {
-      bookmarkCheck1.setChecked(isChecked, isAnim);
-    }
-    else {
-      bookmarkCheck2.setChecked(isChecked, isAnim);
-    }
-  }
-
   @Override
   public abstract void setCoin(String coin);
 

+ 3 - 6
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/my/main/MyMainPresenter.java

@@ -10,6 +10,7 @@ import android.util.Log;
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.bean.BucketDeliveryBean;
 import kr.co.zumo.app.lifeplus.bean.ContentsDeliveryBean;
+import kr.co.zumo.app.lifeplus.bean.api.BookmarkBean;
 import kr.co.zumo.app.lifeplus.bean.api.BucketWithTagBean;
 import kr.co.zumo.app.lifeplus.bean.api.LifeplusContentsBean;
 import kr.co.zumo.app.lifeplus.config.NetworkConfig;
@@ -214,8 +215,8 @@ public class MyMainPresenter extends Presenter<MyMainModel, IMyMainView> {
         }
         else {
           //북마크 리스트 상세클릭시
-          bean = model.getMyBookmarkList().get(index);
-          contentsDeliveryBean = new ContentsDeliveryBean.Builder(bean).build();
+          BookmarkBean bookmarkBean = model.getMyBookmarkList().get(index);
+          contentsDeliveryBean = new ContentsDeliveryBean.Builder(bookmarkBean).listItemNo(bookmarkBean.getListItemNo()).build();
           model.setDeliveryPackaging(contentsDeliveryBean);
           go(ScreenID.CONTENTS);
         }
@@ -276,14 +277,10 @@ public class MyMainPresenter extends Presenter<MyMainModel, IMyMainView> {
         }
         else if (integer == Event.CONTENTS_BOOKMARK) {
           // 북마크의 북마크(체크박스)
-          Log.e("APP#  MyMainPresenter | onResult", "|" + " in ==>");
-          view.setBookmarkContentsBookmarked(event.getIndex(), event.getBool(), true);
           view.drawBookmarkLabel(model.getExpectedMyBookmarkSize());
         }
         else if (integer == Event.CONTENTS_LIKE) {
           // 북마크의 좋아요(체크박스)
-          Log.e("APP#  MyMainPresenter | onResult", "|" + "like in");
-          view.setBookmarkContentsLiked(event.getIndex(), event.getBool(), true);
         }
         else {
           // best bucket