|
|
@@ -1,15 +1,16 @@
|
|
|
package kr.co.zumo.app.lifeplus.view.custom;
|
|
|
|
|
|
+import android.animation.Animator;
|
|
|
+import android.animation.ObjectAnimator;
|
|
|
import android.content.Context;
|
|
|
-import android.os.Handler;
|
|
|
+import android.support.constraint.ConstraintLayout;
|
|
|
import android.support.v4.app.FragmentActivity;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
-import android.view.animation.Animation;
|
|
|
-import android.view.animation.AnimationUtils;
|
|
|
import android.widget.FrameLayout;
|
|
|
|
|
|
import kr.co.zumo.app.R;
|
|
|
+import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
|
|
|
@@ -32,7 +33,7 @@ public class Tutorial {
|
|
|
|
|
|
public final static int TUTORIAL_LISTICLE_COVER = 0;
|
|
|
public final static int TUTORIAL_LISTICLE_DETAIL = 1;
|
|
|
- public final static int TUTORIAL_BUCKET = 3;
|
|
|
+ public final static int TUTORIAL_BUCKET = 2;
|
|
|
|
|
|
|
|
|
public void showTutorial(FragmentActivity activity, int tutorialID, IEventListener listener) {
|
|
|
@@ -44,7 +45,7 @@ public class Tutorial {
|
|
|
|
|
|
switch (tutorialID) {
|
|
|
case TUTORIAL_LISTICLE_COVER:
|
|
|
- showTutorialListicle(listener);
|
|
|
+ showTutorialListicleCover(listener);
|
|
|
break;
|
|
|
case TUTORIAL_LISTICLE_DETAIL:
|
|
|
showTutorialListicleDetail(listener);
|
|
|
@@ -59,141 +60,275 @@ public class Tutorial {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void showTutorialListicle(IEventListener listener) {
|
|
|
- Animation fadeOut = AnimationUtils.loadAnimation(activity, R.anim.fade_out);
|
|
|
+ /**
|
|
|
+ * 공통으로 사용되는 ObjectAnimator 객체 반환
|
|
|
+ *
|
|
|
+ * @param target
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ObjectAnimator fadeOut(View target) {
|
|
|
+ target.clearAnimation();
|
|
|
+ ObjectAnimator fadeOut;
|
|
|
+ fadeOut = ObjectAnimator.ofFloat(
|
|
|
+ target,
|
|
|
+ View.ALPHA,
|
|
|
+ 1.0f,
|
|
|
+ 0.0f
|
|
|
+ );
|
|
|
+ return fadeOut;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showTutorialListicleCover(IEventListener listener) {
|
|
|
View view = inflater.inflate(R.layout.tutorial_listicle_cover, null);
|
|
|
frameLayout.addView(view);
|
|
|
- view.setClickable(true);
|
|
|
+ ConstraintLayout bubble1 = view.findViewById(R.id.tutorial_listicle_cover1);
|
|
|
+ ConstraintLayout bubble2 = view.findViewById(R.id.tutorial_listicle_cover2);
|
|
|
+
|
|
|
+ ObjectAnimator firstTutorial = fadeOut(bubble1);
|
|
|
+ firstTutorial.setStartDelay(1000);
|
|
|
+ firstTutorial.setDuration(1000);
|
|
|
+ firstTutorial.start();
|
|
|
+
|
|
|
+ ObjectAnimator secondTutorial = fadeOut(bubble2);
|
|
|
+ secondTutorial.setStartDelay(1000);
|
|
|
+ secondTutorial.setDuration(1000);
|
|
|
+
|
|
|
+ firstTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_cover1).startAnimation(fadeOut);
|
|
|
- view.findViewById(R.id.tutorial_listicle_cover1).setVisibility(View.GONE);
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ bubble2.setVisibility(View.VISIBLE);
|
|
|
+ secondTutorial.start();
|
|
|
+
|
|
|
}
|
|
|
- }, 1000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_cover2).setVisibility(View.VISIBLE);
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 2000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_cover2).startAnimation(fadeOut);
|
|
|
- // view.findViewById(R.id.tutorial_listicle_cover2).setVisibility(View.GONE);
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 3000);
|
|
|
+ });
|
|
|
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
+ secondTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
frameLayout.removeView(view);
|
|
|
listener.onEvent(new Event.Builder(Event.NEXT).build());
|
|
|
}
|
|
|
- }, 4000);
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private void showTutorialListicleDetail(IEventListener listener) {
|
|
|
- Animation fadeOut = AnimationUtils.loadAnimation(activity, R.anim.fade_out);
|
|
|
View view = inflater.inflate(R.layout.tutorial_listicle_detail, null);
|
|
|
frameLayout.addView(view);
|
|
|
view.setClickable(true);
|
|
|
+ ConstraintLayout bubble1 = view.findViewById(R.id.tutorial_listicle_detail1);
|
|
|
+ ConstraintLayout bubble2 = view.findViewById(R.id.tutorial_listicle_detail2);
|
|
|
+
|
|
|
+ ObjectAnimator firstTutorial = fadeOut(bubble1);
|
|
|
+ firstTutorial.setStartDelay(1000);
|
|
|
+ firstTutorial.setDuration(1000);
|
|
|
+ firstTutorial.start();
|
|
|
|
|
|
+ ObjectAnimator secondTutorial = fadeOut(bubble2);
|
|
|
+ secondTutorial.setStartDelay(1000);
|
|
|
+ secondTutorial.setDuration(1000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
+ firstTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_detail1).startAnimation(fadeOut);
|
|
|
- view.findViewById(R.id.tutorial_listicle_detail1).setVisibility(View.GONE);
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ bubble2.setVisibility(View.VISIBLE);
|
|
|
+ secondTutorial.start();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 1000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_detail2).setVisibility(View.VISIBLE);
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 2000);
|
|
|
+ });
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
+
|
|
|
+ secondTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- view.findViewById(R.id.tutorial_listicle_detail2).startAnimation(fadeOut);
|
|
|
- view.findViewById(R.id.tutorial_listicle_detail2).setVisibility(View.GONE);
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 3000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
frameLayout.removeView(view);
|
|
|
}
|
|
|
- }, 5000);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void showTutorialBucketTag(IEventListener listener) {
|
|
|
- Animation fadeOut = AnimationUtils.loadAnimation(activity, R.anim.fade_out);
|
|
|
View firstView = inflater.inflate(R.layout.tutorial_bucket_list_tag, null);
|
|
|
+ ConstraintLayout bubble1 = firstView.findViewById(R.id.tutorial_bucket_list_tag1);
|
|
|
+ ConstraintLayout bubble2 = firstView.findViewById(R.id.tutorial_bucket_list_tag2);
|
|
|
+
|
|
|
View secondView = inflater.inflate(R.layout.tutorial_bucket_list_update, null);
|
|
|
+ ConstraintLayout bubble3 = secondView.findViewById(R.id.tutorial_bucket_list_success);
|
|
|
|
|
|
frameLayout.addView(firstView);
|
|
|
firstView.setClickable(true);
|
|
|
+ ObjectAnimator first = fadeOut(bubble1);
|
|
|
+ first.setDuration(1000);
|
|
|
+ first.setStartDelay(1000);
|
|
|
+ first.start();
|
|
|
+
|
|
|
+ ObjectAnimator second = fadeOut(bubble2);
|
|
|
+ second.setDuration(1000);
|
|
|
+ second.setStartDelay(1000);
|
|
|
+
|
|
|
+ ObjectAnimator third = fadeOut(bubble3);
|
|
|
+ third.setDuration(1000);
|
|
|
+ third.setStartDelay(1000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
+ ObjectAnimator translateAnimator1 =
|
|
|
+ ObjectAnimator.ofFloat(secondView, View.TRANSLATION_X, SuperModel.getInstance().getScreenWidth(), 0f);
|
|
|
+ translateAnimator1.setDuration(500);
|
|
|
+
|
|
|
+ first.addListener(new Animator.AnimatorListener() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- firstView.findViewById(R.id.tutorial_bucket_list_tag1).startAnimation(fadeOut);
|
|
|
- firstView.findViewById(R.id.tutorial_bucket_list_tag1).setVisibility(View.GONE);
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ bubble2.setVisibility(View.VISIBLE);
|
|
|
+ second.start();
|
|
|
}
|
|
|
- }, 2000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
|
|
|
- firstView.findViewById(R.id.tutorial_bucket_list_tag2).setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
- }, 3000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
|
|
|
- firstView.findViewById(R.id.tutorial_bucket_list_tag2).startAnimation(fadeOut);
|
|
|
- firstView.findViewById(R.id.tutorial_bucket_list_tag2).setVisibility(View.GONE);
|
|
|
}
|
|
|
- }, 4000);
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
+ second.addListener(new Animator.AnimatorListener() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- frameLayout.removeView(firstView);
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ // frameLayout.removeView(firstView);
|
|
|
frameLayout.addView(secondView);
|
|
|
+ secondView.setTranslationX(SuperModel.getInstance().getScreenWidth());
|
|
|
+ translateAnimator1.start();
|
|
|
}
|
|
|
- }, 6000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
- secondView.findViewById(R.id.tutorial_bucket_list_success).startAnimation(fadeOut);
|
|
|
- secondView.findViewById(R.id.tutorial_bucket_list_success).setVisibility(View.GONE);
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
|
|
|
}
|
|
|
- }, 7000);
|
|
|
|
|
|
- new Handler().postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
- public void run() {
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ third.addListener(new Animator.AnimatorListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ frameLayout.removeView(firstView);
|
|
|
frameLayout.removeView(secondView);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ translateAnimator1.addListener(new Animator.AnimatorListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationStart(Animator animator) {
|
|
|
+
|
|
|
}
|
|
|
- }, 9000);
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ third.start();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onAnimationRepeat(Animator animator) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
}
|