mirror of https://github.com/M66B/FairEmail.git
Underline suggestions (Android 10+)
This commit is contained in:
parent
f500acb5fe
commit
286e6724f8
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.TextPaint;
|
import android.text.TextPaint;
|
||||||
|
@ -207,16 +208,26 @@ public class LanguageTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SuggestionSpanEx extends SuggestionSpan {
|
private static class SuggestionSpanEx extends SuggestionSpan {
|
||||||
private final int textColorHighlight;
|
private final int highlightColor;
|
||||||
|
private final int dp3;
|
||||||
|
|
||||||
public SuggestionSpanEx(Context context, String[] suggestions, int flags) {
|
public SuggestionSpanEx(Context context, String[] suggestions, int flags) {
|
||||||
super(context, suggestions, flags);
|
super(context, suggestions, flags);
|
||||||
textColorHighlight = Helper.resolveColor(context, android.R.attr.textColorHighlight);
|
highlightColor = Helper.resolveColor(context,
|
||||||
|
Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
|
||||||
|
? android.R.attr.textColorHighlight
|
||||||
|
: android.R.attr.colorError);
|
||||||
|
dp3 = Helper.dp2pixels(context, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDrawState(TextPaint tp) {
|
public void updateDrawState(TextPaint tp) {
|
||||||
tp.bgColor = textColorHighlight;
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
||||||
|
tp.bgColor = highlightColor;
|
||||||
|
else {
|
||||||
|
tp.underlineColor = highlightColor;
|
||||||
|
tp.underlineThickness = dp3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue