Update Jetpack Compose to 1.1.0-rc01
This commit is contained in:
parent
d893e6a67b
commit
2fa043ef8e
@ -62,7 +62,7 @@ dependencyResolutionManagement {
|
|||||||
listOf("kotlin.stdlib", "kotlinx.coroutines.core", "kotlinx.coroutines.android")
|
listOf("kotlin.stdlib", "kotlinx.coroutines.core", "kotlinx.coroutines.android")
|
||||||
)
|
)
|
||||||
|
|
||||||
version("androidx.compose", "1.1.0-beta04")
|
version("androidx.compose", "1.1.0-rc01")
|
||||||
alias("androidx.compose.runtime")
|
alias("androidx.compose.runtime")
|
||||||
.to("androidx.compose.runtime", "runtime")
|
.to("androidx.compose.runtime", "runtime")
|
||||||
.versionRef("androidx.compose")
|
.versionRef("androidx.compose")
|
||||||
@ -93,9 +93,6 @@ dependencyResolutionManagement {
|
|||||||
alias("androidx.compose.animationgraphics")
|
alias("androidx.compose.animationgraphics")
|
||||||
.to("androidx.compose.animation", "animation-graphics")
|
.to("androidx.compose.animation", "animation-graphics")
|
||||||
.versionRef("androidx.compose")
|
.versionRef("androidx.compose")
|
||||||
alias("androidx.compose.animationgraphics")
|
|
||||||
.to("androidx.compose.animation", "animation-graphics")
|
|
||||||
.versionRef("androidx.compose")
|
|
||||||
alias("androidx.compose.material3")
|
alias("androidx.compose.material3")
|
||||||
.to("androidx.compose.material3", "material3")
|
.to("androidx.compose.material3", "material3")
|
||||||
.version("1.0.0-alpha02")
|
.version("1.0.0-alpha02")
|
||||||
@ -126,7 +123,7 @@ dependencyResolutionManagement {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
version("accompanist", "0.21.0-beta")
|
version("accompanist", "0.21.5-rc")
|
||||||
alias("accompanist.insets")
|
alias("accompanist.insets")
|
||||||
.to("com.google.accompanist", "accompanist-insets")
|
.to("com.google.accompanist", "accompanist-insets")
|
||||||
.versionRef("accompanist")
|
.versionRef("accompanist")
|
||||||
|
|||||||
@ -92,10 +92,10 @@ class ComposeActivity : AppCompatActivity() {
|
|||||||
AnimatedNavHost(
|
AnimatedNavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = "home",
|
startDestination = "home",
|
||||||
exitTransition = { _, _ -> fadeOut(tween(300, 300)) },
|
exitTransition = { fadeOut(tween(300, 300)) },
|
||||||
enterTransition = { _, _ -> fadeIn(tween(200)) },
|
enterTransition = { fadeIn(tween(200)) },
|
||||||
popEnterTransition = { _, _ -> fadeIn(tween(0)) },
|
popEnterTransition = { fadeIn(tween(0)) },
|
||||||
popExitTransition = { _, _ -> fadeOut(tween(200)) },
|
popExitTransition = { fadeOut(tween(200)) },
|
||||||
) {
|
) {
|
||||||
composable("home") {
|
composable("home") {
|
||||||
LauncherMainScreen()
|
LauncherMainScreen()
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package de.mm20.launcher2.ui.component
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.text.BasicText
|
import androidx.compose.foundation.text.BasicText
|
||||||
@ -126,9 +128,9 @@ fun SearchBar(
|
|||||||
},
|
},
|
||||||
modifier = Modifier.size(48.dp)
|
modifier = Modifier.size(48.dp)
|
||||||
) {
|
) {
|
||||||
val menuClearIcon = animatedVectorResource(R.drawable.anim_ic_menu_clear)
|
val menuClearIcon = AnimatedImageVector.animatedVectorResource(R.drawable.anim_ic_menu_clear)
|
||||||
Icon(
|
Icon(
|
||||||
painter = menuClearIcon.painterFor(atEnd = searchQuery.isNotEmpty()),
|
painter = rememberAnimatedVectorPainter(menuClearIcon, atEnd = searchQuery.isNotEmpty()),
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import androidx.compose.animation.ExperimentalAnimationApi
|
|||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
@ -80,7 +82,7 @@ fun WidgetColumn(
|
|||||||
WidgetCard(widget = widget)
|
WidgetCard(widget = widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
val icon = animatedVectorResource(id = R.drawable.anim_ic_edit_add)
|
val icon = AnimatedImageVector.animatedVectorResource(id = R.drawable.anim_ic_edit_add)
|
||||||
ExtendedFloatingActionButton(
|
ExtendedFloatingActionButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
@ -92,7 +94,7 @@ fun WidgetColumn(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
icon = {
|
icon = {
|
||||||
Icon(painter = icon.painterFor(atEnd = editMode), contentDescription = null)
|
Icon(painter = rememberAnimatedVectorPainter(icon, atEnd = editMode), contentDescription = null)
|
||||||
},
|
},
|
||||||
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
|
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import androidx.compose.animation.animateColorAsState
|
|||||||
import androidx.compose.animation.core.*
|
import androidx.compose.animation.core.*
|
||||||
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.DropdownMenu
|
import androidx.compose.material.DropdownMenu
|
||||||
import androidx.compose.material.DropdownMenuItem
|
import androidx.compose.material.DropdownMenuItem
|
||||||
@ -64,7 +66,7 @@ fun AnimatedWeatherIcon(
|
|||||||
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
@OptIn(ExperimentalAnimationGraphicsApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun SunMoon(icon: WeatherIcon, night: Boolean) {
|
private fun SunMoon(icon: WeatherIcon, night: Boolean) {
|
||||||
val sunMoonIcon = animatedVectorResource(R.drawable.anim_weather_sun_moon)
|
val sunMoonIcon = AnimatedImageVector.animatedVectorResource(R.drawable.anim_weather_sun_moon)
|
||||||
val transition = updateTransition(targetState = icon, "AnimatedWeatherIcon")
|
val transition = updateTransition(targetState = icon, "AnimatedWeatherIcon")
|
||||||
|
|
||||||
val color by animateColorAsState(
|
val color by animateColorAsState(
|
||||||
@ -92,7 +94,7 @@ private fun SunMoon(icon: WeatherIcon, night: Boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
sunMoonIcon.painterFor(atEnd = night),
|
rememberAnimatedVectorPainter(sunMoonIcon, atEnd = night),
|
||||||
null,
|
null,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(32.dp)
|
.size(32.dp)
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package de.mm20.launcher2.ui.widget
|
|||||||
|
|
||||||
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
|
import androidx.compose.animation.graphics.res.rememberAnimatedVectorPainter
|
||||||
|
import androidx.compose.animation.graphics.vector.AnimatedImageVector
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
@ -96,10 +98,10 @@ fun MusicWidget() {
|
|||||||
null
|
null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val playPauseIcon = animatedVectorResource(R.drawable.anim_ic_play_pause)
|
val playPauseIcon = AnimatedImageVector.animatedVectorResource(R.drawable.anim_ic_play_pause)
|
||||||
IconButton(onClick = { viewModel.togglePause() }) {
|
IconButton(onClick = { viewModel.togglePause() }) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = playPauseIcon.painterFor(atEnd = playbackState == PlaybackState.Playing),
|
painter = rememberAnimatedVectorPainter(playPauseIcon, atEnd = playbackState == PlaybackState.Playing),
|
||||||
contentDescription = ""
|
contentDescription = ""
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user