|
|
@@ -3,16 +3,27 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.view.screen.menu;
|
|
|
|
|
|
+import android.animation.AnimatorSet;
|
|
|
+import android.animation.ObjectAnimator;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.annotation.Nullable;
|
|
|
+import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
+import android.view.animation.Animation;
|
|
|
+import android.view.animation.AnimationUtils;
|
|
|
+import android.widget.FrameLayout;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
|
|
|
import kr.co.zumo.app.lifeplus.util.AppUtil;
|
|
|
+import kr.co.zumo.app.lifeplus.util.ResourceUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
|
|
|
|
|
|
@@ -27,6 +38,15 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
|
|
|
* @since 2018. 10. 17.
|
|
|
*/
|
|
|
public class AllMenuFragment extends FragmentBase<AllMenuPresenter> implements IAllMenuView {
|
|
|
+
|
|
|
+ private TextView textViewCategory0;
|
|
|
+ private TextView textViewCategory1;
|
|
|
+ private TextView textViewCategory2;
|
|
|
+ private TextView textViewCategory3;
|
|
|
+ private TextView textViewCategory4;
|
|
|
+ private List<TextView> categoryList;
|
|
|
+ private FrameLayout layoutFrame;
|
|
|
+
|
|
|
@Nullable
|
|
|
@Override
|
|
|
protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
|
@@ -36,17 +56,33 @@ public class AllMenuFragment extends FragmentBase<AllMenuPresenter> implements I
|
|
|
@Override
|
|
|
protected void onAfterActivityCreated(Bundle savedInstanceState) {
|
|
|
|
|
|
- findViewById(R.id.text_view_category_0).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FIRST_CATEGORY).build()));
|
|
|
- findViewById(R.id.text_view_category_1).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.SECOND_CATEGORY).build()));
|
|
|
- findViewById(R.id.text_view_category_2).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.THIRD_CATEGORY).build()));
|
|
|
- findViewById(R.id.text_view_category_3).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FOURTH_CATEGORY).build()));
|
|
|
- findViewById(R.id.text_view_category_4).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FIFTH_CATEGORY).build()));
|
|
|
+ textViewCategory0 = findViewById(R.id.text_view_category_0);
|
|
|
+ textViewCategory1 = findViewById(R.id.text_view_category_1);
|
|
|
+ textViewCategory2 = findViewById(R.id.text_view_category_2);
|
|
|
+ textViewCategory3 = findViewById(R.id.text_view_category_3);
|
|
|
+ textViewCategory4 = findViewById(R.id.text_view_category_4);
|
|
|
+
|
|
|
+ categoryList = new ArrayList<>();
|
|
|
+ categoryList.add(textViewCategory0);
|
|
|
+ categoryList.add(textViewCategory1);
|
|
|
+ categoryList.add(textViewCategory2);
|
|
|
+ categoryList.add(textViewCategory3);
|
|
|
+ categoryList.add(textViewCategory4);
|
|
|
+
|
|
|
+ textViewCategory0.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FIRST_CATEGORY).build()));
|
|
|
+ textViewCategory1.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.SECOND_CATEGORY).build()));
|
|
|
+ textViewCategory2.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.THIRD_CATEGORY).build()));
|
|
|
+ textViewCategory3.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FOURTH_CATEGORY).build()));
|
|
|
+ textViewCategory4.setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FIFTH_CATEGORY).build()));
|
|
|
+
|
|
|
|
|
|
findViewById(R.id.text_my).setOnClickListener(v -> presenter.onEvent(new Event.Builder(Event.MY).build()));
|
|
|
findViewById(R.id.text_view_faq).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.FAQ).build()));
|
|
|
findViewById(R.id.text_event).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.EVENT).build()));
|
|
|
findViewById(R.id.text_view_life_plus_guide).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.GUIDE).build()));
|
|
|
|
|
|
+ layoutFrame = findViewById(android.R.id.content);
|
|
|
+
|
|
|
if (AppUtil.isDebug()) {
|
|
|
findViewById(R.id.text_coupon).setVisibility(View.VISIBLE);
|
|
|
findViewById(R.id.text_coupon).setOnClickListener(view -> presenter.onEvent(new Event.Builder(Event.COUPON_MALL).build()));
|
|
|
@@ -54,6 +90,28 @@ public class AllMenuFragment extends FragmentBase<AllMenuPresenter> implements I
|
|
|
else {
|
|
|
findViewById(R.id.text_coupon).setVisibility(View.GONE);
|
|
|
}
|
|
|
+
|
|
|
+ setDefaultAnimationSetting();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setDefaultAnimationSetting() {
|
|
|
+ for (int i = 0; i < categoryList.size(); ++i) {
|
|
|
+ TextView categoryText = categoryList.get(i);
|
|
|
+ categoryText.setTranslationX(ResourceUtil.dpToPx(90));
|
|
|
+ categoryText.setAlpha(0f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void hideMenuAnimation() {
|
|
|
+ // <-------------------------------------
|
|
|
+// ObjectAnimator translationX = ObjectAnimator.ofFloat(layoutFrame, View.TRANSLATION_X, layoutFrame.getWidth(), 0f);
|
|
|
+// translationX.setDuration(500);
|
|
|
+// translationX.start();
|
|
|
+ Log.w("APP# AllMenuFragment | hideMenuAnimation", "|" + "hide Menu A");
|
|
|
+ Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.activity_slide_in_enter);
|
|
|
+ layoutFrame.startAnimation(animation);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -96,4 +154,29 @@ public class AllMenuFragment extends FragmentBase<AllMenuPresenter> implements I
|
|
|
public void showNotiAnimation(boolean isNewNoti, boolean isAnim) {
|
|
|
getHelper(ActionBarHelper.class).setNotiMarker(isNewNoti, isAnim);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 메뉴 애니메이션 추가
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void showMenuAnimation() {
|
|
|
+
|
|
|
+ AnimatorSet animatorSet = new AnimatorSet();
|
|
|
+
|
|
|
+ for (int i = 0; i < categoryList.size(); ++i) {
|
|
|
+ TextView categoryText = categoryList.get(i);
|
|
|
+ ObjectAnimator translationX = ObjectAnimator.ofFloat(categoryText, View.TRANSLATION_X, categoryText.getTranslationX(), 0f);
|
|
|
+ ObjectAnimator alpha = ObjectAnimator.ofFloat(categoryText, View.ALPHA, 0.0f, 1f);
|
|
|
+
|
|
|
+ translationX.setDuration(700);
|
|
|
+ translationX.setStartDelay(100 * i + 1);
|
|
|
+
|
|
|
+ alpha.setDuration(700);
|
|
|
+ alpha.setStartDelay(100 * i + 1);
|
|
|
+
|
|
|
+ animatorSet.playTogether(translationX, alpha);
|
|
|
+ }
|
|
|
+
|
|
|
+ animatorSet.start();
|
|
|
+ }
|
|
|
}
|