mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 13:47:04 +00:00
Show link type in link confirmation dialog
This commit is contained in:
parent
f5ea517876
commit
94ee92a0ad
4 changed files with 32 additions and 0 deletions
|
@ -168,6 +168,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
// Get views
|
||||
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_open_link, null);
|
||||
scroll = dview.findViewById(R.id.scroll);
|
||||
final TextView tvCaption = dview.findViewById(R.id.tvCaption);
|
||||
final ImageButton ibInfo = dview.findViewById(R.id.ibInfo);
|
||||
final TextView tvTitle = dview.findViewById(R.id.tvTitle);
|
||||
final ImageButton ibDifferent = dview.findViewById(R.id.ibDifferent);
|
||||
|
@ -529,6 +530,13 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
|
||||
// Initialize
|
||||
|
||||
if (UriHelper.isHyperLink(uri))
|
||||
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_insert_link_45_24, 0, 0, 0);
|
||||
else if (UriHelper.isPhoneNumber(uri))
|
||||
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_call_24, 0, 0, 0);
|
||||
else if (UriHelper.isGeo(uri))
|
||||
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_language_24, 0, 0, 0);
|
||||
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
|
|
@ -544,6 +544,14 @@ public class UriHelper {
|
|||
"https".equalsIgnoreCase(uri.getScheme())));
|
||||
}
|
||||
|
||||
static boolean isPhoneNumber(Uri uri) {
|
||||
return (uri.isOpaque() && "tel".equalsIgnoreCase(uri.getScheme()));
|
||||
}
|
||||
|
||||
static boolean isGeo(Uri uri) {
|
||||
return (uri.isOpaque() && "geo".equalsIgnoreCase(uri.getScheme()));
|
||||
}
|
||||
|
||||
static Uri fix(Uri uri) {
|
||||
if ((!"http".equals(uri.getScheme()) && "http".equalsIgnoreCase(uri.getScheme())) ||
|
||||
(!"https".equals(uri.getScheme()) && "https".equalsIgnoreCase(uri.getScheme()))) {
|
||||
|
|
15
app/src/main/res/drawable/twotone_call_24.xml
Normal file
15
app/src/main/res/drawable/twotone_call_24.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<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="M19,17.47c-0.88,-0.07 -1.75,-0.22 -2.6,-0.45l-1.19,1.19c1.2,0.41 2.48,0.67 3.8,0.75v-1.49zM6.54,5h-1.5c0.09,1.32 0.35,2.59 0.75,3.8l1.2,-1.2c-0.24,-0.84 -0.39,-1.71 -0.45,-2.6z"
|
||||
android:strokeAlpha="0.3"
|
||||
android:fillAlpha="0.3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,21c0.55,0 1,-0.45 1,-1v-3.49c0,-0.55 -0.45,-1 -1,-1 -1.24,0 -2.45,-0.2 -3.57,-0.57 -0.1,-0.04 -0.21,-0.05 -0.31,-0.05 -0.26,0 -0.51,0.1 -0.71,0.29l-2.2,2.2c-2.83,-1.45 -5.15,-3.76 -6.59,-6.59l2.2,-2.2c0.28,-0.28 0.36,-0.67 0.25,-1.02C8.7,6.45 8.5,5.25 8.5,4c0,-0.55 -0.45,-1 -1,-1L4,3c-0.55,0 -1,0.45 -1,1 0,9.39 7.61,17 17,17zM16.4,17.02c0.85,0.24 1.72,0.39 2.6,0.45v1.49c-1.32,-0.09 -2.59,-0.35 -3.8,-0.75l1.2,-1.19zM5.03,5h1.5c0.07,0.89 0.22,1.76 0.46,2.59l-1.2,1.2c-0.41,-1.2 -0.67,-2.47 -0.76,-3.79z"/>
|
||||
</vector>
|
|
@ -15,6 +15,7 @@
|
|||
android:id="@+id/tvCaption"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_open_link"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Large"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ibInfo"
|
||||
|
|
Loading…
Reference in a new issue