@@ -459,7 +459,7 @@ private fun Shop(c: CreatePartDataHolder) {
459459 throw IllegalStateException (" duplicate $id in idNeeded?" )
460460 parts.add(Part (l.getLong(" size" ),
461461 l.getBoolean(" isPercent" ),
462- l.getString (" type" ),
462+ l.optString (" type" , " 8305 " ),
463463 id, l.getBoolean(" needUnsparse" )))
464464 if (! idUnneeded.remove(id))
465465 vm.idNeeded.add(id)
@@ -606,16 +606,47 @@ private fun Os(c: CreatePartDataHolder) {
606606 .fillMaxWidth()
607607 .padding(10 .dp)
608608 ) {
609- var sizeInSectors: Long = - 1
610- var remaining = c.endSectorRelative - c.startSectorRelative
611- for (iPart in c.parts.slice(0 .. i)) {
612- sizeInSectors = iPart.resolveSectorSize(c, remaining)
613- remaining - = sizeInSectors
614- }
615- remaining + = sizeInSectors
609+ if (c.vm.deviceInfo.metaonsd) {
610+ var sizeInSectors: Long = - 1
611+ var remaining = c.endSectorRelative - c.startSectorRelative
612+ for (iPart in c.parts.slice(0 .. i)) {
613+ sizeInSectors = iPart.resolveSectorSize(c, remaining)
614+ remaining - = sizeInSectors
615+ }
616+ remaining + = sizeInSectors
617+
618+ val selUnit =
619+ stringResource(if (part.isPercent) R .string.percent else R .string.bytes)
620+ Text (
621+ text = stringResource(
622+ R .string.sector_used,
623+ part.size,
624+ selUnit,
625+ sizeInSectors,
626+ remaining
627+ )
628+ )
629+ } else {
630+ var sizeInBytes: Long = - 1
631+ var remaining = c.desiredSize
632+ for (iPart in c.parts.slice(0 .. i)) {
633+ sizeInBytes = iPart.resolveBytesSize(c, remaining)
634+ remaining - = sizeInBytes
635+ }
636+ remaining + = sizeInBytes
616637
617- val selUnit = stringResource(if (part.isPercent) R .string.percent else R .string.bytes)
618- Text (text = stringResource(R .string.sector_used, part.size, selUnit, sizeInSectors, remaining))
638+ val selUnit =
639+ stringResource(if (part.isPercent) R .string.percent else R .string.bytes)
640+ Text (
641+ text = stringResource(
642+ R .string.bytes_used,
643+ part.size,
644+ selUnit,
645+ sizeInBytes,
646+ remaining
647+ )
648+ )
649+ }
619650 TextField (value = part.size.toString(), onValueChange = {
620651 if (it.matches(Regex (" \\ d+" ))) {
621652 part.size = it.toLong()
@@ -657,34 +688,38 @@ private fun Os(c: CreatePartDataHolder) {
657688 Text (text = stringResource(R .string.percent))
658689 }
659690 }
660- ExposedDropdownMenuBox (expanded = d, onExpandedChange = { d = it }) {
661- TextField (
662- readOnly = true ,
663- value = stringResource(partitionTypeCodes.find { it.first == part.code }!! .second),
664- onValueChange = { },
665- label = { Text (stringResource(R .string.type)) },
666- trailingIcon = {
667- ExposedDropdownMenuDefaults .TrailingIcon (
668- expanded = d
669- )
670- },
671- colors = ExposedDropdownMenuDefaults .textFieldColors()
672- )
673- ExposedDropdownMenu (
691+ if (c.vm.deviceInfo.metaonsd) {
692+ ExposedDropdownMenuBox (
674693 expanded = d,
675- onDismissRequest = {
676- d = false
677- }
678- ) {
679- for (g in partitionTypeCodes) {
680- DropdownMenuItem (
681- onClick = {
682- part.code = g.first
683- d = false
684- }, text = {
685- Text (text = stringResource(g.second))
686- }
687- )
694+ onExpandedChange = { d = it }) {
695+ TextField (
696+ readOnly = true ,
697+ value = stringResource(partitionTypeCodes.find { it.first == part.code }!! .second),
698+ onValueChange = { },
699+ label = { Text (stringResource(R .string.type)) },
700+ trailingIcon = {
701+ ExposedDropdownMenuDefaults .TrailingIcon (
702+ expanded = d
703+ )
704+ },
705+ colors = ExposedDropdownMenuDefaults .textFieldColors()
706+ )
707+ ExposedDropdownMenu (
708+ expanded = d,
709+ onDismissRequest = {
710+ d = false
711+ }
712+ ) {
713+ for (g in partitionTypeCodes) {
714+ DropdownMenuItem (
715+ onClick = {
716+ part.code = g.first
717+ d = false
718+ }, text = {
719+ Text (text = stringResource(g.second))
720+ }
721+ )
722+ }
688723 }
689724 }
690725 }
0 commit comments