diff --git a/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt index 14d5d08..f1a71e5 100644 --- a/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt +++ b/app/src/main/java/app/revanced/manager/ui/screen/AppSelectorScreen.kt @@ -49,7 +49,11 @@ fun AppSelectorScreen( val pickApkLauncher = rememberLauncherForActivityResult(ActivityResultContracts.GetContent()) { uri -> uri?.let { apkUri -> - vm.loadSelectedFile(apkUri)?.let(onStorageClick) ?: context.toast(context.getString(R.string.failed_to_load_apk)) + vm.loadSelectedFile(apkUri)?.let(onStorageClick) ?: context.toast( + context.getString( + R.string.failed_to_load_apk + ) + ) } } @@ -85,28 +89,62 @@ fun AppSelectorScreen( } }, content = { - LazyColumn( - modifier = Modifier.fillMaxSize() - ) { - if (appList.isNotEmpty()) { + + if (appList.isNotEmpty() && filterText.isNotEmpty()) { + + LazyColumn( + modifier = Modifier.fillMaxSize() + ) { + items( items = filteredAppList, key = { it.packageName } ) { app -> - ListItem( modifier = Modifier.clickable { onAppClick(app.packageName) }, - leadingContent = { AppIcon(app.packageInfo, null, Modifier.size(36.dp)) }, + leadingContent = { + AppIcon( + app.packageInfo, + null, + Modifier.size(36.dp) + ) + }, headlineContent = { AppLabel(app.packageInfo) }, supportingContent = { Text(app.packageName) }, - trailingContent = app.patches?.let { { Text(pluralStringResource(R.plurals.patches_count, it, it)) } } + trailingContent = app.patches?.let { + { + Text( + pluralStringResource( + R.plurals.patches_count, + it, + it + ) + ) + } + } ) } - } else { - item { LoadingIndicator() } + } + } else { + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Icon( + imageVector = Icons.Outlined.Search, + contentDescription = stringResource(R.string.search), + modifier = Modifier.size(64.dp) + ) + + Text( + text = stringResource(R.string.type_anything), + style = MaterialTheme.typography.bodyLarge + ) } } + } ) } @@ -146,7 +184,10 @@ fun AppSelectorScreen( ) } }, - headlineContent = { Text(stringResource(R.string.select_from_storage)) } + headlineContent = { Text(stringResource(R.string.select_from_storage)) }, + supportingContent = { + Text(stringResource(R.string.select_from_storage_description)) + } ) Divider() } @@ -162,7 +203,17 @@ fun AppSelectorScreen( leadingContent = { AppIcon(app.packageInfo, null, Modifier.size(36.dp)) }, headlineContent = { AppLabel(app.packageInfo) }, supportingContent = { Text(app.packageName) }, - trailingContent = app.patches?.let { { Text(pluralStringResource(R.plurals.patches_count, it, it)) } } + trailingContent = app.patches?.let { + { + Text( + pluralStringResource( + R.plurals.patches_count, + it, + it + ) + ) + } + } ) } diff --git a/app/src/main/res/values/plurals.xml b/app/src/main/res/values/plurals.xml index 697bce9..c64f7d9 100644 --- a/app/src/main/res/values/plurals.xml +++ b/app/src/main/res/values/plurals.xml @@ -1,8 +1,8 @@ - %d Patch - %d Patches + %d patch + %d patches %d applied patch diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5517915..73c2a73 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -93,6 +93,8 @@ Reset Patch Select from storage + Select an APK file from storage using file picker + Type anything to continue Search Apply Help