Feat(ToolView): Support filltering file types
This commit is contained in:
@@ -96,9 +96,10 @@ internal fun ToolViewScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val permissionLauncher = rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) {
|
val permissionLauncher =
|
||||||
Permissions.continuation?.resume(it)
|
rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) {
|
||||||
}
|
Permissions.continuation?.resume(it)
|
||||||
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = Modifier,
|
modifier = Modifier,
|
||||||
@@ -186,14 +187,15 @@ internal fun ToolViewScreen(
|
|||||||
fileChooserParams: FileChooserParams?
|
fileChooserParams: FileChooserParams?
|
||||||
): Boolean {
|
): Boolean {
|
||||||
fileChooserCallback = filePathCallback
|
fileChooserCallback = filePathCallback
|
||||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
val intent = fileChooserParams?.createIntent()
|
||||||
addCategory(Intent.CATEGORY_OPENABLE)
|
?: Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
||||||
type = "*/*"
|
addCategory(Intent.CATEGORY_OPENABLE)
|
||||||
}
|
type = "*/*"
|
||||||
|
}
|
||||||
fileChooserLauncher.launch(
|
fileChooserLauncher.launch(
|
||||||
Intent.createChooser(
|
Intent.createChooser(
|
||||||
intent,
|
intent,
|
||||||
ResourcesUtils.getString(
|
fileChooserParams?.title ?: ResourcesUtils.getString(
|
||||||
context = context,
|
context = context,
|
||||||
resId = R.string.core_file_select_one_text
|
resId = R.string.core_file_select_one_text
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user