Skip to content

Commit

Permalink
Add shimmer color to palette, remove ui_theme dependency from shimmer…
Browse files Browse the repository at this point in the history
… module
  • Loading branch information
tonykolomeytsev committed Oct 2, 2023
1 parent 6d4d8f3 commit 8494a21
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions detekt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ complexity:
LongMethod:
active: true
threshold: 60
ignoreAnnotated: ['Composable']
excludes:
- '**/*Reducer.kt'
- '**/*ListConverter.kt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private fun ShimmersScreen() {

@Composable
private fun ShimmerItem() {
val color = MpeixTheme.palette.surfacePlus3
val color = MpeixTheme.palette.shimmer
val radius = 4.dp
Row(
Modifier
Expand Down
4 changes: 0 additions & 4 deletions modules/ui/shimmer/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
plugins {
id("mpeix.android.ui")
}

dependencies {
implementation(project(":ui_theme"))
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kekmech.ru.ui_shimmer


import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
Expand Down Expand Up @@ -74,6 +73,7 @@ internal class ShimmerArea(
translationDistance = distanceCornerToRotatedCenterLine * 2 + shimmerWidthPx
}

@Suppress("MagicNumber")
private fun Float.toRadian(): Float = this / 180 * Math.PI.toFloat()

override fun equals(other: Any?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kekmech.ru.ui_shimmer


import android.graphics.Matrix
import androidx.compose.animation.core.Animatable
import androidx.compose.runtime.Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package kekmech.ru.ui_shimmer


import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ internal object ShimmerTokens {
val Width: Dp = 400.dp
val AnimationSpec: AnimationSpec<Float> = infiniteRepeatable(
animation = tween(
durationMillis = 500,
durationMillis = 700,
easing = LinearEasing,
delayMillis = 500,
),
repeatMode = RepeatMode.Restart,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ object MpeixColors {
val Neutral95 = Color(0xFFF0F2F5)
val Neutral93 = Color(0xFFE3E7ED)
val Neutral90 = Color(0xFFE0E4EB)
val Neutral85 = Color(0xFFD1D7E0)
val Neutral80 = Color(0xFFC2CAD6)
val Neutral70 = Color(0xFFA3AFC2)
val Neutral60 = Color(0xFF8494AE)
Expand All @@ -63,6 +64,7 @@ class MpeixPalette internal constructor(
val surfacePlus1: Color,
val surfacePlus2: Color,
val surfacePlus3: Color,
val shimmer: Color,
val primaryContainer: Color,
val secondaryContainer: Color,
val content: Color,
Expand All @@ -84,6 +86,7 @@ val LightMpeixPalette = MpeixPalette(
surfacePlus1 = MpeixColors.Neutral98,
surfacePlus2 = MpeixColors.Neutral95,
surfacePlus3 = MpeixColors.Neutral93,
shimmer = MpeixColors.Neutral85,
primaryContainer = MpeixColors.Primary90,
secondaryContainer = MpeixColors.Secondary90,
content = MpeixColors.Neutral20,
Expand All @@ -102,6 +105,7 @@ val DarkMpeixPalette = MpeixPalette(
surfacePlus1 = MpeixColors.Neutral25,
surfacePlus2 = MpeixColors.Neutral30,
surfacePlus3 = MpeixColors.Neutral35,
shimmer = MpeixColors.Neutral25,
primaryContainer = MpeixColors.Primary50,
secondaryContainer = MpeixColors.Secondary30,
content = MpeixColors.Neutral90,
Expand Down Expand Up @@ -164,6 +168,7 @@ private fun PalettePreview(
colorItem("Surface + 1", palette.surfacePlus1, palette.content)
colorItem("Surface + 2", palette.surfacePlus2, palette.content)
colorItem("Surface + 3", palette.surfacePlus3, palette.content)
colorItem("Shimmer", palette.surfacePlus3, palette.content)
}
Row(Modifier.padding(bottom = 12.dp)) {
colorItem("Primary", palette.primary, palette.contentAccent)
Expand Down

0 comments on commit 8494a21

Please sign in to comment.