Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up invalid uses of Image #6452

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.mullvad.mullvadvpn.compose.cell

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -91,10 +91,11 @@ internal fun NavigationTitleView(
showWarning: Boolean = false
) {
if (showWarning) {
Image(
Icon(
painter = painterResource(id = R.drawable.icon_alert),
modifier = Modifier.padding(end = Dimens.smallPadding),
contentDescription = null
contentDescription = null,
tint = MaterialTheme.colorScheme.error
)
}
Text(
Expand All @@ -109,17 +110,19 @@ internal fun NavigationTitleView(

@Composable
internal fun DefaultNavigationView(chevronContentDescription: String) {
Image(
Icon(
painter = painterResource(id = R.drawable.icon_chevron),
contentDescription = chevronContentDescription
contentDescription = chevronContentDescription,
tint = Color.Unspecified
)
}

@Composable
internal fun DefaultExternalLinkView(chevronContentDescription: String) {
Image(
Icon(
painter = painterResource(id = R.drawable.icon_extlink),
contentDescription = chevronContentDescription
contentDescription = chevronContentDescription,
tint = Color.Unspecified
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.mullvad.mullvadvpn.compose.cell

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
Expand All @@ -19,6 +18,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.VerticalDivider
Expand Down Expand Up @@ -106,7 +106,7 @@ fun StatusRelayLocationCell(
shape = CircleShape
)
)
Image(
Icon(
painter = painterResource(id = R.drawable.icon_tick),
modifier =
Modifier.align(Alignment.CenterStart)
Expand All @@ -117,6 +117,7 @@ fun StatusRelayLocationCell(
AlphaInvisible
}
),
tint = Color.Unspecified,
contentDescription = null
)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package net.mullvad.mullvadvpn.compose.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.FilterChip
import androidx.compose.material3.FilterChipDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -55,9 +55,10 @@ fun MullvadFilterChip(text: String, onRemoveClick: () -> Unit) {
style = MaterialTheme.typography.labelMedium
)
Spacer(modifier = Modifier.size(ButtonDefaults.IconSpacing))
Image(
Icon(
painter = painterResource(id = R.drawable.icon_close),
contentDescription = null,
tint = Color.Unspecified,
modifier = Modifier.size(Dimens.smallIconSize).clickable { onRemoveClick() }
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.mullvad.mullvadvpn.compose.screen

import android.content.Context
import android.net.Uri
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -16,6 +15,7 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.ClickableText
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -182,14 +182,15 @@ private fun Content(onPrivacyPolicyLinkClicked: () -> Unit) {
)
)

Image(
Icon(
painter = painterResource(id = R.drawable.icon_extlink),
contentDescription = null,
modifier =
Modifier.align(Alignment.CenterVertically)
.padding(start = 2.dp, top = 2.dp)
.width(10.dp)
.height(10.dp)
.height(10.dp),
tint = Color.Unspecified
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package net.mullvad.mullvadvpn.compose.textfield

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -70,10 +70,11 @@ private fun ErrorSupportingText(text: String) {
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(top = Dimens.miniPadding)
) {
Image(
Icon(
painter = painterResource(id = R.drawable.icon_alert),
contentDescription = null,
modifier = Modifier.size(Dimens.smallIconSize)
modifier = Modifier.size(Dimens.smallIconSize),
tint = MaterialTheme.colorScheme.error
)
Text(
text = text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.mullvad.mullvadvpn.compose.textfield

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
Expand All @@ -9,6 +8,7 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
Expand All @@ -20,7 +20,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -78,29 +77,30 @@ fun SearchTextField(
interactionSource = interactionSource,
visualTransformation = visualTransformation,
leadingIcon = {
Image(
Icon(
painter = painterResource(id = R.drawable.icons_search),
contentDescription = null,
modifier =
Modifier.size(
width = Dimens.searchIconSize,
height = Dimens.searchIconSize,
),
colorFilter = ColorFilter.tint(color = textColor),
tint = textColor,
)
},
placeholder = {
Text(text = placeHolder, style = MaterialTheme.typography.labelLarge)
},
trailingIcon = {
if (searchTerm.isNotEmpty()) {
Image(
Icon(
modifier =
Modifier.size(Dimens.smallIconSize).clickable {
searchTerm = ""
onValueChange.invoke(searchTerm)
},
painter = painterResource(id = R.drawable.icon_close),
tint = Color.Unspecified,
contentDescription = null,
)
}
Expand Down
Loading