OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.ui.text; | |
6 | |
7 import android.graphics.Color; | |
8 import android.text.TextPaint; | |
9 import android.text.style.ClickableSpan; | |
10 import android.view.View; | |
11 | |
12 /** | |
13 * Show a clickable link with underlines turned off. | |
14 */ | |
15 public class NoUnderlineClickableSpan extends ClickableSpan { | |
16 @Override | |
17 public void onClick(View view) { | |
18 // Get rid of the highlight background on selection. | |
19 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
| |
20 } | |
21 | |
22 // Disable underline on the link text. | |
23 @Override | |
24 public void updateDrawState(TextPaint textPaint) { | |
25 super.updateDrawState(textPaint); | |
26 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 :)
| |
27 textPaint.setUnderlineText(false); | |
28 } | |
29 } | |
OLD | NEW |