Skip to content

Commit

Permalink
Fix recursion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
grivos committed Jun 8, 2021
1 parent e8aa622 commit 6c5ef48
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.widget.TextView
import androidx.annotation.StringRes
import androidx.fragment.app.Fragment
import com.grivos.spanomatic.PlaceholderFormatter
import com.grivos.spanomatic.Spanomatic
import com.grivos.spanomatic.spans.ListenableClickableSpan

fun TextView.addSpanClickListener(
Expand Down Expand Up @@ -43,7 +44,7 @@ fun Context.addSpansFromAnnotations(@StringRes id: Int, vararg formatArgs: Any):
val text = getText(id)
return if (text is SpannedString) {
val replaced = PlaceholderFormatter.format(text, *formatArgs)
addSpansFromAnnotations(replaced, this)
Spanomatic.addSpansFromAnnotations(replaced, this)
} else {
getString(id, formatArgs)
}
Expand All @@ -52,9 +53,9 @@ fun Context.addSpansFromAnnotations(@StringRes id: Int, vararg formatArgs: Any):
fun Context.addSpansFromAnnotations(text: CharSequence, vararg formatArgs: Any): CharSequence? {
return if (text is SpannedString) {
val replaced = PlaceholderFormatter.format(text, *formatArgs)
addSpansFromAnnotations(replaced, this)
Spanomatic.addSpansFromAnnotations(replaced, this)
} else {
text
text.toString().format(*formatArgs)
}
}

Expand Down

0 comments on commit 6c5ef48

Please sign in to comment.