From b196e25283fc4060c90e4538dcfc3ce25e665b5f Mon Sep 17 00:00:00 2001 From: Rafael Date: Tue, 18 Jun 2024 12:19:10 +0600 Subject: [PATCH] Replace page column with Scaffold --- .../modules/addtoken/AddTokenFragment.kt | 45 +-- .../modules/balance/ui/BalanceForAccount.kt | 113 ++++--- .../BaseCurrencySettingsFragment.kt | 73 +++-- .../bankwallet/modules/coin/CoinFragment.kt | 195 +++++------ .../investments/CoinInvestmentsFragment.kt | 81 +++-- .../modules/coin/ranks/CoinRankFragment.kt | 28 +- .../coin/reports/CoinReportsFragment.kt | 85 ++--- .../coin/treasuries/CoinTreasuriesFragment.kt | 140 ++++---- .../modules/contacts/screen/AddressScreen.kt | 126 ++++---- .../modules/contacts/screen/ContactScreen.kt | 51 +-- .../modules/contacts/screen/ContactsScreen.kt | 200 ++++++------ .../bankwallet/modules/main/MainFragment.kt | 135 ++++---- .../evmprivatekey/EvmPrivateKeyFragment.kt | 84 ++--- .../recoveryphrase/RecoveryPhraseFragment.kt | 89 ++--- .../ShowExtendedKeyFragment.kt | 250 +++++++------- .../market/filters/MarketFiltersFragment.kt | 13 +- .../restoreblockchains/RestoreBlockchains.kt | 52 +-- .../advanced/SendBtcAdvancedSettingsScreen.kt | 64 ++-- .../settings/appearance/AppearanceFragment.kt | 304 +++++++++--------- .../bankwallet/ui/compose/HSSwipeRefresh.kt | 3 +- 20 files changed, 1165 insertions(+), 966 deletions(-) diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/addtoken/AddTokenFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/addtoken/AddTokenFragment.kt index 7d74f7e56a7..02b96784018 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/addtoken/AddTokenFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/addtoken/AddTokenFragment.kt @@ -1,16 +1,13 @@ package io.horizontalsystems.bankwallet.modules.addtoken import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.Icon +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState @@ -38,9 +35,11 @@ import io.horizontalsystems.bankwallet.ui.compose.components.AppBar import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection import io.horizontalsystems.bankwallet.ui.compose.components.FormsInput import io.horizontalsystems.bankwallet.ui.compose.components.FormsInputStateWarning +import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_grey import io.horizontalsystems.core.SnackbarDuration @@ -116,26 +115,30 @@ private fun AddTokenScreen( } } - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.AddToken_Title), - navigationIcon = { - HsBackButton(onClick = closeScreen) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Add), - onClick = viewModel::onAddClick, - enabled = uiState.addButtonEnabled + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.AddToken_Title), + navigationIcon = { + HsBackButton(onClick = closeScreen) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Add), + onClick = viewModel::onAddClick, + enabled = uiState.addButtonEnabled + ) ) ) - ) + }, + ) { innerPaddings -> Column( modifier = Modifier - .weight(1f) + .padding(innerPaddings) .verticalScroll(rememberScrollState()) ) { - Spacer(modifier = Modifier.height(12.dp)) + VSpacer(12.dp) CellUniversalLawrenceSection( listOf { @@ -149,7 +152,7 @@ private fun AddTokenScreen( painter = painterResource(R.drawable.ic_blocks_24), contentDescription = null ) - Spacer(modifier = Modifier.width(16.dp)) + HSpacer(16.dp) body_leah( text = stringResource(R.string.AddToken_Blockchain), modifier = Modifier.weight(1f) @@ -167,7 +170,7 @@ private fun AddTokenScreen( } ) - Spacer(modifier = Modifier.height(32.dp)) + VSpacer(32.dp) FormsInput( modifier = Modifier.padding(horizontal = 16.dp), @@ -179,7 +182,7 @@ private fun AddTokenScreen( viewModel.onEnterText(it) } - Spacer(modifier = Modifier.height(32.dp)) + VSpacer(32.dp) uiState.tokenInfo?.let { tokenInfo -> CellUniversalLawrenceSection( diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/ui/BalanceForAccount.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/ui/BalanceForAccount.kt index 9cdea92a938..d85d30f2ef7 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/ui/BalanceForAccount.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/balance/ui/BalanceForAccount.kt @@ -6,14 +6,16 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.animation.Crossfade import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -119,56 +121,75 @@ fun BalanceForAccount(navController: NavController, accountViewItem: AccountView ) } ) { - Column { - AppBar( - title = { - BalanceTitleRow(navController, accountViewItem.name) - }, - menuItems = buildList { - if (accountViewItem.type.supportsWalletConnect) { - add( - MenuItem( - title = TranslatableString.ResString(R.string.WalletConnect_NewConnect), - icon = R.drawable.ic_qr_scan_20, - onClick = { - when (val state = viewModel.getWalletConnectSupportState()) { - WCManager.SupportState.Supported -> { - qrScannerLauncher.launch(QRScannerActivity.getScanQrIntent(context, true)) - - stat(page = StatPage.Balance, event = StatEvent.Open(StatPage.ScanQrCode)) - } - - WCManager.SupportState.NotSupportedDueToNoActiveAccount -> { - navController.slideFromBottom(R.id.wcErrorNoAccountFragment) - } - - is WCManager.SupportState.NotSupportedDueToNonBackedUpAccount -> { - val text = Translator.getString(R.string.WalletConnect_Error_NeedBackup) - navController.slideFromBottom( - R.id.backupRequiredDialog, - BackupRequiredDialog.Input(state.account, text) - ) - - stat(page = StatPage.Balance, event = StatEvent.Open(StatPage.BackupRequired)) - } - - is WCManager.SupportState.NotSupported -> { - navController.slideFromBottom( - R.id.wcAccountTypeNotSupportedDialog, - WCAccountTypeNotSupportedDialog.Input(state.accountTypeDescription) - ) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = { + BalanceTitleRow(navController, accountViewItem.name) + }, + menuItems = buildList { + if (accountViewItem.type.supportsWalletConnect) { + add( + MenuItem( + title = TranslatableString.ResString(R.string.WalletConnect_NewConnect), + icon = R.drawable.ic_qr_scan_20, + onClick = { + when (val state = + viewModel.getWalletConnectSupportState()) { + WCManager.SupportState.Supported -> { + qrScannerLauncher.launch( + QRScannerActivity.getScanQrIntent(context, true) + ) + + stat( + page = StatPage.Balance, + event = StatEvent.Open(StatPage.ScanQrCode) + ) + } + + WCManager.SupportState.NotSupportedDueToNoActiveAccount -> { + navController.slideFromBottom(R.id.wcErrorNoAccountFragment) + } + + is WCManager.SupportState.NotSupportedDueToNonBackedUpAccount -> { + val text = + Translator.getString(R.string.WalletConnect_Error_NeedBackup) + navController.slideFromBottom( + R.id.backupRequiredDialog, + BackupRequiredDialog.Input(state.account, text) + ) + + stat( + page = StatPage.Balance, + event = StatEvent.Open(StatPage.BackupRequired) + ) + } + + is WCManager.SupportState.NotSupported -> { + navController.slideFromBottom( + R.id.wcAccountTypeNotSupportedDialog, + WCAccountTypeNotSupportedDialog.Input(state.accountTypeDescription) + ) + } } } - } + ) ) - ) + } } - } - ) - + ) + } + ) { paddingValues -> val uiState = viewModel.uiState - Crossfade(uiState.viewState, label = "") { viewState -> + Crossfade( + targetState = uiState.viewState, + modifier = Modifier + .padding(paddingValues) + .fillMaxSize(), + label = "" + ) { viewState -> when (viewState) { ViewState.Success -> { val balanceViewItems = uiState.balanceViewItems @@ -178,7 +199,7 @@ fun BalanceForAccount(navController: NavController, accountViewItem: AccountView accountViewItem, navController, uiState, - viewModel.totalUiState + viewModel.totalUiState, ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/basecurrency/BaseCurrencySettingsFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/basecurrency/BaseCurrencySettingsFragment.kt index 3490de4ffce..6fe5c91dcdd 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/basecurrency/BaseCurrencySettingsFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/basecurrency/BaseCurrencySettingsFragment.kt @@ -1,8 +1,23 @@ package io.horizontalsystems.bankwallet.modules.basecurrency -import androidx.compose.foundation.* -import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.material.ExperimentalMaterialApi +import androidx.compose.material.Icon +import androidx.compose.material.ModalBottomSheetLayout +import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold +import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.rememberCoroutineScope @@ -18,7 +33,17 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.BaseComposeFragment import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme -import io.horizontalsystems.bankwallet.ui.compose.components.* +import io.horizontalsystems.bankwallet.ui.compose.components.AppBar +import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryTransparent +import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow +import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection +import io.horizontalsystems.bankwallet.ui.compose.components.HeaderText +import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton +import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal +import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer +import io.horizontalsystems.bankwallet.ui.compose.components.body_leah +import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey import io.horizontalsystems.bankwallet.ui.extensions.BottomSheetHeader import kotlinx.coroutines.launch @@ -80,29 +105,32 @@ private fun BaseCurrencyScreen( ) } ) { - Column( - modifier = Modifier.background(color = ComposeAppTheme.colors.tyler) - ) { - AppBar( - title = stringResource(R.string.SettingsCurrency_Title), - navigationIcon = { - HsBackButton(onClick = { navController.popBackStack() }) - } - ) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.SettingsCurrency_Title), + navigationIcon = { + HsBackButton(onClick = { navController.popBackStack() }) + } + ) + } + ) { paddingValues -> Column( - Modifier.verticalScroll(rememberScrollState()) + Modifier + .verticalScroll(rememberScrollState()) + .padding(paddingValues) ) { - Spacer(Modifier.height(12.dp)) + VSpacer(12.dp) CellUniversalLawrenceSection(viewModel.popularItems) { item -> CurrencyCell( item.currency.code, item.currency.symbol, item.currency.flag, - item.selected, - { viewModel.onSelectBaseCurrency(item.currency) } - ) + item.selected + ) { viewModel.onSelectBaseCurrency(item.currency) } } - Spacer(Modifier.height(24.dp)) + VSpacer(24.dp) HeaderText( stringResource(R.string.SettingsCurrency_Other) ) @@ -111,11 +139,10 @@ private fun BaseCurrencyScreen( item.currency.code, item.currency.symbol, item.currency.flag, - item.selected, - { viewModel.onSelectBaseCurrency(item.currency) } - ) + item.selected + ) { viewModel.onSelectBaseCurrency(item.currency) } } - Spacer(Modifier.height(24.dp)) + VSpacer(24.dp) } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/CoinFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/CoinFragment.kt index bdb54b9bd3c..f967bc02cef 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/CoinFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/CoinFragment.kt @@ -2,10 +2,11 @@ package io.horizontalsystems.bankwallet.modules.coin import android.os.Parcelable import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier @@ -92,114 +93,128 @@ fun CoinTabs( val coroutineScope = rememberCoroutineScope() val view = LocalView.current - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = viewModel.fullCoin.coin.code, - navigationIcon = { - HsBackButton(onClick = { navController.popBackStack() }) - }, - menuItems = buildList { - if (viewModel.isWatchlistEnabled) { - if (viewModel.isFavorite) { - add( - MenuItem( - title = TranslatableString.ResString(R.string.CoinPage_Unfavorite), - icon = R.drawable.ic_filled_star_24, - tint = ComposeAppTheme.colors.jacob, - onClick = { - viewModel.onUnfavoriteClick() - - stat(page = StatPage.CoinPage, event = StatEvent.RemoveFromWatchlist(viewModel.fullCoin.coin.uid)) - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = viewModel.fullCoin.coin.code, + navigationIcon = { + HsBackButton(onClick = { navController.popBackStack() }) + }, + menuItems = buildList { + if (viewModel.isWatchlistEnabled) { + if (viewModel.isFavorite) { + add( + MenuItem( + title = TranslatableString.ResString(R.string.CoinPage_Unfavorite), + icon = R.drawable.ic_filled_star_24, + tint = ComposeAppTheme.colors.jacob, + onClick = { + viewModel.onUnfavoriteClick() + + stat( + page = StatPage.CoinPage, + event = StatEvent.RemoveFromWatchlist(viewModel.fullCoin.coin.uid) + ) + } + ) ) - ) - } else { - add( - MenuItem( - title = TranslatableString.ResString(R.string.CoinPage_Favorite), - icon = R.drawable.ic_star_24, - onClick = { - viewModel.onFavoriteClick() - - stat(page = StatPage.CoinPage, event = StatEvent.AddToWatchlist(viewModel.fullCoin.coin.uid)) - } + } else { + add( + MenuItem( + title = TranslatableString.ResString(R.string.CoinPage_Favorite), + icon = R.drawable.ic_star_24, + onClick = { + viewModel.onFavoriteClick() + + stat( + page = StatPage.CoinPage, + event = StatEvent.AddToWatchlist(viewModel.fullCoin.coin.uid) + ) + } + ) ) - ) + } } } - } - ) - - val selectedTab = tabs[pagerState.currentPage] - val tabItems = tabs.map { - TabItem(stringResource(id = it.titleResId), it == selectedTab, it) + ) } - Tabs(tabItems, onClick = { tab -> - coroutineScope.launch { - pagerState.scrollToPage(tab.ordinal) + ) { innerPaddings -> + Column( + modifier = Modifier.padding(innerPaddings) + ) { + val selectedTab = tabs[pagerState.currentPage] + val tabItems = tabs.map { + TabItem(stringResource(id = it.titleResId), it == selectedTab, it) + } + Tabs(tabItems, onClick = { tab -> + coroutineScope.launch { + pagerState.scrollToPage(tab.ordinal) - stat(page = StatPage.CoinPage, event = StatEvent.SwitchTab(tab.statTab)) + stat(page = StatPage.CoinPage, event = StatEvent.SwitchTab(tab.statTab)) - if (tab == CoinModule.Tab.Details && viewModel.shouldShowSubscriptionInfo()) { - viewModel.subscriptionInfoShown() + if (tab == CoinModule.Tab.Details && viewModel.shouldShowSubscriptionInfo()) { + viewModel.subscriptionInfoShown() - delay(1000) - navController.slideFromBottom(R.id.subscriptionInfoFragment) - } - } - }) - - HorizontalPager( - state = pagerState, - userScrollEnabled = false - ) { page -> - when (tabs[page]) { - CoinModule.Tab.Overview -> { - CoinOverviewScreen( - fullCoin = viewModel.fullCoin, - navController = navController - ) + delay(1000) + navController.slideFromBottom(R.id.subscriptionInfoFragment) + } } + }) + + HorizontalPager( + state = pagerState, + userScrollEnabled = false + ) { page -> + when (tabs[page]) { + CoinModule.Tab.Overview -> { + CoinOverviewScreen( + fullCoin = viewModel.fullCoin, + navController = navController + ) + } - CoinModule.Tab.Market -> { - CoinMarketsScreen(fullCoin = viewModel.fullCoin) - } + CoinModule.Tab.Market -> { + CoinMarketsScreen(fullCoin = viewModel.fullCoin) + } - CoinModule.Tab.Details -> { - CoinAnalyticsScreen( - fullCoin = viewModel.fullCoin, - navController = navController, - fragmentManager = fragmentManager - ) + CoinModule.Tab.Details -> { + CoinAnalyticsScreen( + fullCoin = viewModel.fullCoin, + navController = navController, + fragmentManager = fragmentManager + ) + } } -// CoinModule.Tab.Tweets -> { -// CoinTweetsScreen(fullCoin = viewModel.fullCoin) -// } } - } - viewModel.successMessage?.let { - HudHelper.showSuccessMessage(view, it) + viewModel.successMessage?.let { + HudHelper.showSuccessMessage(view, it) - viewModel.onSuccessMessageShown() + viewModel.onSuccessMessageShown() + } } } } @Composable fun CoinNotFound(coinUid: String, navController: NavController) { - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = coinUid, - navigationIcon = { - HsBackButton(onClick = { navController.popBackStack() }) - } - ) - - ListEmptyView( - text = stringResource(R.string.CoinPage_CoinNotFound, coinUid), - icon = R.drawable.ic_not_available - ) - - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = coinUid, + navigationIcon = { + HsBackButton(onClick = { navController.popBackStack() }) + } + ) + }, + content = { + ListEmptyView( + paddingValues = it, + text = stringResource(R.string.CoinPage_CoinNotFound, coinUid), + icon = R.drawable.ic_not_available + ) + } + ) } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/investments/CoinInvestmentsFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/investments/CoinInvestmentsFragment.kt index 5ffb7805970..d735bbd4e91 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/investments/CoinInvestmentsFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/investments/CoinInvestmentsFragment.kt @@ -3,9 +3,7 @@ package io.horizontalsystems.bankwallet.modules.coin.investments import android.os.Parcelable import androidx.compose.animation.Crossfade import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -14,6 +12,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -78,50 +77,64 @@ private fun CoinInvestmentsScreen( val isRefreshing by viewModel.isRefreshingLiveData.observeAsState(false) val viewItems by viewModel.viewItemsLiveData.observeAsState() - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.CoinPage_FundsInvested), - navigationIcon = { - HsBackButton(onClick = onClickNavigation) - } - ) - + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.CoinPage_FundsInvested), + navigationIcon = { + HsBackButton(onClick = onClickNavigation) + } + ) + } + ) { innerPadding -> HSSwipeRefresh( refreshing = isRefreshing, - onRefresh = viewModel::refresh - ) { - Crossfade(viewState) { viewState -> - when (viewState) { - ViewState.Loading -> { - Loading() - } + modifier = Modifier + .padding(innerPadding) + .fillMaxSize(), + onRefresh = viewModel::refresh, + content = { + Crossfade(viewState, label = "") { viewState -> + when (viewState) { + ViewState.Loading -> { + Loading() + } - is ViewState.Error -> { - ListErrorView(stringResource(R.string.SyncError), viewModel::onErrorClick) - } + is ViewState.Error -> { + ListErrorView( + stringResource(R.string.SyncError), + viewModel::onErrorClick + ) + } - ViewState.Success -> { - LazyColumn(modifier = Modifier.fillMaxSize()) { - viewItems?.forEach { viewItem -> - item { - CoinInvestmentHeader(viewItem.amount, viewItem.info) + ViewState.Success -> { + LazyColumn(modifier = Modifier.fillMaxSize()) { + viewItems?.forEach { viewItem -> + item { + CoinInvestmentHeader(viewItem.amount, viewItem.info) - Spacer(modifier = Modifier.height(12.dp)) - } - item { - CellSingleLineLawrenceSection(viewItem.fundViewItems) { fundViewItem -> - CoinInvestmentFund(fundViewItem) { onClickFundUrl(fundViewItem.url) } + Spacer(modifier = Modifier.height(12.dp)) + } + item { + CellSingleLineLawrenceSection(viewItem.fundViewItems) { fundViewItem -> + CoinInvestmentFund(fundViewItem) { + onClickFundUrl( + fundViewItem.url + ) + } + } + Spacer(modifier = Modifier.height(24.dp)) } - Spacer(modifier = Modifier.height(24.dp)) } } } - } - null -> {} + null -> {} + } } } - } + ) } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/ranks/CoinRankFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/ranks/CoinRankFragment.kt index 75135201970..5f7ecd473b0 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/ranks/CoinRankFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/ranks/CoinRankFragment.kt @@ -3,7 +3,6 @@ package io.horizontalsystems.bankwallet.modules.coin.ranks import androidx.compose.animation.Crossfade import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Spacer @@ -19,6 +18,7 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Divider +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -105,17 +105,25 @@ private fun CoinRankScreen( val uiState = viewModel.uiState val viewItems = viewModel.uiState.rankViewItems - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Close), - icon = R.drawable.ic_close, - onClick = { navController.popBackStack() } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Close), + icon = R.drawable.ic_close, + onClick = { navController.popBackStack() } + ) ) ) - ) - Crossfade(uiState.viewState, label = "") { viewItemState -> + } + ) { padding -> + Crossfade( + targetState = uiState.viewState, + modifier = Modifier.padding(padding), + label = "" + ) { viewItemState -> when (viewItemState) { ViewState.Loading -> { Loading() diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/reports/CoinReportsFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/reports/CoinReportsFragment.kt index 5dea81fb864..046c2c1cc21 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/reports/CoinReportsFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/reports/CoinReportsFragment.kt @@ -2,13 +2,13 @@ package io.horizontalsystems.bankwallet.modules.coin.reports import android.os.Parcelable import androidx.compose.animation.Crossfade -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -62,51 +62,62 @@ private fun CoinReportsScreen( val isRefreshing by viewModel.isRefreshingLiveData.observeAsState(false) val reportViewItems by viewModel.reportViewItemsLiveData.observeAsState() - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.CoinPage_Reports), - navigationIcon = { - HsBackButton(onClick = onClickNavigation) - } - ) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.CoinPage_Reports), + navigationIcon = { + HsBackButton(onClick = onClickNavigation) + } + ) + } + ) { padding -> HSSwipeRefresh( refreshing = isRefreshing, - onRefresh = viewModel::refresh - ) { - Crossfade(viewState) { viewState -> - when (viewState) { - ViewState.Loading -> { - Loading() - } + modifier = Modifier + .padding(padding) + .fillMaxSize(), + onRefresh = viewModel::refresh, + content = { + Crossfade(viewState, label = "") { viewState -> + when (viewState) { + ViewState.Loading -> { + Loading() + } - is ViewState.Error -> { - ListErrorView(stringResource(R.string.SyncError), viewModel::onErrorClick) - } + is ViewState.Error -> { + ListErrorView( + stringResource(R.string.SyncError), + viewModel::onErrorClick + ) + } - ViewState.Success -> { - LazyColumn(modifier = Modifier.fillMaxSize()) { - reportViewItems?.let { - items(it) { report -> - Spacer(modifier = Modifier.height(12.dp)) - CellNews( - source = report.author, - title = report.title, - body = report.body, - date = report.date, - ) { - onClickReportUrl(report.url) + ViewState.Success -> { + LazyColumn(modifier = Modifier.fillMaxSize()) { + reportViewItems?.let { + items(it) { report -> + Spacer(modifier = Modifier.height(12.dp)) + CellNews( + source = report.author, + title = report.title, + body = report.body, + date = report.date, + ) { + onClickReportUrl(report.url) + } + } + item { + Spacer(modifier = Modifier.height(12.dp)) } - } - item { - Spacer(modifier = Modifier.height(12.dp)) } } } - } - null -> {} + null -> {} + } } } - } + ) } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/treasuries/CoinTreasuriesFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/treasuries/CoinTreasuriesFragment.kt index 8ba8c6b920b..64eccffc850 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/treasuries/CoinTreasuriesFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/coin/treasuries/CoinTreasuriesFragment.kt @@ -1,18 +1,17 @@ package io.horizontalsystems.bankwallet.modules.coin.treasuries import androidx.compose.animation.Crossfade -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items +import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.livedata.observeAsState @@ -43,6 +42,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.ListErrorView import io.horizontalsystems.bankwallet.ui.compose.components.MarketCoinFirstRow import io.horizontalsystems.bankwallet.ui.compose.components.SectionItemBorderedRowUniversalClear import io.horizontalsystems.bankwallet.ui.compose.components.SortMenu +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_jacob @@ -64,87 +64,101 @@ class CoinTreasuriesFragment : BaseComposeFragment() { val viewState by viewModel.viewStateLiveData.observeAsState() val isRefreshing by viewModel.isRefreshingLiveData.observeAsState(false) val treasuriesData by viewModel.coinTreasuriesLiveData.observeAsState() - val chainSelectorDialogState by viewModel.treasuryTypeSelectorDialogStateLiveData.observeAsState(TvlModule.SelectorDialogState.Closed) + val chainSelectorDialogState by viewModel.treasuryTypeSelectorDialogStateLiveData.observeAsState( + TvlModule.SelectorDialogState.Closed + ) - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.CoinPage_Treasuries), - navigationIcon = { - HsBackButton(onClick = { findNavController().popBackStack() }) - } - ) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.CoinPage_Treasuries), + navigationIcon = { + HsBackButton(onClick = { findNavController().popBackStack() }) + } + ) + } + ) { paddingValues -> HSSwipeRefresh( refreshing = isRefreshing, + modifier = Modifier.padding(paddingValues), onRefresh = { viewModel.refresh() - } - ) { - Crossfade(viewState) { viewState -> - when (viewState) { - ViewState.Loading -> { - Loading() - } - - is ViewState.Error -> { - ListErrorView(stringResource(R.string.SyncError), viewModel::onErrorClick) - } + }, + content = { + Crossfade(viewState, label = "") { viewState -> + when (viewState) { + ViewState.Loading -> { + Loading() + } - ViewState.Success -> { - LazyColumn(modifier = Modifier.fillMaxSize()) { - treasuriesData?.let { treasuriesData -> - item { - CoinTreasuriesMenu( - treasuryTypeSelect = treasuriesData.treasuryTypeSelect, - sortDescending = treasuriesData.sortDescending, - onClickTreasuryTypeSelector = viewModel::onClickTreasuryTypeSelector, - onToggleSortType = viewModel::onToggleSortType - ) - } + is ViewState.Error -> { + ListErrorView( + stringResource(R.string.SyncError), + viewModel::onErrorClick + ) + } - items(treasuriesData.coinTreasuries) { item -> - SectionItemBorderedRowUniversalClear( - borderBottom = true - ) { - HsImage( - url = item.fundLogoUrl, - modifier = Modifier - .padding(end = 16.dp) - .size(32.dp) + ViewState.Success -> { + LazyColumn(modifier = Modifier.fillMaxSize()) { + treasuriesData?.let { treasuriesData -> + item { + CoinTreasuriesMenu( + treasuryTypeSelect = treasuriesData.treasuryTypeSelect, + sortDescending = treasuriesData.sortDescending, + onClickTreasuryTypeSelector = viewModel::onClickTreasuryTypeSelector, + onToggleSortType = viewModel::onToggleSortType ) - Column( - modifier = Modifier.fillMaxWidth() + } + + items(treasuriesData.coinTreasuries) { item -> + SectionItemBorderedRowUniversalClear( + borderBottom = true ) { - MarketCoinFirstRow(item.fund, item.amount) - Spacer(modifier = Modifier.height(3.dp)) - CoinTreasurySecondRow(item.country, item.amountInCurrency) + HsImage( + url = item.fundLogoUrl, + modifier = Modifier + .padding(end = 16.dp) + .size(32.dp) + ) + Column( + modifier = Modifier.fillMaxWidth() + ) { + MarketCoinFirstRow(item.fund, item.amount) + VSpacer(3.dp) + CoinTreasurySecondRow( + item.country, + item.amountInCurrency + ) + } } } - } - item { - Spacer(modifier = Modifier.height(32.dp)) - CellFooter(text = stringResource(id = R.string.CoinPage_Treasuries_PoweredBy)) + item { + VSpacer(32.dp) + CellFooter(text = stringResource(id = R.string.CoinPage_Treasuries_PoweredBy)) + } } } } - } - null -> {} + null -> {} + } } - } - // chain selector dialog - when (val option = chainSelectorDialogState) { - is CoinTreasuriesModule.SelectorDialogState.Opened -> { - AlertGroup( - R.string.CoinPage_Treasuries_FilterTitle, - option.select, - viewModel::onSelectTreasuryType, - viewModel::onTreasuryTypeSelectorDialogDismiss - ) + // chain selector dialog + when (val option = chainSelectorDialogState) { + is CoinTreasuriesModule.SelectorDialogState.Opened -> { + AlertGroup( + R.string.CoinPage_Treasuries_FilterTitle, + option.select, + viewModel::onSelectTreasuryType, + viewModel::onTreasuryTypeSelectorDialogDismiss + ) + } } } - } + ) } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/AddressScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/AddressScreen.kt index 01cb8853589..dbb2ae703e6 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/AddressScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/AddressScreen.kt @@ -1,6 +1,5 @@ package io.horizontalsystems.bankwallet.modules.contacts.screen -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -11,6 +10,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope @@ -31,6 +31,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.FormsInput import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_lucian import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_leah import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey @@ -71,74 +72,79 @@ fun AddressScreen( ) } ) { - Column( - modifier = Modifier - .fillMaxSize() - .background(color = ComposeAppTheme.colors.tyler) - ) { - AppBar( - title = uiState.headerTitle.getString(), - navigationIcon = { - HsBackButton(onNavigateToBack) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Done), - enabled = uiState.doneEnabled, - onClick = { - uiState.addressState?.dataOrNull?.let { - onDone(ContactAddress(uiState.blockchain, it.hex)) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = uiState.headerTitle.getString(), + navigationIcon = { + HsBackButton(onNavigateToBack) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Done), + enabled = uiState.doneEnabled, + onClick = { + uiState.addressState?.dataOrNull?.let { + onDone(ContactAddress(uiState.blockchain, it.hex)) + } } - } + ) ) ) - ) - - Spacer(modifier = Modifier.height(12.dp)) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + ) { + Spacer(modifier = Modifier.height(12.dp)) - CellUniversalLawrenceSection( - listOf { - RowUniversal( - modifier = Modifier - .fillMaxWidth() - .padding(horizontal = 16.dp), - onClick = if (uiState.canChangeBlockchain) onNavigateToBlockchainSelector else null - ) { - subhead2_grey( - text = stringResource(R.string.AddToken_Blockchain), - modifier = Modifier.weight(1f) - ) - subhead1_leah( - text = uiState.blockchain.name, - modifier = Modifier.padding(horizontal = 8.dp) - ) - if (uiState.canChangeBlockchain) { - Icon( - painter = painterResource(id = R.drawable.ic_down_arrow_20), - contentDescription = null, - tint = ComposeAppTheme.colors.grey + CellUniversalLawrenceSection( + listOf { + RowUniversal( + modifier = Modifier + .fillMaxWidth() + .padding(horizontal = 16.dp), + onClick = if (uiState.canChangeBlockchain) onNavigateToBlockchainSelector else null + ) { + subhead2_grey( + text = stringResource(R.string.AddToken_Blockchain), + modifier = Modifier.weight(1f) + ) + subhead1_leah( + text = uiState.blockchain.name, + modifier = Modifier.padding(horizontal = 8.dp) ) + if (uiState.canChangeBlockchain) { + Icon( + painter = painterResource(id = R.drawable.ic_down_arrow_20), + contentDescription = null, + tint = ComposeAppTheme.colors.grey + ) + } } } - } - ) + ) - Spacer(modifier = Modifier.height(32.dp)) + VSpacer(32.dp) - FormsInput( - modifier = Modifier.padding(horizontal = 16.dp), - initial = uiState.address, - hint = stringResource(R.string.Contacts_AddressHint), - state = uiState.addressState, - qrScannerEnabled = true, - ) { - viewModel.onEnterAddress(it) - } - if (uiState.showDelete) { - Spacer(modifier = Modifier.height(32.dp)) - DeleteAddressButton { - coroutineScope.launch { - modalBottomSheetState.show() + FormsInput( + modifier = Modifier.padding(horizontal = 16.dp), + initial = uiState.address, + hint = stringResource(R.string.Contacts_AddressHint), + state = uiState.addressState, + qrScannerEnabled = true, + ) { + viewModel.onEnterAddress(it) + } + if (uiState.showDelete) { + VSpacer(32.dp) + DeleteAddressButton { + coroutineScope.launch { + modalBottomSheetState.show() + } } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactScreen.kt index 1743a9dc144..4d50b72f6ab 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactScreen.kt @@ -2,10 +2,8 @@ package io.horizontalsystems.bankwallet.modules.contacts.screen import androidx.activity.compose.BackHandler import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -17,6 +15,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -56,6 +55,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_jacob import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.body_lucian @@ -155,29 +155,32 @@ fun ContactScreen( } } - Column( - modifier = Modifier - .fillMaxSize() - .background(color = ComposeAppTheme.colors.tyler) - ) { - AppBar( - title = uiState.headerTitle.getString(), - navigationIcon = { - HsBackButton { - confirmNavigateToBack() - } - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Save), - enabled = uiState.saveEnabled, - onClick = viewModel::onSave + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = uiState.headerTitle.getString(), + navigationIcon = { + HsBackButton { + confirmNavigateToBack() + } + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Save), + enabled = uiState.saveEnabled, + onClick = viewModel::onSave + ) ) ) - ) - - Column(modifier = Modifier.verticalScroll(rememberScrollState())) { - Spacer(Modifier.height(12.dp)) + } + ) { paddingValues -> + Column( + modifier = Modifier + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { + VSpacer(12.dp) FormsInput( modifier = Modifier .focusRequester(focusRequester) @@ -210,7 +213,7 @@ fun ContactScreen( } ) - Spacer(Modifier.height(32.dp)) + VSpacer(32.dp) } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactsScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactsScreen.kt index e6b2671adf5..95311667ba8 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactsScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/contacts/screen/ContactsScreen.kt @@ -4,10 +4,9 @@ import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.Image -import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -17,6 +16,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -48,6 +48,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.ScreenMessageWithAc import io.horizontalsystems.bankwallet.ui.compose.components.SearchBar import io.horizontalsystems.bankwallet.ui.compose.components.SelectorDialogCompose import io.horizontalsystems.bankwallet.ui.compose.components.SelectorItem +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey import io.horizontalsystems.core.SnackbarDuration @@ -166,112 +167,120 @@ fun ContactsScreen( } ) { - Column( - modifier = Modifier - .fillMaxSize() - .background(color = ComposeAppTheme.colors.tyler) - ) { - SearchBar( - title = stringResource(R.string.Contacts), - searchHintText = stringResource(R.string.Market_Search_Hint), - menuItems = buildList { - if (uiState.showAddContact) { - add( - MenuItem( - title = TranslatableString.ResString(R.string.Contacts_NewContact), - icon = R.drawable.icon_user_plus, - tint = ComposeAppTheme.colors.jacob, - onClick = onNavigateToCreateContact + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + SearchBar( + title = stringResource(R.string.Contacts), + searchHintText = stringResource(R.string.Market_Search_Hint), + menuItems = buildList { + if (uiState.showAddContact) { + add( + MenuItem( + title = TranslatableString.ResString(R.string.Contacts_NewContact), + icon = R.drawable.icon_user_plus, + tint = ComposeAppTheme.colors.jacob, + onClick = onNavigateToCreateContact + ) ) - ) - } - if (uiState.showMoreOptions) { - add( - MenuItem( - title = TranslatableString.ResString(R.string.Contacts_ActionMore), - icon = R.drawable.ic_more2_20, - tint = ComposeAppTheme.colors.jacob, - enabled = true, - onClick = { - showMoreSelectorDialog = true - } + } + if (uiState.showMoreOptions) { + add( + MenuItem( + title = TranslatableString.ResString(R.string.Contacts_ActionMore), + icon = R.drawable.ic_more2_20, + tint = ComposeAppTheme.colors.jacob, + enabled = true, + onClick = { + showMoreSelectorDialog = true + } + ) ) - ) + } + }, + onClose = onNavigateToBack, + onSearchTextChanged = { text -> + viewModel.onEnterQuery(text) } - }, - onClose = onNavigateToBack, - onSearchTextChanged = { text -> - viewModel.onEnterQuery(text) - } - ) - if (uiState.contacts.isNotEmpty()) { - Column(modifier = Modifier.verticalScroll(rememberScrollState())) { - Spacer(Modifier.height(12.dp)) - CellUniversalLawrenceSection(uiState.contacts) { contact -> - Contact(contact) { - if (viewModel.shouldShowReplaceWarning(contact)) { - coroutineScope.launch { - bottomSheetType = ContactsScreenBottomSheetType.ReplaceAddressConfirmation - selectedContact = contact - bottomSheetState.show() + ) + } + ) { paddingValues -> + Box( + modifier = Modifier + .fillMaxWidth() + .padding(paddingValues) + ) { + if (uiState.contacts.isNotEmpty()) { + Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + VSpacer(12.dp) + CellUniversalLawrenceSection(uiState.contacts) { contact -> + Contact(contact) { + if (viewModel.shouldShowReplaceWarning(contact)) { + coroutineScope.launch { + bottomSheetType = + ContactsScreenBottomSheetType.ReplaceAddressConfirmation + selectedContact = contact + bottomSheetState.show() + } + } else { + onNavigateToContact(contact) } - } else { - onNavigateToContact(contact) } } + VSpacer(32.dp) } - Spacer(Modifier.height(32.dp)) - } - } else { - if (uiState.searchMode) { - ListEmptyView( - text = stringResource(R.string.EmptyResults), - icon = R.drawable.ic_not_found - ) } else { - ScreenMessageWithAction( - text = stringResource(R.string.Contacts_NoContacts), - icon = R.drawable.icon_user_plus - ) { - ButtonPrimaryYellow( - modifier = Modifier - .padding(horizontal = 48.dp) - .fillMaxWidth(), - title = stringResource(R.string.Contacts_AddNewContact), - onClick = onNavigateToCreateContact + if (uiState.searchMode) { + ListEmptyView( + text = stringResource(R.string.EmptyResults), + icon = R.drawable.ic_not_found ) + } else { + ScreenMessageWithAction( + text = stringResource(R.string.Contacts_NoContacts), + icon = R.drawable.icon_user_plus + ) { + ButtonPrimaryYellow( + modifier = Modifier + .padding(horizontal = 48.dp) + .fillMaxWidth(), + title = stringResource(R.string.Contacts_AddNewContact), + onClick = onNavigateToCreateContact + ) + } } } - } - if (showMoreSelectorDialog) { - SelectorDialogCompose( - title = stringResource(R.string.Contacts_ActionMore), - items = ContactsModule.ContactsAction.values().map { - (SelectorItem(stringResource(it.title), false, it)) - }, - onDismissRequest = { - showMoreSelectorDialog = false - }, - onSelectItem = { action -> - when (action) { - ContactsModule.ContactsAction.Restore -> { - if (viewModel.shouldShowRestoreWarning()) { - coroutineScope.launch { - bottomSheetType = ContactsScreenBottomSheetType.RestoreContactsConfirmation - bottomSheetState.show() + if (showMoreSelectorDialog) { + SelectorDialogCompose( + title = stringResource(R.string.Contacts_ActionMore), + items = ContactsModule.ContactsAction.values().map { + (SelectorItem(stringResource(it.title), false, it)) + }, + onDismissRequest = { + showMoreSelectorDialog = false + }, + onSelectItem = { action -> + when (action) { + ContactsModule.ContactsAction.Restore -> { + if (viewModel.shouldShowRestoreWarning()) { + coroutineScope.launch { + bottomSheetType = + ContactsScreenBottomSheetType.RestoreContactsConfirmation + bottomSheetState.show() + } + } else { + restoreLauncher.launch(arrayOf("application/json")) } - } else { - restoreLauncher.launch(arrayOf("application/json")) } - } - ContactsModule.ContactsAction.Backup -> { - App.pinComponent.keepUnlocked() - backupLauncher.launch(viewModel.backupFileName) + ContactsModule.ContactsAction.Backup -> { + App.pinComponent.keepUnlocked() + backupLauncher.launch(viewModel.backupFileName) + } } - } - }) + }) + } } } } @@ -291,7 +300,12 @@ fun Contact( text = contact.name, maxLines = 1 ) - subhead2_grey(text = stringResource(R.string.Contacts_AddressesCount, contact.addresses.size)) + subhead2_grey( + text = stringResource( + R.string.Contacts_AddressesCount, + contact.addresses.size + ) + ) } Image( modifier = Modifier.size(20.dp), diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt index 1e85bc4152a..ab26473d100 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt @@ -153,83 +153,87 @@ private fun MainScreen( ) }, ) { - Box(Modifier.fillMaxSize()) { - Scaffold( - backgroundColor = ComposeAppTheme.colors.tyler, - bottomBar = { - Column { - if (uiState.torEnabled) { - TorStatusView() - } - HsBottomNavigation( - backgroundColor = ComposeAppTheme.colors.tyler, - elevation = 10.dp - ) { - uiState.mainNavItems.forEach { item -> - HsBottomNavigationItem( - icon = { - BadgedIcon(item.badge) { - Icon( - painter = painterResource(item.mainNavItem.iconRes), - contentDescription = stringResource(item.mainNavItem.titleRes) - ) - } - }, - selected = item.selected, - enabled = item.enabled, - selectedContentColor = ComposeAppTheme.colors.jacob, - unselectedContentColor = if (item.enabled) ComposeAppTheme.colors.grey else ComposeAppTheme.colors.grey50, - onClick = { - viewModel.onSelect(item.mainNavItem) + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + bottomBar = { + Column { + if (uiState.torEnabled) { + TorStatusView() + } + HsBottomNavigation( + backgroundColor = ComposeAppTheme.colors.tyler, + elevation = 10.dp + ) { + uiState.mainNavItems.forEach { item -> + HsBottomNavigationItem( + icon = { + BadgedIcon(item.badge) { + Icon( + painter = painterResource(item.mainNavItem.iconRes), + contentDescription = stringResource(item.mainNavItem.titleRes) + ) + } + }, + selected = item.selected, + enabled = item.enabled, + selectedContentColor = ComposeAppTheme.colors.jacob, + unselectedContentColor = if (item.enabled) ComposeAppTheme.colors.grey else ComposeAppTheme.colors.grey50, + onClick = { + viewModel.onSelect(item.mainNavItem) - stat(page = StatPage.Main, event = StatEvent.SwitchTab(item.mainNavItem.statTab)) - }, - onLongClick = { - if (item.mainNavItem == MainNavigation.Balance) { - coroutineScope.launch { - modalBottomSheetState.show() + stat( + page = StatPage.Main, + event = StatEvent.SwitchTab(item.mainNavItem.statTab) + ) + }, + onLongClick = { + if (item.mainNavItem == MainNavigation.Balance) { + coroutineScope.launch { + modalBottomSheetState.show() - stat(page = StatPage.Main, event = StatEvent.Open(StatPage.SwitchWallet)) - } + stat( + page = StatPage.Main, + event = StatEvent.Open(StatPage.SwitchWallet) + ) } } - ) - } + } + ) } } } - ) { - BackHandler(enabled = modalBottomSheetState.isVisible) { - coroutineScope.launch { - modalBottomSheetState.hide() - } + } + ) { + BackHandler(enabled = modalBottomSheetState.isVisible) { + coroutineScope.launch { + modalBottomSheetState.hide() } - Column(modifier = Modifier.padding(it)) { - LaunchedEffect(key1 = selectedPage, block = { - pagerState.scrollToPage(selectedPage) - }) + } + Column(modifier = Modifier.padding(it)) { + LaunchedEffect(key1 = selectedPage, block = { + pagerState.scrollToPage(selectedPage) + }) - HorizontalPager( - modifier = Modifier.weight(1f), - state = pagerState, - userScrollEnabled = false, - verticalAlignment = Alignment.Top - ) { page -> - when (uiState.mainNavItems[page].mainNavItem) { - MainNavigation.Market -> MarketScreen(fragmentNavController) - MainNavigation.Balance -> BalanceScreen(fragmentNavController) - MainNavigation.Transactions -> TransactionsScreen( - fragmentNavController, - transactionsViewModel - ) + HorizontalPager( + modifier = Modifier.weight(1f), + state = pagerState, + userScrollEnabled = false, + verticalAlignment = Alignment.Top + ) { page -> + when (uiState.mainNavItems[page].mainNavItem) { + MainNavigation.Market -> MarketScreen(fragmentNavController) + MainNavigation.Balance -> BalanceScreen(fragmentNavController) + MainNavigation.Transactions -> TransactionsScreen( + fragmentNavController, + transactionsViewModel + ) - MainNavigation.Settings -> SettingsScreen(fragmentNavController) - } + MainNavigation.Settings -> SettingsScreen(fragmentNavController) } } } - HideContentBox(uiState.contentHidden) } + HideContentBox(uiState.contentHidden) } if (uiState.showWhatsNew) { @@ -304,7 +308,10 @@ private fun HideContentBox(contentHidden: Boolean) { } else { Modifier } - Box(Modifier.fillMaxSize().then(backgroundModifier)) + Box( + Modifier + .fillMaxSize() + .then(backgroundModifier)) } @Composable diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/evmprivatekey/EvmPrivateKeyFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/evmprivatekey/EvmPrivateKeyFragment.kt index 03eb160288b..3b1aa6ef8e0 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/evmprivatekey/EvmPrivateKeyFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/evmprivatekey/EvmPrivateKeyFragment.kt @@ -1,17 +1,15 @@ package io.horizontalsystems.bankwallet.modules.manageaccount.evmprivatekey import android.os.Parcelable -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope @@ -37,6 +35,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.AppBar import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.helpers.TextHelper import io.horizontalsystems.core.helpers.HudHelper import kotlinx.coroutines.launch @@ -91,44 +90,57 @@ private fun EvmPrivateKeyScreen( ) } ) { - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.EvmPrivateKey_Title), - navigationIcon = { - HsBackButton(onClick = navController::popBackStack) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Info_Title), - icon = R.drawable.ic_info_24, - onClick = { - FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) - - stat(page = StatPage.EvmPrivateKey, event = StatEvent.Open(StatPage.Info)) - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.EvmPrivateKey_Title), + navigationIcon = { + HsBackButton(onClick = navController::popBackStack) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Info_Title), + icon = R.drawable.ic_info_24, + onClick = { + FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) + stat( + page = StatPage.EvmPrivateKey, + event = StatEvent.Open(StatPage.Info) + ) + } + ) ) ) - ) - + } + ) { paddingValues -> Column( - modifier = Modifier - .weight(1f) - .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.Top + modifier = Modifier.padding(paddingValues), ) { - Spacer(Modifier.height(12.dp)) - TextImportantWarning( - modifier = Modifier.padding(horizontal = 16.dp), - text = stringResource(R.string.PrivateKeys_NeverShareWarning) - ) - Spacer(Modifier.height(24.dp)) - HidableContent(evmPrivateKey, stringResource(R.string.EvmPrivateKey_ShowPrivateKey)) { - stat(page = StatPage.EvmPrivateKey, event = StatEvent.ToggleHidden) + Column( + modifier = Modifier + .weight(1f) + .verticalScroll(rememberScrollState()), + verticalArrangement = Arrangement.Top + ) { + VSpacer(12.dp) + TextImportantWarning( + modifier = Modifier.padding(horizontal = 16.dp), + text = stringResource(R.string.PrivateKeys_NeverShareWarning) + ) + VSpacer(24.dp) + HidableContent( + evmPrivateKey, + stringResource(R.string.EvmPrivateKey_ShowPrivateKey) + ) { + stat(page = StatPage.EvmPrivateKey, event = StatEvent.ToggleHidden) + } } - } - ActionButton(R.string.Alert_Copy) { - coroutineScope.launch { - sheetState.show() + + ActionButton(R.string.Alert_Copy) { + coroutineScope.launch { + sheetState.show() + } } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/recoveryphrase/RecoveryPhraseFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/recoveryphrase/RecoveryPhraseFragment.kt index fb771291495..6e63e520d32 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/recoveryphrase/RecoveryPhraseFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/recoveryphrase/RecoveryPhraseFragment.kt @@ -1,16 +1,13 @@ package io.horizontalsystems.bankwallet.modules.manageaccount.recoveryphrase -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -43,6 +40,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.AppBar import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.helpers.TextHelper import io.horizontalsystems.core.helpers.HudHelper import kotlinx.coroutines.launch @@ -95,49 +93,56 @@ private fun RecoveryPhraseScreen( ) } ) { - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.RecoveryPhrase_Title), - navigationIcon = { - HsBackButton(onClick = navController::popBackStack) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Info_Title), - icon = R.drawable.ic_info_24, - onClick = { - FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) - - stat(page = StatPage.RecoveryPhrase, event = StatEvent.Open(StatPage.Info)) - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.RecoveryPhrase_Title), + navigationIcon = { + HsBackButton(onClick = navController::popBackStack) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Info_Title), + icon = R.drawable.ic_info_24, + onClick = { + FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) + stat( + page = StatPage.RecoveryPhrase, + event = StatEvent.Open(StatPage.Info) + ) + } + ) ) ) - ) - + } + ) { paddingValues -> Column( - modifier = Modifier - .weight(1f) - .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.Top + modifier = Modifier.padding(paddingValues), ) { - Spacer(Modifier.height(12.dp)) - TextImportantWarning( - modifier = Modifier.padding(horizontal = 16.dp), - text = stringResource(R.string.PrivateKeys_NeverShareWarning) - ) - Spacer(Modifier.height(24.dp)) - var hidden by remember { mutableStateOf(true) } - SeedPhraseList(viewModel.wordsNumbered, hidden) { - hidden = !hidden - - stat(page = StatPage.RecoveryPhrase, event = StatEvent.ToggleHidden) + Column( + modifier = Modifier + .weight(1f) + .verticalScroll(rememberScrollState()), + ) { + VSpacer(12.dp) + TextImportantWarning( + modifier = Modifier.padding(horizontal = 16.dp), + text = stringResource(R.string.PrivateKeys_NeverShareWarning) + ) + VSpacer(24.dp) + var hidden by remember { mutableStateOf(true) } + SeedPhraseList(viewModel.wordsNumbered, hidden) { + hidden = !hidden + stat(page = StatPage.RecoveryPhrase, event = StatEvent.ToggleHidden) + } + VSpacer(24.dp) + PassphraseCell(viewModel.passphrase, hidden) } - Spacer(Modifier.height(24.dp)) - PassphraseCell(viewModel.passphrase, hidden) - } - ActionButton(R.string.Alert_Copy) { - coroutineScope.launch { - sheetState.show() + ActionButton(R.string.Alert_Copy) { + coroutineScope.launch { + sheetState.show() + } } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/showextendedkey/ShowExtendedKeyFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/showextendedkey/ShowExtendedKeyFragment.kt index 230276f805d..e5d8fdfd73c 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/showextendedkey/ShowExtendedKeyFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/manageaccount/showextendedkey/ShowExtendedKeyFragment.kt @@ -1,13 +1,11 @@ package io.horizontalsystems.bankwallet.modules.manageaccount.showextendedkey import android.os.Parcelable -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState @@ -16,6 +14,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -56,6 +55,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal import io.horizontalsystems.bankwallet.ui.compose.components.SelectorDialogCompose import io.horizontalsystems.bankwallet.ui.compose.components.SelectorItem import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_grey import io.horizontalsystems.bankwallet.ui.helpers.TextHelper @@ -133,144 +133,154 @@ private fun ShowExtendedKeyScreen( ) } ) { - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = viewModel.title.getString(), - navigationIcon = { - HsBackButton(onClick = navController::popBackStack) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Info_Title), - icon = R.drawable.ic_info_24, - onClick = { - FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) - - viewModel.logEvent(StatEvent.Open(StatPage.Info)) - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = viewModel.title.getString(), + navigationIcon = { + HsBackButton(onClick = navController::popBackStack) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Info_Title), + icon = R.drawable.ic_info_24, + onClick = { + FaqManager.showFaqPage(navController, FaqManager.faqPathPrivateKeys) + viewModel.logEvent(StatEvent.Open(StatPage.Info)) + } + ) ) ) - ) - + } + ) { paddingValues -> Column( - modifier = Modifier - .weight(1f) - .verticalScroll(rememberScrollState()), - verticalArrangement = Arrangement.Top + modifier = Modifier.padding(paddingValues), ) { - Spacer(Modifier.height(12.dp)) + Column( + modifier = Modifier + .weight(1f) + .verticalScroll(rememberScrollState()), + verticalArrangement = Arrangement.Top + ) { + VSpacer(12.dp) - if (viewModel.displayKeyType.isPrivate) { - TextImportantWarning( - modifier = Modifier.padding(horizontal = 16.dp), - text = stringResource(R.string.PrivateKeys_NeverShareWarning) - ) - Spacer(Modifier.height(24.dp)) - } - - var showBlockchainSelectorDialog by remember { mutableStateOf(false) } - var showPurposeSelectorDialog by remember { mutableStateOf(false) } - var showAccountSelectorDialog by remember { mutableStateOf(false) } - - val menuItems = buildList<@Composable () -> Unit> { - add { - MenuItem( - title = stringResource(R.string.ExtendedKey_Purpose), - value = viewModel.purpose.name, - onClick = if (viewModel.displayKeyType == DisplayKeyType.Bip32RootKey || viewModel.displayKeyType.isDerivable) { - { showPurposeSelectorDialog = true } - } else { - null - } + if (viewModel.displayKeyType.isPrivate) { + TextImportantWarning( + modifier = Modifier.padding(horizontal = 16.dp), + text = stringResource(R.string.PrivateKeys_NeverShareWarning) ) + VSpacer(24.dp) } - if (viewModel.displayKeyType.isDerivable) { + + var showBlockchainSelectorDialog by remember { mutableStateOf(false) } + var showPurposeSelectorDialog by remember { mutableStateOf(false) } + var showAccountSelectorDialog by remember { mutableStateOf(false) } + + val menuItems = buildList<@Composable () -> Unit> { add { MenuItem( - title = stringResource(R.string.ExtendedKey_Blockchain), - value = viewModel.blockchain.name, - onClick = { showBlockchainSelectorDialog = true } + title = stringResource(R.string.ExtendedKey_Purpose), + value = viewModel.purpose.name, + onClick = if (viewModel.displayKeyType == DisplayKeyType.Bip32RootKey || viewModel.displayKeyType.isDerivable) { + { showPurposeSelectorDialog = true } + } else { + null + } ) } - add { - MenuItem( - title = stringResource(R.string.ExtendedKey_Account), - value = viewModel.account.toString(), - infoButtonClick = { - navController.slideFromBottom(R.id.кeyAccountInfoFragment) - }, - onClick = { showAccountSelectorDialog = true } - ) + if (viewModel.displayKeyType.isDerivable) { + add { + MenuItem( + title = stringResource(R.string.ExtendedKey_Blockchain), + value = viewModel.blockchain.name, + onClick = { showBlockchainSelectorDialog = true } + ) + } + add { + MenuItem( + title = stringResource(R.string.ExtendedKey_Account), + value = viewModel.account.toString(), + infoButtonClick = { + navController.slideFromBottom(R.id.кeyAccountInfoFragment) + }, + onClick = { showAccountSelectorDialog = true } + ) + } } } - } - if (menuItems.isNotEmpty()) { - CellUniversalLawrenceSection(menuItems) - } - - Spacer(Modifier.height(32.dp)) - if (viewModel.displayKeyType.isPrivate) { - HidableContent(viewModel.extendedKey, stringResource(R.string.ExtendedKey_TapToShowPrivateKey)) { - viewModel.logEvent(StatEvent.ToggleHidden) + if (menuItems.isNotEmpty()) { + CellUniversalLawrenceSection(menuItems) } - } else { - HidableContent(viewModel.extendedKey) - } - if (showPurposeSelectorDialog) { - SelectorDialogCompose( - title = stringResource(R.string.ExtendedKey_Purpose), - items = viewModel.purposes.map { - SelectorItem(it.name, it == viewModel.purpose, it) - }, - onDismissRequest = { - showPurposeSelectorDialog = false - }, - onSelectItem = { - viewModel.set(it) + VSpacer(32.dp) + if (viewModel.displayKeyType.isPrivate) { + HidableContent( + viewModel.extendedKey, + stringResource(R.string.ExtendedKey_TapToShowPrivateKey) + ) { + viewModel.logEvent(StatEvent.ToggleHidden) } - ) - } - if (showBlockchainSelectorDialog) { - SelectorDialogCompose( - title = stringResource(R.string.ExtendedKey_Blockchain), - items = viewModel.blockchains.map { - SelectorItem(it.name, it == viewModel.blockchain, it) - }, - onDismissRequest = { - showBlockchainSelectorDialog = false - }, - onSelectItem = { - viewModel.set(it) - } - ) + } else { + HidableContent(viewModel.extendedKey) + } + + if (showPurposeSelectorDialog) { + SelectorDialogCompose( + title = stringResource(R.string.ExtendedKey_Purpose), + items = viewModel.purposes.map { + SelectorItem(it.name, it == viewModel.purpose, it) + }, + onDismissRequest = { + showPurposeSelectorDialog = false + }, + onSelectItem = { + viewModel.set(it) + } + ) + } + if (showBlockchainSelectorDialog) { + SelectorDialogCompose( + title = stringResource(R.string.ExtendedKey_Blockchain), + items = viewModel.blockchains.map { + SelectorItem(it.name, it == viewModel.blockchain, it) + }, + onDismissRequest = { + showBlockchainSelectorDialog = false + }, + onSelectItem = { + viewModel.set(it) + } + ) + } + if (showAccountSelectorDialog) { + SelectorDialogCompose( + title = stringResource(R.string.ExtendedKey_Account), + items = viewModel.accounts.map { + SelectorItem(it.toString(), it == viewModel.account, it) + }, + onDismissRequest = { + showAccountSelectorDialog = false + }, + onSelectItem = { + viewModel.set(it) + } + ) + } } - if (showAccountSelectorDialog) { - SelectorDialogCompose( - title = stringResource(R.string.ExtendedKey_Account), - items = viewModel.accounts.map { - SelectorItem(it.toString(), it == viewModel.account, it) - }, - onDismissRequest = { - showAccountSelectorDialog = false - }, - onSelectItem = { - viewModel.set(it) + + ActionButton(R.string.Alert_Copy) { + if (viewModel.displayKeyType.isPrivate) { + coroutineScope.launch { + sheetState.show() } - ) - } - } - ActionButton(R.string.Alert_Copy) { - if (viewModel.displayKeyType.isPrivate) { - coroutineScope.launch { - sheetState.show() - } - } else { - TextHelper.copyText(viewModel.extendedKey) - HudHelper.showSuccessMessage(view, R.string.Hud_Text_Copied) + } else { + TextHelper.copyText(viewModel.extendedKey) + HudHelper.showSuccessMessage(view, R.string.Hud_Text_Copied) - viewModel.logEvent(StatEvent.Copy(StatEntity.Key)) + viewModel.logEvent(StatEvent.Copy(StatEntity.Key)) + } } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/filters/MarketFiltersFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/filters/MarketFiltersFragment.kt index 1d1011b0f3d..a1b1f566c39 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/filters/MarketFiltersFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/market/filters/MarketFiltersFragment.kt @@ -17,7 +17,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue -import androidx.compose.material.Surface +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -107,8 +107,9 @@ private fun AdvancedSearchScreen( ) }, ) { - Surface(color = ComposeAppTheme.colors.tyler) { - Column { + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { AppBar( title = stringResource(R.string.Market_Filters), navigationIcon = { @@ -121,7 +122,11 @@ private fun AdvancedSearchScreen( ) ), ) - + } + ) { paddingValues -> + Column( + modifier = Modifier.padding(paddingValues) + ) { Column( modifier = Modifier .weight(1f) diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/restoreaccount/restoreblockchains/RestoreBlockchains.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/restoreaccount/restoreblockchains/RestoreBlockchains.kt index 83aa1e1f29d..5e845120d4a 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/restoreaccount/restoreblockchains/RestoreBlockchains.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/restoreaccount/restoreblockchains/RestoreBlockchains.kt @@ -2,7 +2,6 @@ package io.horizontalsystems.bankwallet.modules.restoreaccount.restoreblockchain import android.widget.Toast import androidx.compose.foundation.Image -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -10,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.Divider @@ -18,6 +16,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -45,6 +44,7 @@ import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.TranslatableString import io.horizontalsystems.bankwallet.ui.compose.components.AppBar import io.horizontalsystems.bankwallet.ui.compose.components.CellMultilineClear +import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton import io.horizontalsystems.bankwallet.ui.compose.components.HsIconButton import io.horizontalsystems.bankwallet.ui.compose.components.HsSwitch @@ -153,24 +153,29 @@ fun ManageWalletsScreen( } }, ) { - Column( - modifier = Modifier.background(color = ComposeAppTheme.colors.tyler) - ) { - AppBar( - title = stringResource(R.string.Restore_Title), - navigationIcon = { - HsBackButton(onClick = onBackClick) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Restore), - onClick = { viewModel.onRestore() }, - enabled = doneButtonEnabled - ) - ), - ) - - LazyColumn { + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.Restore_Title), + navigationIcon = { + HsBackButton(onClick = onBackClick) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Restore), + onClick = { viewModel.onRestore() }, + enabled = doneButtonEnabled + ) + ), + ) + } + ) { paddingValues -> + LazyColumn( + modifier = Modifier + .fillMaxSize() + .padding(paddingValues) + ) { item { Spacer(modifier = Modifier.height(12.dp)) Divider( @@ -208,7 +213,7 @@ fun ManageWalletsScreen( modifier = Modifier.padding(top = 1.dp) ) } - Spacer(Modifier.width(12.dp)) + HSpacer(12.dp) if (viewItem.hasSettings) { HsIconButton( onClick = { viewModel.onClickSettings(viewItem.item) } @@ -233,7 +238,10 @@ fun ManageWalletsScreen( } } -private fun onItemClick(viewItem: CoinViewItem, viewModel: RestoreBlockchainsViewModel) { +private fun onItemClick( + viewItem: CoinViewItem, + viewModel: RestoreBlockchainsViewModel +) { if (viewItem.enabled) { viewModel.disable(viewItem.item) } else { diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/send/bitcoin/advanced/SendBtcAdvancedSettingsScreen.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/send/bitcoin/advanced/SendBtcAdvancedSettingsScreen.kt index c954a587854..5b19856cfb6 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/send/bitcoin/advanced/SendBtcAdvancedSettingsScreen.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/send/bitcoin/advanced/SendBtcAdvancedSettingsScreen.kt @@ -1,6 +1,5 @@ package io.horizontalsystems.bankwallet.modules.send.bitcoin.advanced -import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box @@ -16,6 +15,7 @@ import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.Icon import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.remember @@ -51,6 +51,7 @@ import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantError import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning +import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer import io.horizontalsystems.bankwallet.ui.compose.components.body_leah import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey import io.horizontalsystems.bankwallet.ui.extensions.BottomSheetHeader @@ -101,25 +102,33 @@ fun SendBtcAdvancedSettingsScreen( ) }, ) { - Column(modifier = Modifier.background(color = ComposeAppTheme.colors.tyler)) { - AppBar( - title = stringResource(R.string.Send_Advanced), - navigationIcon = { - HsBackButton(onClick = { navController.popBackStack() }) - }, - menuItems = listOf( - MenuItem( - title = TranslatableString.ResString(R.string.Button_Reset), - onClick = { - sendBitcoinViewModel.reset() - viewModel.reset() - } + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { + AppBar( + title = stringResource(R.string.Send_Advanced), + navigationIcon = { + HsBackButton(onClick = { navController.popBackStack() }) + }, + menuItems = listOf( + MenuItem( + title = TranslatableString.ResString(R.string.Button_Reset), + onClick = { + sendBitcoinViewModel.reset() + viewModel.reset() + } + ) ) ) - ) - Column(modifier = Modifier.verticalScroll(rememberScrollState())) { + } + ) { paddingValues -> + Column( + modifier = Modifier + .padding(paddingValues) + .verticalScroll(rememberScrollState()) + ) { - Spacer(modifier = Modifier.height(12.dp)) + VSpacer(12.dp) CellUniversalLawrenceSection( listOf { HSFeeRaw( @@ -133,8 +142,8 @@ fun SendBtcAdvancedSettingsScreen( } ) - if(feeRateVisible) { - Spacer(modifier = Modifier.height(24.dp)) + if (feeRateVisible) { + VSpacer(24.dp) EvmSettingsInput( title = stringResource(R.string.FeeSettings_FeeRate), info = stringResource(R.string.FeeSettings_FeeRate_Info), @@ -157,7 +166,7 @@ fun SendBtcAdvancedSettingsScreen( ) } - Spacer(modifier = Modifier.height(24.dp)) + VSpacer(24.dp) TransactionDataSortSettings( navController, viewModel.uiState.transactionSortTitle, @@ -168,7 +177,7 @@ fun SendBtcAdvancedSettingsScreen( } if (lockTimeEnabled) { - Spacer(Modifier.height(32.dp)) + VSpacer(32.dp) CellUniversalLawrenceSection( listOf { HSHodlerInput( @@ -185,7 +194,7 @@ fun SendBtcAdvancedSettingsScreen( ) } - Spacer(Modifier.height(32.dp)) + VSpacer(32.dp) CellUniversalLawrenceSection( listOf { UtxoSwitch( @@ -198,7 +207,7 @@ fun SendBtcAdvancedSettingsScreen( text = stringResource(R.string.Send_Utxo_Description), ) - Spacer(Modifier.height(32.dp)) + VSpacer(32.dp) CellUniversalLawrenceSection { RbfSwitch( enabled = viewModel.uiState.rbfEnabled, @@ -212,12 +221,16 @@ fun SendBtcAdvancedSettingsScreen( feeRateCaution?.let { FeeRateCaution( - modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 12.dp), + modifier = Modifier.padding( + start = 16.dp, + end = 16.dp, + top = 12.dp + ), feeRateCaution = it ) } - Spacer(Modifier.height(32.dp)) + VSpacer(32.dp) } } } @@ -362,6 +375,7 @@ fun FeeRateCaution(modifier: Modifier, feeRateCaution: HSCaution) { text = feeRateCaution.getDescription() ?: "" ) } + HSCaution.Type.Warning -> { TextImportantWarning( modifier = modifier, diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt index daad2da5200..d6ccb2e4828 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/settings/appearance/AppearanceFragment.kt @@ -23,7 +23,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.ModalBottomSheetLayout import androidx.compose.material.ModalBottomSheetValue -import androidx.compose.material.Surface +import androidx.compose.material.Scaffold import androidx.compose.material.rememberModalBottomSheetState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -92,21 +92,22 @@ fun AppearanceScreen(navController: NavController) { var openBalanceValueSelector by rememberSaveable { mutableStateOf(false) } var openPriceChangeIntervalSelector by rememberSaveable { mutableStateOf(false) } - Surface(color = ComposeAppTheme.colors.tyler) { - ModalBottomSheetLayout( - sheetState = sheetState, - sheetBackgroundColor = ComposeAppTheme.colors.transparent, - sheetContent = { - AppCloseWarningBottomSheet( - onCloseClick = { scope.launch { sheetState.hide() } }, - onChangeClick = { - selectedAppIcon?.let { viewModel.onEnterAppIcon(it) } - scope.launch { sheetState.hide() } - } - ) - } - ) { - Column { + ModalBottomSheetLayout( + sheetState = sheetState, + sheetBackgroundColor = ComposeAppTheme.colors.transparent, + sheetContent = { + AppCloseWarningBottomSheet( + onCloseClick = { scope.launch { sheetState.hide() } }, + onChangeClick = { + selectedAppIcon?.let { viewModel.onEnterAppIcon(it) } + scope.launch { sheetState.hide() } + } + ) + } + ) { + Scaffold( + backgroundColor = ComposeAppTheme.colors.tyler, + topBar = { AppBar( title = stringResource(R.string.Settings_Appearance), navigationIcon = { @@ -114,160 +115,161 @@ fun AppearanceScreen(navController: NavController) { }, menuItems = listOf(), ) + } + ) { paddingValues -> + Column( + modifier = Modifier + .fillMaxSize() + .verticalScroll(rememberScrollState()) + .padding(paddingValues), + ) { + VSpacer(height = 12.dp) + CellUniversalLawrenceSection( + listOf { + MenuItemWithDialog( + R.string.Settings_Theme, + value = uiState.selectedTheme.title.getString(), + onClick = { openThemeSelector = true } + ) + } + ) + + VSpacer(24.dp) - Column( - modifier = Modifier - .fillMaxSize() - .verticalScroll(rememberScrollState()), - ) { - VSpacer(height = 12.dp) - CellUniversalLawrenceSection( - listOf { + HeaderText(text = stringResource(id = R.string.Appearance_MarketsTab)) + CellUniversalLawrenceSection( + listOf( + { + RowUniversal( + modifier = Modifier.padding(horizontal = 16.dp), + ) { + body_leah( + text = stringResource(id = R.string.Appearance_HideMarketsTab), + modifier = Modifier + .weight(1f) + .padding(end = 16.dp) + ) + HsSwitch( + checked = uiState.marketsTabHidden, + onCheckedChange = { + viewModel.onSetMarketTabsHidden(it) + } + ) + } + }, + { MenuItemWithDialog( - R.string.Settings_Theme, - value = uiState.selectedTheme.title.getString(), - onClick = { openThemeSelector = true } + R.string.Appearance_PriceChangeInterval, + value = uiState.priceChangeInterval.title.getString(), + onClick = { openPriceChangeIntervalSelector = true } ) } ) + ) - VSpacer(24.dp) - - HeaderText(text = stringResource(id = R.string.Appearance_MarketsTab)) - CellUniversalLawrenceSection( - listOf ( - { - RowUniversal( - modifier = Modifier.padding(horizontal = 16.dp), - ) { - body_leah( - text = stringResource(id = R.string.Appearance_HideMarketsTab), - modifier = Modifier - .weight(1f) - .padding(end = 16.dp) - ) - HsSwitch( - checked = uiState.marketsTabHidden, - onCheckedChange = { - viewModel.onSetMarketTabsHidden(it) - } - ) - } - }, - { + AnimatedVisibility(visible = !uiState.marketsTabHidden) { + Column { + VSpacer(32.dp) + CellUniversalLawrenceSection( + listOf { MenuItemWithDialog( - R.string.Appearance_PriceChangeInterval, - value = uiState.priceChangeInterval.title.getString(), - onClick = { openPriceChangeIntervalSelector = true } + R.string.Settings_LaunchScreen, + value = uiState.selectedLaunchScreen.title.getString(), + onClick = { openLaunchPageSelector = true } ) } ) - ) - - AnimatedVisibility(visible = !uiState.marketsTabHidden) { - Column { - VSpacer(32.dp) - CellUniversalLawrenceSection( - listOf { - MenuItemWithDialog( - R.string.Settings_LaunchScreen, - value = uiState.selectedLaunchScreen.title.getString(), - onClick = { openLaunchPageSelector = true } - ) - } - ) - } } + } - VSpacer(24.dp) - HeaderText(text = stringResource(id = R.string.Appearance_BalanceTab)) - CellUniversalLawrenceSection( - listOf( - { - RowUniversal( - modifier = Modifier.padding(horizontal = 16.dp), - ) { - body_leah( - text = stringResource(id = R.string.Appearance_HideBalanceTabButtons), - modifier = Modifier - .weight(1f) - .padding(end = 16.dp) - ) - HsSwitch( - checked = uiState.balanceTabButtonsHidden, - onCheckedChange = { - viewModel.onSetBalanceTabButtonsHidden(it) - } - ) - } - }, - { - MenuItemWithDialog( - R.string.Appearance_BalanceValue, - value = uiState.selectedBalanceViewType.title.getString(), - onClick = { openBalanceValueSelector = true } + VSpacer(24.dp) + HeaderText(text = stringResource(id = R.string.Appearance_BalanceTab)) + CellUniversalLawrenceSection( + listOf( + { + RowUniversal( + modifier = Modifier.padding(horizontal = 16.dp), + ) { + body_leah( + text = stringResource(id = R.string.Appearance_HideBalanceTabButtons), + modifier = Modifier + .weight(1f) + .padding(end = 16.dp) + ) + HsSwitch( + checked = uiState.balanceTabButtonsHidden, + onCheckedChange = { + viewModel.onSetBalanceTabButtonsHidden(it) + } ) } - ) + }, + { + MenuItemWithDialog( + R.string.Appearance_BalanceValue, + value = uiState.selectedBalanceViewType.title.getString(), + onClick = { openBalanceValueSelector = true } + ) + } ) + ) - VSpacer(24.dp) - HeaderText(text = stringResource(id = R.string.Appearance_AppIcon)) - AppIconSection(uiState.appIconOptions) { - scope.launch { - selectedAppIcon = it - sheetState.show() - } + VSpacer(24.dp) + HeaderText(text = stringResource(id = R.string.Appearance_AppIcon)) + AppIconSection(uiState.appIconOptions) { + scope.launch { + selectedAppIcon = it + sheetState.show() } - - VSpacer(32.dp) } + + VSpacer(32.dp) } - //Dialogs - if (openThemeSelector) { - AlertGroup( - R.string.Settings_Theme, - uiState.themeOptions, - { selected -> - viewModel.onEnterTheme(selected) - openThemeSelector = false - }, - { openThemeSelector = false } - ) - } - if (openLaunchPageSelector) { - AlertGroup( - R.string.Settings_LaunchScreen, - uiState.launchScreenOptions, - { selected -> - viewModel.onEnterLaunchPage(selected) - openLaunchPageSelector = false - }, - { openLaunchPageSelector = false } - ) - } - if (openBalanceValueSelector) { - AlertGroup( - R.string.Appearance_BalanceValue, - uiState.balanceViewTypeOptions, - { selected -> - viewModel.onEnterBalanceViewType(selected) - openBalanceValueSelector = false - }, - { openBalanceValueSelector = false } - ) - } - if (openPriceChangeIntervalSelector) { - AlertGroup( - R.string.Appearance_PriceChangeInterval, - uiState.priceChangeIntervalOptions, - { selected -> - viewModel.onSetPriceChangeInterval(selected) - openPriceChangeIntervalSelector = false - }, - { openPriceChangeIntervalSelector = false } - ) - } + } + //Dialogs + if (openThemeSelector) { + AlertGroup( + R.string.Settings_Theme, + uiState.themeOptions, + { selected -> + viewModel.onEnterTheme(selected) + openThemeSelector = false + }, + { openThemeSelector = false } + ) + } + if (openLaunchPageSelector) { + AlertGroup( + R.string.Settings_LaunchScreen, + uiState.launchScreenOptions, + { selected -> + viewModel.onEnterLaunchPage(selected) + openLaunchPageSelector = false + }, + { openLaunchPageSelector = false } + ) + } + if (openBalanceValueSelector) { + AlertGroup( + R.string.Appearance_BalanceValue, + uiState.balanceViewTypeOptions, + { selected -> + viewModel.onEnterBalanceViewType(selected) + openBalanceValueSelector = false + }, + { openBalanceValueSelector = false } + ) + } + if (openPriceChangeIntervalSelector) { + AlertGroup( + R.string.Appearance_PriceChangeInterval, + uiState.priceChangeIntervalOptions, + { selected -> + viewModel.onSetPriceChangeInterval(selected) + openPriceChangeIntervalSelector = false + }, + { openPriceChangeIntervalSelector = false } + ) } } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/ui/compose/HSSwipeRefresh.kt b/app/src/main/java/io/horizontalsystems/bankwallet/ui/compose/HSSwipeRefresh.kt index 80a9a91b61a..ddba609d367 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/ui/compose/HSSwipeRefresh.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/ui/compose/HSSwipeRefresh.kt @@ -14,13 +14,14 @@ import androidx.compose.ui.Modifier @Composable fun HSSwipeRefresh( refreshing: Boolean, + modifier: Modifier = Modifier, onRefresh: () -> Unit, content: @Composable () -> Unit, ) { val pullRefreshState = rememberPullRefreshState(refreshing, onRefresh) Box( - modifier = Modifier + modifier = modifier .fillMaxSize() .pullRefresh(pullRefreshState) ) {