mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-07 17:43:18 +02:00
Added link click ripple
This commit is contained in:
@@ -463,6 +463,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
private TextView tvBody;
|
||||
private View wvBody;
|
||||
private ContentLoadingProgressBar pbBody;
|
||||
private View vwRipple;
|
||||
private TextView tvNoInternetBody;
|
||||
private ImageButton ibDownloading;
|
||||
private Group grpDownloading;
|
||||
@@ -584,9 +585,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (image.length > 0 && image[0].getSource() != null) {
|
||||
ImageHelper.AnnotatedSource a = new ImageHelper.AnnotatedSource(image[0].getSource());
|
||||
Uri uri = Uri.parse(a.getSource());
|
||||
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))
|
||||
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
|
||||
ripple(event);
|
||||
if (onOpenLink(uri, null, false))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,6 +605,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (url.equals(title))
|
||||
title = null;
|
||||
|
||||
ripple(event);
|
||||
if (onOpenLink(uri, title, false))
|
||||
return true;
|
||||
}
|
||||
@@ -611,8 +615,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
ImageHelper.AnnotatedSource a = new ImageHelper.AnnotatedSource(image[0].getSource());
|
||||
String source = a.getSource();
|
||||
if (!TextUtils.isEmpty(source)) {
|
||||
if (!a.isTracking())
|
||||
if (!a.isTracking()) {
|
||||
ripple(event);
|
||||
onOpenImage(message.id, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -626,6 +632,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ripple(MotionEvent event) {
|
||||
int r = context.getResources().getDimensionPixelSize(R.dimen.ripple_radius);
|
||||
vwRipple.setLeft(tvBody.getLeft() + Math.round(event.getX()) - r);
|
||||
vwRipple.setTop(tvBody.getTop() + Math.round(event.getY()) - r);
|
||||
vwRipple.setRight(tvBody.getLeft() + Math.round(event.getX()) + r);
|
||||
vwRipple.setBottom(tvBody.getTop() + Math.round(event.getY()) + r);
|
||||
vwRipple.setClickable(true);
|
||||
vwRipple.setPressed(true);
|
||||
vwRipple.setPressed(false);
|
||||
vwRipple.setClickable(false);
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
@@ -858,6 +876,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
tvBody = vsBody.findViewById(R.id.tvBody);
|
||||
wvBody = vsBody.findViewById(R.id.wvBody);
|
||||
pbBody = vsBody.findViewById(R.id.pbBody);
|
||||
vwRipple = vsBody.findViewById(R.id.vwRipple);
|
||||
tvNoInternetBody = vsBody.findViewById(R.id.tvNoInternetBody);
|
||||
ibDownloading = vsBody.findViewById(R.id.ibDownloading);
|
||||
grpDownloading = vsBody.findViewById(R.id.grpDownloading);
|
||||
|
||||
3
app/src/main/res/drawable/ripple.xml
Normal file
3
app/src/main/res/drawable/ripple.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?android:colorControlHighlight" />
|
||||
@@ -102,6 +102,14 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDownloading" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vwRipple"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:background="@drawable/ripple"
|
||||
app:layout_constraintStart_toStartOf="@+id/tvBody"
|
||||
app:layout_constraintTop_toTopOf="@+id/tvBody" />
|
||||
|
||||
<View
|
||||
android:id="@+id/wvBody"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -13,4 +13,5 @@
|
||||
<dimen name="quote_stripe_width">3dp</dimen>
|
||||
<dimen name="line_dash_length">3dp</dimen>
|
||||
<dimen name="search_in_text_margin">48dp</dimen>
|
||||
<dimen name="ripple_radius">24dp</dimen>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user