Skip to content

Commit

Permalink
rename some fields and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
shpasha committed Nov 8, 2024
1 parent 8c3d541 commit e2c70cd
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 56 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=0.0.5
version=0.0.6
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
agp = "8.7.1"
kotlin = "2.0.21"
appcompat = "1.7.0"
compose = "1.7.5"
compose = "1.7.4"
activity = "1.9.3"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ enum class PagerIndicatorOrientation {
* @param dotColor Color of the inactive dots.
* @param dotCount Number of dots to display.
* @param dotPainter Painter to use for drawing the dots.
* @param dotNormalSize Size of the inactive dots.
* @param dotSelectedSize Size of the active dot.
* @param dotMinSize Size of the dot displayed on the edge
* @param normalDotSize Size of the inactive dots.
* @param activeDotSize Size of the active dot.
* @param minDotSize Size of the dot displayed on the edge
* @param space Space between the dots.
* @param orientation Orientation of the pager.
*/
Expand All @@ -45,9 +45,9 @@ fun PagerIndicator(
dotColor: Color,
dotCount: Int = 5,
dotPainter: Painter = CirclePainter,
dotNormalSize: Dp = 6.dp,
dotSelectedSize: Dp = 8.dp,
dotMinSize: Dp = 4.dp,
normalDotSize: Dp = 6.dp,
activeDotSize: Dp = 8.dp,
minDotSize: Dp = 4.dp,
space: Dp = 8.dp,
orientation: PagerIndicatorOrientation = Horizontal,
) {
Expand All @@ -64,9 +64,9 @@ fun PagerIndicator(
},
dotPainter = dotPainter,
dotCount = dotCount,
dotNormalSize = dotNormalSize,
dotSelectedSize = dotSelectedSize,
dotMinSize = dotMinSize,
normalDotSize = normalDotSize,
activeDotSize = activeDotSize,
minDotSize = minDotSize,
space = space,
activeDotColor = activeDotColor,
dotColor = dotColor,
Expand All @@ -85,9 +85,9 @@ fun PagerIndicator(
* @param dotColor Color of the inactive dots.
* @param dotCount Number of dots to display.
* @param dotPainter Painter to use for drawing the dots.
* @param dotNormalSize Size of the inactive dots.
* @param dotSelectedSize Size of the active dot.
* @param dotMinSize Size of the dot displayed on the edge
* @param normalDotSize Size of the inactive dots.
* @param activeDotSize Size of the active dot.
* @param minDotSize Size of the dot displayed on the edge
* @param space Space between the dots.
* @param orientation Orientation of the pager.
* @param onDotClick Lambda that is called when a dot is clicked.
Expand All @@ -101,9 +101,9 @@ fun PagerIndicator(
modifier: Modifier = Modifier,
dotPainter: Painter = CirclePainter,
dotCount: Int = 5,
dotNormalSize: Dp = 6.dp,
dotSelectedSize: Dp = 8.dp,
dotMinSize: Dp = 4.dp,
normalDotSize: Dp = 6.dp,
activeDotSize: Dp = 8.dp,
minDotSize: Dp = 4.dp,
space: Dp = 8.dp,
orientation: PagerIndicatorOrientation = Horizontal,
onDotClick: (Int) -> Unit = {},
Expand All @@ -122,9 +122,9 @@ fun PagerIndicator(
dotColor = dotColor,
dotPainter = dotPainter,
dotCount = dotCount,
dotNormalSize = dotNormalSize,
dotSelectedSize = dotSelectedSize,
dotMinSize = dotMinSize,
normalDotSize = normalDotSize,
activeDotSize = activeDotSize,
minDotSize = minDotSize,
space = space,
orientation = orientation,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,17 @@ import mx.platacard.pagerindicator.internal.warmLinePosAsState
* @param activeDotColor Color of the active dot.
* @param dotColor Color of the inactive dots.
* @param dotCount Number of dots to display.
* @param dotPainter Painter to use for drawing the dots.
* @param dotNormalSize Size of the inactive dots.
* @param dotSelectedSize Size of the active dot.
* @param dotMinSize Size of the dot displayed on the edge
* @param activeDotSize Size of the active dot.
* @param minDotSize Size of the dot displayed on the edge
* @param space Space between the dots.
* @param orientation Orientation of the pager.
*/
@Composable
fun PagerWormIndicator(
pagerState: PagerState,
modifier: Modifier = Modifier,
dotSelectedSize: Dp = 8.dp,
dotMinSize: Dp = 4.dp,
activeDotSize: Dp = 8.dp,
minDotSize: Dp = 4.dp,
space: Dp = 8.dp,
dotCount: Int = 5,
activeDotColor: Color,
Expand All @@ -59,8 +57,8 @@ fun PagerWormIndicator(
}
},
modifier = modifier,
dotSelectedSize = dotSelectedSize,
dotMinSize = dotMinSize,
activeDotSize = activeDotSize,
minDotSize = minDotSize,
space = space,
dotCount = dotCount,
activeDotColor = activeDotColor,
Expand All @@ -80,9 +78,8 @@ fun PagerWormIndicator(
* @param activeDotColor Color of the active dot.
* @param dotColor Color of the inactive dots.
* @param dotCount Number of dots to display.
* @param dotNormalSize Size of the inactive dots.
* @param dotSelectedSize Size of the active dot.
* @param dotMinSize Size of the dot displayed on the edge
* @param activeDotSize Size of the active dot.
* @param minDotSize Size of the dot displayed on the edge
* @param space Space between the dots.
* @param orientation Orientation of the pager.
* @param onDotClick Callback when a dot is clicked.
Expand All @@ -92,8 +89,8 @@ fun PagerWormIndicator(
pageCount: Int,
currentPageFraction: State<Float>,
modifier: Modifier = Modifier,
dotSelectedSize: Dp = 8.dp,
dotMinSize: Dp = 4.dp,
activeDotSize: Dp = 8.dp,
minDotSize: Dp = 4.dp,
space: Dp = 8.dp,
dotCount: Int = 5,
activeDotColor: Color,
Expand All @@ -105,7 +102,7 @@ fun PagerWormIndicator(
val warmLinePos = warmLinePosAsState(currentPageFraction)

val density = LocalDensity.current
val dotSizePx = with(density) { dotSelectedSize.toPx() }
val dotSizePx = with(density) { activeDotSize.toPx() }
val spacePx = with(density) { space.toPx() }

PagerIndicatorInternal(
Expand All @@ -121,9 +118,9 @@ fun PagerWormIndicator(
activeDotColor = dotColor,
dotColor = dotColor,
dotCount = dotCount,
dotNormalSize = dotSelectedSize,
dotSelectedSize = dotSelectedSize,
dotMinSize = dotMinSize,
normalDotSize = activeDotSize,
activeDotSize = activeDotSize,
minDotSize = minDotSize,
space = space,
orientation = orientation,
onAfterDraw = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ internal fun PagerIndicatorInternal(
dotColor: Color,
dotPainter: Painter = CirclePainter,
dotCount: Int = 5,
dotNormalSize: Dp = 6.dp,
dotSelectedSize: Dp = 8.dp,
dotMinSize: Dp = 4.dp,
normalDotSize: Dp = 6.dp,
activeDotSize: Dp = 8.dp,
minDotSize: Dp = 4.dp,
space: Dp = 8.dp,
orientation: PagerIndicatorOrientation = Horizontal,
onAfterDraw: DrawScope.() -> Unit = {},
Expand All @@ -55,9 +55,9 @@ internal fun PagerIndicatorInternal(

val density = LocalDensity.current

val dotMinSizePx = with(density) { dotMinSize.toPx() }
val dotNormalSizePx = with(density) { dotNormalSize.toPx() }
val dotSizePx = with(density) { dotSelectedSize.toPx() }
val dotMinSizePx = with(density) { minDotSize.toPx() }
val dotNormalSizePx = with(density) { normalDotSize.toPx() }
val dotSizePx = with(density) { activeDotSize.toPx() }

val spacePx = with(density) { space.toPx() }

Expand Down Expand Up @@ -86,12 +86,12 @@ internal fun PagerIndicatorInternal(
}
}

val mainAxisSize = dotSelectedSize * adjustedDotCount + space * (adjustedDotCount - 1)
val mainAxisSize = activeDotSize * adjustedDotCount + space * (adjustedDotCount - 1)

Canvas(
modifier = modifier
.width(if (orientation == Horizontal) mainAxisSize else dotSelectedSize)
.height(if (orientation == Horizontal) dotSelectedSize else mainAxisSize)
.width(if (orientation == Horizontal) mainAxisSize else activeDotSize)
.height(if (orientation == Horizontal) activeDotSize else mainAxisSize)
) {

val centerDot = pageCount / 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ private fun HorizontalPagerSample() {
PagerIndicator(
pagerState = pagerState,
activeDotColor = Color.Blue,
dotNormalSize = 8.dp,
dotSelectedSize = 12.dp,
dotMinSize = 4.dp,
normalDotSize = 8.dp,
activeDotSize = 12.dp,
minDotSize = 4.dp,
dotColor = Color.Gray,
)

Expand All @@ -100,8 +100,8 @@ private fun HorizontalPagerSample() {
derivedStateOf { pagerState.currentPage + pagerState.currentPageOffsetFraction }
},
activeDotColor = Color.Blue,
dotSelectedSize = 12.dp,
dotMinSize = 4.dp,
activeDotSize = 12.dp,
minDotSize = 4.dp,
dotColor = Color.Gray,
)
}
Expand Down Expand Up @@ -148,9 +148,9 @@ private fun VerticalPagerSample() {
PagerIndicator(
pagerState = pagerState,
activeDotColor = Color.Blue,
dotNormalSize = 10.dp,
dotSelectedSize = 14.dp,
dotMinSize = 6.dp,
normalDotSize = 10.dp,
activeDotSize = 14.dp,
minDotSize = 6.dp,
dotColor = Color.Gray,
orientation = PagerIndicatorOrientation.Vertical,
dotPainter = painterResource(R.drawable.ic_16_star),
Expand All @@ -160,8 +160,8 @@ private fun VerticalPagerSample() {
PagerWormIndicator(
pagerState = pagerState,
activeDotColor = Color.Blue,
dotSelectedSize = 12.dp,
dotMinSize = 4.dp,
activeDotSize = 12.dp,
minDotSize = 4.dp,
orientation = PagerIndicatorOrientation.Vertical,
dotColor = Color.Gray,
)
Expand Down

0 comments on commit e2c70cd

Please sign in to comment.