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.
Merge pull request #104 from nimblehq/feature/100-ui-implement-no-con…
…nection-dialog [#100] [UI] As a user, I can see dialog when there is no internet connection
- Loading branch information
Showing
6 changed files
with
97 additions
and
11 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
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,70 @@ | ||
package co.nimblehq.compose.crypto.ui.common | ||
|
||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.window.Dialog | ||
import co.nimblehq.compose.crypto.ui.theme.* | ||
|
||
@Composable | ||
fun AppDialogPopUp( | ||
onDismiss: () -> Unit, | ||
onClick: () -> Unit, | ||
title: String, | ||
message: String, | ||
actionText: String, | ||
) { | ||
Dialog( | ||
onDismissRequest = onDismiss | ||
) { | ||
Surface { | ||
Column( | ||
modifier = Modifier.width(DialogWidth) | ||
) { | ||
Text( | ||
text = title, | ||
style = AppTheme.typography.h6, | ||
color = AppTheme.colors.text, | ||
modifier = Modifier.padding(top = Dp16, start = Dp16, end = Dp16) | ||
) | ||
Text( | ||
text = message, | ||
style = AppTheme.typography.body1, | ||
color = AppTheme.colors.text, | ||
modifier = Modifier.padding(Dp16) | ||
) | ||
TextButton( | ||
onClick = onClick, | ||
modifier = Modifier | ||
.align(Alignment.End) | ||
.padding(bottom = Dp16, end = Dp8) | ||
) { | ||
Text( | ||
text = actionText, | ||
style = AppTheme.styles.semiBold16, | ||
color = AppTheme.colors.dialogText, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
@Preview(showSystemUi = true) | ||
fun AppDialogPopUpPreview() { | ||
ComposeTheme { | ||
Box { | ||
AppDialogPopUp( | ||
onDismiss = { /*TODO*/ }, | ||
onClick = { /*TODO*/ }, | ||
message = "No internet connection was found. Please check your internet connection and try again.", | ||
actionText = "OK", | ||
title = "Oops!" | ||
) | ||
} | ||
} | ||
} |
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
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