|
|
@@ -5,7 +5,6 @@ import android.animation.ObjectAnimator;
|
|
|
import android.content.Context;
|
|
|
import android.support.constraint.ConstraintLayout;
|
|
|
import android.support.v4.app.FragmentActivity;
|
|
|
-import android.util.Log;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.widget.FrameLayout;
|
|
|
@@ -31,13 +30,19 @@ public class Tutorial {
|
|
|
private FragmentActivity activity;
|
|
|
private FrameLayout frameLayout;
|
|
|
private LayoutInflater inflater;
|
|
|
- private ObjectAnimator fadeOut;
|
|
|
+ private ObjectAnimator animator;
|
|
|
|
|
|
public final static int TUTORIAL_LISTICLE_COVER = 0;
|
|
|
public final static int TUTORIAL_LISTICLE_DETAIL = 1;
|
|
|
public final static int TUTORIAL_BUCKET = 2;
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 튜토리얼 표시하기
|
|
|
+ *
|
|
|
+ * @param activity
|
|
|
+ * @param tutorialID
|
|
|
+ * @param listener
|
|
|
+ */
|
|
|
public void showTutorial(FragmentActivity activity, int tutorialID, IEventListener listener) {
|
|
|
this.activity = activity;
|
|
|
|
|
|
@@ -62,9 +67,14 @@ public class Tutorial {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public void cancel(){
|
|
|
- if(fadeOut != null){
|
|
|
- fadeOut.cancel();
|
|
|
+ /**
|
|
|
+ * 튜토리얼 취소
|
|
|
+ */
|
|
|
+ public void cancel() {
|
|
|
+ if (animator != null) {
|
|
|
+ animator.removeAllListeners();
|
|
|
+ animator.cancel();
|
|
|
+ animator = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -76,13 +86,12 @@ public class Tutorial {
|
|
|
*/
|
|
|
private ObjectAnimator fadeOut(View target) {
|
|
|
target.clearAnimation();
|
|
|
- this.fadeOut = ObjectAnimator.ofFloat(
|
|
|
+ return ObjectAnimator.ofFloat(
|
|
|
target,
|
|
|
View.ALPHA,
|
|
|
1.0f,
|
|
|
0.0f
|
|
|
);
|
|
|
- return fadeOut;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -96,61 +105,33 @@ public class Tutorial {
|
|
|
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) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ firstTutorial.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
- bubble2.setVisibility(View.VISIBLE);
|
|
|
- secondTutorial.start();
|
|
|
|
|
|
- }
|
|
|
+ ObjectAnimator secondTutorial = fadeOut(bubble2);
|
|
|
+ secondTutorial.setStartDelay(1000);
|
|
|
+ secondTutorial.setDuration(1000);
|
|
|
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
+ bubble2.setVisibility(View.VISIBLE);
|
|
|
|
|
|
+ secondTutorial.addListener(new SimpleAnimatorListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ frameLayout.removeView(view);
|
|
|
+ if (null != listener) {
|
|
|
+ listener.onEvent(new Event.Builder(Event.NEXT).build());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ Tutorial.this.animator = secondTutorial;
|
|
|
+ secondTutorial.start();
|
|
|
}
|
|
|
});
|
|
|
+ this.animator = firstTutorial;
|
|
|
+ firstTutorial.start();
|
|
|
|
|
|
-
|
|
|
- secondTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationEnd(Animator animator) {
|
|
|
- frameLayout.removeView(view);
|
|
|
- if(null != listener){
|
|
|
- listener.onEvent(new Event.Builder(Event.NEXT).build());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
private void showTutorialListicleDetail(IEventListener listener) {
|
|
|
@@ -163,57 +144,34 @@ public class Tutorial {
|
|
|
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) {
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
+ firstTutorial.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
- bubble2.setVisibility(View.VISIBLE);
|
|
|
- secondTutorial.start();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
|
|
|
- }
|
|
|
+ ObjectAnimator secondTutorial = fadeOut(bubble2);
|
|
|
+ secondTutorial.setStartDelay(1000);
|
|
|
+ secondTutorial.setDuration(1000);
|
|
|
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
+ bubble2.setVisibility(View.VISIBLE);
|
|
|
|
|
|
+ secondTutorial.addListener(new SimpleAnimatorListener() {
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animator) {
|
|
|
+ frameLayout.removeView(view);
|
|
|
+ if (null != listener) {
|
|
|
+ listener.onEvent(new Event.Builder(Event.NEXT).build());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ Tutorial.this.animator = secondTutorial;
|
|
|
+ secondTutorial.start();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- secondTutorial.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationEnd(Animator animator) {
|
|
|
- frameLayout.removeView(view);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
+ this.animator = firstTutorial;
|
|
|
+ firstTutorial.start();
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -230,6 +188,7 @@ public class Tutorial {
|
|
|
ObjectAnimator first = fadeOut(bubble1);
|
|
|
first.setDuration(1000);
|
|
|
first.setStartDelay(1000);
|
|
|
+ this.animator = first;
|
|
|
first.start();
|
|
|
|
|
|
ObjectAnimator second = fadeOut(bubble2);
|
|
|
@@ -248,104 +207,61 @@ public class Tutorial {
|
|
|
fourth.setDuration(1000);
|
|
|
fourth.setStartDelay(1000);
|
|
|
|
|
|
- first.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ first.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
bubble2.setVisibility(View.VISIBLE);
|
|
|
- second.start();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
|
|
|
+ Tutorial.this.animator = second;
|
|
|
+ second.start();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
- second.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ second.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
// frameLayout.removeView(firstView);
|
|
|
frameLayout.addView(secondView);
|
|
|
secondView.setTranslationX(SuperModel.getInstance().getScreenWidth());
|
|
|
+ Tutorial.this.animator = translateAnimator1;
|
|
|
translateAnimator1.start();
|
|
|
}
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
});
|
|
|
|
|
|
|
|
|
- third.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ third.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
frameLayout.removeView(firstView);
|
|
|
+ Tutorial.this.animator = fourth;
|
|
|
fourth.start();
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
-
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- translateAnimator1.addListener(new Animator.AnimatorListener() {
|
|
|
- @Override
|
|
|
- public void onAnimationStart(Animator animator) {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ translateAnimator1.addListener(new SimpleAnimatorListener() {
|
|
|
@Override
|
|
|
public void onAnimationEnd(Animator animator) {
|
|
|
+ Tutorial.this.animator = third;
|
|
|
third.start();
|
|
|
}
|
|
|
+ });
|
|
|
|
|
|
- @Override
|
|
|
- public void onAnimationCancel(Animator animator) {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public void onAnimationRepeat(Animator animator) {
|
|
|
+ class SimpleAnimatorListener implements Animator.AnimatorListener {
|
|
|
|
|
|
- }
|
|
|
- });
|
|
|
+ @Override
|
|
|
+ public void onAnimationStart(Animator animation) { }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onAnimationEnd(Animator animation) { }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onAnimationCancel(Animator animation) { }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onAnimationRepeat(Animator animation) { }
|
|
|
}
|
|
|
}
|