android: profile import as an Expressive bottom sheet in a transparent host
This commit is contained in:
1 parent
8deafeae8e
commit
7a7673119e
2 files changed
+19
-8
No files matched your search
@@ -149,7 +149,7 @@
|
||||
<activity
|
||||
android:name=".ui.VpnProfileImportActivity"
|
||||
android:label="@string/profile_import"
|
||||
android:theme="@style/ApplicationTheme.ActionBar"
|
||||
android:theme="@style/TransparentActivity"
|
||||
android:taskAffinity=""
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true">
|
||||
|
||||
+18
-7
@@ -52,6 +52,8 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import org.strongswan.android.R
|
||||
import org.strongswan.android.ui.compose.components.ShxCard
|
||||
import org.strongswan.android.ui.compose.theme.ShxSpacing
|
||||
@@ -89,19 +91,28 @@ class ImportUiModel
|
||||
var hideImport by mutableStateOf(false)
|
||||
}
|
||||
|
||||
/** Renders the import screen in the transparent import activity. */
|
||||
/** Renders the import UI as a bottom sheet in the transparent import activity. */
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
fun ComponentActivity.installImportScreen(model: ImportUiModel, onImport: Runnable, onClose: Runnable,
|
||||
onImportPkcs12: Runnable, onSelectUserCert: Runnable)
|
||||
{
|
||||
setContent {
|
||||
ShxTheme {
|
||||
ImportScreen(
|
||||
model = model,
|
||||
onImport = onImport::run,
|
||||
onClose = onClose::run,
|
||||
onImportPkcs12 = onImportPkcs12::run,
|
||||
onSelectUserCert = onSelectUserCert::run,
|
||||
/* the activity is a transparent host: the import UI is an Expressive bottom sheet */
|
||||
ModalBottomSheet(
|
||||
onDismissRequest = onClose::run,
|
||||
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
||||
containerColor = MaterialTheme.colorScheme.background,
|
||||
)
|
||||
{
|
||||
ImportScreen(
|
||||
model = model,
|
||||
onImport = onImport::run,
|
||||
onClose = onClose::run,
|
||||
onImportPkcs12 = onImportPkcs12::run,
|
||||
onSelectUserCert = onSelectUserCert::run,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user