RetryScreen.kt (2650B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2025 Taler Systems S.A. 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 package net.taler.wallet.compose 18 19 import androidx.compose.foundation.layout.Arrangement 20 import androidx.compose.foundation.layout.Column 21 import androidx.compose.foundation.layout.Spacer 22 import androidx.compose.foundation.layout.fillMaxSize 23 import androidx.compose.foundation.layout.height 24 import androidx.compose.foundation.layout.padding 25 import androidx.compose.foundation.layout.size 26 import androidx.compose.material.icons.Icons 27 import androidx.compose.material.icons.filled.Refresh 28 import androidx.compose.material3.Button 29 import androidx.compose.material3.ButtonDefaults 30 import androidx.compose.material3.Icon 31 import androidx.compose.material3.Text 32 import androidx.compose.runtime.Composable 33 import androidx.compose.ui.Alignment 34 import androidx.compose.ui.Modifier 35 import androidx.compose.ui.res.stringResource 36 import androidx.compose.ui.text.style.TextAlign 37 import androidx.compose.ui.tooling.preview.Preview 38 import androidx.compose.ui.unit.dp 39 import net.taler.wallet.R 40 import net.taler.wallet.systemBarsPaddingBottom 41 42 @Composable 43 fun RetryScreen(onRetry: () -> Unit) { 44 Column ( 45 modifier = Modifier 46 .fillMaxSize() 47 .padding(16.dp) 48 .systemBarsPaddingBottom(), 49 horizontalAlignment = Alignment.CenterHorizontally, 50 verticalArrangement = Arrangement.Center, 51 ) { 52 Text( 53 stringResource(R.string.qr_scan_offline), 54 textAlign = TextAlign.Center, 55 ) 56 57 Spacer(Modifier.height(16.dp)) 58 59 Button(onRetry) { 60 Icon( 61 Icons.Default.Refresh, 62 contentDescription = null, 63 modifier = Modifier.size(ButtonDefaults.IconSize), 64 ) 65 Spacer(Modifier.size(ButtonDefaults.IconSpacing)) 66 Text(stringResource(R.string.transactions_retry)) 67 } 68 } 69 } 70 71 @Composable 72 @Preview 73 fun RetryScreenPreview() { 74 TalerSurface { 75 RetryScreen {} 76 } 77 }