-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Android dynamic derivations support (#1943)
* started wotk with derived screen * started wotk with derived screen progress 2 * add derivation screen progress * components file renamed * add derived keys screen finished * adjusted paddings * small adjustements * key details added lable for dynamic derivations * added todo * fixed size for text * network filter work in progress * network filter work in progress 2 * network filter implementation * network filter implementation 2 * dependencies updated * netfilter workin in progress * netfilter working in progress 2 ui clearing * network filters preferences added * network filters preferences added 2 * network filters preferences added 3 * keyset details refactoring * moved backup BS to keyset details screen * filters implemented, only keyset old items missing * fixed network filters * changed elements for a old ones for keyset details * key derived elements updated * removed outdated todo * feat: #1882 import dymanic derivations * fix: ios: fix building after enum change * fixed compilation errors from rust * fixed compilation errors from rust for android * implemented new view for keyset details when all keys filtered out * error messages added * animated qr code implemented for dynamic derivations * add response QR * integration dynamic derivations screen 1 * integration dynamic derivations screen 2 * removed unrelated todos * padding added * padding added 2 * add was_imported field to MKeysCard * fix grammar * fix ios * fix #1935 investigation * add was_imported to MKeyDetails * fix #1935 fixed * autoformat * implemented to show was imported label * fixed paddings for imported label as per design * removed temp notes * filter network - hide done if empty list * filter network - fixed difference between clean selection and close * fixing new rust changes to make app compile. Next will be to adjust behaviour * remove build tools version as now agp defines it * work in progress - implementation separate import keys * implementation import derivation in progress * implemented create import dynamic derevation keys * improved UX - text, password asking while still screen presented. * fix to show errors in case if keyset doesn't exist. --------- Co-authored-by: Pavel Rybalko <[email protected]> Co-authored-by: Krzysztof Rodak <[email protected]>
- Loading branch information
1 parent
56e9c21
commit 184c87d
Showing
36 changed files
with
1,151 additions
and
252 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
149 changes: 149 additions & 0 deletions
149
android/src/main/java/io/parity/signer/components/items/NetworkItems.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,149 @@ | ||
package io.parity.signer.components.items | ||
|
||
import SignerCheckbox | ||
import android.content.res.Configuration | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.Text | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.ChevronRight | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import io.parity.signer.components.networkicon.NetworkIcon | ||
import io.parity.signer.domain.NetworkModel | ||
import io.parity.signer.ui.theme.SignerNewTheme | ||
import io.parity.signer.ui.theme.SignerTypeface | ||
import io.parity.signer.ui.theme.textTertiary | ||
|
||
|
||
@Composable | ||
fun NetworkItemClickable( | ||
network: NetworkModel, | ||
onClick: (NetworkModel) -> Unit, | ||
) { | ||
Row( | ||
modifier = Modifier.clickable { onClick(network) }, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
NetworkIcon( | ||
networkLogoName = network.logo, | ||
modifier = Modifier | ||
.padding( | ||
top = 16.dp, | ||
bottom = 16.dp, | ||
start = 16.dp, | ||
end = 12.dp | ||
) | ||
.size(36.dp), | ||
) | ||
Text( | ||
text = network.title, | ||
color = MaterialTheme.colors.primary, | ||
style = SignerTypeface.TitleS, | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
Image( | ||
imageVector = Icons.Filled.ChevronRight, | ||
contentDescription = null, | ||
colorFilter = ColorFilter.tint(MaterialTheme.colors.textTertiary), | ||
modifier = Modifier | ||
.padding(2.dp)// because it's 28 not 32pd | ||
.padding(end = 16.dp) | ||
.size(28.dp) | ||
) | ||
} | ||
} | ||
|
||
@Composable | ||
fun NetworkItemMultiselect( | ||
network: NetworkModel, | ||
isSelected: Boolean, | ||
modifier: Modifier = Modifier, | ||
onClick: (NetworkModel) -> Unit, | ||
) { | ||
Row( | ||
modifier = modifier.clickable { onClick(network) }, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
NetworkIcon( | ||
networkLogoName = network.logo, | ||
modifier = Modifier | ||
.padding( | ||
top = 16.dp, | ||
bottom = 16.dp, | ||
start = 16.dp, | ||
end = 12.dp | ||
) | ||
.size(36.dp), | ||
) | ||
Text( | ||
text = network.title, | ||
color = MaterialTheme.colors.primary, | ||
style = SignerTypeface.TitleS, | ||
) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
SignerCheckbox( | ||
isChecked = isSelected, | ||
modifier = Modifier.padding(end = 8.dp), | ||
uncheckedColor = MaterialTheme.colors.primary, | ||
) { | ||
onClick(network) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
@Preview( | ||
name = "light", group = "general", uiMode = Configuration.UI_MODE_NIGHT_NO, | ||
showBackground = true, backgroundColor = 0xFFFFFFFF, | ||
) | ||
@Preview( | ||
name = "dark", group = "general", | ||
uiMode = Configuration.UI_MODE_NIGHT_YES, | ||
showBackground = true, backgroundColor = 0xFF000000, | ||
) | ||
@Composable | ||
private fun PreviewNetworkItem() { | ||
val networks = listOf( | ||
NetworkModel( | ||
key = "0", | ||
logo = "polkadot", | ||
title = "Polkadot", | ||
pathId = "polkadot", | ||
), | ||
NetworkModel( | ||
key = "1", | ||
logo = "Kusama", | ||
title = "Kusama", | ||
pathId = "kusama", | ||
), | ||
) | ||
SignerNewTheme { | ||
Column() { | ||
NetworkItemClickable( | ||
network = networks[0], | ||
onClick = {}) | ||
NetworkItemMultiselect( | ||
network = networks[0], | ||
isSelected = true, | ||
onClick = {} | ||
) | ||
NetworkItemMultiselect( | ||
network = networks[1], | ||
isSelected = false, | ||
onClick = {} | ||
) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.