Chromium Code Reviews| Index: ui/android/java/src/org/chromium/ui/text/NoUnderlineClickableSpan.java |
| diff --git a/ui/android/java/src/org/chromium/ui/text/NoUnderlineClickableSpan.java b/ui/android/java/src/org/chromium/ui/text/NoUnderlineClickableSpan.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8cf97eba6c62f44535dec0704a8d7d88beae2b7f |
| --- /dev/null |
| +++ b/ui/android/java/src/org/chromium/ui/text/NoUnderlineClickableSpan.java |
| @@ -0,0 +1,29 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.ui.text; |
| + |
| +import android.graphics.Color; |
| +import android.text.TextPaint; |
| +import android.text.style.ClickableSpan; |
| +import android.view.View; |
| + |
| +/** |
| +* Show a clickable link with underlines turned off. |
| +*/ |
| +public class NoUnderlineClickableSpan extends ClickableSpan { |
| + @Override |
| + public void onClick(View view) { |
| + // Get rid of the highlight background on selection. |
| + view.invalidate(); |
|
newt (away)
2016/03/15 19:03:54
Why is this needed? Are you copying this from some
Finnur
2016/03/15 21:11:26
My ears are burning... ;)
It was definitely usefu
newt (away)
2016/03/15 21:24:45
Ahhhh, thanks for explaining. So this *might* be n
juncai
2016/03/16 00:40:36
I did some test and it seems that this is needed f
|
| + } |
| + |
| + // Disable underline on the link text. |
| + @Override |
| + public void updateDrawState(TextPaint textPaint) { |
| + super.updateDrawState(textPaint); |
| + textPaint.bgColor = Color.TRANSPARENT; |
|
newt (away)
2016/03/15 19:03:54
Also, why set the background color to transparent?
Finnur
2016/03/15 21:11:26
Might be related to the above, not sure. Don't rem
juncai
2016/03/16 00:40:36
I did some test and it seems that with or without
Finnur
2016/03/16 13:35:14
Like I said. Coo coo crazy. ;)
newt (away)
2016/03/16 17:17:16
I'm sure there was a reason at the time :)
|
| + textPaint.setUnderlineText(false); |
| + } |
| +} |