blob: 1101f7b70cab0999031bb729b428a9336948b672 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package de.pixart.messenger.ui.util;
import android.content.Context;
import androidx.annotation.StringRes;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.TypefaceSpan;
public class JidDialog {
public static SpannableString style(Context context, @StringRes int res, String... args) {
SpannableString spannable = new SpannableString(context.getString(res, (Object[]) args));
if (args.length >= 1) {
final String value = args[0];
int start = spannable.toString().indexOf(value);
if (start >= 0) {
spannable.setSpan(new TypefaceSpan("monospace"), start, start + value.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
return spannable;
}
}
|