Skip to content

Commit

Permalink
Merge pull request #4 from yumemi-inc/feature/sync_v0.34.0
Browse files Browse the repository at this point in the history
v0.34.0 を同期
  • Loading branch information
warahiko committed Apr 23, 2024
2 parents 7c6e277 + c9de674 commit 4cde6d7
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 46 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
> [!Note]
> 本レポジトリは fork 元である [google/accompanist](https://github.com/google/accompanist) において非推奨となる API を保持することを目的としています。
> 動作、問題の解決やメンテナンスなどは一切保証しません。
> バージョンは [v0.33.2-alpha](https://github.com/google/accompanist/releases/tag/v0.33.2-alpha) を用いています。
> バージョンは [v0.34.0](https://github.com/google/accompanist/releases/tag/v0.34.0) を用いています。
![Accompanist logo](docs/header.png)

Expand Down
44 changes: 23 additions & 21 deletions docs/flowlayout.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,13 @@

[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-flowlayout)](https://search.maven.org/search?q=g:com.google.accompanist)

Flow Layouts in Accompanist is now deprecated. Please see the migration guide below to begin using
Flow Layouts in Androidx.

The official `androidx.compose.foundation` FlowLayouts support is very similar to accompanist/flowlayouts, with a few changes.

It is most similar to `Row` and `Column` and shares similar modifiers and the scopes.
Unlike the standard `Row` and `Column` composables, if it runs out of space on the current row,
the children are placed in the next line, and this repeats until the children are fully placed.

## Usage

``` kotlin
FlowRow {
// row contents
}

FlowColumn {
// column contents
}
```
!!! warning
**This library is deprecated, with official FlowLayout support in androidx.compose.foundation.** The migration guide and original documentation is below.

## Migration Guide to the official FlowLayouts

The official `androidx.compose.foundation` FlowLayouts support is very similar to accompanist/flowlayouts, with a few changes.

1. Replace import packages to point to Androidx.Compose
``` kotlin
import androidx.compose.foundation.layout.FlowColumn
Expand Down Expand Up @@ -126,6 +110,24 @@ FlowRow(maxItemsInEachRow = 3) {
For examples, refer to the [Flow Row samples](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowRowSample.kt)
and the [Flow Column samples](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/compose/foundation/foundation-layout/samples/src/main/java/androidx/compose/foundation/layout/samples/FlowColumnSample.kt).
## Original Docs
It is most similar to `Row` and `Column` and shares similar modifiers and the scopes.
Unlike the standard `Row` and `Column` composables, if it runs out of space on the current row,
the children are placed in the next line, and this repeats until the children are fully placed.
## Usage
``` kotlin
FlowRow {
// row contents
}
FlowColumn {
// column contents
}
```
## Download
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-flowlayout)](https://search.maven.org/search?q=g:com.google.accompanist)
Expand All @@ -136,7 +138,7 @@ repositories {
}
dependencies {
implementation "androidx.compose.foundation:foundation:<compose-version>"
implementation "com.google.accompanist:accompanist-flowlayout:<version>"
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/placeholder.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-placeholder)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.

A library which provides a [modifier][modifier] for display 'placeholder' UI while content is loading.

Expand Down
2 changes: 1 addition & 1 deletion docs/systemuicontroller.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-systemuicontroller)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.

## Migration
Recommendation: If you were using SystemUIController to go edge-to-edge in your activity and change the system bar colors and system bar icon colors, use the new [Activity.enableEdgeToEdge](https://developer.android.com/reference/androidx/activity/ComponentActivity#(androidx.activity.ComponentActivity).enableEdgeToEdge(androidx.activity.SystemBarStyle,androidx.activity.SystemBarStyle)) method available in androidx.activity 1.8.0-alpha03 and later. This method backports the scrims used on some versions of Android. [This](https://github.com/android/nowinandroid/pull/817) is a sample PR of the migration to the new method and removing the dependency on SystemUIController in Now in Android.
Expand Down
4 changes: 2 additions & 2 deletions docs/themeadapter-appcompat.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-themeadapter-appcompat)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.

## Migration
Recommendation: Use the [Material Theme Builder](https://m3.material.io/theme-builder) tool, or an alternative design tool, to generate a matching XML and Compose theme implementation for your app. See [Migrating XML themes to Compose](https://developer.android.com/jetpack/compose/designsystems/views-to-compose) to learn more.
Expand Down Expand Up @@ -186,4 +186,4 @@ limitations under the License.
[materialtheme]: https://developer.android.com/reference/kotlin/androidx/compose/material/MaterialTheme
[colors]: https://developer.android.com/reference/kotlin/androidx/compose/material/Colors
[typography]: https://developer.android.com/reference/kotlin/androidx/compose/material/Typography
[shapes]: https://developer.android.com/reference/kotlin/androidx/compose/material/Shapes
[shapes]: https://developer.android.com/reference/kotlin/androidx/compose/material/Shapes
4 changes: 2 additions & 2 deletions docs/themeadapter-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-themeadapter-core)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.

## Migration
Recommendation: Use the [Material Theme Builder](https://m3.material.io/theme-builder) tool, or an alternative design tool, to generate a matching XML and Compose theme implementation for your app. See [Migrating XML themes to Compose](https://developer.android.com/jetpack/compose/designsystems/views-to-compose) to learn more.
Expand Down Expand Up @@ -62,4 +62,4 @@ limitations under the License.
```

[compose]: https://developer.android.com/jetpack/compose
[api]: ../api/themeadapter-core
[api]: ../api/themeadapter-core
8 changes: 4 additions & 4 deletions docs/themeadapter-material.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-themeadapter-material)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained.** The original documentation is below.

## Migration
Recommendation: Use the [Material Theme Builder](https://m3.material.io/theme-builder) tool, or an alternative design tool, to generate a matching XML and Compose theme implementation for your app. See [Migrating XML themes to Compose](https://developer.android.com/jetpack/compose/designsystems/views-to-compose) to learn more.
Expand Down Expand Up @@ -58,9 +58,9 @@ MdcTheme {
This is especially handy when you're migrating an existing app, a `Fragment` (or other UI container) at a time.

!!! caution
If you are using an AppCompat (i.e. non-MDC) theme in your app, you should use
[AppCompat Theme Adapter](https://github.com/google/accompanist/tree/main/themeadapter-appcompat)
instead, as it attempts to bridge the gap between [AppCompat][appcompat] XML themes, and M2 themes in [Jetpack Compose][compose].
If you are using an AppCompat (i.e. non-MDC) theme in your app, you should use
[AppCompat Theme Adapter](https://github.com/google/accompanist/tree/main/themeadapter-appcompat)
instead, as it attempts to bridge the gap between [AppCompat][appcompat] XML themes, and M2 themes in [Jetpack Compose][compose].

### Customizing the M2 theme

Expand Down
4 changes: 2 additions & 2 deletions docs/themeadapter-material3.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Maven Central](https://img.shields.io/maven-central/v/com.google.accompanist/accompanist-themeadapter-material3)](https://search.maven.org/search?q=g:com.google.accompanist)

!!! warning
**This library is deprecated, and the API is no longer maintained. We recommend generating a theme with [Material Theme Builder](https://m3.material.io/theme-builder)** The original documentation is below.
**This library is deprecated, and the API is no longer maintained. We recommend generating a theme with [Material Theme Builder](https://m3.material.io/theme-builder)** The original documentation is below.

## Migration
Recommendation: Use the [Material Theme Builder](https://m3.material.io/theme-builder) tool, or an alternative design tool, to generate a matching XML and Compose theme implementation for your app. See [Migrating XML themes to Compose](https://developer.android.com/jetpack/compose/designsystems/views-to-compose) to learn more.
Expand Down Expand Up @@ -141,4 +141,4 @@ limitations under the License.
[materialtheme]: https://developer.android.com/reference/kotlin/androidx/compose/material3/MaterialTheme
[colorscheme]: https://developer.android.com/reference/kotlin/androidx/compose/material3/ColorScheme
[typography]: https://developer.android.com/reference/kotlin/androidx/compose/material3/Typography
[shapes]: https://developer.android.com/reference/kotlin/androidx/compose/material3/Shapes
[shapes]: https://developer.android.com/reference/kotlin/androidx/compose/material3/Shapes
4 changes: 2 additions & 2 deletions docs/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
A library which provides a Jetpack Compose wrapper around Android's WebView.

!!! warning
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.
**This library is deprecated, and the API is no longer maintained. We recommend forking the implementation and customising it to your needs.** The original documentation is below.

## Usage

Expand Down Expand Up @@ -71,4 +71,4 @@ repositories {
dependencies {
implementation "com.google.accompanist:accompanist-webview:<version>"
}
```
```
8 changes: 4 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[versions]

compose = "1.6.0-alpha06"
composeCompiler = "1.5.3"
compose = "1.6.0"
composeCompiler = "1.5.8"
composeMaterial3 = "1.0.1"
composesnapshot = "-" # a single character = no snapshot

dokka = "1.8.10"

# gradlePlugin and lint need to be updated together
gradlePlugin = "8.1.0"
gradlePlugin = "8.2.2"
lintMinCompose = "30.0.0"

ktlint = "0.45.2"
kotlin = "1.9.10"
kotlin = "1.9.22"
coroutines = "1.6.4"
okhttp = "3.12.13"
coil = "1.3.2"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 6 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -144,15 +141,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,71 @@ internal class BottomSheetNavigatorTest {
.isEqualTo(firstSheetDestination)
}

@Test
fun testBackPressWithNestedGraphBehind() {
lateinit var navigator: BottomSheetNavigator
lateinit var navController: NavHostController
lateinit var nestedNavController: NavHostController
lateinit var backDispatcher: OnBackPressedDispatcher
val homeDestination = "home"
val firstSheetDestination = "sheet1"
val firstNestedDestination = "nested1"
val secondNestedDestination = "nested2"

composeTestRule.setContent {
backDispatcher = LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher!!
navigator = rememberBottomSheetNavigator()
navController = rememberNavController(navigator)
ModalBottomSheetLayout(navigator) {
NavHost(navController, homeDestination) {
composable(homeDestination) {
nestedNavController = rememberNavController()
NavHost(nestedNavController, "nested1") {
composable(firstNestedDestination) { }
composable(secondNestedDestination) { }
}
}
bottomSheet(firstSheetDestination) {
Text("SheetDestination")
}
}
}
}

assertThat(navController.currentBackStackEntry?.destination?.route)
.isEqualTo(homeDestination)

composeTestRule.runOnUiThread {
nestedNavController.navigate(secondNestedDestination)
}
composeTestRule.waitForIdle()

assertThat(navController.currentBackStackEntry?.destination?.route)
.isEqualTo(homeDestination)
assertThat(nestedNavController.currentBackStackEntry?.destination?.route)
.isEqualTo(secondNestedDestination)

composeTestRule.runOnUiThread {
navController.navigate(firstSheetDestination)
}
composeTestRule.waitForIdle()

assertThat(navigator.sheetState.currentValue)
.isAnyOf(ModalBottomSheetValue.HalfExpanded, ModalBottomSheetValue.Expanded)

composeTestRule.runOnUiThread {
backDispatcher.onBackPressed()
}
composeTestRule.waitForIdle()

assertThat(navController.currentBackStackEntry?.destination?.route)
.isEqualTo(homeDestination)
assertThat(nestedNavController.currentBackStackEntry?.destination?.route)
.isEqualTo(secondNestedDestination)

assertThat(navigator.sheetState.currentValue).isEqualTo(ModalBottomSheetValue.Hidden)
}

private fun BottomSheetNavigator.createFakeDestination() =
BottomSheetNavigator.Destination(this) {
Text("Fake Sheet Content")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.accompanist.navigation.material

import android.annotation.SuppressLint
import androidx.activity.compose.BackHandler
import androidx.compose.animation.core.AnimationSpec
import androidx.compose.animation.core.SpringSpec
import androidx.compose.foundation.layout.ColumnScope
Expand Down Expand Up @@ -185,6 +186,10 @@ public class BottomSheetNavigator(
LaunchedEffect(retainedEntry) {
sheetState.show()
}

BackHandler {
state.popWithTransition(popUpTo = retainedEntry!!, saveState = false)
}
}

SheetContentHost(
Expand Down

0 comments on commit 4cde6d7

Please sign in to comment.