@@ -5,7 +5,7 @@ Studies built with [Jetpack Compose](https://developer.android.com/jetpack/compo
5
5
The goal of the sample is to showcase Material components, draggable UI elements, Android Views
6
6
inside Compose, and UI state handling.
7
7
8
- To try out this sample app, you need to use the latest Canary version of Android Studio 4.2 .
8
+ To try out this sample app, you need to use the latest Canary version of Android Studio Arctic Fox .
9
9
You can clone this repository or import the
10
10
project from Android Studio following the steps
11
11
[ here] ( https://developer.android.com/jetpack/compose/setup#sample ) .
@@ -22,8 +22,6 @@ the bottom of the screen.
22
22
- __ Home__ [ screen] [ home ] where you can explore flights, hotels, and restaurants specifying
23
23
the number of people.
24
24
- Clicking on the number of people refreshes the destinations.
25
- - The [ backdrop] ( https://material.io/components/backdrop ) is draggable and can pin to the top of
26
- the screen, just under the search criteria, and to the bottom. Implemented [ here] [ backdrop ] .
27
25
- Destination's images are retrieved using the [ coil-accompanist] [ coil-accompanist ] library.
28
26
- __ Calendar__ [ screen] [ calendar ] . Tapping on __ Select Dates__ takes you to a calendar built
29
27
completely from scratch. It makes a heavy usage of Compose's state APIs.
@@ -32,6 +30,9 @@ implemented using a different Activity will be displayed. In there, you can see
32
30
embedded in Compose and Compose buttons updating the Android View. Notice how you can also
33
31
interact with the ` MapView ` seamlessly.
34
32
33
+ Crane is a multi-activity app that showcases how navigating between activities can be done in
34
+ Jetpack Compose.
35
+
35
36
## Hilt
36
37
37
38
Crane uses [ Hilt] [ hilt ] to manage its dependencies. Hilt's ViewModel (with the
@@ -48,8 +49,9 @@ class MainViewModel @Inject constructor(
48
49
) : ViewModel() { ... }
49
50
50
51
@Composable
51
- fun CraneHomeContent(...) {
52
- val viewModel: MainViewModel = viewModel()
52
+ fun CraneHomeContent(
53
+ viewModel: MainViewModel = viewModel()
54
+ ) {
53
55
...
54
56
}
55
57
```
@@ -75,11 +77,9 @@ and include it in the `local.properties` file as follows:
75
77
google.maps.key={insert_your_api_key_here}
76
78
```
77
79
78
- ## Data
80
+ ## Images
79
81
80
- The data is hardcoded in the _ CraneData_ [ file] [ data ] and exposed to the UI using the
81
- [ MainViewModel] [ mainViewModel ] . Image resources are retrieved from
82
- [ Unsplash] ( https://unsplash.com/ ) .
82
+ Image resources are retrieved from [ Unsplash] ( https://unsplash.com/ ) .
83
83
84
84
## Testing
85
85
@@ -107,10 +107,8 @@ limitations under the License.
107
107
108
108
[ landing ] : app/src/main/java/androidx/compose/samples/crane/home/LandingScreen.kt
109
109
[ home ] : app/src/main/java/androidx/compose/samples/crane/home/CraneHome.kt
110
- [ backdrop ] : app/src/main/java/androidx/compose/samples/crane/ui/BackdropFrontLayer.kt
111
110
[ calendar ] : app/src/main/java/androidx/compose/samples/crane/calendar/Calendar.kt
112
111
[ details ] : app/src/main/java/androidx/compose/samples/crane/details/DetailsActivity.kt
113
- [ data ] : app/src/main/java/androidx/compose/samples/crane/data/CraneData.kt
114
112
[ mainViewModel ] : app/src/main/java/androidx/compose/samples/crane/home/MainViewModel.kt
115
113
[ detailsViewModel ] : app/src/main/java/androidx/compose/samples/crane/details/DetailsViewModel.kt
116
114
[ homeTest ] : app/src/androidTest/java/androidx/compose/samples/crane/home/HomeTest.kt
0 commit comments