Skip to content

Commit 231a39d

Browse files
author
Manuel Vivo
committedAug 14, 2020
[Crane] Adds README
Change-Id: Id7e26646e842b76410c86fd80350fb141f720bec
1 parent 30e2cc8 commit 231a39d

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed
 

‎Crane/README.md

+71-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,71 @@
1-
Steps to run this sample in go/compose-samples-howto
1+
# Crane sample
2+
3+
[Crane](https://material.io/design/material-studies/crane.html) is a travel app part of the Material
4+
Studies built with [Jetpack Compose](https://developer.android.com/jetpack/compose).
5+
The goal of the sample is to showcase Material components, draggable UI elements, Android Views
6+
inside Compose, and UI state handling.
7+
8+
## Screenshots
9+
10+
<img src="screenshots/crane.gif"/>
11+
12+
## Features
13+
14+
This sample contains 4 screens:
15+
- __Landing__ [screen][landing] that fades out after 2 seconds then slides the main content in from
16+
the bottom of the screen.
17+
- __Home__ [screen][home] where you can explore flights, hotels, and restaurants specifying
18+
the number of people.
19+
- Clicking on the number of people refreshes the destinations.
20+
- The [backdrop](https://material.io/components/backdrop) is draggable and can pin to the top of
21+
the screen, just under the search criteria, and to the bottom. Implemented [here][backdrop].
22+
- Destination's images are retrieved using the [coil-accompanist][coil-accompanist] library.
23+
- __Calendar__ [screen][calendar]. Tapping on __Select Dates__ takes you to a calendar built
24+
completely from scratch. It makes a heavy usage of Compose's state APIs.
25+
- Destination's __Details__ [screen][details]. When tapping on a destination, a new screen
26+
implemented using a different Activity will be displayed. In there, you can see the a `MapView`
27+
embedded in Compose and Compose buttons updating the Android View. Notice how you can also
28+
interact with the `MapView` seamlessly.
29+
30+
## Google Maps SDK
31+
32+
To get the MapView working, you need to get an API key as
33+
the [documentation says](https://developers.google.com/maps/documentation/android-sdk/get-api-key),
34+
and include it in the `local.properties` file as follows:
35+
36+
```
37+
google.maps.key={insert_your_api_key_here}
38+
```
39+
40+
## Data
41+
42+
The data is hardcoded in the _CraneData_ [file][data] and exposed to the UI using the
43+
[MainViewModel][mainViewModel]. Image resources are retrieved from
44+
[Unsplash](https://unsplash.com/).
45+
46+
## License
47+
48+
```
49+
Copyright 2020 Google LLC
50+
51+
Licensed under the Apache License, Version 2.0 (the "License");
52+
you may not use this file except in compliance with the License.
53+
You may obtain a copy of the License at
54+
55+
https://www.apache.org/licenses/LICENSE-2.0
56+
57+
Unless required by applicable law or agreed to in writing, software
58+
distributed under the License is distributed on an "AS IS" BASIS,
59+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60+
See the License for the specific language governing permissions and
61+
limitations under the License.
62+
```
63+
64+
[landing]: app/src/main/java/androidx/compose/samples/crane/home/LandingScreen.kt
65+
[home]: app/src/main/java/androidx/compose/samples/crane/home/CraneHome.kt
66+
[backdrop]: app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayer.kt
67+
[calendar]: app/src/main/java/androidx/compose/samples/crane/calendar/Calendar.kt
68+
[details]: app/src/main/java/androidx/compose/samples/crane/details/DetailsActivity.kt
69+
[data]: app/src/main/java/androidx/compose/samples/crane/data/CraneData.kt
70+
[mainViewModel]: app/src/main/java/androidx/compose/samples/crane/home/MainViewModel.kt
71+
[coil-accompanist]: https://github.com/chrisbanes/accompanist

‎Crane/screenshots/crane.gif

7.31 MB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.