diff --git a/README.md b/README.md index 00be531..49ef892 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ val text = span { You can grab it via Gradle: ``` -implementation 'me.gujun.android:span:1.6' +implementation 'me.gujun.android:span:1.7' ``` ### Usage diff --git a/span/build.gradle b/span/build.gradle index ca06cb2..e5d66f1 100644 --- a/span/build.gradle +++ b/span/build.gradle @@ -23,7 +23,7 @@ dependencies { def GROUP = 'me.gujun.android' def ARTIFACTID = 'span' -def VERSION = '1.6' +def VERSION = '1.7' group = GROUP version = VERSION diff --git a/span/src/main/kotlin/me/gujun/android/span/span.kt b/span/src/main/kotlin/me/gujun/android/span/span.kt index 0581aa5..d3007f2 100644 --- a/span/src/main/kotlin/me/gujun/android/span/span.kt +++ b/span/src/main/kotlin/me/gujun/android/span/span.kt @@ -11,7 +11,6 @@ import android.text.TextUtils import android.text.style.AbsoluteSizeSpan import android.text.style.AlignmentSpan import android.text.style.BackgroundColorSpan -import android.text.style.ClickableSpan import android.text.style.ForegroundColorSpan import android.text.style.ImageSpan import android.text.style.QuoteSpan @@ -23,6 +22,7 @@ import android.text.style.URLSpan import android.view.View import me.gujun.android.span.style.CustomTypefaceSpan import me.gujun.android.span.style.LineSpacingSpan +import me.gujun.android.span.style.SimpleClickableSpan import me.gujun.android.span.style.TextDecorationLineSpan import me.gujun.android.span.style.VerticalPaddingSpan @@ -102,7 +102,7 @@ class Span(val parent: Span? = null) : SpannableStringBuilder() { } if (onClick != null) { - builder.add(object : ClickableSpan() { + builder.add(object : SimpleClickableSpan() { override fun onClick(widget: View) { onClick?.invoke() } @@ -205,7 +205,7 @@ class Span(val parent: Span? = null) : SpannableStringBuilder() { if (verticalPadding == null) { verticalPadding = style.verticalPadding } - if (onClick != null) { + if (onClick == null) { onClick = style.onClick } spans.addAll(style.spans) diff --git a/span/src/main/kotlin/me/gujun/android/span/style/SimpleClickableSpan.kt b/span/src/main/kotlin/me/gujun/android/span/style/SimpleClickableSpan.kt new file mode 100644 index 0000000..491d1fc --- /dev/null +++ b/span/src/main/kotlin/me/gujun/android/span/style/SimpleClickableSpan.kt @@ -0,0 +1,10 @@ +package me.gujun.android.span.style + +import android.text.TextPaint +import android.text.style.ClickableSpan + +abstract class SimpleClickableSpan : ClickableSpan() { + override fun updateDrawState(ds: TextPaint?) { + // no-op + } +} \ No newline at end of file