From 5d3b9636821c574751ec501e399d923f02c34fd5 Mon Sep 17 00:00:00 2001 From: CnC-Robert Date: Fri, 14 Jul 2023 21:37:50 +0200 Subject: [PATCH] feat: disable filter chips when there are no patches --- .../manager/ui/screen/PatchesSelectorScreen.kt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt index c589eb9a..1f5b9687 100644 --- a/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt +++ b/app/src/main/java/app/revanced/manager/ui/screen/PatchesSelectorScreen.kt @@ -162,21 +162,24 @@ fun PatchesSelectorScreen( horizontalArrangement = Arrangement.spacedBy(5.dp) ) { FilterChip( - selected = vm.filter and SHOW_SUPPORTED != 0, + selected = vm.filter and SHOW_SUPPORTED != 0 && bundle.supported.isNotEmpty(), onClick = { vm.toggleFlag(SHOW_SUPPORTED) }, - label = { Text(stringResource(R.string.supported)) } + label = { Text(stringResource(R.string.supported)) }, + enabled = bundle.supported.isNotEmpty() ) FilterChip( - selected = vm.filter and SHOW_UNIVERSAL != 0, + selected = vm.filter and SHOW_UNIVERSAL != 0 && bundle.universal.isNotEmpty(), onClick = { vm.toggleFlag(SHOW_UNIVERSAL) }, - label = { Text(stringResource(R.string.universal)) } + label = { Text(stringResource(R.string.universal)) }, + enabled = bundle.universal.isNotEmpty() ) FilterChip( - selected = vm.filter and SHOW_UNSUPPORTED != 0, + selected = vm.filter and SHOW_UNSUPPORTED != 0 && bundle.unsupported.isNotEmpty(), onClick = { vm.toggleFlag(SHOW_UNSUPPORTED) }, - label = { Text(stringResource(R.string.unsupported)) } + label = { Text(stringResource(R.string.unsupported)) }, + enabled = bundle.unsupported.isNotEmpty() ) }