Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseCreationDialogFragment.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseCreationDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseCreationDialogFragment.java |
| index 79dd691796b854d5487458d5752baa1cd9326437..6c9627e7002ed725c7c7d66b5f882eac51a37535 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseCreationDialogFragment.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseCreationDialogFragment.java |
| @@ -4,10 +4,17 @@ |
| package org.chromium.chrome.browser.sync.ui; |
| +import android.app.Activity; |
| import android.app.Dialog; |
| import android.app.DialogFragment; |
| +import android.content.Context; |
| +import android.content.Intent; |
| +import android.net.Uri; |
| import android.os.Bundle; |
| +import android.provider.Browser; |
| import android.support.v7.app.AlertDialog; |
| +import android.text.SpannableString; |
| +import android.text.style.ClickableSpan; |
| import android.view.KeyEvent; |
| import android.view.LayoutInflater; |
| import android.view.View; |
| @@ -17,11 +24,16 @@ import android.widget.TextView; |
| import android.widget.TextView.OnEditorActionListener; |
| import org.chromium.chrome.R; |
| +import org.chromium.ui.text.SpanApplier; |
| +import org.chromium.ui.text.SpanApplier.SpanInfo; |
| /** |
| * Dialog to ask the user to enter a new custom passphrase. |
| */ |
| public class PassphraseCreationDialogFragment extends DialogFragment { |
| + private static final String SYNC_PASSPHRASE_SUPPORT_URL = |
| + "https://support.google.com/chrome/answer/1181035"; |
| + |
| interface Listener { |
| void onPassphraseCreated(String passphrase); |
| } |
| @@ -47,16 +59,39 @@ public class PassphraseCreationDialogFragment extends DialogFragment { |
| } |
| }); |
| + TextView instructionsView = |
| + (TextView) view.findViewById(R.id.custom_passphrase_instructions); |
| + instructionsView.setText(getInstructionsText()); |
| + |
| AlertDialog dialog = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) |
| - .setView(view) |
| - .setTitle(R.string.sync_passphrase_type_custom) |
| - .setPositiveButton(R.string.ok, null) |
| - .setNegativeButton(R.string.cancel, null) |
| - .create(); |
| + .setView(view) |
|
newt (away)
2016/02/12 22:03:51
the indentation was correct before. Indent by 8 no
May
2016/02/16 17:32:07
Done.
|
| + .setTitle(R.string.sync_passphrase_type_custom_dialog_title) |
| + .setPositiveButton(R.string.save, null) |
| + .setNegativeButton(R.string.cancel, null) |
| + .create(); |
| dialog.getDelegate().setHandleNativeActionModesEnabled(false); |
| return dialog; |
| } |
| + private SpannableString getInstructionsText() { |
| + final Context context = getActivity(); |
| + return SpanApplier.applySpans( |
| + context.getString(R.string.sync_custom_passphrase), |
| + new SpanInfo("<link>", "</link>", new ClickableSpan() { |
| + @Override |
| + public void onClick(View view) { |
| + Uri syncPassphraseHC = Uri.parse(SYNC_PASSPHRASE_SUPPORT_URL); |
|
newt (away)
2016/02/12 22:03:51
s/HC/Url/
May
2016/02/16 17:32:07
Done.
|
| + Intent intent = new Intent(Intent.ACTION_VIEW, syncPassphraseHC); |
|
newt (away)
2016/02/12 22:03:51
We should be using either:
- custom tabs, or
- H
May
2016/02/16 17:32:07
Thanks for the tip. Will my addition to go/mobileh
|
| + intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); |
| + intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); |
| + intent.setPackage(context.getPackageName()); |
| + context.startActivity(intent); |
| + Activity activity = getActivity(); |
| + if (activity != null) activity.finish(); |
| + } |
| + })); |
| + } |
| + |
| @Override |
| public void onStart() { |
| super.onStart(); |