From f49cc2d498d803e152b5588cf3e8a6db4dcfdab7 Mon Sep 17 00:00:00 2001 From: tarsin Date: Thu, 17 Nov 2022 00:34:10 +0800 Subject: [PATCH] Fix GalleryCommentsScene fab and edittext render out of screen --- .../ui/scene/GalleryCommentsScene.java | 11 ++- .../res/layout/scene_gallery_comments.xml | 67 ++++++++++--------- app/src/main/res/layout/scene_toolbar.xml | 2 +- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryCommentsScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryCommentsScene.java index aedb2ae36..7e958661b 100644 --- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryCommentsScene.java +++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryCommentsScene.java @@ -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, diff --git a/app/src/main/res/layout/scene_gallery_comments.xml b/app/src/main/res/layout/scene_gallery_comments.xml index cace60233..761e9fe12 100644 --- a/app/src/main/res/layout/scene_gallery_comments.xml +++ b/app/src/main/res/layout/scene_gallery_comments.xml @@ -47,42 +47,47 @@ android:text="@string/no_one_comments_gallery" app:fitsSystemWindowsInsets="bottom" /> - + android:layout_height="match_parent"> - - - + android:background="?attr/colorPrimaryContainer" + android:elevation="4dp" + android:orientation="horizontal" + android:visibility="invisible" + app:fitsSystemWindowsInsets="bottom"> - + + + + + + + android:fitsSystemWindows="true">