Explorar o código

Merge branch 'develop' of https://github.com/swict/LifeplusAndroid into develop

hyodong.min %!s(int64=7) %!d(string=hai) anos
pai
achega
49648b27b5

+ 0 - 14
app/src/main/java/kr/co/zumo/app/lifeplus/view/BookmarkAnimation.java

@@ -1,14 +0,0 @@
-package kr.co.zumo.app.lifeplus.view;
-
-/**
- * BookmarkAnimation
- * <pre>
- * </pre>
- *
- * @author 하세미
- * @version 1.0
- * @history 하세미   [2019-01-14]   [최초 작성]
- * @since 2019-01-14
- */
-public class BookmarkAnimation {
-}

+ 90 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/BookmarkCheckbox.java

@@ -0,0 +1,90 @@
+/*
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
+ */
+package kr.co.zumo.app.lifeplus.view.custom;
+
+import android.content.Context;
+import android.support.constraint.ConstraintLayout;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Checkable;
+import android.widget.ImageView;
+
+import kr.co.zumo.app.R;
+
+/**
+ * BookmarkCheckbox
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2019-01-15]   [최초 작성]
+ * @since 2019-01-15
+ */
+public class BookmarkCheckbox extends ConstraintLayout implements Checkable {
+
+  private LayoutInflater inflater;
+  private ImageView checkImage;
+  private boolean isChecked;
+
+  public BookmarkCheckbox(Context context) {
+    super(context);
+    init(context);
+  }
+
+  public BookmarkCheckbox(Context context, AttributeSet attrs) {
+    super(context, attrs);
+    init(context);
+  }
+
+  private void init(Context context) {
+    if (null != context) {
+      inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+      View view = inflater.inflate(R.layout.checkbox_bookmark, this);
+      checkImage = view.findViewById(R.id.icon_bookmark);
+      checkImage.setOnClickListener(view1 -> {setChecked(!isChecked);});
+    }
+  }
+
+  @Override
+  public void setChecked(boolean isChecked) {
+    this.isChecked = isChecked;
+    if (isChecked) {
+      checkImage.setImageResource(R.drawable.icon_bookmark_on);
+    }
+    else {
+      checkImage.setImageResource(R.drawable.icon_bookmark_off);
+    }
+  }
+
+  public void setChecked(boolean isChecked, boolean isAnim) {
+    this.isChecked = isChecked;
+    if (isChecked) {
+      if (isAnim) {
+        Log.e("APP#  BookmarkCheckbox | setChecked", "|" + "animation  들어옴");
+        BookmarkAnimation bookmarkAnimation = new BookmarkAnimation();
+        bookmarkAnimation.show(checkImage);
+      }
+      else {
+        checkImage.setImageResource(R.drawable.icon_bookmark_on);
+      }
+    }
+    else {
+      checkImage.setImageResource(R.drawable.icon_bookmark_off);
+    }
+
+  }
+
+  @Override
+  public boolean isChecked() {
+    return isChecked;
+  }
+
+  @Override
+  public void toggle() {
+    //nothing
+  }
+}

+ 92 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/LikeCheckbox.java

@@ -0,0 +1,92 @@
+/*
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
+ */
+package kr.co.zumo.app.lifeplus.view.custom;
+
+import android.content.Context;
+import android.support.constraint.ConstraintLayout;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Checkable;
+import android.widget.ImageView;
+
+import kr.co.zumo.app.R;
+
+/**
+ * LikeCheckbox
+ * <pre>
+ * </pre>
+ *
+ * @author 하세미
+ * @version 1.0
+ * @history 하세미   [2019-01-15]   [최초 작성]
+ * @since 2019-01-15
+ */
+public class LikeCheckbox extends ConstraintLayout implements Checkable {
+
+  private LayoutInflater inflater;
+  private ImageView checkImage;
+  private boolean isChecked;
+
+  public LikeCheckbox(Context context) {
+    super(context);
+    init(context);
+  }
+
+  public LikeCheckbox(Context context, AttributeSet attrs) {
+    super(context, attrs);
+    init(context);
+  }
+
+  private void init(Context context) {
+    if (null != context) {
+      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);});
+    }
+  }
+
+  @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);
+    }
+  }
+
+  public void setChecked(boolean isChecked, boolean isAnim) {
+    this.isChecked = isChecked;
+    if (isChecked) {
+      if (isAnim) {
+        Log.e("APP#  LikeCheckbox | setChecked", "|" + "들어옴" + isChecked + "," + isAnim);
+        LikeAnimation likeAnimation = new LikeAnimation();
+        likeAnimation.show(checkImage);
+      }
+      else {
+        checkImage.setImageResource(R.drawable.icon_like_on);
+      }
+    }
+    else {
+      checkImage.setImageResource(R.drawable.icon_like_off);
+    }
+
+  }
+
+
+  @Override
+  public boolean isChecked() {
+    return isChecked;
+  }
+
+  @Override
+  public void toggle() {
+
+  }
+}

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

@@ -35,8 +35,12 @@ 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);

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

@@ -9,10 +9,10 @@ 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;
-import android.widget.CheckBox;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -30,6 +30,8 @@ import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
 import kr.co.zumo.app.lifeplus.view.IEventListener;
+import kr.co.zumo.app.lifeplus.view.custom.BookmarkCheckbox;
+import kr.co.zumo.app.lifeplus.view.custom.LikeCheckbox;
 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;
@@ -75,10 +77,10 @@ public abstract class MyMainFragment extends FragmentBase<MyMainPresenter> imple
   protected TextView textBucketLabel;
   protected TextView textBenefitLabel;
 
-  protected CheckBox likeCheck1;
-  protected CheckBox likeCheck2;
-  protected CheckBox bookmarkCheck1;
-  protected CheckBox bookmarkCheck2;
+  protected LikeCheckbox likeCheck1;
+  protected LikeCheckbox likeCheck2;
+  protected BookmarkCheckbox bookmarkCheck1;
+  protected BookmarkCheckbox bookmarkCheck2;
   protected MyBucketListAdapter bucketListAdapter;
 
 
@@ -277,6 +279,17 @@ 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) {
     if (index == 0) {
@@ -287,6 +300,18 @@ 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);
 

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

@@ -276,12 +276,14 @@ public class MyMainPresenter extends Presenter<MyMainModel, IMyMainView> {
         }
         else if (integer == Event.CONTENTS_BOOKMARK) {
           // 북마크의 북마크(체크박스)
-          view.setBookmarkContentsBookmarked(event.getIndex(), event.getBool());
+          Log.e("APP#  MyMainPresenter | onResult", "|" + " in ==>");
+          view.setBookmarkContentsBookmarked(event.getIndex(), event.getBool(), true);
           view.drawBookmarkLabel(model.getExpectedMyBookmarkSize());
         }
         else if (integer == Event.CONTENTS_LIKE) {
           // 북마크의 좋아요(체크박스)
-          view.setBookmarkContentsLiked(event.getIndex(), event.getBool());
+          Log.e("APP#  MyMainPresenter | onResult", "|" + "like in");
+          view.setBookmarkContentsLiked(event.getIndex(), event.getBool(), true);
         }
         else {
           // best bucket

+ 20 - 0
app/src/main/res/layout/checkbox_bookmark.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<merge
+  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="wrap_content"
+  android:layout_height="wrap_content">
+
+  <ImageView
+    android:id="@+id/icon_bookmark"
+    android:layout_width="wrap_content"
+    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"
+    app:srcCompat="@drawable/icon_bookmark_off"
+    />
+
+</merge>

+ 20 - 0
app/src/main/res/layout/checkbox_like.xml

@@ -0,0 +1,20 @@
+<?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="wrap_content"
+  android:layout_height="wrap_content">
+
+  <ImageView
+    android:id="@+id/icon_like"
+    android:layout_width="wrap_content"
+    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"
+    app:srcCompat="@drawable/icon_like_off"
+    />
+
+</android.support.constraint.ConstraintLayout>

+ 7 - 32
app/src/main/res/layout/fragment_my_main.xml

@@ -467,38 +467,25 @@
         android:layout_marginEnd="208dp"
         android:layout_marginBottom="16dp"
         android:visibility="gone"
+        tools:visibility="visible"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintHorizontal_bias="1.0"
         app:layout_constraintStart_toEndOf="@+id/image_view_book_mark1"
         app:layout_constraintTop_toBottomOf="@+id/text_view_book_mark1">
 
-        <CheckBox
+        <kr.co.zumo.app.lifeplus.view.custom.LikeCheckbox
           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"/>
+          android:paddingEnd="4dp"/>
 
-        <CheckBox
+        <kr.co.zumo.app.lifeplus.view.custom.BookmarkCheckbox
           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"/>
@@ -557,34 +544,22 @@
         app:layout_constraintTop_toBottomOf="@+id/text_view_book_mark2"
         tools:visibility="visible">
 
-        <CheckBox
+        <kr.co.zumo.app.lifeplus.view.custom.LikeCheckbox
           android:id="@+id/like_check2"
           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"/>
+          app:layout_constraintTop_toTopOf="parent"/>
 
-        <CheckBox
+        <kr.co.zumo.app.lifeplus.view.custom.BookmarkCheckbox
           android:id="@+id/book_mark_check2"
           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_check2"
           app:layout_constraintTop_toTopOf="parent"/>