diff options
author | cretin45 <cretin45@gmail.com> | 2015-01-21 15:55:03 -0800 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2015-01-21 15:55:03 -0800 |
commit | 716ffa86dc68d72a6eb031a7ed52759b2298d4f3 (patch) | |
tree | 43523316775c317373411bd878ba07a60ccf2a3d /src/com/cyanogenmod/setupwizard/setup/FinishPage.java | |
parent | 48ca24eb9b92c9b62970c3a12e963f497fc65bbc (diff) | |
download | packages_apps_SetupWizard-716ffa86dc68d72a6eb031a7ed52759b2298d4f3.zip packages_apps_SetupWizard-716ffa86dc68d72a6eb031a7ed52759b2298d4f3.tar.gz packages_apps_SetupWizard-716ffa86dc68d72a6eb031a7ed52759b2298d4f3.tar.bz2 |
SetupWizard: More refactor to match redlines
Change-Id: I74f422ba0c294d5e91aefb9356458c681cc53b37
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup/FinishPage.java')
-rw-r--r-- | src/com/cyanogenmod/setupwizard/setup/FinishPage.java | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/FinishPage.java b/src/com/cyanogenmod/setupwizard/setup/FinishPage.java index 1ab0df9..d97ada5 100644 --- a/src/com/cyanogenmod/setupwizard/setup/FinishPage.java +++ b/src/com/cyanogenmod/setupwizard/setup/FinishPage.java @@ -19,14 +19,20 @@ package com.cyanogenmod.setupwizard.setup; import com.cyanogenmod.setupwizard.R; import com.cyanogenmod.setupwizard.ui.SetupPageFragment; +import android.animation.Animator; import android.app.Fragment; import android.content.Context; import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.view.ViewAnimationUtils; public class FinishPage extends SetupPage { public static final String TAG = "FinishPage"; + private FinishFragment mFinishFragment; + public FinishPage(Context context, SetupDataCallbacks callbacks) { super(context, callbacks); } @@ -36,9 +42,9 @@ public class FinishPage extends SetupPage { Bundle args = new Bundle(); args.putString(SetupPage.KEY_PAGE_ARGUMENT, getKey()); - FinishFragment fragment = new FinishFragment(); - fragment.setArguments(args); - return fragment; + mFinishFragment = new FinishFragment(); + mFinishFragment.setArguments(args); + return mFinishFragment; } @Override @@ -53,7 +59,7 @@ public class FinishPage extends SetupPage { @Override public boolean doNextAction() { - getCallbacks().onFinish(); + mFinishFragment.animateOut(getCallbacks()); return true; } @@ -69,17 +75,57 @@ public class FinishPage extends SetupPage { public static class FinishFragment extends SetupPageFragment { + private View mReveal; + + private Handler mHandler; + @Override - protected void initializePage() {} + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + mHandler = new Handler(); + getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary)); + } @Override - protected int getLayoutResource() { - return R.layout.setup_finished_page; + protected void initializePage() { + mReveal = mRootView.findViewById(R.id.reveal); + } + + private void animateOut(final SetupDataCallbacks callbacks) { + int cx = (mReveal.getLeft() + mReveal.getRight()) / 2; + int cy = (mReveal.getTop() + mReveal.getBottom()) / 2; + int finalRadius = Math.max(mReveal.getWidth(), mReveal.getHeight()); + Animator anim = + ViewAnimationUtils.createCircularReveal(mReveal, cx, cy, 0, finalRadius); + + anim.addListener(new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animation) { + mReveal.setVisibility(View.VISIBLE); + } + + @Override + public void onAnimationEnd(Animator animation) { + mHandler.post(new Runnable() { + @Override + public void run() { + callbacks.onFinish(); + } + }); + } + + @Override + public void onAnimationCancel(Animator animation) {} + + @Override + public void onAnimationRepeat(Animator animation) {} + }); + anim.start(); } @Override - protected int getHeaderLayoutResource() { - return -1; + protected int getLayoutResource() { + return R.layout.setup_finished_page; } } |