|
|
@@ -4,21 +4,19 @@
|
|
|
package kr.co.zumo.app.lifeplus.helper;
|
|
|
|
|
|
import android.content.Context;
|
|
|
-import android.graphics.drawable.AnimationDrawable;
|
|
|
-import android.graphics.drawable.Drawable;
|
|
|
import android.support.annotation.StringRes;
|
|
|
import android.support.constraint.ConstraintLayout;
|
|
|
-import android.support.v4.graphics.drawable.DrawableCompat;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
-import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.animation.BookmarkAnimation;
|
|
|
import kr.co.zumo.app.lifeplus.view.animation.BucketListCheckAnimation;
|
|
|
import kr.co.zumo.app.lifeplus.view.animation.LikeAnimation;
|
|
|
@@ -65,6 +63,7 @@ public class NavigationBar {
|
|
|
|
|
|
private Builder builder;
|
|
|
private boolean isWhite;
|
|
|
+ private List<BlackWhite> blackWhiteList;
|
|
|
|
|
|
private NavigationBar(Context context) {
|
|
|
|
|
|
@@ -118,6 +117,22 @@ public class NavigationBar {
|
|
|
setClickListener(imageBi);
|
|
|
setClickListener(buttonEdit);
|
|
|
|
|
|
+ blackWhiteList = new ArrayList<>();
|
|
|
+ blackWhiteList.add(new BlackWhite(imageBi));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonBack));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonSearch));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonMenu));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonArrow));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonHome));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonNotification));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonSetting));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonClose));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonTrash));
|
|
|
+ blackWhiteList.add(new BlackWhiteAnimation(buttonConfirm));
|
|
|
+ blackWhiteList.add(new BlackWhite(buttonShare));
|
|
|
+ blackWhiteList.add(new BlackWhiteAnimation(buttonLike));
|
|
|
+ blackWhiteList.add(new BlackWhiteAnimation(buttonBookmark));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void setClickListener(View view) {
|
|
|
@@ -378,51 +393,23 @@ public class NavigationBar {
|
|
|
buttonArrow.setImageResource(R.drawable.icon_header_up);
|
|
|
}
|
|
|
isArrowOpened = !isArrowOpened;
|
|
|
- setWhiteDrawable(buttonArrow.getDrawable(), builder.isWhite);
|
|
|
+ getBlackWhite(buttonArrow).change(isWhite);
|
|
|
}
|
|
|
|
|
|
private void setWhiteUi(boolean isWhite) {
|
|
|
- int color;
|
|
|
- if (isWhite) {
|
|
|
- color = ResourceUtil.getColor(R.color.CFFFFFF);
|
|
|
- }
|
|
|
- else {
|
|
|
- color = ResourceUtil.getColor(R.color.C000000);
|
|
|
- }
|
|
|
- actionBarTitle.setTextColor(color);
|
|
|
- textButton.setTextColor(color);
|
|
|
- setWhiteDrawable(imageBi.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonBack.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonSearch.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonMenu.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonArrow.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonHome.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonNotification.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonSetting.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonClose.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonTrash.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonConfirm.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonShare.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonLike.getDrawable(), isWhite);
|
|
|
- setWhiteDrawable(buttonBookmark.getDrawable(), isWhite);
|
|
|
-
|
|
|
this.isWhite = isWhite;
|
|
|
- }
|
|
|
-
|
|
|
- private void setWhiteDrawable(Drawable drawable, boolean isWhite) {
|
|
|
- if (drawable instanceof AnimationDrawable) {
|
|
|
- // animation 적용된 drawable 은 컬러 변경 제외
|
|
|
- return;
|
|
|
+ for (BlackWhite blackWhite : blackWhiteList) {
|
|
|
+ blackWhite.change(isWhite);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- int color;
|
|
|
- if (isWhite) {
|
|
|
- color = ResourceUtil.getColor(R.color.CFFFFFF);
|
|
|
- }
|
|
|
- else {
|
|
|
- color = ResourceUtil.getColor(R.color.C000000);
|
|
|
+ private BlackWhite getBlackWhite(ImageView imageView) {
|
|
|
+ for (BlackWhite blackWhite : blackWhiteList) {
|
|
|
+ if (blackWhite.getImageView().equals(imageView)) {
|
|
|
+ return blackWhite;
|
|
|
+ }
|
|
|
}
|
|
|
- DrawableCompat.setTint(drawable, color);
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/***********************************
|
|
|
@@ -479,6 +466,8 @@ public class NavigationBar {
|
|
|
}
|
|
|
|
|
|
public void setCompleted(boolean isChecked, boolean isAnim) {
|
|
|
+ BlackWhite blackWhite = getBlackWhite(buttonConfirm);
|
|
|
+ blackWhite.setChecked(isChecked);
|
|
|
if (isChecked) {
|
|
|
if (isAnim) {
|
|
|
BucketListCheckAnimation bucketListCheckAnimation = new BucketListCheckAnimation();
|
|
|
@@ -490,7 +479,7 @@ public class NavigationBar {
|
|
|
}
|
|
|
else {
|
|
|
buttonConfirm.setImageResource(R.drawable.ic_icon_bucket_complete_default);
|
|
|
- setWhiteDrawable(buttonConfirm.getDrawable(), isWhite);
|
|
|
+ blackWhite.change(isWhite);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -500,6 +489,8 @@ public class NavigationBar {
|
|
|
* @param isChecked
|
|
|
*/
|
|
|
public void setLiked(boolean isChecked, boolean isAnim) {
|
|
|
+ BlackWhite blackWhite = getBlackWhite(buttonLike);
|
|
|
+ blackWhite.setChecked(isChecked);
|
|
|
if (isChecked) {
|
|
|
if (isAnim) {
|
|
|
LikeAnimation likeAnimation = new LikeAnimation();
|
|
|
@@ -511,7 +502,7 @@ public class NavigationBar {
|
|
|
}
|
|
|
else {
|
|
|
buttonLike.setImageResource(R.drawable.icon_header_like_wh_off);
|
|
|
- setWhiteDrawable(buttonLike.getDrawable(), isWhite);
|
|
|
+ blackWhite.change(isWhite);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -525,6 +516,8 @@ public class NavigationBar {
|
|
|
* @param isChecked
|
|
|
*/
|
|
|
public void setBookmarked(boolean isChecked, boolean isAnim) {
|
|
|
+ BlackWhite blackWhite = getBlackWhite(buttonBookmark);
|
|
|
+ blackWhite.setChecked(isChecked);
|
|
|
if (isChecked) {
|
|
|
if (isAnim) {
|
|
|
BookmarkAnimation bookmarkAnimation = new BookmarkAnimation();
|
|
|
@@ -536,7 +529,7 @@ public class NavigationBar {
|
|
|
}
|
|
|
else {
|
|
|
buttonBookmark.setImageResource(R.drawable.icon_header_bookmark_wh_off);
|
|
|
- setWhiteDrawable(buttonBookmark.getDrawable(), isWhite);
|
|
|
+ blackWhite.change(isWhite);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -547,6 +540,8 @@ public class NavigationBar {
|
|
|
* @param isAnim
|
|
|
*/
|
|
|
public void setNotiMarker(boolean isNewNoti, boolean isAnim) {
|
|
|
+ BlackWhite blackWhite = getBlackWhite(buttonNotification);
|
|
|
+ blackWhite.setChecked(isNewNoti);
|
|
|
if (isNewNoti) {
|
|
|
if (isAnim) {
|
|
|
NotiAnimation notiAnimation = new NotiAnimation();
|
|
|
@@ -558,7 +553,7 @@ public class NavigationBar {
|
|
|
}
|
|
|
else {
|
|
|
buttonNotification.setImageResource(R.drawable.icon_header_notice);
|
|
|
- setWhiteDrawable(buttonNotification.getDrawable(), builder.isWhite);
|
|
|
+ blackWhite.change(isWhite);
|
|
|
}
|
|
|
}
|
|
|
|