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) {