Skip to content

Commit

Permalink
Prepare version 2.6.0-beta01
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed May 26, 2024
1 parent 8de97d6 commit 5ae9acb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object Libs {
}

object Compose {
private const val composeVersion = "1.6.1"
private const val composeVersion = "1.7.0-beta01"
const val ui = "androidx.compose.ui:ui:$composeVersion"
const val foundation = "androidx.compose.foundation:foundation:$composeVersion"
const val tooling = "androidx.compose.ui:ui-tooling:$composeVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.gestures.FlingBehavior
import androidx.compose.foundation.gestures.ScrollableDefaults
import androidx.compose.foundation.gestures.snapping.SnapLayoutInfoProvider
import androidx.compose.foundation.gestures.snapping.SnapPositionInLayout
import androidx.compose.foundation.gestures.snapping.SnapPosition
import androidx.compose.foundation.gestures.snapping.rememberSnapFlingBehavior
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
Expand All @@ -22,7 +22,7 @@ internal object CalendarDefaults {
@Composable
private fun pagedFlingBehavior(state: LazyListState): FlingBehavior {
val snappingLayout = remember(state) {
val provider = SnapLayoutInfoProvider(state, CalendarSnapPositionInLayout())
val provider = SnapLayoutInfoProvider(state, SnapPosition.Start)
CalendarSnapLayoutInfoProvider(provider)
}
return rememberSnapFlingBehavior(snappingLayout)
Expand All @@ -46,9 +46,5 @@ private fun CalendarSnapLayoutInfoProvider(
* In compose 1.3, the default was single page snapping (zero), but this changed
* in compose 1.4 to decayed page snapping which is not great for calendar usage.
*/
override fun calculateApproachOffset(initialVelocity: Float): Float = 0f
override fun calculateApproachOffset(velocity: Float, decayOffset: Float): Float = 0f
}

@OptIn(ExperimentalFoundationApi::class)
@Suppress("FunctionName")
private fun CalendarSnapPositionInLayout() = SnapPositionInLayout { _, _, _, _, _ -> 0 }
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true

GROUP=com.kizitonwose.calendar
VERSION_NAME=2.5.2-SNAPSHOT

VERSION_NAME=2.6.0-beta01
POM_NAME=Calendar

POM_INCEPTION_YEAR=2019
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.lazy.items
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.LocalContentColor
import androidx.compose.material.LocalRippleConfiguration
import androidx.compose.material.RippleConfiguration
import androidx.compose.material.Text
import androidx.compose.material.darkColors
import androidx.compose.material.ripple.LocalRippleTheme
import androidx.compose.material.ripple.RippleTheme
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -126,7 +128,8 @@ fun Example3Page() {
modifier = Modifier.wrapContentWidth(),
state = state,
dayContent = { day ->
CompositionLocalProvider(LocalRippleTheme provides Example3RippleTheme) {
@OptIn(ExperimentalMaterialApi::class)
CompositionLocalProvider(LocalRippleConfiguration provides Example3RippleConfiguration) {
val colors = if (day.position == DayPosition.MonthDate) {
flights[day.date].orEmpty().map { colorResource(it.color) }
} else {
Expand Down Expand Up @@ -319,13 +322,17 @@ private fun AirportInformation(airport: Airport, isDeparture: Boolean) {
}

// The default dark them ripple is too bright so we tone it down.
private object Example3RippleTheme : RippleTheme {
@Composable
override fun defaultColor() = RippleTheme.defaultRippleColor(Color.Gray, lightTheme = false)

@Composable
override fun rippleAlpha() = RippleTheme.defaultRippleAlpha(Color.Gray, lightTheme = false)
}
@OptIn(ExperimentalMaterialApi::class)
private val Example3RippleConfiguration = RippleConfiguration(
color = Color.Gray,
// Copied from RippleTheme#DarkThemeRippleAlpha
rippleAlpha = RippleAlpha(
pressedAlpha = 0.10f,
focusedAlpha = 0.12f,
draggedAlpha = 0.08f,
hoveredAlpha = 0.04f,
),
)

@Preview(heightDp = 600)
@Composable
Expand Down

0 comments on commit 5ae9acb

Please sign in to comment.