tweak footer margins and hitboxes

This commit is contained in:
sk
2023-06-04 04:08:38 +02:00
parent 486eef21dd
commit bc717f5b10
2 changed files with 92 additions and 86 deletions

View File

@@ -56,8 +56,8 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
} }
public static class Holder extends StatusDisplayItem.Holder<FooterStatusDisplayItem>{ public static class Holder extends StatusDisplayItem.Holder<FooterStatusDisplayItem>{
private final TextView reply, boost, favorite, bookmark; private final TextView reply, boost, favorite;
private final ImageView share; private final ImageView share, bookmark;
private static final Animation opacityOut, opacityIn; private static final Animation opacityOut, opacityIn;
private View touchingView = null; private View touchingView = null;
@@ -100,7 +100,6 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
UiUtils.fixCompoundDrawableTintOnAndroid6(reply); UiUtils.fixCompoundDrawableTintOnAndroid6(reply);
UiUtils.fixCompoundDrawableTintOnAndroid6(boost); UiUtils.fixCompoundDrawableTintOnAndroid6(boost);
UiUtils.fixCompoundDrawableTintOnAndroid6(favorite); UiUtils.fixCompoundDrawableTintOnAndroid6(favorite);
UiUtils.fixCompoundDrawableTintOnAndroid6(bookmark);
} }
View reply=findViewById(R.id.reply_btn); View reply=findViewById(R.id.reply_btn);
View boost=findViewById(R.id.boost_btn); View boost=findViewById(R.id.boost_btn);
@@ -181,8 +180,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
} else if (action == MotionEvent.ACTION_DOWN) { } else if (action == MotionEvent.ACTION_DOWN) {
longClickPerformed = false; longClickPerformed = false;
touchingView = v; touchingView = v;
// 20dp to center in middle of icon, because: (icon width = 24dp) / 2 + (paddingStart = 8dp) // 28dp to center in middle of icon, because:
v.setPivotX(V.dp(20)); // (icon width = 24dp) / 2 + (paddingStart = 8dp) + (paddingHorizontal = 8dp)
v.setPivotX(V.dp(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());

View File

@@ -3,122 +3,128 @@
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="600dp"
app:defaultWidth="350dp" app:defaultWidth="450dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp">
android:paddingHorizontal="16dp">
<FrameLayout <FrameLayout
android:id="@+id/reply_btn" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent">
android:minWidth="56dp"> <FrameLayout
<TextView android:id="@+id/reply_btn"
android:id="@+id/reply"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:paddingHorizontal="16dp"
android:drawableStart="@drawable/ic_fluent_chat_multiple_24_selector_text" android:minWidth="56dp">
android:drawablePadding="8dp" <TextView
android:paddingHorizontal="8dp" android:id="@+id/reply"
android:drawableTint="?android:textColorSecondary" android:layout_width="wrap_content"
android:gravity="center_vertical" android:layout_height="match_parent"
android:textAppearance="@style/m3_label_large" android:layout_gravity="center_vertical"
tools:text="123"/> android:drawableStart="@drawable/ic_fluent_chat_multiple_24_selector_text"
android:drawablePadding="8dp"
android:drawableTint="?android:textColorSecondary"
android:gravity="center_vertical"
android:textAppearance="@style/m3_label_large"
android:maxLines="1"
android:ellipsize="end"
tools:text="123"/>
</FrameLayout>
</FrameLayout> </FrameLayout>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<FrameLayout <FrameLayout
android:id="@+id/boost_btn" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent">
android:minWidth="56dp"> <FrameLayout
<TextView android:id="@+id/boost_btn"
android:id="@+id/boost"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:paddingHorizontal="16dp"
android:drawableStart="@drawable/ic_boost" android:minWidth="56dp">
android:drawablePadding="8dp" <TextView
android:paddingHorizontal="8dp" android:id="@+id/boost"
android:drawableTint="@color/boost_icon" android:layout_width="wrap_content"
android:textColor="@color/boost_icon" android:layout_height="match_parent"
android:gravity="center_vertical" android:layout_gravity="center_vertical"
android:textAppearance="@style/m3_label_large" android:drawableStart="@drawable/ic_boost"
tools:text="123"/> android:drawablePadding="8dp"
android:drawableTint="@color/boost_icon"
android:textColor="@color/boost_icon"
android:gravity="center_vertical"
android:textAppearance="@style/m3_label_large"
android:maxLines="1"
android:ellipsize="end"
tools:text="123"/>
</FrameLayout>
</FrameLayout> </FrameLayout>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<FrameLayout <FrameLayout
android:id="@+id/favorite_btn" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent">
android:minWidth="56dp"> <FrameLayout
<TextView android:id="@+id/favorite_btn"
android:id="@+id/favorite"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:paddingHorizontal="16dp"
android:drawableStart="@drawable/ic_fluent_star_24_selector" android:minWidth="56dp">
android:drawablePadding="8dp" <TextView
android:paddingHorizontal="8dp" android:id="@+id/favorite"
android:drawableTint="@color/favorite_icon" android:layout_width="wrap_content"
android:textColor="@color/favorite_icon" android:layout_height="match_parent"
android:gravity="center_vertical" android:layout_gravity="center_vertical"
android:textAppearance="@style/m3_label_large" android:drawableStart="@drawable/ic_fluent_star_24_selector"
tools:text="123"/> android:drawablePadding="8dp"
android:drawableTint="@color/favorite_icon"
android:textColor="@color/favorite_icon"
android:gravity="center_vertical"
android:textAppearance="@style/m3_label_large"
android:maxLines="1"
android:ellipsize="end"
tools:text="123"/>
</FrameLayout>
</FrameLayout> </FrameLayout>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<FrameLayout <FrameLayout
android:id="@+id/bookmark_btn" android:layout_weight="1"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent">
android:minWidth="56dp"> <FrameLayout
<TextView android:id="@+id/bookmark_btn"
android:id="@+id/bookmark"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:paddingHorizontal="16dp"
android:drawableStart="@drawable/ic_fluent_bookmark_24_selector" android:minWidth="56dp">
android:paddingHorizontal="8dp" <ImageView
android:drawableTint="@color/bookmark_icon" android:id="@+id/bookmark"
android:gravity="center_vertical" android:layout_width="wrap_content"
android:textAppearance="@style/m3_label_large" /> android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_fluent_bookmark_24_selector"
android:tint="@color/bookmark_icon"
android:gravity="center_vertical"
android:textAppearance="@style/m3_label_large" />
</FrameLayout>
</FrameLayout> </FrameLayout>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<FrameLayout <FrameLayout
android:id="@+id/share_btn" android:id="@+id/share_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:paddingHorizontal="16dp">
<ImageView <ImageView
android:id="@+id/share" android:id="@+id/share"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_fluent_share_24_regular" android:src="@drawable/ic_fluent_share_24_regular"
android:paddingHorizontal="8dp"
android:tint="?android:textColorSecondary" android:tint="?android:textColorSecondary"
android:gravity="center_vertical"/> android:gravity="center_vertical"/>
</FrameLayout> </FrameLayout>