diff --git a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/SoraCardImage.kt b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/SoraCardImage.kt
new file mode 100644
index 000000000..d4ef097f2
--- /dev/null
+++ b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/SoraCardImage.kt
@@ -0,0 +1,95 @@
+/*
+This file is part of the SORA network and Polkaswap app.
+
+Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-4-Clause
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list
+of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+All advertising materials mentioning features or use of this software must display
+the following acknowledgement: This product includes software developed by Polka Biome
+Ltd., SORA, and Polkaswap.
+
+Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used
+to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jp.co.soramitsu.common.presentation.compose.components
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.wrapContentHeight
+import androidx.compose.foundation.layout.wrapContentSize
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.tooling.preview.Preview
+import jp.co.soramitsu.common.R
+import jp.co.soramitsu.ui_core.resources.Dimens
+
+@Composable
+fun SoraCardImage(
+ modifier: Modifier = Modifier,
+) {
+ Box(
+ modifier = modifier,
+ ) {
+ Image(
+ modifier = Modifier.fillMaxWidth(),
+ painter = painterResource(id = R.drawable.sora_card),
+ contentDescription = "",
+ contentScale = ContentScale.FillWidth,
+ )
+ Image(
+ modifier = Modifier
+ .padding(start = Dimens.x2, top = Dimens.x2)
+ .wrapContentSize(),
+ painter = painterResource(id = R.drawable.ic_sora_on_card),
+ contentDescription = "",
+ contentScale = ContentScale.Fit,
+ )
+ }
+}
+
+@Composable
+@Preview(locale = "en")
+private fun PreviewSoraCardImage1() {
+ SoraCardImage(
+ modifier = Modifier.fillMaxWidth().wrapContentHeight()
+ )
+}
+
+@Composable
+@Preview(locale = "ar")
+private fun PreviewSoraCardImage2() {
+ SoraCardImage(
+ modifier = Modifier.fillMaxWidth().wrapContentHeight()
+ )
+}
+
+@Composable
+@Preview(locale = "he")
+private fun PreviewSoraCardImage3() {
+ SoraCardImage(
+ modifier = Modifier.fillMaxWidth().wrapContentHeight()
+ )
+}
diff --git a/common/src/main/res/drawable-hdpi/sora_card.png b/common/src/main/res/drawable-hdpi/sora_card.png
index 5647f253d..e8752dd8b 100644
Binary files a/common/src/main/res/drawable-hdpi/sora_card.png and b/common/src/main/res/drawable-hdpi/sora_card.png differ
diff --git a/common/src/main/res/drawable-ldpi/sora_card.png b/common/src/main/res/drawable-ldpi/sora_card.png
deleted file mode 100644
index 538c05644..000000000
Binary files a/common/src/main/res/drawable-ldpi/sora_card.png and /dev/null differ
diff --git a/common/src/main/res/drawable-ldpi/sora_card_referral_banner.png b/common/src/main/res/drawable-ldpi/sora_card_referral_banner.png
deleted file mode 100644
index 1b5a368b0..000000000
Binary files a/common/src/main/res/drawable-ldpi/sora_card_referral_banner.png and /dev/null differ
diff --git a/common/src/main/res/drawable-mdpi/sora_card.png b/common/src/main/res/drawable-mdpi/sora_card.png
index 19872a7b6..889bed61f 100644
Binary files a/common/src/main/res/drawable-mdpi/sora_card.png and b/common/src/main/res/drawable-mdpi/sora_card.png differ
diff --git a/common/src/main/res/drawable-xhdpi/sora_card.png b/common/src/main/res/drawable-xhdpi/sora_card.png
index 307354a4a..9a453882e 100644
Binary files a/common/src/main/res/drawable-xhdpi/sora_card.png and b/common/src/main/res/drawable-xhdpi/sora_card.png differ
diff --git a/common/src/main/res/drawable-xxhdpi/sora_card.png b/common/src/main/res/drawable-xxhdpi/sora_card.png
index 5cdf76d6c..70d6a5984 100644
Binary files a/common/src/main/res/drawable-xxhdpi/sora_card.png and b/common/src/main/res/drawable-xxhdpi/sora_card.png differ
diff --git a/common/src/main/res/drawable-xxxhdpi/sora_card.png b/common/src/main/res/drawable-xxxhdpi/sora_card.png
index 4322329c8..a86c47dbf 100644
Binary files a/common/src/main/res/drawable-xxxhdpi/sora_card.png and b/common/src/main/res/drawable-xxxhdpi/sora_card.png differ
diff --git a/common/src/main/res/drawable/ic_sora_on_card.xml b/common/src/main/res/drawable/ic_sora_on_card.xml
new file mode 100644
index 000000000..de69ebd05
--- /dev/null
+++ b/common/src/main/res/drawable/ic_sora_on_card.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
diff --git a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/GetSoraCardScreen.kt b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/GetSoraCardScreen.kt
index db3dfb8cb..cec885187 100644
--- a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/GetSoraCardScreen.kt
+++ b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/GetSoraCardScreen.kt
@@ -32,7 +32,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package jp.co.soramitsu.feature_sora_card_impl.presentation.get.card
-import androidx.compose.foundation.Image
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
@@ -47,12 +46,12 @@ import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
-import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
import jp.co.soramitsu.common.R
+import jp.co.soramitsu.common.presentation.compose.components.SoraCardImage
import jp.co.soramitsu.common.util.ext.testTagAsId
import jp.co.soramitsu.ui_core.component.button.FilledButton
import jp.co.soramitsu.ui_core.component.button.properties.Order
@@ -84,10 +83,8 @@ fun GetSoraCardScreen(
.fillMaxSize()
.padding(Dimens.x2)
) {
- Image(
+ SoraCardImage(
modifier = Modifier.fillMaxWidth(),
- painter = painterResource(R.drawable.sora_card),
- contentDescription = null
)
Text(
diff --git a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/details/SoraCardMainSoraContentCard.kt b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/details/SoraCardMainSoraContentCard.kt
index 0caea957e..6280db054 100644
--- a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/details/SoraCardMainSoraContentCard.kt
+++ b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/get/card/details/SoraCardMainSoraContentCard.kt
@@ -32,29 +32,27 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package jp.co.soramitsu.feature_sora_card_impl.presentation.get.card.details
-import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import jp.co.soramitsu.common.R
+import jp.co.soramitsu.common.presentation.compose.components.SoraCardImage
import jp.co.soramitsu.common.presentation.compose.uikit.tokens.Image
import jp.co.soramitsu.common.presentation.compose.uikit.tokens.Text
-import jp.co.soramitsu.common.presentation.compose.uikit.tokens.retrievePainter
-import jp.co.soramitsu.common.presentation.compose.uikit.tokens.retrieveString
import jp.co.soramitsu.ui_core.component.button.BleachedButton
import jp.co.soramitsu.ui_core.component.button.properties.Order
import jp.co.soramitsu.ui_core.component.button.properties.Size
@@ -70,34 +68,9 @@ enum class SoraCardMenuAction {
data class SoraCardMainSoraContentCardState(
val balance: Float,
val isCardEnabled: Boolean,
- val soraCardMenuActions: List
+ val soraCardMenuActions: List,
) {
- val soraImage: Image
- get() = Image.ResImage(
- id = R.drawable.sora_card
- )
-
- val showDetailsText: Text
- get() = Text.StringRes(
- id = R.string.show_more
- )
-
- val soraCardText: Text
- get() = Text.StringRes(
- id = R.string.more_menu_sora_card_title
- )
-
- val soraCardBalanceText: Text
- get() = Text.SimpleText(
- text = "$balance"
- )
-
- val soraCardManagementComingSoonText: Text
- get() = Text.StringRes(
- id = R.string.sora_card_details_card_management_coming_soon
- )
-
val menuState: List
get() = soraCardMenuActions.map {
when (it) {
@@ -141,7 +114,6 @@ fun SoraCardMainSoraContentCard(
) {
ContentCard(
cornerRadius = Dimens.x4,
- onClick = remember { { /* DO NOTHING */ } }
) {
Column(
modifier = Modifier
@@ -153,12 +125,7 @@ fun SoraCardMainSoraContentCard(
Box(
modifier = Modifier.wrapContentSize()
) {
- Image(
- modifier = Modifier.fillMaxWidth(),
- painter = soraCardMainSoraContentCardState.soraImage.retrievePainter(),
- contentDescription = "",
- contentScale = ContentScale.FillWidth
- )
+ SoraCardImage(modifier = Modifier.fillMaxWidth().wrapContentHeight())
if (soraCardMainSoraContentCardState.isCardEnabled)
BleachedButton(
modifier = Modifier
@@ -168,7 +135,7 @@ fun SoraCardMainSoraContentCard(
shape = CircleShape,
size = Size.Small,
order = Order.SECONDARY,
- text = soraCardMainSoraContentCardState.showDetailsText.retrieveString(),
+ text = stringResource(id = R.string.show_more),
onClick = onShowMoreClick
)
}
@@ -182,12 +149,12 @@ fun SoraCardMainSoraContentCard(
horizontalArrangement = Arrangement.SpaceBetween
) {
Text(
- text = soraCardMainSoraContentCardState.soraCardText.retrieveString(),
+ text = stringResource(id = R.string.more_menu_sora_card_title),
style = MaterialTheme.customTypography.headline2,
color = MaterialTheme.customColors.fgPrimary
)
Text(
- text = soraCardMainSoraContentCardState.soraCardBalanceText.retrieveString(),
+ text = "%.5f".format(soraCardMainSoraContentCardState.balance),
style = MaterialTheme.customTypography.headline2,
color = MaterialTheme.customColors.fgPrimary
)
@@ -195,7 +162,7 @@ fun SoraCardMainSoraContentCard(
else
Text(
modifier = Modifier.fillMaxWidth(),
- text = soraCardMainSoraContentCardState.soraCardManagementComingSoonText.retrieveString(),
+ text = stringResource(id = R.string.sora_card_details_card_management_coming_soon),
style = MaterialTheme.customTypography.textS,
color = MaterialTheme.customColors.fgSecondary,
textAlign = TextAlign.Center
@@ -208,13 +175,27 @@ fun SoraCardMainSoraContentCard(
}
}
-@Preview
+@Preview(locale = "ru")
@Composable
private fun PreviewMainSoraContentCard() {
SoraCardMainSoraContentCard(
soraCardMainSoraContentCardState = SoraCardMainSoraContentCardState(
balance = 3644.50f,
- isCardEnabled = false,
+ isCardEnabled = true,
+ soraCardMenuActions = SoraCardMenuAction.values().toList()
+ ),
+ onShowMoreClick = {},
+ onIconButtonClick = { _ -> }
+ )
+}
+
+@Preview(locale = "ar")
+@Composable
+private fun PreviewMainSoraContentCard2() {
+ SoraCardMainSoraContentCard(
+ soraCardMainSoraContentCardState = SoraCardMainSoraContentCardState(
+ balance = 3644.50f,
+ isCardEnabled = true,
soraCardMenuActions = SoraCardMenuAction.values().toList()
),
onShowMoreClick = {},
diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt
index f08f3858d..27bafdec0 100644
--- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt
+++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt
@@ -32,7 +32,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package jp.co.soramitsu.feature_wallet_impl.presentation.cardshub
-import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
@@ -45,11 +44,11 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
-import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import jp.co.soramitsu.common.R
+import jp.co.soramitsu.common.presentation.compose.components.SoraCardImage
import jp.co.soramitsu.common.util.ext.testTagAsId
import jp.co.soramitsu.common_wallet.presentation.compose.states.SoraCardState
import jp.co.soramitsu.ui_core.component.button.BleachedButton
@@ -74,11 +73,8 @@ fun SoraCard(
.clickable { onCardStateClicked() }
.fillMaxWidth()
) {
- Image(
+ SoraCardImage(
modifier = Modifier.fillMaxWidth(),
- painter = painterResource(R.drawable.sora_card),
- contentDescription = null,
- contentScale = ContentScale.FillWidth
)
CardStateButton(
@@ -149,8 +145,8 @@ private fun CardStateButton(
}
@Composable
-@Preview
-private fun PreviewSoraCard() {
+@Preview(locale = "en")
+private fun PreviewSoraCard1() {
SoraCard(
modifier = Modifier.fillMaxWidth(),
state = SoraCardState(kycStatus = "", success = true, visible = true),
@@ -158,3 +154,14 @@ private fun PreviewSoraCard() {
onCardStateClicked = {}
)
}
+
+@Composable
+@Preview(locale = "he")
+private fun PreviewSoraCard2() {
+ SoraCard(
+ modifier = Modifier.fillMaxWidth(),
+ state = SoraCardState(kycStatus = "Pending", success = false, visible = true),
+ onCloseClicked = {},
+ onCardStateClicked = {}
+ )
+}