Flatten layout

This commit is contained in:
tarsin committed 2023-07-12 17:21:22 +08:00
1 parent 41b46035e4
commit 39b7623688
5 files changed
+21 -38

No files matched your search

@@ -35,8 +35,8 @@ abstract class BaseToolbarScene : BaseScene(), ToolBarScene {
savedInstanceState: Bundle?,
): View {
_binding = SceneToolbarBinding.inflate(inflater, container, false)
val contentView = onCreateViewWithToolbar(inflater, binding.root, savedInstanceState)
return binding.root.apply { addView(contentView, 0) }
onCreateViewWithToolbar(inflater, binding.root, savedInstanceState)
return binding.root
}
override fun onDestroyView() {
@@ -252,14 +252,10 @@ class DownloadsScene :
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
_binding = SceneDownloadBinding.inflate(inflater, container, false)
_binding = SceneDownloadBinding.inflate(inflater, container!!)
binding.run {
setLiftOnScrollTargetView(recyclerView)
// Workaround
(fabLayout.parent as ViewGroup).removeView(fabLayout)
container!!.addView(fabLayout)
mViewTransition =
ViewTransition(content, tip)
mViewTransition = ViewTransition(content, tip)
val drawable = ContextCompat.getDrawable(requireContext(), R.drawable.big_download)
drawable!!.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight)
tip.setCompoundDrawables(null, drawable, null, null)
@@ -354,7 +350,6 @@ class DownloadsScene :
super.onDestroyView()
binding.recyclerView.stopScroll()
removeAboveSnackView(binding.fabLayout)
(binding.fabLayout.parent as ViewGroup).removeView(binding.fabLayout)
mViewTransition = null
mAdapter = null
mLabelAdapter = null
@@ -153,19 +153,11 @@ class GalleryCommentsScene : BaseToolbarScene(), View.OnClickListener, OnRefresh
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
val view = inflater.inflate(R.layout.scene_gallery_comments, container, false) as ViewGroup
_binding = SceneGalleryCommentsBinding.bind(view)
_binding = SceneGalleryCommentsBinding.inflate(inflater, container!!)
setLiftOnScrollTargetView(binding.recyclerView)
val tip = binding.tip
// Workaround for fab and edittext render out of screen
view.removeView(binding.fabLayout)
view.removeView(binding.editPanel.parent as View)
assert(container != null)
container!!.addView(binding.fabLayout)
container.addView(binding.editPanel.parent as View)
ViewCompat.setWindowInsetsAnimationCallback(
view,
binding.root,
WindowInsetsAnimationHelper(
WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_STOP,
binding.editPanel,
@@ -269,7 +261,7 @@ class GalleryCommentsScene : BaseToolbarScene(), View.OnClickListener, OnRefresh
addAboveSnackView(binding.fabLayout)
mViewTransition = ViewTransition(binding.recyclerView, tip)
updateView(false)
return view
return binding.root
}
fun Spannable.clearSpan(start: Int, end: Int, url: Boolean) {
+5 -7
View File
@@ -14,16 +14,14 @@
~ limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.hippo.ehviewer.ui.legacy.EasyRecyclerView
android:id="@+id/recycler_view"
@@ -100,4 +98,4 @@
</com.hippo.ehviewer.ui.legacy.FabLayout>
</FrameLayout>
</merge>
@@ -14,25 +14,23 @@
~ limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.swiperefreshlayout.widget.ThemedSwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<com.hippo.ehviewer.ui.legacy.EasyRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="@dimen/fab_rv_padding_size"
android:paddingLeft="@dimen/keyline_margin"
android:paddingRight="@dimen/keyline_margin"
android:paddingBottom="@dimen/fab_rv_padding_size"
app:fitsSystemWindowsInsets="bottom" />
</androidx.swiperefreshlayout.widget.ThemedSwipeRefreshLayout>
@@ -70,13 +68,13 @@
android:layout_weight="1"
android:background="@null"
android:gravity="start|center_vertical"
android:importantForAutofill="no"
android:inputType="textMultiLine"
android:maxHeight="168dp"
android:minHeight="56dp"
android:textSize="16sp"
android:padding="@dimen/keyline_margin"
android:importantForAutofill="no"
android:textColor="?colorOnPrimaryContainer" />
android:textColor="?colorOnPrimaryContainer"
android:textSize="16sp" />
<ImageView
android:id="@+id/send"
@@ -107,4 +105,4 @@
app:srcCompat="@drawable/v_reply_dark_x24" />
</com.hippo.ehviewer.ui.legacy.FabLayout>
</FrameLayout>
</merge>