Show link type in link confirmation dialog (2)

pull/214/head
M66B 11 months ago
parent 9b2566050f
commit 04d39f8f13

@ -530,12 +530,16 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
// Initialize
int icon = 0;
if (UriHelper.isHyperLink(uri))
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_insert_link_45_24, 0, 0, 0);
icon = R.drawable.twotone_insert_link_45_24;
else if (UriHelper.isMail(uri))
icon = R.drawable.twotone_mail_24;
else if (UriHelper.isPhoneNumber(uri))
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_call_24, 0, 0, 0);
icon = R.drawable.twotone_call_24;
else if (UriHelper.isGeo(uri))
tvCaption.setCompoundDrawablesWithIntrinsicBounds(R.drawable.twotone_language_24, 0, 0, 0);
icon = R.drawable.twotone_language_24;
tvCaption.setCompoundDrawablesWithIntrinsicBounds(icon, 0, 0, 0);
tvTitle.setText(title);
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);

@ -544,6 +544,10 @@ public class UriHelper {
"https".equalsIgnoreCase(uri.getScheme())));
}
static boolean isMail(Uri uri) {
return (uri.isOpaque() && "mailto".equalsIgnoreCase(uri.getScheme()));
}
static boolean isPhoneNumber(Uri uri) {
return (uri.isOpaque() && "tel".equalsIgnoreCase(uri.getScheme()));
}

@ -15,7 +15,9 @@
android:id="@+id/tvCaption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_insert_link_45_24"
android:drawablePadding="6dp"
android:drawableTint="?android:attr/textColorPrimary"
android:text="@string/title_open_link"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toStartOf="@+id/ibInfo"

Loading…
Cancel
Save