summaryrefslogtreecommitdiffstats
path: root/src/com/cyanogenmod/setupwizard
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2015-01-22 14:17:05 -0800
committercretin45 <cretin45@gmail.com>2015-01-22 14:17:05 -0800
commit8913799a9757c426fac6a8bbddc55eded0c3af4f (patch)
tree52ed1cec1d77e8468a71c4483de7133a76649b9e /src/com/cyanogenmod/setupwizard
parent716ffa86dc68d72a6eb031a7ed52759b2298d4f3 (diff)
downloadpackages_apps_SetupWizard-8913799a9757c426fac6a8bbddc55eded0c3af4f.zip
packages_apps_SetupWizard-8913799a9757c426fac6a8bbddc55eded0c3af4f.tar.gz
packages_apps_SetupWizard-8913799a9757c426fac6a8bbddc55eded0c3af4f.tar.bz2
SetupWizard: Add privacy policy popup
* Also launch cmaccount by default Change-Id: Idf625f4f5c8bdb05a4d0b888846972c11676d12d
Diffstat (limited to 'src/com/cyanogenmod/setupwizard')
-rw-r--r--src/com/cyanogenmod/setupwizard/SetupWizardApp.java2
-rw-r--r--src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java18
-rw-r--r--src/com/cyanogenmod/setupwizard/ui/WebViewDialogFragment.java86
3 files changed, 99 insertions, 7 deletions
diff --git a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
index 240d4b0..bf7522e 100644
--- a/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
+++ b/src/com/cyanogenmod/setupwizard/SetupWizardApp.java
@@ -29,7 +29,6 @@ public class SetupWizardApp extends Application {
public static final String ACTION_FINISHED = "com.cyanogenmod.setupwizard.SETUP_FINISHED";
- public static final String ACCOUNT_TYPE_CYANOGEN = "com.cyanogen";
public static final String ACCOUNT_TYPE_GMS = "com.google";
public static final String ACTION_SETUP_WIFI = "com.android.net.wifi.SETUP_WIFI_NETWORK";
@@ -37,6 +36,7 @@ public class SetupWizardApp extends Application {
public static final String EXTRA_FIRST_RUN = "firstRun";
public static final String EXTRA_ALLOW_SKIP = "allowSkip";
public static final String EXTRA_AUTO_FINISH = "wifi_auto_finish_on_connect";
+ public static final String EXTRA_SHOW_BUTTON_BAR = "extra_prefs_show_button_bar";
public static final int REQUEST_CODE_SETUP_WIFI = 0;
diff --git a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
index 6b87bc3..330e74e 100644
--- a/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
+++ b/src/com/cyanogenmod/setupwizard/setup/CyanogenServicesPage.java
@@ -39,6 +39,7 @@ import android.widget.TextView;
import com.cyanogenmod.setupwizard.R;
import com.cyanogenmod.setupwizard.SetupWizardApp;
import com.cyanogenmod.setupwizard.ui.SetupPageFragment;
+import com.cyanogenmod.setupwizard.ui.WebViewDialogFragment;
import com.cyanogenmod.setupwizard.util.SetupWizardUtils;
import com.google.android.gms.common.ConnectionResult;
@@ -54,6 +55,7 @@ public class CyanogenServicesPage extends SetupPage {
public static final String KEY_REGISTER_WHISPERPUSH = "register";
public static final String SETTING_METRICS = "settings.cyanogen.allow_metrics";
+ public static final String PRIVACY_POLICY_URI = "https://cyngn.com/legal/privacy-policy";
public CyanogenServicesPage(Context context, SetupDataCallbacks callbacks) {
super(context, callbacks);
@@ -180,10 +182,11 @@ public class CyanogenServicesPage extends SetupPage {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- getActivity().getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
- if (!SetupWizardUtils.accountExists(getActivity(),
- SetupWizardApp.ACCOUNT_TYPE_CYANOGEN)) {
- launchCyanogenAccountSetup(getActivity());
+ final Activity activity = getActivity();
+ activity.getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
+ if (!SetupWizardUtils.accountExists(activity,
+ activity.getString(R.string.cm_account_type))) {
+ launchCyanogenAccountSetup(activity);
}
}
@@ -195,7 +198,9 @@ public class CyanogenServicesPage extends SetupPage {
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
- //TDB privacy policy
+ WebViewDialogFragment.newInstance()
+ .setUri(PRIVACY_POLICY_URI)
+ .show(getActivity().getFragmentManager(), WebViewDialogFragment.TAG);
}
};
ss.setSpan(clickableSpan,
@@ -262,8 +267,9 @@ public class CyanogenServicesPage extends SetupPage {
private void launchCyanogenAccountSetup(final Activity activity) {
Bundle bundle = new Bundle();
bundle.putBoolean(SetupWizardApp.EXTRA_FIRST_RUN, true);
+ bundle.putBoolean(SetupWizardApp.EXTRA_SHOW_BUTTON_BAR, true);
AccountManager.get(activity)
- .addAccount(SetupWizardApp.ACCOUNT_TYPE_CYANOGEN, null, null, bundle,
+ .addAccount(activity.getString(R.string.cm_account_type), null, null, bundle,
activity, null, null);
}
diff --git a/src/com/cyanogenmod/setupwizard/ui/WebViewDialogFragment.java b/src/com/cyanogenmod/setupwizard/ui/WebViewDialogFragment.java
new file mode 100644
index 0000000..46f22ae
--- /dev/null
+++ b/src/com/cyanogenmod/setupwizard/ui/WebViewDialogFragment.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2013 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cyanogenmod.setupwizard.ui;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.content.DialogInterface;
+import android.os.Bundle;
+import android.view.View;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import com.cyanogenmod.setupwizard.R;
+
+public class WebViewDialogFragment extends DialogFragment {
+
+ public static String TAG = WebViewDialogFragment.class.getSimpleName();
+
+ private View mRootView;
+ private WebView mWebView;
+ private String mUri;
+ private Dialog mDialog;
+
+ public static WebViewDialogFragment newInstance() {
+ return new WebViewDialogFragment();
+ }
+
+ public WebViewDialogFragment() {
+
+ }
+
+ public WebViewDialogFragment setUri(String uri) {
+ mUri = uri;
+ return this;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setRetainInstance(true);
+ mRootView = getActivity().getLayoutInflater().inflate(R.layout.terms_webview, null, false);
+ mWebView = (WebView)mRootView.findViewById(R.id.webview);
+ mWebView.setWebViewClient(new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ return false;
+ }
+ });
+ mWebView.getSettings().setJavaScriptEnabled(true);
+ mWebView.getSettings().setUseWideViewPort(true);
+ mWebView.loadUrl(mUri);
+ }
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ if (mDialog == null) {
+ mDialog =new AlertDialog.Builder(getActivity())
+ .setView(mRootView)
+ .setCancelable(false)
+ .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i) {
+ dialogInterface.dismiss();
+ }
+ })
+ .create();
+ }
+ return mDialog;
+ }
+}
+