From d16427509220a55eac08f72cafa9f9ca7d75c9b3 Mon Sep 17 00:00:00 2001 From: Janne Koschinski <janne@kuschku.de> Date: Sat, 24 Mar 2018 12:41:51 +0100 Subject: [PATCH] Fixed minor bug --- .../quasseldroid/util/ui/SpanFormatter.kt | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt b/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt index 09ddf7b1f..ba44b319b 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/SpanFormatter.kt @@ -30,22 +30,6 @@ import java.util.regex.Pattern object SpanFormatter { private val FORMAT_SEQUENCE = Pattern.compile("%([0-9]+\\$|<?)([^a-zA-z%]*)([[a-zA-Z%]&&[^tT]]|[tT][a-zA-Z])") - /** - * Version of [String.format] that works on [Spanned] strings to preserve rich text formatting. - * Both the `format` as well as any `%s args` can be Spanned and will have their formatting preserved. - * Due to the way [Spannable]s work, any argument's spans will can only be included **once** in the result. - * Any duplicates will appear as text only. - * - * @param format the format string (see [java.util.Formatter.format]) - * @param args the list of arguments passed to the formatter. If there are - * more arguments than required by `format`, - * additional arguments are ignored. - * @return the formatted string (with spans). - */ - fun format(format: CharSequence, vararg args: Any): SpannedString { - return format(Locale.getDefault(), format, *args) - } - /** * Version of [String.format] that works on [Spanned] strings to preserve rich text formatting. * Both the `format` as well as any `%s args` can be Spanned and will have their formatting preserved. @@ -58,7 +42,8 @@ object SpanFormatter { * @return the formatted string (with spans). * @see String.format */ - fun format(locale: Locale, format: CharSequence, vararg args: Any): SpannedString { + fun format(format: CharSequence, vararg args: Any?, + locale: Locale = Locale.getDefault()): SpannedString { val out = SpannableStringBuilder(format) var i = 0 -- GitLab