aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator/infinityforreddit
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-09-04 04:08:54 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-09-04 04:08:54 +0000
commit60eb71fe11b166a30dd0b879ea935e1769120c63 (patch)
treead7acc71afb59551b3dbeb683a58afc2693ec7cb /app/src/main/java/ml/docilealligator/infinityforreddit
parent47c1069d1e588c6c00a0a11d04593831ed51f65d (diff)
downloadinfinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar.gz
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar.bz2
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar.lz
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar.xz
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.tar.zst
infinity-for-reddit-60eb71fe11b166a30dd0b879ea935e1769120c63.zip
Fix icon position in swipe action.
Diffstat (limited to 'app/src/main/java/ml/docilealligator/infinityforreddit')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
index 7727964a..7edfa0c4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
@@ -629,6 +629,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
backgroundRight = new ColorDrawable(customThemeWrapper.getUpvoted());
drawableLeft = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_downward_black_24dp, null);
drawableRight = ResourcesCompat.getDrawable(activity.getResources(), R.drawable.ic_arrow_upward_black_24dp, null);
+ int screenBottom = window.getDecorView().getHeight();
touchHelper = new ItemTouchHelper(new ItemTouchHelper.Callback() {
boolean exceedThreshold = false;
@@ -674,7 +675,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
v.vibrate(VibrationEffect.createOneShot(10, 175));
} else {
//deprecated in API 26
- v.vibrate(50);
+ v.vibrate(10);
}
}
}
@@ -683,7 +684,11 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
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);
+
+ 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) {
@@ -695,7 +700,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
v.vibrate(VibrationEffect.createOneShot(10, 175));
} else {
//deprecated in API 26
- v.vibrate(50);
+ v.vibrate(10);
}
}
}
@@ -704,7 +709,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
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);
+ 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);
backgroundRight.draw(c);
drawableRight.draw(c);
}