Fix GalleryCommentsScene fab and edittext render out of screen

This commit is contained in:
tarsin committed 2022-11-17 00:34:10 +08:00
1 parent 3f4d2b75fc
commit f49cc2d498
3 files changed
+47 -33

No files matched your search

@@ -170,7 +170,7 @@ public final class GalleryCommentsScene extends ToolbarScene
@Override
public View onCreateViewWithToolbar(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.scene_gallery_comments, container, false);
ViewGroup view = (ViewGroup) inflater.inflate(R.layout.scene_gallery_comments, container, false);
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
setLiftOnScrollTargetView(mRecyclerView);
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
@@ -180,6 +180,15 @@ public final class GalleryCommentsScene extends ToolbarScene
mFabLayout = (FabLayout) ViewUtils.$$(view, R.id.fab_layout);
mFab = (FloatingActionButton) ViewUtils.$$(view, R.id.fab);
mRefreshLayout = (SwipeRefreshLayout) ViewUtils.$$(view, R.id.refresh_layout);
// Workaround for fab and edittext render out of screen
view.removeView(mFabLayout);
view.removeView((View) mEditPanel.getParent());
assert container != null;
container.addView(mFabLayout);
container.addView((View) mEditPanel.getParent());
ViewCompat.setWindowInsetsAnimationCallback(view, new WindowInsetsAnimationHelper(
WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP,
mEditPanel,
@@ -47,42 +47,47 @@
android:text="@string/no_one_comments_gallery"
app:fitsSystemWindowsInsets="bottom" />
<LinearLayout
android:id="@+id/edit_panel"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?attr/colorPrimaryContainer"
android:elevation="4dp"
android:orientation="horizontal"
android:visibility="invisible"
app:fitsSystemWindowsInsets="bottom">
android:layout_height="match_parent">
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
<LinearLayout
android:id="@+id/edit_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:gravity="left|center_vertical"
android:inputType="textMultiLine"
android:maxHeight="112dp"
android:minHeight="56dp"
android:padding="@dimen/keyline_margin"
android:textColor="?colorOnPrimarySurface" />
<ImageView
android:id="@+id/send"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:padding="16dp"
app:tint="?colorOnPrimarySurface" />
android:background="?attr/colorPrimaryContainer"
android:elevation="4dp"
android:orientation="horizontal"
android:visibility="invisible"
app:fitsSystemWindowsInsets="bottom">
</LinearLayout>
<EditText
android:id="@+id/edit_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:gravity="left|center_vertical"
android:inputType="textMultiLine"
android:maxHeight="112dp"
android:minHeight="56dp"
android:padding="@dimen/keyline_margin"
android:textColor="?colorOnPrimarySurface" />
<ImageView
android:id="@+id/send"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="bottom"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:padding="16dp"
app:tint="?colorOnPrimarySurface" />
</LinearLayout>
</FrameLayout>
<com.hippo.widget.FabLayout
android:id="@+id/fab_layout"
+1 -1
View File
@@ -23,7 +23,7 @@
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:fitsSystemWindowsInsets="top">
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"