diff --git a/Crane/README.md b/Crane/README.md index b3c5ffde27..60f08e17bc 100644 --- a/Crane/README.md +++ b/Crane/README.md @@ -1 +1,71 @@ -Steps to run this sample in go/compose-samples-howto \ No newline at end of file +# Crane sample + +[Crane](https://material.io/design/material-studies/crane.html) is a travel app part of the Material +Studies built with [Jetpack Compose](https://developer.android.com/jetpack/compose). +The goal of the sample is to showcase Material components, draggable UI elements, Android Views +inside Compose, and UI state handling. + +## Screenshots + + + +## Features + +This sample contains 4 screens: +- __Landing__ [screen][landing] that fades out after 2 seconds then slides the main content in from +the bottom of the screen. +- __Home__ [screen][home] where you can explore flights, hotels, and restaurants specifying +the number of people. + - Clicking on the number of people refreshes the destinations. + - The [backdrop](https://material.io/components/backdrop) is draggable and can pin to the top of + the screen, just under the search criteria, and to the bottom. Implemented [here][backdrop]. + - Destination's images are retrieved using the [coil-accompanist][coil-accompanist] library. +- __Calendar__ [screen][calendar]. Tapping on __Select Dates__ takes you to a calendar built +completely from scratch. It makes a heavy usage of Compose's state APIs. +- Destination's __Details__ [screen][details]. When tapping on a destination, a new screen +implemented using a different Activity will be displayed. In there, you can see the a `MapView` +embedded in Compose and Compose buttons updating the Android View. Notice how you can also +interact with the `MapView` seamlessly. + +## Google Maps SDK + +To get the MapView working, you need to get an API key as +the [documentation says](https://developers.google.com/maps/documentation/android-sdk/get-api-key), +and include it in the `local.properties` file as follows: + +``` +google.maps.key={insert_your_api_key_here} +``` + +## Data + +The data is hardcoded in the _CraneData_ [file][data] and exposed to the UI using the +[MainViewModel][mainViewModel]. Image resources are retrieved from +[Unsplash](https://unsplash.com/). + +## License + +``` +Copyright 2020 Google LLC + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` + +[landing]: app/src/main/java/androidx/compose/samples/crane/home/LandingScreen.kt +[home]: app/src/main/java/androidx/compose/samples/crane/home/CraneHome.kt +[backdrop]: app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayer.kt +[calendar]: app/src/main/java/androidx/compose/samples/crane/calendar/Calendar.kt +[details]: app/src/main/java/androidx/compose/samples/crane/details/DetailsActivity.kt +[data]: app/src/main/java/androidx/compose/samples/crane/data/CraneData.kt +[mainViewModel]: app/src/main/java/androidx/compose/samples/crane/home/MainViewModel.kt +[coil-accompanist]: https://github.com/chrisbanes/accompanist diff --git a/Crane/app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayerDraggable.kt b/Crane/app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayer.kt similarity index 100% rename from Crane/app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayerDraggable.kt rename to Crane/app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayer.kt diff --git a/Crane/screenshots/crane.gif b/Crane/screenshots/crane.gif new file mode 100644 index 0000000000..c0690e52ce Binary files /dev/null and b/Crane/screenshots/crane.gif differ