Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
| index 12f583782dd2000f93a59400c5d500605dbc26be..1d6b777f1b6b685a38830ea3f5ee3eab35316c8a 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/BluetoothChooserDialog.java |
| @@ -8,11 +8,8 @@ import android.Manifest; |
| import android.content.Context; |
| import android.content.Intent; |
| import android.content.pm.PackageManager; |
| -import android.graphics.Color; |
| import android.text.SpannableString; |
| -import android.text.TextPaint; |
| import android.text.TextUtils; |
| -import android.text.style.ClickableSpan; |
| import android.view.View; |
| import org.chromium.base.VisibleForTesting; |
| @@ -21,6 +18,7 @@ import org.chromium.chrome.R; |
| import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer; |
| import org.chromium.chrome.browser.profiles.Profile; |
| import org.chromium.ui.base.WindowAndroid; |
| +import org.chromium.ui.text.NoUnderlineClickableSpan; |
| import org.chromium.ui.text.SpanApplier; |
| import org.chromium.ui.text.SpanApplier.SpanInfo; |
| @@ -108,33 +106,33 @@ public class BluetoothChooserDialog |
| TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title, start); |
| String message = mContext.getString(R.string.bluetooth_not_found); |
| - SpannableString noneFound = SpanApplier.applySpans( |
| - message, new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.RESTART_SEARCH, mContext))); |
| + SpannableString noneFound = SpanApplier.applySpans(message, |
| + new SpanInfo("<link>", "</link>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.RESTART_SEARCH, mContext))); |
|
newt (away)
2016/03/15 19:03:53
fix indentation here and below
juncai
2016/03/16 00:40:35
I think in browser it is displayed like this but i
|
| SpannableString searching = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_searching), |
| - new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| + new SpanInfo("<link>", "</link>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| String positiveButton = mContext.getString(R.string.bluetooth_confirm_button); |
| SpannableString statusActive = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_not_seeing_it), |
| - new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| + new SpanInfo("<link>", "</link>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| SpannableString statusIdleNoneFound = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_not_seeing_it_idle_none_found), |
| - new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| + new SpanInfo("<link>", "</link>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.EXPLAIN_BLUETOOTH, mContext))); |
| SpannableString statusIdleSomeFound = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_not_seeing_it_idle_some_found), |
| - new SpanInfo("<link1>", "</link1>", |
| - new NoUnderlineClickableSpan(LinkType.EXPLAIN_BLUETOOTH, mContext)), |
| + new SpanInfo("<link1>", "</link1>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.EXPLAIN_BLUETOOTH, mContext)), |
| new SpanInfo("<link2>", "</link2>", |
| - new NoUnderlineClickableSpan(LinkType.RESTART_SEARCH, mContext))); |
| + new BluetoothNoUnderlineClickableSpan(LinkType.RESTART_SEARCH, mContext))); |
| ItemChooserDialog.ItemChooserLabels labels = |
| new ItemChooserDialog.ItemChooserLabels(title, searching, noneFound, statusActive, |
| @@ -188,28 +186,25 @@ public class BluetoothChooserDialog |
| SpannableString needLocationMessage = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_need_location_permission), |
| new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan( |
| + new BluetoothNoUnderlineClickableSpan( |
| LinkType.REQUEST_LOCATION_PERMISSION, mContext))); |
| SpannableString needLocationStatus = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_need_location_permission_help), |
| new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan( |
| + new BluetoothNoUnderlineClickableSpan( |
| LinkType.NEED_LOCATION_PERMISSION_HELP, mContext))); |
| mItemChooserDialog.setErrorState(needLocationMessage, needLocationStatus); |
| } |
| - /** |
| - * A helper class to show a clickable link with underlines turned off. |
| - */ |
| - private class NoUnderlineClickableSpan extends ClickableSpan { |
| + private class BluetoothNoUnderlineClickableSpan extends NoUnderlineClickableSpan { |
|
newt (away)
2016/03/15 19:03:53
For brevity, I'd just call this BluetoothClickable
juncai
2016/03/16 00:40:35
Done.
|
| // The type of link this span represents. |
| private LinkType mLinkType; |
| private Context mContext; |
| - NoUnderlineClickableSpan(LinkType linkType, Context context) { |
| + BluetoothNoUnderlineClickableSpan(LinkType linkType, Context context) { |
| mLinkType = linkType; |
| mContext = context; |
| } |
| @@ -261,15 +256,7 @@ public class BluetoothChooserDialog |
| assert false; |
| } |
| - // Get rid of the highlight background on selection. |
| - view.invalidate(); |
| - } |
| - |
| - @Override |
| - public void updateDrawState(TextPaint textPaint) { |
| - super.updateDrawState(textPaint); |
| - textPaint.bgColor = Color.TRANSPARENT; |
| - textPaint.setUnderlineText(false); |
| + super.onClick(view); |
|
Finnur
2016/03/16 13:35:14
Should you not call super.onClick also?
juncai
2016/03/16 21:01:34
I made the modification at Patch set 22 and didn't
|
| } |
| } |
| @@ -318,11 +305,11 @@ public class BluetoothChooserDialog |
| SpannableString adapterOffMessage = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_adapter_off), |
| new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF, mContext))); |
| + new BluetoothNoUnderlineClickableSpan(LinkType.ADAPTER_OFF, mContext))); |
| SpannableString adapterOffStatus = SpanApplier.applySpans( |
| mContext.getString(R.string.bluetooth_adapter_off_help), |
| - new SpanInfo("<link>", "</link>", |
| - new NoUnderlineClickableSpan(LinkType.ADAPTER_OFF_HELP, mContext))); |
| + new SpanInfo("<link>", "</link>", new BluetoothNoUnderlineClickableSpan( |
| + LinkType.ADAPTER_OFF_HELP, mContext))); |
| mItemChooserDialog.setErrorState(adapterOffMessage, adapterOffStatus); |
| } |