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(); |
| 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; |
| 27 textPaint.setUnderlineText(false); |
| 28 } |
| 29 } |
OLD | NEW |