| Index: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java
|
| index e9bff287b3c9d216d1eefbb4b02fb3f23d66dfc4..88a9a6dc9a65d4a0bfed68d20f620220e844e480 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseTypeDialogFragment.java
|
| @@ -6,9 +6,18 @@ package org.chromium.chrome.browser.sync.ui;
|
|
|
| import android.app.Dialog;
|
| import android.app.DialogFragment;
|
| +import android.content.ComponentName;
|
| +import android.content.Context;
|
| import android.content.DialogInterface;
|
| +import android.content.Intent;
|
| +import android.net.Uri;
|
| import android.os.Bundle;
|
| +import android.support.customtabs.CustomTabsIntent;
|
| import android.support.v7.app.AlertDialog;
|
| +import android.text.SpannableString;
|
| +import android.text.method.LinkMovementMethod;
|
| +import android.text.style.ClickableSpan;
|
| +import android.view.LayoutInflater;
|
| import android.view.View;
|
| import android.view.ViewGroup;
|
| import android.widget.AdapterView;
|
| @@ -16,10 +25,14 @@ import android.widget.AdapterView.OnItemClickListener;
|
| import android.widget.ArrayAdapter;
|
| import android.widget.CheckedTextView;
|
| import android.widget.ListView;
|
| +import android.widget.TextView;
|
|
|
| import org.chromium.base.VisibleForTesting;
|
| import org.chromium.chrome.R;
|
| +import org.chromium.chrome.browser.document.ChromeLauncherActivity;
|
| import org.chromium.sync.PassphraseType;
|
| +import org.chromium.ui.text.SpanApplier;
|
| +import org.chromium.ui.text.SpanApplier.SpanInfo;
|
|
|
| import java.text.DateFormat;
|
| import java.util.ArrayList;
|
| @@ -142,8 +155,11 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements
|
|
|
| @Override
|
| public Dialog onCreateDialog(Bundle savedInstanceState) {
|
| + LayoutInflater inflater = getActivity().getLayoutInflater();
|
| + View v = inflater.inflate(R.layout.sync_passphrase_types, null);
|
| +
|
| // Configure the passphrase type list
|
| - ListView list = new ListView(getActivity());
|
| + ListView list = (ListView) v.findViewById(R.id.passphrase_types);
|
| Adapter adapter = createAdapter(getCurrentTypeFromArguments());
|
| list.setAdapter(adapter);
|
| list.setId(R.id.passphrase_type_list);
|
| @@ -152,14 +168,41 @@ public class PassphraseTypeDialogFragment extends DialogFragment implements
|
| PassphraseType currentType = getCurrentTypeFromArguments();
|
| list.setSelection(adapter.getPositionForType(currentType));
|
|
|
| + // Configure the hint to reset the passphrase settings
|
| + // Only show this hint if encryption has been set to use sync passphrase
|
| + if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
|
| + TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
|
| + instructionsView.setVisibility(View.VISIBLE);
|
| + instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
|
| + instructionsView.setText(getResetText());
|
| + }
|
| +
|
| // Create and return the dialog
|
| return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
|
| .setNegativeButton(R.string.cancel, this)
|
| .setTitle(R.string.sync_passphrase_type_title)
|
| - .setView(list)
|
| + .setView(v)
|
| .create();
|
| }
|
|
|
| + private SpannableString getResetText() {
|
| + final Context context = getActivity();
|
| + return SpanApplier.applySpans(
|
| + context.getString(R.string.sync_passphrase_encryption_reset_instructions),
|
| + new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() {
|
| + @Override
|
| + public void onClick(View view) {
|
| + Uri syncDashboardUrl = Uri.parse(
|
| + context.getText(R.string.sync_dashboard_url).toString());
|
| + Intent intent = new Intent(Intent.ACTION_VIEW, syncDashboardUrl);
|
| + intent.setComponent(new ComponentName(
|
| + context, ChromeLauncherActivity.class));
|
| + intent.putExtra(CustomTabsIntent.EXTRA_SESSION, true);
|
| + context.startActivity(intent);
|
| + }
|
| + }));
|
| + }
|
| +
|
| @Override
|
| public void onClick(DialogInterface dialog, int which) {
|
| if (which == DialogInterface.BUTTON_NEGATIVE) {
|
|
|