use sp for scaled footer
This commit is contained in:
parent
2f02a238df
commit
f090ca7f75
|
@ -182,7 +182,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
|
||||||
touchingView = v;
|
touchingView = v;
|
||||||
// 28dp to center in middle of icon, because:
|
// 28dp to center in middle of icon, because:
|
||||||
// (icon width = 24dp) / 2 + (paddingStart = 8dp) + (paddingHorizontal = 8dp)
|
// (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();
|
v.animate().scaleX(0.85f).scaleY(0.85f).setInterpolator(CubicBezierInterpolator.DEFAULT).setDuration(75).start();
|
||||||
if (disabled) return true;
|
if (disabled) return true;
|
||||||
v.postDelayed(longClickRunnable, ViewConfiguration.getLongPressTimeout());
|
v.postDelayed(longClickRunnable, ViewConfiguration.getLongPressTimeout());
|
||||||
|
|
|
@ -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.
|
* Wraps a View.OnClickListener to filter multiple clicks in succession.
|
||||||
* Useful for buttons that perform some action that changes their state asynchronously.
|
* Useful for buttons that perform some action that changes their state asynchronously.
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<org.joinmastodon.android.ui.views.MaxWidthFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<org.joinmastodon.android.ui.views.MaxWidthFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:maxWidth="600dp"
|
android:maxWidth="600sp"
|
||||||
app:defaultWidth="450dp"
|
app:defaultWidth="450sp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue