Skip to content

Commit

Permalink
fix(layout-inspector): hierarchy expand/collapse functionality fixed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
srtvprateek authored Jul 24, 2023
1 parent 0e0294e commit cf52f29
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.os.Bundle
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.os.bundleOf
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
Expand All @@ -29,6 +31,11 @@ internal class ViewInfoFragment : Fragment(R.layout.pluto_li___fragment_view_inf

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _, insets ->
val systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
binding.bsContainer.previewPanelBottomSheet.setPadding(0, 0, 0, systemBarsInsets.bottom)
insets
}
ActivityLifecycle.topActivity?.let { binding.operableView.tryGetFrontView(it) }
binding.operableView.setOnClickListener(this)
binding.leftControls.initialise(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ internal class ViewHierarchyFragment : DialogFragment() {
toast("root view not found, go back & try again")
}

rootView?.let {
rootView?.let { root ->
binding.expandCta.setOnDebounceClickListener {
viewModel.expandAll(it)
viewModel.expandAll(root)
}
binding.collapseCta.setOnDebounceClickListener {
viewModel.collapseAll(it)
viewModel.collapseAll(root)
}
binding.list.apply {
adapter = hierarchyAdapter
}

viewModel.list.removeObserver(parsedAttrObserver)
viewModel.list.observe(viewLifecycleOwner, parsedAttrObserver)
viewModel.parseInit(it)
viewModel.parseInit(root)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
android:id="@+id/previewPanelBottomSheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/pluto___white"
android:fitsSystemWindows="true"
app:behavior_hideable="true"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">

<com.pluto.plugins.layoutinspector.internal.ParamsPreviewPanel
android:id="@+id/previewPanel"
app:layout_constraintTop_toTopOf="parent"
android:background="@color/pluto___blue"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit cf52f29

Please sign in to comment.