mirror of https://github.com/M66B/FairEmail.git
Highlight/dim link scheme
This commit is contained in:
parent
a5fa1ed49c
commit
39993638f5
|
@ -38,6 +38,7 @@ import android.text.TextUtils;
|
|||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -219,8 +220,6 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
|
||||
cbSecure.setText(
|
||||
secure ? R.string.title_link_https : R.string.title_link_http);
|
||||
cbSecure.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||
0, 0, secure ? 0 : R.drawable.twotone_http_24, 0);
|
||||
cbSecure.setTextColor(Helper.resolveColor(context,
|
||||
secure ? android.R.attr.textColorSecondary : R.attr.colorWarning));
|
||||
cbSecure.setTypeface(
|
||||
|
@ -629,6 +628,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
|
||||
try {
|
||||
int textColorLink = Helper.resolveColor(context, android.R.attr.textColorLink);
|
||||
int colorSeparator = Helper.resolveColor(context, R.attr.colorSeparator);
|
||||
int colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
|
||||
|
||||
if ("tel".equals(scheme)) {
|
||||
// tel://+123%2045%20678%123456
|
||||
|
@ -641,6 +642,19 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
}
|
||||
}
|
||||
|
||||
if (scheme != null) {
|
||||
int index = text.indexOf(scheme);
|
||||
if (index >= 0)
|
||||
if ("http".equals(scheme)) {
|
||||
ssb.setSpan(new ForegroundColorSpan(colorWarning),
|
||||
index, index + scheme.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
ssb.setSpan(new StyleSpan(Typeface.BOLD),
|
||||
index, index + scheme.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
} else
|
||||
ssb.setSpan(new ForegroundColorSpan(colorSeparator),
|
||||
index, index + scheme.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
if (host != null) {
|
||||
int index = text.indexOf(host);
|
||||
if (index >= 0)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M4.5,11h-2L2.5,9L1,9v6h1.5v-2.5h2L4.5,15L6,15L6,9L4.5,9v2zM7,10.5h1.5L8.5,15L10,15v-4.5h1.5L11.5,9L7,9v1.5zM12.5,10.5L14,10.5L14,15h1.5v-4.5L17,10.5L17,9h-4.5v1.5zM21.5,9L18,9v6h1.5v-2h2c0.8,0 1.5,-0.7 1.5,-1.5v-1c0,-0.8 -0.7,-1.5 -1.5,-1.5zM21.5,11.5h-2v-1h2v1z"/>
|
||||
</vector>
|
|
@ -172,7 +172,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/twotone_http_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_link_http"
|
||||
android:textColor="?attr/colorWarning"
|
||||
|
|
Loading…
Reference in New Issue