generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#100] Ui implementation for no connection dialog
- Loading branch information
1 parent
8a173a8
commit e0e0e42
Showing
4 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
app/src/main/java/co/nimblehq/compose/crypto/ui/common/AppDialogPopUp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package co.nimblehq.compose.crypto.ui.common | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.window.Dialog | ||
import co.nimblehq.compose.crypto.R | ||
import co.nimblehq.compose.crypto.ui.theme.* | ||
|
||
@Composable | ||
fun AppDialogPopUp( | ||
onDismiss: () -> Unit, | ||
onClick: () -> Unit, | ||
@StringRes title: Int, | ||
@StringRes message: Int, | ||
@StringRes actionText: Int, | ||
) { | ||
Dialog( | ||
onDismissRequest = onDismiss | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.background(Color.White) | ||
.width(DialogWidth) | ||
) { | ||
Text( | ||
text = stringResource(id = title), | ||
style = AppTheme.typography.h6, | ||
color = Color.Black, | ||
modifier = Modifier.padding(top = Dp16, start = Dp16, end = Dp16) | ||
) | ||
Text( | ||
text = stringResource(id = message), | ||
style = AppTheme.typography.body1, | ||
color = Color.Black, | ||
modifier = Modifier.padding(Dp16) | ||
) | ||
Row( | ||
horizontalArrangement = Arrangement.End, | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(bottom = Dp16, end = Dp8) | ||
) { | ||
TextButton( | ||
onClick = onClick | ||
) { | ||
Text( | ||
text = stringResource(id = actionText), | ||
style = AppTheme.styles.semiBold16, | ||
color = Color.Blue, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@Preview(showSystemUi = true) | ||
fun AppDialogPopUpPreview() { | ||
ComposeTheme { | ||
Box { | ||
AppDialogPopUp( | ||
onDismiss = { /*TODO*/ }, | ||
onClick = { /*TODO*/ }, | ||
message = R.string.no_internet_message, | ||
actionText = android.R.string.ok, | ||
title = R.string.no_internet_title | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ val Sp12 = 12.sp | |
val Sp14 = 14.sp | ||
val Sp16 = 16.sp | ||
val Sp24 = 24.sp | ||
|
||
val DialogWidth = 300.dp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters