summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard/setup
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/cyanogenmod/setupwizard/setup')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/AbstractSetupData.java5
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java42
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/FinishPage.java64
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/LocationSettingsPage.java5
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/SetupDataCallbacks.java4
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/SetupPage.java21
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/WelcomePage.java10
7 files changed, 78 insertions, 73 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/AbstractSetupData.java b/src/com/cyanogenmod/setupwizard/setup/AbstractSetupData.java
index fed8732..c388eef 100644
--- a/src/com/cyanogenmod/setupwizard/setup/AbstractSetupData.java
+++ b/src/com/cyanogenmod/setupwizard/setup/AbstractSetupData.java
@@ -18,7 +18,6 @@ package com.cyanogenmod.setupwizard.setup;
import android.content.Context;
import android.os.Bundle;
-import android.view.LayoutInflater;
import java.util.ArrayList;
@@ -104,10 +103,6 @@ public abstract class AbstractSetupData implements SetupDataCallbacks {
}
}
- @Override
- public void onPageViewCreated(LayoutInflater inflater, Bundle savedInstanceState,
- int layoutResource) {}
-
private boolean advanceToNextUncompleted() {
while (mCurrentPageIndex < mPageList.size()) {
mCurrentPageIndex++;
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
index 2949b9e..6b87bc3 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
@@ -17,8 +17,6 @@
package com.cyanogenmod.setupwizard.setup;
import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
@@ -137,8 +135,6 @@ public class CyanogenServicesPage extends SetupPage {
private CheckBox mNavKeys;
private CheckBox mSecureSms;
- private Runnable mDeferredAction;
-
private Handler mHandler;
@@ -251,22 +247,9 @@ public class CyanogenServicesPage extends SetupPage {
}
@Override
- protected int getHeaderLayoutResource() {
- return R.layout.header_condensed;
- }
-
- @Override
public void onResume() {
super.onResume();
updateDisableNavkeysOption();
- runDeferredAction();
- }
-
- private void runDeferredAction() {
- if (mDeferredAction != null) {
- mDeferredAction.run();
- mDeferredAction = null;
- }
}
private void updateDisableNavkeysOption() {
@@ -279,28 +262,9 @@ public class CyanogenServicesPage extends SetupPage {
private void launchCyanogenAccountSetup(final Activity activity) {
Bundle bundle = new Bundle();
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
- AccountManager
- .get(activity).addAccount(SetupWizardApp.ACCOUNT_TYPE_CYANOGEN, null, null, bundle,
- activity, new AccountManagerCallback<Bundle>() {
- @Override
- public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
- if (activity == null) return; //There is a chance this activity has been torn down.
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- if (!SetupWizardUtils.accountExists(activity,
- SetupWizardApp.ACCOUNT_TYPE_CYANOGEN)) {
- mPage.getCallbacks().onNextPage();
- }
- }
- };
- if (activity.isResumed()) {
- runnable.run();
- } else {
- mDeferredAction = runnable;
- }
- }
- }, null);
+ AccountManager.get(activity)
+ .addAccount(SetupWizardApp.ACCOUNT_TYPE_CYANOGEN, null, null, bundle,
+ activity, null, null);
}
}
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;
}
}
diff --git a/src/com/cyanogenmod/setupwizard/setup/LocationSettingsPage.java b/src/com/cyanogenmod/setupwizard/setup/LocationSettingsPage.java
index 00865f4..ff87054 100644
--- a/src/com/cyanogenmod/setupwizard/setup/LocationSettingsPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/LocationSettingsPage.java
@@ -128,11 +128,6 @@ public class LocationSettingsPage extends SetupPage {
}
@Override
- protected int getHeaderLayoutResource() {
- return R.layout.header_condensed;
- }
-
- @Override
public void onResume() {
super.onResume();
updateLocationToggles();
diff --git a/src/com/cyanogenmod/setupwizard/setup/SetupDataCallbacks.java b/src/com/cyanogenmod/setupwizard/setup/SetupDataCallbacks.java
index 2e787b4..d12da2c 100644
--- a/src/com/cyanogenmod/setupwizard/setup/SetupDataCallbacks.java
+++ b/src/com/cyanogenmod/setupwizard/setup/SetupDataCallbacks.java
@@ -16,9 +16,6 @@
package com.cyanogenmod.setupwizard.setup;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-
public interface SetupDataCallbacks {
void onNextPage();
void onPreviousPage();
@@ -27,5 +24,4 @@ public interface SetupDataCallbacks {
void onFinish();
Page getPage(String key);
Page getPage(int key);
- void onPageViewCreated(LayoutInflater inflater, Bundle savedInstanceState, int layoutResource);
}
diff --git a/src/com/cyanogenmod/setupwizard/setup/SetupPage.java b/src/com/cyanogenmod/setupwizard/setup/SetupPage.java
index 4c64d5c..60322bf 100644
--- a/src/com/cyanogenmod/setupwizard/setup/SetupPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/SetupPage.java
@@ -21,10 +21,12 @@ import com.cyanogenmod.setupwizard.R;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
-import android.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.transition.Slide;
+import android.transition.Transition;
+import android.view.Gravity;
public abstract class SetupPage implements Page {
@@ -71,14 +73,19 @@ public abstract class SetupPage implements Page {
public void doLoadAction(Activity context, int action) {
if (context == null || context.isFinishing()) { return; }
final FragmentManager fragmentManager = context.getFragmentManager();
+ Fragment fragment = getFragment();
if (action == Page.ACTION_NEXT) {
- FragmentTransaction transaction = fragmentManager.beginTransaction();
- transaction.replace(R.id.content, getFragment(), getKey());
- transaction.commit();
+ Transition t = new Slide(Gravity.RIGHT);
+ fragment.setEnterTransition(t);
+ fragmentManager.beginTransaction()
+ .replace(R.id.content,fragment, getKey())
+ .commit();
} else {
- FragmentTransaction transaction = fragmentManager.beginTransaction();
- transaction.replace(R.id.content, getFragment(), getKey());
- transaction.commit();
+ Transition t = new Slide(Gravity.LEFT);
+ fragment.setEnterTransition(t);
+ fragmentManager.beginTransaction()
+ .replace(R.id.content, fragment, getKey())
+ .commit();
}
}
diff --git a/src/com/cyanogenmod/setupwizard/setup/WelcomePage.java b/src/com/cyanogenmod/setupwizard/setup/WelcomePage.java
index 569f7b9..fea1ffa 100644
--- a/src/com/cyanogenmod/setupwizard/setup/WelcomePage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/WelcomePage.java
@@ -97,6 +97,12 @@ public class WelcomePage extends SetupPage {
};
@Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary));
+ }
+
+ @Override
protected void initializePage() {
mLanguagePicker = (LocalePicker) mRootView.findViewById(R.id.locale_list);
loadLanguages();
@@ -152,10 +158,6 @@ public class WelcomePage extends SetupPage {
return R.layout.setup_welcome_page;
}
- @Override
- protected int getHeaderLayoutResource() {
- return R.layout.logo_header;
- }
}
}