summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java53
-rw-r--r--src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java32
2 files changed, 36 insertions, 49 deletions
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
index 948f0be..ab7c07f 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenSettingsPage.java
@@ -30,6 +30,7 @@ import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
+import android.util.Log;
import android.view.IWindowManager;
import android.view.View;
import android.view.WindowManagerGlobal;
@@ -40,6 +41,7 @@ import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
import com.cyanogenmod.setupwizard.ui.WebViewDialogFragment;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
+import com.cyanogenmod.setupwizard.util.WhisperPushUtils;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
@@ -52,6 +54,7 @@ public class CyanogenSettingsPage extends SetupPage {
public static final String KEY_SEND_METRICS = "send_metrics";
public static final String KEY_REGISTER_WHISPERPUSH = "register";
+ public static final String KEY_ENABLE_NAV_KEYS = "enable_nav_keys";
public static final String SETTING_METRICS = "settings.cyanogen.allow_metrics";
public static final String PRIVACY_POLICY_URI = "https://cyngn.com/legal/privacy-policy";
@@ -114,6 +117,32 @@ public class CyanogenSettingsPage extends SetupPage {
editor.commit();
}
+ @Override
+ public void onFinishSetup() {
+ if (getData().containsKey(KEY_ENABLE_NAV_KEYS)) {
+ writeDisableNavkeysOption(mContext, getData().getBoolean(KEY_ENABLE_NAV_KEYS));
+ }
+ handleWhisperPushRegistration();
+ handleEnableMetrics();
+ }
+
+ private void handleWhisperPushRegistration() {
+ Bundle privacyData = getData();
+ if (privacyData != null && privacyData.containsKey(CyanogenSettingsPage.KEY_REGISTER_WHISPERPUSH)) {
+ Log.i(TAG, "Registering with WhisperPush");
+ WhisperPushUtils.startRegistration(mContext);
+ }
+ }
+
+ private void handleEnableMetrics() {
+ Bundle privacyData = getData();
+ if (privacyData != null
+ && privacyData.containsKey(CyanogenSettingsPage.KEY_SEND_METRICS)) {
+ Settings.System.putInt(mContext.getContentResolver(), CyanogenSettingsPage.SETTING_METRICS,
+ privacyData.getBoolean(CyanogenSettingsPage.KEY_SEND_METRICS) ? 1 : 0);
+ }
+ }
+
private static boolean hideKeyDisabler() {
try {
return !KeyDisabler.isSupported();
@@ -139,8 +168,6 @@ public class CyanogenSettingsPage extends SetupPage {
private CheckBox mNavKeys;
private CheckBox mSecureSms;
- private Handler mHandler;
-
private View.OnClickListener mMetricsClickListener = new View.OnClickListener() {
@Override
@@ -154,16 +181,9 @@ public class CyanogenSettingsPage extends SetupPage {
private View.OnClickListener mNavKeysClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
- mNavKeys.setEnabled(false);
boolean checked = !mNavKeys.isChecked();
- writeDisableNavkeysOption(getActivity(), checked);
- updateDisableNavkeysOption();
- mHandler.postDelayed(new Runnable() {
- @Override
- public void run() {
- mNavKeys.setEnabled(true);
- }
- }, 1000);
+ mNavKeys.setChecked(checked);
+ mPage.getData().putBoolean(KEY_ENABLE_NAV_KEYS, checked);
}
};
@@ -176,11 +196,6 @@ public class CyanogenSettingsPage extends SetupPage {
}
};
- public CyanogenSettingsFragment() {
- super();
- mHandler = new Handler();
- }
-
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
@@ -258,8 +273,10 @@ public class CyanogenSettingsPage extends SetupPage {
private void updateDisableNavkeysOption() {
boolean enabled = Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.DEV_FORCE_SHOW_NAVBAR, 0) != 0;
-
- mNavKeys.setChecked(enabled);
+ boolean checked = mPage.getData().containsKey(KEY_ENABLE_NAV_KEYS) ?
+ mPage.getData().getBoolean(KEY_ENABLE_NAV_KEYS) :
+ enabled;
+ mNavKeys.setChecked(checked);
}
}
diff --git a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
index 83179b2..4f5ebe8 100644
--- a/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
+++ b/src/com/cyanogenmod/setupwizard/ui/SetupWizardActivity.java
@@ -25,7 +25,6 @@ import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
@@ -34,13 +33,10 @@ import android.widget.Button;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.setup.CMSetupWizardData;
-import com.cyanogenmod.setupwizard.setup.CyanogenServicesPage;
-import com.cyanogenmod.setupwizard.setup.CyanogenSettingsPage;
import com.cyanogenmod.setupwizard.setup.Page;
import com.cyanogenmod.setupwizard.setup.SetupDataCallbacks;
import com.cyanogenmod.setupwizard.util.EnableAccessibilityController;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
-import com.cyanogenmod.setupwizard.util.WhisperPushUtils;
public class SetupWizardActivity extends Activity implements SetupDataCallbacks {
@@ -263,35 +259,9 @@ public class SetupWizardActivity extends Activity implements SetupDataCallbacks
anim.start();
}
- private void handleWhisperPushRegistration() {
- Page page = getPage(CyanogenServicesPage.TAG);
- if (page == null) {
- return;
- }
- Bundle privacyData = page.getData();
- if (privacyData != null && privacyData.getBoolean(CyanogenSettingsPage.KEY_REGISTER_WHISPERPUSH)) {
- Log.d(TAG, "Registering with WhisperPush");
- WhisperPushUtils.startRegistration(this);
- }
- }
-
- public void handleEnableMetrics() {
- Page page = getPage(CyanogenServicesPage.TAG);
- if (page == null) {
- return;
- }
- Bundle privacyData = page.getData();
- if (privacyData != null
- && privacyData.getBoolean(CyanogenSettingsPage.KEY_SEND_METRICS)) {
- Settings.System.putInt(getContentResolver(), CyanogenSettingsPage.SETTING_METRICS,
- privacyData.getBoolean(CyanogenSettingsPage.KEY_SEND_METRICS) ? 1 : 0);
- }
- }
-
private void finishSetup() {
getApplication().sendBroadcast(new Intent(SetupWizardApp.ACTION_FINISHED));
- handleWhisperPushRegistration();
- handleEnableMetrics();
+ mSetupData.finishPages();
Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
((SetupWizardApp)AppGlobals.getInitialApplication()).enableStatusBar();