File tree Expand file tree Collapse file tree 4 files changed +33
-4
lines changed
java/org/mydomain/myscan/view Expand file tree Collapse file tree 4 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ fun CameraScreenFooter(
414414 horizontalArrangement = Arrangement .SpaceBetween
415415 ) {
416416 Text (
417- text = " $ pageCount pages " ,
417+ text = pageCountText( pageCount) ,
418418 style = MaterialTheme .typography.bodyMedium,
419419 modifier = Modifier .clickable(onClick = onPageCountClick)
420420 )
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ fun PdfGenerationBottomSheet(
145145 val context = LocalContext .current
146146 val formattedFileSize = formatFileSize(pdf.sizeInBytes, context)
147147 Text (
148- text = " ${pdf.pageCount} pages · $formattedFileSize " ,
148+ text = " ${pageCountText( pdf.pageCount)} · $formattedFileSize " ,
149149 style = MaterialTheme .typography.bodyMedium,
150150 color = MaterialTheme .colorScheme.onSurface.copy(alpha = 0.6f )
151151 )
@@ -267,7 +267,7 @@ fun PreviewPdfGenerationDialogDuringGeneration() {
267267fun PreviewPdfGenerationDialogAfterGeneration () {
268268 PreviewToCustomize (
269269 uiState = PdfGenerationUiState (
270- generatedPdf = GeneratedPdf (" file://fake.pdf" .toUri(), 442897L , 3 )
270+ generatedPdf = GeneratedPdf (" file://fake.pdf" .toUri(), 442897L , 1 )
271271 )
272272 )
273273}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 Pierre-Yves Nicolas
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License as published by the Free
6+ * Software Foundation, either version 3 of the License, or (at your option)
7+ * any later version.
8+ * This program is distributed in the hope that it will be useful, but WITHOUT
9+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11+ * more details.
12+ * You should have received a copy of the GNU General Public License along with
13+ * this program. If not, see <https://www.gnu.org/licenses/>.
14+ */
15+ package org.mydomain.myscan.view
16+
17+ import androidx.compose.runtime.Composable
18+ import androidx.compose.ui.platform.LocalContext
19+ import org.mydomain.myscan.R
20+
21+ @Composable
22+ fun pageCountText (quantity : Int ): String {
23+ val context = LocalContext .current
24+ return context.resources.getQuantityString(R .plurals.page_count, quantity, quantity)
25+ }
Original file line number Diff line number Diff line change 11<resources >
22 <string name =" app_name" >MyScan</string >
3- </resources >
3+ <plurals name =" page_count" >
4+ <item quantity =" one" >%d page</item >
5+ <item quantity =" other" >%d pages</item >
6+ </plurals >
7+ </resources >
You can’t perform that action at this time.
0 commit comments