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
|
<activity
|
||||||
android:name=".ui.VpnProfileImportActivity"
|
android:name=".ui.VpnProfileImportActivity"
|
||||||
android:label="@string/profile_import"
|
android:label="@string/profile_import"
|
||||||
android:theme="@style/ApplicationTheme.ActionBar"
|
android:theme="@style/TransparentActivity"
|
||||||
android:taskAffinity=""
|
android:taskAffinity=""
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:exported="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.res.stringResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
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.R
|
||||||
import org.strongswan.android.ui.compose.components.ShxCard
|
import org.strongswan.android.ui.compose.components.ShxCard
|
||||||
import org.strongswan.android.ui.compose.theme.ShxSpacing
|
import org.strongswan.android.ui.compose.theme.ShxSpacing
|
||||||
@@ -89,19 +91,28 @@ class ImportUiModel
|
|||||||
var hideImport by mutableStateOf(false)
|
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,
|
fun ComponentActivity.installImportScreen(model: ImportUiModel, onImport: Runnable, onClose: Runnable,
|
||||||
onImportPkcs12: Runnable, onSelectUserCert: Runnable)
|
onImportPkcs12: Runnable, onSelectUserCert: Runnable)
|
||||||
{
|
{
|
||||||
setContent {
|
setContent {
|
||||||
ShxTheme {
|
ShxTheme {
|
||||||
ImportScreen(
|
/* the activity is a transparent host: the import UI is an Expressive bottom sheet */
|
||||||
model = model,
|
ModalBottomSheet(
|
||||||
onImport = onImport::run,
|
onDismissRequest = onClose::run,
|
||||||
onClose = onClose::run,
|
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
|
||||||
onImportPkcs12 = onImportPkcs12::run,
|
containerColor = MaterialTheme.colorScheme.background,
|
||||||
onSelectUserCert = onSelectUserCert::run,
|
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
ImportScreen(
|
||||||
|
model = model,
|
||||||
|
onImport = onImport::run,
|
||||||
|
onClose = onClose::run,
|
||||||
|
onImportPkcs12 = onImportPkcs12::run,
|
||||||
|
onSelectUserCert = onSelectUserCert::run,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user