Skip to content

Commit

Permalink
Fragment test cases removed and linting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Saifuddin53 committed Jan 1, 2025
1 parent f5fc31e commit ac86a22
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 198 deletions.
69 changes: 0 additions & 69 deletions app/src/androidTest/kotlin/be/scri/fragments/MainFragmentTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package be.scri.ui.common.bottombar
import androidx.annotation.DrawableRes
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand Down Expand Up @@ -76,7 +75,7 @@ fun BottomBarItem(
style =
MaterialTheme.typography.labelMedium.copy(
fontSize = textSize,
fontWeight = if(isSelected) FontWeight.ExtraBold else FontWeight.W600,
fontWeight = if (isSelected) FontWeight.ExtraBold else FontWeight.W600,
letterSpacing = (0).sp,
),
)
Expand Down
81 changes: 40 additions & 41 deletions app/src/main/java/be/scri/ui/common/components/DarkModeSwitch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import be.scri.ui.theme.BorderColor
import be.scri.ui.theme.NightSky
import kotlinx.coroutines.launch


@Suppress("MagicNumber")
@Composable
fun DarkModeSwitch(
Expand All @@ -66,19 +65,19 @@ fun DarkModeSwitch(
Box(
contentAlignment = Alignment.CenterStart,
modifier =
modifier
.width(switchWidth)
.height(switchHeight)
.clip(RoundedCornerShape(switchHeight))
.background(lerp(BlueSky, NightSky, offset.value))
.border(3.dp, BorderColor, RoundedCornerShape(switchHeight))
.toggleable(
value = checked,
onValueChange = onCheckChange,
role = Role.Switch,
interactionSource = remember { MutableInteractionSource() },
indication = null,
),
modifier
.width(switchWidth)
.height(switchHeight)
.clip(RoundedCornerShape(switchHeight))
.background(lerp(BlueSky, NightSky, offset.value))
.border(3.dp, BorderColor, RoundedCornerShape(switchHeight))
.toggleable(
value = checked,
onValueChange = onCheckChange,
role = Role.Switch,
interactionSource = remember { MutableInteractionSource() },
indication = null,
),
) {
val backgroundPainter = painterResource(R.drawable.background)
Canvas(modifier = Modifier.fillMaxSize()) {
Expand All @@ -95,41 +94,41 @@ fun DarkModeSwitch(
contentDescription = null,
contentScale = ContentScale.Crop,
modifier =
Modifier
.size(switchWidth)
.graphicsLayer {
scaleX = 1.2f
scaleY = scaleX
translationX =
lerp(
-size.width * 0.5f + handlePadding.toPx() + handleSize.toPx() * 0.5f,
switchWidth.toPx() -
size.width * 0.5f -
handlePadding.toPx() -
handleSize.toPx() *
0.5f,
offset.value,
)
},
Modifier
.size(switchWidth)
.graphicsLayer {
scaleX = 1.2f
scaleY = scaleX
translationX =
lerp(
-size.width * 0.5f + handlePadding.toPx() + handleSize.toPx() * 0.5f,
switchWidth.toPx() -
size.width * 0.5f -
handlePadding.toPx() -
handleSize.toPx() *
0.5f,
offset.value,
)
},
)
Box(
modifier =
Modifier
.padding(horizontal = handlePadding)
.size(handleSize)
.offset(x = (switchWidth - handleSize - handlePadding * 2f) * offset.value)
.paint(painterResource(R.drawable.sun))
.clip(CircleShape),
Modifier
.padding(horizontal = handlePadding)
.size(handleSize)
.offset(x = (switchWidth - handleSize - handlePadding * 2f) * offset.value)
.paint(painterResource(R.drawable.sun))
.clip(CircleShape),
) {
Image(
painter = painterResource(R.drawable.moon),
contentDescription = null,
modifier =
Modifier
.size(handleSize)
.graphicsLayer {
translationX = size.width * (1f - offset.value)
},
Modifier
.size(handleSize)
.graphicsLayer {
translationX = size.width * (1f - offset.value)
},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,32 @@ fun SwitchableItemComp(
checked = isChecked,
onCheckedChange = onCheckedChange,
modifier =
Modifier
.width(51.dp)
.height(31.dp),
Modifier
.width(51.dp)
.height(31.dp),
thumbContent = {
Box(
modifier =
Modifier
.size(27.dp)
.background(
if (isChecked) {
checkedThumbColor
} else {
uncheckedThumbColor
},
shape = CircleShape,
),
Modifier
.size(27.dp)
.background(
if (isChecked) {
checkedThumbColor
} else {
uncheckedThumbColor
},
shape = CircleShape,
),
)
},
colors =
SwitchDefaults.colors(
checkedThumbColor = checkedThumbColor,
uncheckedThumbColor = uncheckedThumbColor,
checkedTrackColor = checkedTrackColor,
uncheckedTrackColor = uncheckedTrackColor,
uncheckedBorderColor = Color.Transparent,
),
SwitchDefaults.colors(
checkedThumbColor = checkedThumbColor,
uncheckedThumbColor = uncheckedThumbColor,
checkedTrackColor = checkedTrackColor,
uncheckedTrackColor = uncheckedTrackColor,
uncheckedBorderColor = Color.Transparent,
),
)
}
}
Expand Down
17 changes: 7 additions & 10 deletions app/src/main/java/be/scri/ui/screens/InstallationScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ fun InstallationScreen(
start = 4.dp,
top = Dimensions.PaddingLarge,
bottom = Dimensions.PaddingSmall,
)
.align(Alignment.Start)
,
).align(Alignment.Start),
)

Card(
Expand Down Expand Up @@ -241,13 +239,12 @@ fun InstallationScreen(
fontWeight = FontWeight.Bold,
fontSize = Dimensions.TextSizeLarge,
modifier =
Modifier.padding(
start = 4.dp,
top = Dimensions.PaddingLarge,
bottom = Dimensions.PaddingSmall,
)
.align(Alignment.Start)
,
Modifier
.padding(
start = 4.dp,
top = Dimensions.PaddingLarge,
bottom = Dimensions.PaddingSmall,
).align(Alignment.Start),
)
Card(
modifier =
Expand Down
56 changes: 0 additions & 56 deletions app/src/test/kotlin/fragments/MainFragmentTest.kt

This file was deleted.

0 comments on commit ac86a22

Please sign in to comment.