Remove: Layout's categories recycler

This commit is contained in:
machiav3lli 2022-04-11 01:08:24 +02:00
parent cb93e62544
commit 466af7faa5
2 changed files with 4 additions and 57 deletions

View File

@ -52,35 +52,6 @@ class ExploreFragment : MainNavFragmentX() {
redrawPage(it)
}
viewModel.categories.observe(viewLifecycleOwner) {
binding.categories.apply {
removeAllViews()
addView(Chip(requireContext(), null, R.attr.categoryChipStyle).apply {
setText(R.string.all_applications)
id = R.id.SHOW_ALL
})
it.sorted().forEach {
addView(Chip(requireContext(), null, R.attr.categoryChipStyle).apply {
text = it
})
}
val selectedSection = viewModel.sections.value
check(
children.filterNotNull()
.find { child ->
child is Chip && selectedSection is Category && child.text == selectedSection.label
}?.id ?: R.id.SHOW_ALL
)
}
}
binding.categories.setOnCheckedStateChangeListener { group, checkedIds ->
group.findViewById<Chip>(checkedIds[0]).let {
viewModel.setSection(
if (it.text.equals(getString(R.string.all_applications)))
Section.All
else
Section.Category(it.text.toString())
)
}
}
mainActivityX.menuSetup.observe(viewLifecycleOwner) {
if (it != null) {

View File

@ -15,8 +15,7 @@
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
@ -26,33 +25,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<androidx.compose.ui.platform.ComposeView
android:id="@+id/primaryComposeRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<com.google.android.material.chip.ChipGroup
android:id="@+id/categories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="true"
android:paddingHorizontal="@dimen/shape_margin_medium"
app:selectionRequired="true"
app:singleSelection="true" />
</HorizontalScrollView>
<androidx.compose.ui.platform.ComposeView
android:id="@+id/primaryComposeRecycler"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
android:layout_height="match_parent" />
</com.google.android.material.circularreveal.CircularRevealFrameLayout>
</layout>