Skip to content

Commit

Permalink
Removes the need to draw a background with the theme's background col…
Browse files Browse the repository at this point in the history
…or on the verification symbol
  • Loading branch information
vitorpamplona committed Jul 1, 2023
1 parent 1d5dfbf commit 09582fd
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.material.Icon
Expand All @@ -48,7 +47,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalClipboardManager
Expand Down Expand Up @@ -599,15 +597,7 @@ private fun HashVerificationSymbol(verifiedHash: Boolean, modifier: Modifier) {
.height(40.dp)
.padding(10.dp)
) {
Box(
Modifier
.clip(CircleShape)
.fillMaxSize(0.6f)
.align(Alignment.Center)
.background(MaterialTheme.colors.background)
)

if (verifiedHash == true) {
if (verifiedHash) {
IconButton(
onClick = {
scope.launch {
Expand All @@ -626,7 +616,7 @@ private fun HashVerificationSymbol(verifiedHash: Boolean, modifier: Modifier) {
modifier = Modifier.size(30.dp)
)
}
} else if (verifiedHash == false) {
} else {
IconButton(
onClick = {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3240,30 +3240,12 @@ fun FollowingIcon(iconSize: Dp) {
Modifier.size(iconSize)
}

val backgroundColor = MaterialTheme.colors.background

val myIconBackgroundModifier = remember {
Modifier
.clip(CircleShape)
.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
)
}
Icon(
painter = painterResource(R.drawable.ic_verified),
stringResource(id = R.string.following),
modifier = modifier,
tint = Following
)
}

@Immutable
Expand Down
Binary file modified app/src/main/res/drawable-hdpi/ic_verified.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_verified.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_verified.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_verified.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxxhdpi/ic_verified.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 09582fd

Please sign in to comment.