diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index d4e50917b..ea30eb1e4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -182,7 +182,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ touchingView = v; // 28dp to center in middle of icon, because: // (icon width = 24dp) / 2 + (paddingStart = 8dp) + (paddingHorizontal = 8dp) - v.setPivotX(V.dp(28)); + v.setPivotX(UiUtils.sp(v.getContext(), 28)); v.animate().scaleX(0.85f).scaleY(0.85f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(75).start(); if (disabled) return true; v.postDelayed(longClickRunnable, ViewConfiguration.getLongPressTimeout()); diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 25ca9e1d0..0988e589b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -1407,6 +1407,16 @@ public class UiUtils { } } + /** + * Scale the input value according to the device's scaled display density + * @param sp Input value in scale-independent pixels (sp) + * @return Scaled value in physical pixels (px) + */ + public static int sp(Context context, float sp){ + // TODO: replace with V.sp in next AppKit version + return Math.round(sp*context.getApplicationContext().getResources().getDisplayMetrics().scaledDensity); + } + /** * Wraps a View.OnClickListener to filter multiple clicks in succession. * Useful for buttons that perform some action that changes their state asynchronously. diff --git a/mastodon/src/main/res/layout/display_item_footer.xml b/mastodon/src/main/res/layout/display_item_footer.xml index 3f92635db..e1a173b2b 100644 --- a/mastodon/src/main/res/layout/display_item_footer.xml +++ b/mastodon/src/main/res/layout/display_item_footer.xml @@ -2,8 +2,8 @@