Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

feat: more info for the select from application screen #81

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
}
}

Expand Down Expand Up @@ -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
)
Axelen123 marked this conversation as resolved.
Show resolved Hide resolved
}
}

}
)
}
Expand Down Expand Up @@ -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_an_installation_file))
}
)
Divider()
}
Expand All @@ -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
)
)
}
}
)

}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
<string name="ok">OK</string>
<string name="patch">Patch</string>
<string name="select_from_storage">Select from storage</string>
<string name="select_an_installation_file">Select an installation file using file picker</string>
Axelen123 marked this conversation as resolved.
Show resolved Hide resolved
<string name="type_anything">Type anything to continue</string>
<string name="search">Search</string>
<string name="apply">Apply</string>
<string name="help">Help</string>
Expand Down
Loading