-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
173 additions
and
16 deletions.
There are no files selected for viewing
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
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
37 changes: 37 additions & 0 deletions
37
ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/qrdialog/AndroidQrDialog.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,37 @@ | ||
package co.electriccoin.zcash.ui.screen.qrdialog | ||
|
||
import androidx.activity.compose.BackHandler | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.SideEffect | ||
import androidx.compose.ui.platform.LocalView | ||
import androidx.compose.ui.window.DialogWindowProvider | ||
import co.electriccoin.zcash.ui.NavigationRouter | ||
import co.electriccoin.zcash.ui.design.component.QrState | ||
import org.koin.compose.koinInject | ||
|
||
@Composable | ||
fun AndroidQrDialog(arg: QrDialog) { | ||
val navigationRouter = koinInject<NavigationRouter>() | ||
|
||
val parent = LocalView.current.parent | ||
|
||
SideEffect { | ||
(parent as? DialogWindowProvider)?.window?.setDimAmount(DIALOG_DIM) | ||
} | ||
|
||
BackHandler { | ||
navigationRouter.back() | ||
} | ||
|
||
QrDialogView( | ||
state = | ||
QrState( | ||
qrData = arg.qr, | ||
), | ||
onBack = { | ||
navigationRouter.back() | ||
} | ||
) | ||
} | ||
|
||
private const val DIALOG_DIM = .8f |
8 changes: 8 additions & 0 deletions
8
ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/qrdialog/QrDialog.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,8 @@ | ||
package co.electriccoin.zcash.ui.screen.qrdialog | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class QrDialog( | ||
val qr: String, | ||
) |
74 changes: 74 additions & 0 deletions
74
ui-lib/src/main/java/co/electriccoin/zcash/ui/screen/qrdialog/QrDialogView.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,74 @@ | ||
package co.electriccoin.zcash.ui.screen.qrdialog | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.platform.LocalConfiguration | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.window.Dialog | ||
import co.electriccoin.zcash.ui.design.component.QrCodeDefaults | ||
import co.electriccoin.zcash.ui.design.component.QrState | ||
import co.electriccoin.zcash.ui.design.component.ZashiQr | ||
import co.electriccoin.zcash.ui.design.newcomponent.PreviewScreens | ||
import co.electriccoin.zcash.ui.design.theme.ZcashTheme | ||
|
||
@Composable | ||
fun QrDialogView( | ||
state: QrState, | ||
onBack: () -> Unit | ||
) { | ||
Box( | ||
modifier = | ||
Modifier | ||
.fillMaxSize() | ||
.clickable( | ||
interactionSource = remember { MutableInteractionSource() }, | ||
indication = null, | ||
onClick = onBack | ||
) | ||
.padding(start = 16.dp, end = 16.dp, bottom = 64.dp) | ||
) { | ||
ZashiQr( | ||
modifier = | ||
Modifier | ||
.fillMaxWidth() | ||
.align(Alignment.Center), | ||
state = state, | ||
qrSize = LocalConfiguration.current.screenWidthDp.dp - 44.dp, | ||
contentPadding = PaddingValues(6.dp), | ||
colors = | ||
QrCodeDefaults.colors( | ||
background = Color.White, | ||
foreground = Color.Black, | ||
border = Color.Unspecified | ||
) | ||
) | ||
} | ||
} | ||
|
||
@PreviewScreens | ||
@Composable | ||
private fun Preview() = | ||
ZcashTheme { | ||
Dialog( | ||
onDismissRequest = {} | ||
) { | ||
QrDialogView( | ||
state = | ||
QrState( | ||
qrData = "test", | ||
centerImageResId = co.electriccoin.zcash.ui.design.R.drawable.ic_item_keystone_qr | ||
), | ||
onBack = {} | ||
) | ||
} | ||
} |
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