Removes the need to draw a background with the theme's background color on the verification symbol

This commit is contained in:
Vitor Pamplona
2023-07-01 15:33:00 -04:00
parent 1d5dfbfd29
commit 09582fd0b1
17 changed files with 8 additions and 36 deletions
@@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.InlineTextContent import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.material.Icon import androidx.compose.material.Icon
@@ -48,7 +47,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalClipboardManager
@@ -599,15 +597,7 @@ private fun HashVerificationSymbol(verifiedHash: Boolean, modifier: Modifier) {
.height(40.dp) .height(40.dp)
.padding(10.dp) .padding(10.dp)
) { ) {
Box( if (verifiedHash) {
Modifier
.clip(CircleShape)
.fillMaxSize(0.6f)
.align(Alignment.Center)
.background(MaterialTheme.colors.background)
)
if (verifiedHash == true) {
IconButton( IconButton(
onClick = { onClick = {
scope.launch { scope.launch {
@@ -626,7 +616,7 @@ private fun HashVerificationSymbol(verifiedHash: Boolean, modifier: Modifier) {
modifier = Modifier.size(30.dp) modifier = Modifier.size(30.dp)
) )
} }
} else if (verifiedHash == false) { } else {
IconButton( IconButton(
onClick = { onClick = {
scope.launch { scope.launch {
@@ -3240,30 +3240,12 @@ fun FollowingIcon(iconSize: Dp) {
Modifier.size(iconSize) Modifier.size(iconSize)
} }
val backgroundColor = MaterialTheme.colors.background Icon(
painter = painterResource(R.drawable.ic_verified),
val myIconBackgroundModifier = remember { stringResource(id = R.string.following),
Modifier modifier = modifier,
.clip(CircleShape) tint = Following
.size(iconSize.times(0.6f)) )
.drawBehind { drawRect(backgroundColor) }
}
FollowingIcon(modifier, myIconBackgroundModifier)
}
@Composable
fun FollowingIcon(modifier: Modifier, myIconBackgroundModifier: Modifier) {
Box(modifier = modifier, contentAlignment = Alignment.Center) {
Box(myIconBackgroundModifier)
Icon(
painter = painterResource(R.drawable.ic_verified),
stringResource(id = R.string.following),
modifier = modifier,
tint = Following
)
}
} }
@Immutable @Immutable
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB