@@ -124,14 +124,44 @@ fun ImportExportSettingsScreen(
124124 .fillMaxSize()
125125 .padding(paddingValues)
126126 ) {
127- GroupHeader (stringResource(R .string.signing))
127+ var showPackageSelector by rememberSaveable {
128+ mutableStateOf(false )
129+ }
130+ var showBundleSelector by rememberSaveable {
131+ mutableStateOf(false )
132+ }
133+
134+ if (showPackageSelector) {
135+ PackageSelector (packages = packagesWithOptions) { selected ->
136+ selected?.let (vm::resetOptionsForPackage)
137+
138+ showPackageSelector = false
139+ }
140+ }
141+
142+ if (showBundleSelector) {
143+ BundleSelector (bundles = patchBundles) { bundle ->
144+ bundle?.let (vm::clearOptionsForBundle)
145+
146+ showBundleSelector = false
147+ }
148+ }
149+
150+ GroupHeader (stringResource(R .string.import_))
128151 GroupItem (
129152 onClick = {
130153 importKeystoreLauncher.launch(" */*" )
131154 },
132155 headline = R .string.import_keystore,
133156 description = R .string.import_keystore_description
134157 )
158+ GroupItem (
159+ onClick = vm::importSelection,
160+ headline = R .string.import_patch_selection,
161+ description = R .string.import_patch_selection_description
162+ )
163+
164+ GroupHeader (stringResource(R .string.export))
135165 GroupItem (
136166 onClick = {
137167 if (! vm.canExport()) {
@@ -143,54 +173,25 @@ fun ImportExportSettingsScreen(
143173 headline = R .string.export_keystore,
144174 description = R .string.export_keystore_description
145175 )
146- GroupItem (
147- onClick = vm::regenerateKeystore,
148- headline = R .string.regenerate_keystore,
149- description = R .string.regenerate_keystore_description
150- )
151-
152- GroupHeader (stringResource(R .string.patches))
153- GroupItem (
154- onClick = vm::importSelection,
155- headline = R .string.import_patch_selection,
156- description = R .string.import_patch_selection_description
157- )
158176 GroupItem (
159177 onClick = vm::exportSelection,
160178 headline = R .string.export_patch_selection,
161179 description = R .string.export_patch_selection_description
162180 )
163- // TODO: allow resetting selection for specific bundle or package name.
181+
182+ GroupHeader (stringResource(R .string.reset))
183+ GroupItem (
184+ onClick = vm::regenerateKeystore,
185+ headline = R .string.regenerate_keystore,
186+ description = R .string.regenerate_keystore_description
187+ )
164188 GroupItem (
165- onClick = vm::resetSelection,
189+ onClick = vm::resetSelection, // TODO: allow resetting selection for specific bundle or package name.
166190 headline = R .string.reset_patch_selection,
167191 description = R .string.reset_patch_selection_description
168192 )
169-
170- var showPackageSelector by rememberSaveable {
171- mutableStateOf(false )
172- }
173- var showBundleSelector by rememberSaveable {
174- mutableStateOf(false )
175- }
176-
177- if (showPackageSelector)
178- PackageSelector (packages = packagesWithOptions) { selected ->
179- selected?.let (vm::resetOptionsForPackage)
180-
181- showPackageSelector = false
182- }
183-
184- if (showBundleSelector)
185- BundleSelector (bundles = patchBundles) { bundle ->
186- bundle?.let (vm::clearOptionsForBundle)
187-
188- showBundleSelector = false
189- }
190-
191- // TODO: patch options import/export.
192193 GroupItem (
193- onClick = vm::resetOptions,
194+ onClick = vm::resetOptions, // TODO: patch options import/export.
194195 headline = R .string.patch_options_reset_all,
195196 description = R .string.patch_options_reset_all_description,
196197 )
@@ -199,12 +200,13 @@ fun ImportExportSettingsScreen(
199200 headline = R .string.patch_options_reset_package,
200201 description = R .string.patch_options_reset_package_description
201202 )
202- if (patchBundles.size > 1 )
203+ if (patchBundles.size > 1 ) {
203204 GroupItem (
204205 onClick = { showBundleSelector = true },
205206 headline = R .string.patch_options_reset_bundle,
206207 description = R .string.patch_options_reset_bundle_description,
207208 )
209+ }
208210 }
209211 }
210212}
0 commit comments