Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseDialogFragment.java | 
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseDialogFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseDialogFragment.java | 
| index 018f58b440862180761fe05a3fd5dc08b191e78b..454611c13328d8465ee8e255cc37b62c1c2f1b2b 100644 | 
| --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseDialogFragment.java | 
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ui/PassphraseDialogFragment.java | 
| @@ -12,6 +12,8 @@ import android.content.Context; | 
| import android.content.DialogInterface; | 
| import android.content.DialogInterface.OnClickListener; | 
| import android.content.Intent; | 
| +import android.graphics.ColorFilter; | 
| +import android.graphics.PorterDuff; | 
| import android.net.Uri; | 
| import android.os.Bundle; | 
| import android.provider.Browser; | 
| @@ -28,6 +30,7 @@ import android.widget.EditText; | 
| import android.widget.TextView; | 
| import android.widget.TextView.OnEditorActionListener; | 
| +import org.chromium.base.ApiCompatibilityUtils; | 
| import org.chromium.base.Log; | 
| import org.chromium.base.metrics.RecordHistogram; | 
| import org.chromium.chrome.R; | 
| @@ -51,6 +54,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| * @return whether passphrase was valid. | 
| */ | 
| boolean onPassphraseEntered(String passphrase); | 
| + | 
| void onPassphraseCanceled(); | 
| } | 
| @@ -60,6 +64,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| private static final int PASSPHRASE_DIALOG_RESET_LINK = 3; | 
| private static final int PASSPHRASE_DIALOG_LIMIT = 4; | 
| + private ColorFilter mPasswordEditTextOriginalColorFilter; | 
| + | 
| /** | 
| * Create a new instanceof of {@link PassphraseDialogFragment} and set its arguments. | 
| */ | 
| @@ -98,15 +104,16 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| @Override | 
| public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { | 
| if (actionId == EditorInfo.IME_ACTION_NEXT) { | 
| - handleOk(); | 
| + handleSubmit(); | 
| } | 
| return false; | 
| } | 
| }); | 
| + mPasswordEditTextOriginalColorFilter = passphrase.getBackground().getColorFilter(); | 
| final AlertDialog d = new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) | 
| .setView(v) | 
| - .setPositiveButton(R.string.ok, new Dialog.OnClickListener() { | 
| + .setPositiveButton(R.string.submit, new Dialog.OnClickListener() { | 
| @Override | 
| public void onClick(DialogInterface d, int which) { | 
| // We override the onclick. This is a hack to not dismiss the dialog after | 
| @@ -114,9 +121,9 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| // is correct. | 
| } | 
| }) | 
| - .setNegativeButton(R.string.cancel, this) | 
| - .setTitle(R.string.sign_in_google_account) | 
| - .create(); | 
| + .setNegativeButton(R.string.cancel, this) | 
| + .setTitle(R.string.sign_in_google_account) | 
| + .create(); | 
| d.getDelegate().setHandleNativeActionModesEnabled(false); | 
| d.setOnShowListener(new DialogInterface.OnShowListener() { | 
| @Override | 
| @@ -125,7 +132,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| b.setOnClickListener(new View.OnClickListener() { | 
| @Override | 
| public void onClick(View view) { | 
| - handleOk(); | 
| + handleSubmit(); | 
| } | 
| }); | 
| } | 
| @@ -165,7 +172,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| final Context context = getActivity(); | 
| return SpanApplier.applySpans( | 
| context.getString(R.string.sync_passphrase_reset_instructions), | 
| - new SpanInfo("<link>", "</link>", new ClickableSpan() { | 
| + new SpanInfo("<resetlink>", "</resetlink>", new ClickableSpan() { | 
| @Override | 
| public void onClick(View view) { | 
| recordPassphraseDialogDismissal(PASSPHRASE_DIALOG_RESET_LINK); | 
| @@ -183,8 +190,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| } | 
| /** | 
| - * @return whether the incorrect passphrase text is currently visible. | 
| - */ | 
| + * @return whether the incorrect passphrase text is currently visible. | 
| + */ | 
| private boolean isIncorrectPassphraseVisible() { | 
| // Check if the verifying TextView is currently showing the incorrect | 
| // passphrase text. | 
| @@ -203,11 +210,12 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| getListener().onPassphraseCanceled(); | 
| } | 
| - private void handleOk() { | 
| + private void handleSubmit() { | 
| TextView verifying = (TextView) getDialog().findViewById(R.id.verifying); | 
| verifying.setText(R.string.sync_verifying); | 
| EditText passphraseEditText = (EditText) getDialog().findViewById(R.id.passphrase); | 
| + passphraseEditText.getBackground().setColorFilter(mPasswordEditTextOriginalColorFilter); | 
| String passphrase = passphraseEditText.getText().toString(); | 
| boolean success = getListener().onPassphraseEntered(passphrase); | 
| @@ -232,5 +240,10 @@ public class PassphraseDialogFragment extends DialogFragment implements OnClickL | 
| private void invalidPassphrase() { | 
| TextView verifying = (TextView) getDialog().findViewById(R.id.verifying); | 
| verifying.setText(R.string.sync_passphrase_incorrect); | 
| + verifying.setTextColor(ApiCompatibilityUtils.getColor( | 
| 
 
newt (away)
2016/02/17 19:34:41
I'd store the result of getColor() and use it agai
 
May
2016/02/19 18:10:04
Done.
 
 | 
| + getResources(), R.color.input_underline_error_color)); | 
| + EditText passphraseEditText = (EditText) getDialog().findViewById(R.id.passphrase); | 
| + passphraseEditText.getBackground().setColorFilter(ApiCompatibilityUtils.getColor( | 
| 
 
newt (away)
2016/02/17 19:34:41
You must call getBackground().mutate() before chan
 
May
2016/02/19 18:10:04
Ah, good to know. Done
 
newt (away)
2016/02/20 00:25:17
Store that tidbit away :)
This is definitely a ro
 
 | 
| + getResources(), R.color.input_underline_error_color), PorterDuff.Mode.SRC_IN); | 
| } | 
| } |