Skip to content

Commit

Permalink
ANDROID-14792 Fix. Lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
haynlo committed Jan 7, 2025
1 parent 49ce40b commit fc33953
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.telefonica.mistica.catalog.ui.classic.components

import android.annotation.SuppressLint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -21,6 +22,7 @@ class SteppersCatalogFragment : Fragment() {
return layoutInflater.inflate(R.layout.screen_steppers_catalog, container, false)
}

@SuppressLint("SetTextI18n")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand All @@ -42,7 +44,7 @@ class SteppersCatalogFragment : Fragment() {
numberOfSteps.map { it.toString() }
)
)
setText(2.toString())
setText(maxSteps.toString())
setOnItemClickListener { _, _, position, _ ->
maxSteps = numberOfSteps[position]
currentStep = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ fun TabsCatalog() {
text = "Remove last tab",
onClickListener = {
if (tabs.size > 1) {
tabs = tabs.toMutableList().also {
it.removeLast()
tabs = tabs.toMutableList().apply {
removeAt(lastIndex)
}
if (currentIndex >= tabs.size) {
currentIndex = tabs.size - 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -78,7 +79,7 @@ fun CarouselPagerIndicator(
}
})
}
var currentlySelected by remember { mutableStateOf(0) }
var currentlySelected by remember { mutableIntStateOf(0) }
var shouldAnimate by remember { mutableStateOf(true) }

val indicatorUnselectedModifier = remember {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.telefonica.mistica.compose.input

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -30,7 +30,7 @@ fun TextAreaInput(
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
) {
var currentChars by remember {
mutableStateOf(0)
mutableIntStateOf(0)
}

TextInputImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import com.telefonica.mistica.compose.theme.MisticaTheme
import com.telefonica.mistica.compose.theme.brand.MovistarBrand
Expand Down Expand Up @@ -331,9 +332,12 @@ private fun Modifier.misticaTabIndicatorOffset(
targetValue = currentTabPosition.left,
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing)
)

fillMaxWidth()
.wrapContentSize(Alignment.BottomStart)
.offset(x = indicatorOffset)
.offset {
IntOffset(x = indicatorOffset.roundToPx(), y = 0)
}
.width(currentTabWidth)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.telefonica.mistica.compose.theme.values

import androidx.compose.runtime.ProvidableCompositionLocal
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
Expand All @@ -23,8 +24,7 @@ public class MisticaRadius(
sheetBorderRadius: Dp = Dp.Unspecified,
mediaSmallBorderRadius: Dp = Dp.Unspecified,
) {
public var avatarBorderRadius: Int by mutableStateOf(avatarBorderRadius,
structuralEqualityPolicy())
public var avatarBorderRadius: Int by mutableIntStateOf(avatarBorderRadius)
internal set

public var barBorderRadius: Dp by mutableStateOf(barBorderRadius, structuralEqualityPolicy())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.text.style.ForegroundColorSpan
import android.view.LayoutInflater
import android.view.View
import android.view.accessibility.AccessibilityManager
import android.widget.FrameLayout
import androidx.annotation.AttrRes
import androidx.annotation.StringRes
import com.google.android.material.snackbar.BaseTransientBottomBar.BaseCallback
Expand Down Expand Up @@ -141,7 +142,8 @@ open class SnackbarBuilder(view: View?, text: String) {
// Since we are inflating a custom layout, we pass a dummy text and apply
// the expected one later on to our custom TextView
val snackbar = Snackbar.make(view, "", duration)
val snackbarLayout = snackbar.view as Snackbar.SnackbarLayout

val snackbarLayout = snackbar.view as FrameLayout

snackbarLayout.removeAllViews()
val customLayout = LayoutInflater.from(snackbarLayout.context).inflate(R.layout.snackbar_layout, snackbarLayout, false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.telefonica.mistica.stepper

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
Expand Down Expand Up @@ -84,6 +85,7 @@ internal class StepView @JvmOverloads constructor(
}
}

@SuppressLint("SetTextI18n")
fun setStep(step: Int, isSelected: Boolean = false) {
selectedStepTextView.text = step.toString()
unselectedStepTextView.text = step.toString()
Expand Down

0 comments on commit fc33953

Please sign in to comment.