Skip to content

Commit

Permalink
Prepare versions 2.6.0-beta03-A|2.6.0-alpha04-MP
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed Jul 27, 2024
1 parent fb0be24 commit 2899aab
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ object Config {
}

object Version {
val android = "2.5.3"
val multiplatfrom = "2.5.3"
val android = "2.6.0-beta03"
val multiplatfrom = "2.6.0-alpha04"

fun String.isNoPublish() = this == VERSION_NO_PUBLISH
}
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 }
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 }
23 changes: 12 additions & 11 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[versions]
agp = "8.5.1"
kotlin = "2.0.0"
compose = "1.6.8"
composeAndroid = "1.7.0-beta06"
composeMultiplatform = "1.7.0-alpha01"
espresso = "3.6.1"
junit5 = "5.10.3"
kotlinxSerialization = "1.7.1"
Expand Down Expand Up @@ -30,18 +31,18 @@ test-junit4 = { module = "junit:junit", version = "4.13.2" }
test-junit5-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
test-junit5-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }

compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version = "1.2.1" }
compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "composeAndroid" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "composeAndroid" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "composeAndroid" }
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "composeAndroid" }
compose-material3 = { module = "androidx.compose.material3:material3", version = "1.3.0-beta05" }
compose-activity = { module = "androidx.activity:activity-compose", version = "1.9.1" }
compose-navigation = { module = "androidx.navigation:navigation-compose", version = "2.7.7" }
compose-navigation = { module = "androidx.navigation:navigation-compose", version = "2.8.0-beta06" }

compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" }
compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" }
compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "composeAndroid" }
compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "composeAndroid" }

jetbrains-compose-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version = "2.7.0-alpha07" }
jetbrains-compose-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version = "2.8.0-alpha08" }

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
Expand All @@ -56,5 +57,5 @@ bcv = "org.jetbrains.kotlinx.binary-compatibility-validator:0.15.1"

# KMM
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
jetbrainsCompose = { id = "org.jetbrains.compose", version = "1.6.11" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "composeMultiplatform" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.kizitonwose.calendar.sample.compose

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
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.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -149,7 +147,6 @@ fun Example10Page(adjacentYears: Long = 50) {
}
}

@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun YearHeader(
startYear: Year,
Expand All @@ -166,7 +163,7 @@ private fun YearHeader(
.wrapContentHeight()
.background(headerBackground),
state = headerState,
flingBehavior = rememberSnapFlingBehavior(SnapLayoutInfoProvider(headerState, SnapPositionInLayout.CenterToCenter)),
flingBehavior = rememberSnapFlingBehavior(lazyListState = headerState, SnapPosition.Center),
contentPadding = PaddingValues(horizontal = if (isTablet) 40.dp else 10.dp),
) {
items(count = startYear.yearsUntil(endYear).toInt()) { index ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyItemScope
import androidx.compose.foundation.lazy.items
import androidx.compose.material.ripple.RippleAlpha
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalRippleConfiguration
import androidx.compose.material3.RippleConfiguration
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
Expand Down Expand Up @@ -125,7 +128,7 @@ fun Example3Page() {
state = state,
dayContent = { day ->
@OptIn(ExperimentalMaterial3Api::class)
// CompositionLocalProvider(LocalRippleConfiguration provides Example3RippleConfiguration) {
CompositionLocalProvider(LocalRippleConfiguration provides Example3RippleConfiguration) {
val colors = if (day.position == DayPosition.MonthDate) {
flights[day.date].orEmpty().map { colorResource(it.color) }
} else {
Expand All @@ -138,7 +141,7 @@ fun Example3Page() {
) { clicked ->
selection = clicked
}
// }
}
},
monthHeader = {
MonthHeader(
Expand Down Expand Up @@ -319,16 +322,16 @@ private fun AirportInformation(airport: Airport, isDeparture: Boolean) {

// The default dark them ripple is too bright so we tone it down.
@OptIn(ExperimentalMaterial3Api::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,
// ),
//)
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.SegmentedButton
import androidx.compose.material3.SegmentedButtonDefaults
Expand Down Expand Up @@ -177,7 +176,6 @@ private fun FullScreenCalendar(
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun PageOptions(selectedIndex: Int, onSelect: (Int) -> Unit) {
val options = listOf("Horizontal", "Vertical")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.LocalLifecycleOwner
import com.kizitonwose.calendar.compose.CalendarLayoutInfo
import com.kizitonwose.calendar.compose.CalendarState
import com.kizitonwose.calendar.compose.weekcalendar.WeekCalendarState
Expand Down

0 comments on commit 2899aab

Please sign in to comment.