From 1f096d019e718b1efe7c9b2944df69afd73890ba Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 12 Sep 2018 17:37:47 +0000 Subject: [PATCH] Fixed stretched action icons Fixes #107 --- .../main/java/eu/faircode/email/FragmentMessages.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index cd0edb88..1f8ea060 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -197,20 +197,22 @@ public class FragmentMessages extends FragmentEx { if (dX > margin) { // Right swipe Drawable d = getResources().getDrawable(inbox ? R.drawable.baseline_inbox_24 : R.drawable.baseline_archive_24, getContext().getTheme()); + int padding = (itemView.getHeight() - d.getIntrinsicHeight()); d.setBounds( itemView.getLeft() + margin, - itemView.getTop() + d.getIntrinsicHeight() / 2, + itemView.getTop() + padding / 2, itemView.getLeft() + margin + d.getIntrinsicWidth(), - itemView.getTop() + (itemView.getHeight() - d.getIntrinsicHeight() / 2)); + itemView.getTop() + padding / 2 + d.getIntrinsicHeight()); d.draw(canvas); } else if (dX < -margin) { // Left swipe Drawable d = getResources().getDrawable(inbox ? R.drawable.baseline_inbox_24 : R.drawable.baseline_delete_24, getContext().getTheme()); + int padding = (itemView.getHeight() - d.getIntrinsicHeight()); d.setBounds( itemView.getLeft() + itemView.getWidth() - d.getIntrinsicWidth() - margin, - itemView.getTop() + d.getIntrinsicHeight() / 2, + itemView.getTop() + padding / 2, itemView.getLeft() + itemView.getWidth() - margin, - itemView.getTop() + (itemView.getHeight() - d.getIntrinsicHeight() / 2)); + itemView.getTop() + padding / 2 + d.getIntrinsicHeight()); d.draw(canvas); }