Skip to content

Commit

Permalink
Merge pull request #1120 from google/ben/upgrade
Browse files Browse the repository at this point in the history
Compose 1.2.0-alpha07
  • Loading branch information
bentrengrove authored Apr 6, 2022
2 parents 5e8fb86 + a50ed69 commit 3ce4f04
Show file tree
Hide file tree
Showing 22 changed files with 55 additions and 43 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000

GROUP=com.google.accompanist
# !! No longer need to update this manually when using a Compose SNAPSHOT
VERSION_NAME=0.24.6-SNAPSHOT
VERSION_NAME=0.24.6-alpha

POM_DESCRIPTION=Utilities for Jetpack Compose

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
compose = "1.2.0-alpha06"
compose = "1.2.0-alpha07"
composesnapshot = "-" # a single character = no snapshot

# gradlePlugin and lint need to be updated together
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package com.google.accompanist.sample.flowlayout
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.google.accompanist.flowlayout.FlowColumn
import com.google.accompanist.sample.AccompanistSampleTheme
Expand All @@ -38,8 +40,8 @@ class FlowColumnSample : ComponentActivity() {
title = { Text(text = stringResource(R.string.flowlayout_title_column)) }
)
}
) {
FlowColumn {
) { padding ->
FlowColumn(Modifier.padding(padding)) {
SampleContent()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ package com.google.accompanist.sample.flowlayout
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.google.accompanist.flowlayout.FlowRow
import com.google.accompanist.sample.AccompanistSampleTheme
Expand All @@ -38,8 +40,8 @@ class FlowRowSample : ComponentActivity() {
title = { Text(text = stringResource(R.string.flowlayout_title_row)) }
)
}
) {
FlowRow {
) { padding ->
FlowRow(Modifier.padding(padding)) {
SampleContent()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.MaterialTheme
Expand Down Expand Up @@ -76,8 +77,8 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
Column(Modifier.fillMaxSize()) {
) { padding ->
Column(Modifier.fillMaxSize().padding(padding)) {
val pagerState = rememberPagerState()

// Display 10 items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.accompanist.sample.pager

import android.annotation.SuppressLint
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand Down Expand Up @@ -61,7 +62,7 @@ class HorizontalPagerDifferentPaddingsSample : ComponentActivity() {
}
}

@OptIn(ExperimentalPagerApi::class)
@SuppressLint("UnusedMaterialScaffoldPaddingParameter") // Sample deals with paddings itself
@Composable
private fun Sample() {
Scaffold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
Expand Down Expand Up @@ -65,8 +66,8 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
Column(Modifier.fillMaxSize()) {
) { padding ->
Column(Modifier.fillMaxSize().padding(padding)) {
// Display 10 items
val pageCount = 10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.foundation.layout.aspectRatio
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.foundation.rememberScrollState
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand Down Expand Up @@ -69,8 +70,8 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
Column(Modifier.fillMaxSize()) {
) { padding ->
Column(Modifier.fillMaxSize().padding(padding)) {
val pagerState = rememberPagerState()

// Display 10 items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Card
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand Down Expand Up @@ -73,12 +74,12 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
val pages = remember {
listOf("Home", "Shows", "Movies", "Books", "Really long movies", "Short audiobooks")
}

Column(Modifier.fillMaxSize()) {
Column(Modifier.fillMaxSize().padding(padding)) {
val coroutineScope = rememberCoroutineScope()

// Remember a PagerState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
HorizontalPagerWithOffsetTransition()
) { padding ->
HorizontalPagerWithOffsetTransition(Modifier.padding(padding))
}
}

@OptIn(ExperimentalPagerApi::class, ExperimentalCoilApi::class)
@Composable
fun HorizontalPagerWithOffsetTransition() {
fun HorizontalPagerWithOffsetTransition(modifier: Modifier = Modifier) {
HorizontalPager(
count = 10,
// Add 32.dp horizontal padding to 'center' the pages
contentPadding = PaddingValues(horizontal = 32.dp),
modifier = Modifier.fillMaxSize()
modifier = modifier.fillMaxSize()
) { page ->
Card(
Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
Column(Modifier.fillMaxSize()) {
) { padding ->
Column(Modifier.fillMaxSize().padding(padding)) {
val pagerState = rememberPagerState()

// Display 10 items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
Expand Down Expand Up @@ -61,10 +62,10 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
VerticalPager(
count = 10,
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize().padding(padding),
) {
HorizontalPager(
count = 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
import androidx.compose.material.Surface
Expand Down Expand Up @@ -64,8 +65,8 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
Column(Modifier.fillMaxSize()) {
) { padding ->
Column(Modifier.fillMaxSize().padding(padding)) {
val pagerState = rememberPagerState()

// Display 10 items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
Column(Modifier.fillMaxSize()) {
val pagerState = rememberPagerState()

Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.weight(1f),
modifier = Modifier.weight(1f).padding(padding),
) {
// Display 10 items
VerticalPager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Scaffold
Expand Down Expand Up @@ -69,7 +70,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -84,7 +85,7 @@ private fun Sample() {
state = rememberSwipeRefreshState(isRefreshing = refreshing),
onRefresh = { refreshing = true },
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
if (refreshing.not()) {
item {
ListItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -86,7 +86,7 @@ private fun Sample() {
state = rememberSwipeRefreshState(isRefreshing = refreshing),
onRefresh = { refreshing = true },
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
if (refreshing.not()) {
item {
ListItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -86,7 +86,7 @@ private fun Sample() {
state = rememberSwipeRefreshState(isRefreshing = refreshing),
onRefresh = { refreshing = true },
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
if (refreshing.not()) {
item {
ListItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -88,7 +88,7 @@ private fun Sample() {
state = rememberSwipeRefreshState(isRefreshing = refreshing),
onRefresh = { refreshing = true },
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
items(30) { index ->
Row(Modifier.padding(16.dp)) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -102,7 +102,7 @@ private fun Sample() {
)
},
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
items(30) {
Row(Modifier.padding(16.dp)) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -101,7 +101,7 @@ private fun Sample() {
)
},
) {
LazyColumn {
LazyColumn(contentPadding = padding) {
items(30) { index ->
Row(Modifier.padding(16.dp)) {
Image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
// Simulate a fake 2-second 'load'. Ideally this 'refreshing' value would
// come from a ViewModel or similar
var refreshing by remember { mutableStateOf(false) }
Expand All @@ -97,7 +97,7 @@ private fun Sample() {
VerticalPager(
count = 10,
itemSpacing = 8.dp,
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize().padding(padding),
) { page ->
Box {
// Our page content, displaying a random image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ private fun Sample() {
)
},
modifier = Modifier.fillMaxSize()
) {
) { padding ->
Column(
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxSize().padding(padding),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Expand Down

0 comments on commit 3ce4f04

Please sign in to comment.