Some ripples in the water

pull/161/head
M66B 5 years ago
parent 15cbc2438b
commit 5432a9ff8c

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import android.Manifest;
import android.animation.Animator;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog;
@ -68,9 +69,11 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
@ -226,8 +229,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
public class ViewHolder extends RecyclerView.ViewHolder implements
View.OnClickListener, View.OnLongClickListener, BottomNavigationView.OnNavigationItemSelectedListener, View.OnKeyListener {
private View card;
private View view;
private View vwRipple;
private View vwColor;
private ImageView ivExpander;
@ -332,8 +335,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ViewHolder(final View itemView) {
super(itemView);
card = itemView.findViewById(R.id.card);
view = itemView.findViewById(R.id.clItem);
vwRipple = itemView.findViewById(R.id.vwRipple);
vwColor = itemView.findViewById(R.id.vwColor);
ivExpander = itemView.findViewById(R.id.ivExpander);
@ -1472,8 +1475,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onToggleMessage(message);
}
} else {
vwRipple.setPressed(true);
vwRipple.setPressed(false);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
// Unreveal
int cx = card.getWidth() / 2;
int cy = card.getHeight() / 2;
int r = Math.max(card.getWidth(), card.getHeight());
Animator anim = ViewAnimationUtils.createCircularReveal(card, cx, cy, r, 0);
anim.setInterpolator(new AccelerateDecelerateInterpolator());
anim.setDuration(context.getResources().getInteger(android.R.integer.config_mediumAnimTime));
anim.start();
} else {
// selectableItemBackground
card.setClickable(true);
card.setPressed(true);
}
if (EntityFolder.DRAFTS.equals(message.folderType) && message.visible == 1)
context.startActivity(

@ -5,8 +5,10 @@
android:layout_height="wrap_content">
<eu.faircode.email.ViewCardOptional
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
@ -25,16 +27,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/vwRipple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
app:layout_constraintBottom_toBottomOf="@id/inHeader"
app:layout_constraintEnd_toEndOf="@id/inHeader"
app:layout_constraintStart_toStartOf="@id/inHeader"
app:layout_constraintTop_toTopOf="@id/inHeader" />
<ViewStub
android:id="@+id/vsBody"
android:layout_width="match_parent"

@ -5,8 +5,10 @@
android:layout_height="wrap_content">
<eu.faircode.email.ViewCardOptional
android:id="@+id/card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:foreground="?android:attr/selectableItemBackground">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
@ -25,16 +27,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/vwRipple"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
app:layout_constraintBottom_toBottomOf="@id/inHeader"
app:layout_constraintEnd_toEndOf="@id/inHeader"
app:layout_constraintStart_toStartOf="@id/inHeader"
app:layout_constraintTop_toTopOf="@id/inHeader" />
<ViewStub
android:id="@+id/vsBody"
android:layout_width="match_parent"

Loading…
Cancel
Save