Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply UX changes to Sectors/Blockchains selectors in MarketFilters #7871

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.horizontalsystems.bankwallet.modules.market.filters
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand All @@ -19,9 +20,12 @@ import androidx.navigation.NavController
import androidx.navigation.navGraphViewModels
import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.BaseComposeFragment
import io.horizontalsystems.bankwallet.modules.evmfee.ButtonsGroupWithShade
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.HsBackButton
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow
import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer
import io.horizontalsystems.bankwallet.ui.compose.components.body_grey
import io.horizontalsystems.bankwallet.ui.compose.components.cell.CellBlockchainChecked
Expand Down Expand Up @@ -69,39 +73,73 @@ private fun FilterByBlockchainsScreen(
AppBar(
title = stringResource(R.string.Market_Filter_Blockchains),
navigationIcon = {
HsBackButton(onClick = { navController.popBackStack() })
}
Icon(
modifier = Modifier.padding(start = 24.dp),
painter = painterResource(id = R.drawable.ic_blocks_24),
contentDescription = null,
tint = ComposeAppTheme.colors.jacob
)
},
menuItems = listOf(
MenuItem(
title = TranslatableString.ResString(R.string.Button_Close),
icon = R.drawable.ic_close,
onClick = navController::popBackStack
)
),
)
},
backgroundColor = ComposeAppTheme.colors.tyler,
) {
Column(
modifier = Modifier
.padding(it)
.verticalScroll(rememberScrollState())
modifier = Modifier.padding(it)
) {
VSpacer(height = 12.dp)
Column(
modifier = Modifier
.weight(1f)
.verticalScroll(rememberScrollState())
) {
VSpacer(height = 12.dp)

SectionUniversalLawrence {
AnyCell(
checked = uiState.selectedBlockchains.isEmpty(),
onClick = { viewModel.anyBlockchains() }
)
uiState.blockchainOptions.forEach { item ->
CellBlockchainChecked(
blockchain = item.blockchain,
checked = item.checked
) {
if (item.checked) {
viewModel.onBlockchainUncheck(item.blockchain)
} else {
viewModel.onBlockchainCheck(item.blockchain)
SectionUniversalLawrence {
AnyCell(
checked = uiState.selectedBlockchains.isEmpty(),
onClick = { viewModel.anyBlockchains() }
)
uiState.blockchainOptions.forEach { item ->
CellBlockchainChecked(
blockchain = item.blockchain,
checked = item.checked
) {
if (item.checked) {
viewModel.onBlockchainUncheck(item.blockchain)
} else {
viewModel.onBlockchainCheck(item.blockchain)
}
}
}
}
}

VSpacer(height = 32.dp)
VSpacer(height = 32.dp)
}
ButtonsGroupWithShade {
ButtonPrimaryYellow(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
title = if (uiState.selectedBlockchains.isEmpty()) {
stringResource(R.string.Button_Done)
} else {
stringResource(
R.string.Market_Filters_Select,
uiState.selectedBlockchains.size
)
},
onClick = {
navController.popBackStack()
},
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import androidx.navigation.navGraphViewModels
import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.BaseComposeFragment
import io.horizontalsystems.bankwallet.core.paidAction
import io.horizontalsystems.bankwallet.core.slideFromBottom
import io.horizontalsystems.bankwallet.core.slideFromRight
import io.horizontalsystems.bankwallet.modules.evmfee.ButtonsGroupWithShade
import io.horizontalsystems.bankwallet.modules.market.filters.MarketFiltersModule.FilterDropdown.CoinSet
Expand Down Expand Up @@ -123,7 +124,7 @@ private fun AdvancedSearchScreen(
navController = navController,
viewModel = viewModel,
onFilterByBlockchainsClick = {
navController.slideFromRight(R.id.blockchainsSelectorFragment)
navController.slideFromBottom(R.id.blockchainsSelectorFragment)
},
showBottomSheet = { type ->
bottomSheetType = type
Expand Down Expand Up @@ -316,7 +317,7 @@ fun AdvancedSearchContent(
value = if (uiState.sectors.size == 1 && uiState.sectors[0].item == null) null else uiState.sectors.size.toString(),
onDropdownClick = {
navController.paidAction(AdvancedSearch) {
navController.slideFromRight(R.id.sectorsSelectorFragment)
navController.slideFromBottom(R.id.sectorsSelectorFragment)
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
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.getValue
Expand All @@ -26,10 +27,11 @@ import io.horizontalsystems.bankwallet.R
import io.horizontalsystems.bankwallet.core.BaseComposeFragment
import io.horizontalsystems.bankwallet.modules.evmfee.ButtonsGroupWithShade
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.ButtonPrimaryYellow
import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection
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_grey
Expand Down Expand Up @@ -76,10 +78,22 @@ fun SectorsSelectorScreen(
Scaffold(
topBar = {
AppBar(
title = stringResource(R.string.Market_Filter_Blockchains),
title = stringResource(R.string.Market_Filter_Sectors),
navigationIcon = {
HsBackButton(onClick = { navController.popBackStack() })
}
Icon(
modifier = Modifier.padding(start = 24.dp),
painter = painterResource(id = R.drawable.prem_portfolio_24),
contentDescription = null,
tint = ComposeAppTheme.colors.jacob
)
},
menuItems = listOf(
MenuItem(
title = TranslatableString.ResString(R.string.Button_Close),
icon = R.drawable.ic_close,
onClick = navController::popBackStack
)
),
)
},
backgroundColor = ComposeAppTheme.colors.tyler,
Expand Down Expand Up @@ -117,6 +131,8 @@ fun SectorsSelectorScreen(
} else {
selectedItems + itemWrapper
}

viewModel.setSectors(selectedItems)
}
) {
if (itemWrapper.title != null) {
Expand Down Expand Up @@ -149,9 +165,12 @@ fun SectorsSelectorScreen(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 24.dp),
title = stringResource(R.string.Button_Apply),
title = if (selectedItems.size == 1 && selectedItems[0].item == null) {
stringResource(R.string.Button_Done)
} else {
stringResource(R.string.Market_Filters_Select, selectedItems.size)
},
onClick = {
viewModel.setSectors(selectedItems)
navController.popBackStack()
},
)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@
<string name="Market_Sorting_HighestCap">Highest Cap</string>
<string name="Market_Sorting_LowestCap">Lowest Cap</string>

<string name="Market_Filters_Select">Select %d</string>

<!--Coin Markets-->

<!--TVL Rank-->
Expand Down
Loading