take switcher width into account for button
This commit is contained in:
@@ -240,14 +240,18 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
|||||||
if(toolbarWidth==0) return;
|
if(toolbarWidth==0) return;
|
||||||
|
|
||||||
int toolbarFrameWidth=toolbarFrame.getWidth();
|
int toolbarFrameWidth=toolbarFrame.getWidth();
|
||||||
int padding = toolbarWidth - toolbarFrameWidth;
|
int actionsWidth=toolbarWidth-toolbarFrameWidth;
|
||||||
|
// margin (4) + padding (12) + icon (24) + margin (8) + chevron (16) + padding (12)
|
||||||
|
int switcherWidth=V.dp(76);
|
||||||
FrameLayout parent=((FrameLayout) toolbarShowNewPostsBtn.getParent());
|
FrameLayout parent=((FrameLayout) toolbarShowNewPostsBtn.getParent());
|
||||||
if (padding == parent.getPaddingStart()) return;
|
if(actionsWidth==parent.getPaddingStart()) return;
|
||||||
|
int paddingMax=Math.max(actionsWidth, switcherWidth);
|
||||||
|
int paddingEnd=(Math.max(0, switcherWidth-actionsWidth));
|
||||||
|
|
||||||
// toolbar frame goes from screen edge to beginning of right-aligned option buttons.
|
// toolbar frame goes from screen edge to beginning of right-aligned option buttons.
|
||||||
// centering button by applying the same space on the left
|
// centering button by applying the same space on the left
|
||||||
parent.setPaddingRelative(padding, 0, 0, 0);
|
parent.setPaddingRelative(paddingMax, 0, paddingEnd, 0);
|
||||||
toolbarShowNewPostsBtn.setMaxWidth(toolbarWidth - padding * 2);
|
toolbarShowNewPostsBtn.setMaxWidth(toolbarWidth-paddingMax*2);
|
||||||
|
|
||||||
switcher.setPivotX(V.dp(28)); // padding + half of icon
|
switcher.setPivotX(V.dp(28)); // padding + half of icon
|
||||||
switcher.setPivotY(switcher.getHeight() / 2f);
|
switcher.setPivotY(switcher.getHeight() / 2f);
|
||||||
|
|||||||
@@ -51,9 +51,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@drawable/bg_button_m3_tonal_selector"
|
android:background="@drawable/bg_button_m3_tonal_selector"
|
||||||
android:maxLines="2"
|
android:maxLines="1"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:lineSpacingMultiplier="0.8"
|
|
||||||
android:textAppearance="@style/m3_title_medium"
|
android:textAppearance="@style/m3_title_medium"
|
||||||
android:text="@string/see_new_posts"
|
android:text="@string/see_new_posts"
|
||||||
android:drawableStart="@drawable/ic_fluent_arrow_up_16_filled"
|
android:drawableStart="@drawable/ic_fluent_arrow_up_16_filled"
|
||||||
|
|||||||
Reference in New Issue
Block a user