Skip to content
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 @@ -90,7 +90,11 @@ internal fun TransactionsScene(
} else {
EmptyContentType.Activity(onReceive = onReceive, onBuy = onBuy)
}
EmptyContentView(type = type, modifier = Modifier.fillMaxSize())
LazyColumn(modifier = Modifier.fillMaxSize()) {
item {
EmptyContentView(type = type, modifier = Modifier.fillParentMaxSize())
}
}
} else {
LazyColumn(
modifier = Modifier.fillMaxSize(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
Expand Down Expand Up @@ -104,7 +105,14 @@ fun NftListScene(
}

if (!isLoading && items.isEmpty()) {
EmptyContentView(type = EmptyContentType.Nft(), modifier = Modifier.fillMaxSize())
LazyColumn(modifier = Modifier.fillMaxSize()) {
item {
EmptyContentView(
type = EmptyContentType.Nft(),
modifier = Modifier.fillParentMaxSize(),
)
}
}
return@PullToRefreshBox
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ private fun EmptyContentType.buttons(): List<EmptyAction> = when (this) {
)
is EmptyContentType.Asset -> if (isViewOnly) emptyList() else listOfNotNull(
onBuy?.let { EmptyAction(stringResource(R.string.wallet_buy), it) },
onSwap?.let { EmptyAction(stringResource(R.string.wallet_swap), it) },
onSwap?.let { EmptyAction(stringResource(R.string.wallet_swap), it, EmptyActionStyle.Secondary) },
)
is EmptyContentType.Activity -> if (isViewOnly) emptyList() else listOfNotNull(
onBuy?.let { EmptyAction(stringResource(R.string.wallet_buy), it) },
onReceive?.let { EmptyAction(stringResource(R.string.wallet_receive), it) },
onReceive?.let { EmptyAction(stringResource(R.string.wallet_receive), it, EmptyActionStyle.Secondary) },
)
is EmptyContentType.SearchAssets -> listOfNotNull(
onAddCustomToken?.let { EmptyAction(stringResource(R.string.assets_add_custom_token), it) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -23,16 +24,18 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.style.TextAlign
import com.gemwallet.android.ui.theme.emptyImageColor
import com.gemwallet.android.ui.theme.largeIconSize
import com.gemwallet.android.ui.theme.listItemIconSize
import com.gemwallet.android.ui.theme.paddingDefault
import com.gemwallet.android.ui.theme.paddingSmall
import com.gemwallet.android.ui.theme.space8

enum class EmptyActionStyle { Primary, Secondary }

data class EmptyAction(
val title: String,
val onClick: () -> Unit,
val style: EmptyActionStyle = EmptyActionStyle.Primary,
)

@Composable
Expand All @@ -56,22 +59,22 @@ fun EmptyStateView(
modifier = Modifier
.size(largeIconSize)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.scrim),
.background(MaterialTheme.colorScheme.surfaceContainerHighest),
contentAlignment = Alignment.Center,
) {
if (iconVector != null) {
Icon(
imageVector = iconVector,
contentDescription = null,
modifier = Modifier.size(listItemIconSize),
tint = emptyImageColor,
tint = MaterialTheme.colorScheme.onSurface,
)
} else if (icon != null) {
Icon(
painter = icon,
contentDescription = null,
modifier = Modifier.size(listItemIconSize),
tint = emptyImageColor,
tint = MaterialTheme.colorScheme.onSurface,
)
}
}
Expand Down Expand Up @@ -103,8 +106,19 @@ fun EmptyStateView(
Spacer(modifier = Modifier.height(paddingDefault))
Row(horizontalArrangement = Arrangement.spacedBy(paddingSmall)) {
buttons.forEach { action ->
OutlinedButton(onClick = action.onClick) {
Text(action.title)
when (action.style) {
EmptyActionStyle.Primary -> Button(onClick = action.onClick) {
Text(action.title)
}
EmptyActionStyle.Secondary -> Button(
onClick = action.onClick,
colors = ButtonDefaults.buttonColors().copy(
containerColor = MaterialTheme.colorScheme.surfaceContainerHighest,
contentColor = MaterialTheme.colorScheme.onSurface,
),
) {
Text(action.title)
}
}
}
}
Expand Down