diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1a29d099..13339b1b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,6 +6,7 @@
+
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 13fa5d90..7c7d8f53 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -10,7 +10,6 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -511,12 +510,10 @@ public class PostRecyclerViewAdapter extends PagedListAdapter 0) {
- if (dX > (itemView.getRight() - itemView.getLeft()) * 0.3) {
+ if (dX > (itemView.getRight() - itemView.getLeft()) * swipeActionThreshold) {
+ if (!exceedThreshold) {
+ exceedThreshold = true;
+ if (v != null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ v.vibrate(VibrationEffect.createOneShot(10, 175));
+ } else {
+ //deprecated in API 26
+ v.vibrate(50);
+ }
+ }
+ }
backgroundLeft.setBounds(0, itemView.getTop(), itemView.getRight(), itemView.getBottom());
} else {
+ exceedThreshold = false;
backgroundLeft.setBounds(0, 0, 0, 0);
}
drawableLeft.setBounds(itemView.getLeft() + ((int) dX) - horizontalOffset - drawableLeft.getIntrinsicWidth(), (itemView.getBottom() - itemView.getTop() - drawableLeft.getIntrinsicHeight()) / 2, itemView.getLeft() + ((int) dX) - horizontalOffset, (itemView.getBottom() - itemView.getTop() + drawableLeft.getIntrinsicHeight()) / 2);
backgroundLeft.draw(c);
drawableLeft.draw(c);
} else if (dX < 0) {
- if (-dX > (itemView.getRight() - itemView.getLeft()) * 0.3) {
+ if (-dX > (itemView.getRight() - itemView.getLeft()) * swipeActionThreshold) {
+ if (!exceedThreshold) {
+ exceedThreshold = true;
+ if (v != null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ v.vibrate(VibrationEffect.createOneShot(10, 175));
+ } else {
+ //deprecated in API 26
+ v.vibrate(50);
+ }
+ }
+ }
backgroundRight.setBounds(0, itemView.getTop(), itemView.getRight(), itemView.getBottom());
} else {
+ exceedThreshold = false;
backgroundRight.setBounds(0, 0, 0, 0);
}
drawableRight.setBounds(itemView.getRight() + ((int) dX) + horizontalOffset, (itemView.getBottom() - itemView.getTop() - drawableRight.getIntrinsicHeight()) / 2, itemView.getRight() + ((int) dX) + horizontalOffset + drawableRight.getIntrinsicWidth(), (itemView.getBottom() - itemView.getTop() + drawableRight.getIntrinsicHeight()) / 2);