Skip to content

Commit

Permalink
[Rally] Removes Rally from this repo, pointing to codelabs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseAlcerreca committed Jun 18, 2021
1 parent 4079e96 commit 5c9605b
Show file tree
Hide file tree
Showing 52 changed files with 6 additions and 2,677 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/Rally.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@ jobs:
asset_name: owl-debug.apk
asset_content_type: application/vnd.android.package-archive

- name: Upload Rally
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Rally/app/build/outputs/apk/debug/app-debug.apk
asset_name: rally-debug.apk
asset_content_type: application/vnd.android.package-archive

- name: Upload Jetcaster
uses: actions/upload-release-asset@v1
env:
Expand Down
15 changes: 0 additions & 15 deletions Rally/.gitignore

This file was deleted.

29 changes: 0 additions & 29 deletions Rally/.google/packaging.yaml

This file was deleted.

88 changes: 0 additions & 88 deletions Rally/ASSETS_LICENSE

This file was deleted.

88 changes: 6 additions & 82 deletions Rally/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,17 @@

This sample is a [Jetpack Compose][compose] implementation of [Rally][rally], a Material Design study.

To try out this sample app, you need to use the latest
[Canary version of Android Studio](https://developer.android.com/studio/preview).
You can clone this repository or import the
project from Android Studio following the steps
[here](https://developer.android.com/jetpack/compose/setup#sample).
Rally is used as the starting point in the following codelabs:

This sample showcases:

* [Material theming][materialtheming]
* Custom layouts and reusable elements
* Charts and tables
* Animations
- [Jetpack Compose Navigation codelab][navcodelab]: Learn how to use the Jetpack Navigation library in Compose, navigate within your application, navigate with arguments, support deep-links, and test your navigation.
- [Jetpack Compose Testing codelab][testcodelab]: Learn about testing Jetpack Compose UIs. Write your first tests, and learn about testing in isolation, debugging tests, the semantics tree, and test synchronization.

<img src="screenshots/rally.gif"/>

### Status: 🚧 In progress

This sample is still in under development, and some features are not yet implemented.

## Features

### Purpose
This sample is a simple introduction to Material Design in Compose and it focuses on creating custom layouts and reusable elements. It uses a very simple architecture with a single activity and some hard-coded sample data. The navigation mechanism is implemented as a placeholder for an eventual official implementation using [Android Architecture Components Navigation](https://developer.android.com/guide/navigation).

### Custom layouts and reusable elements
Rally contains screens that have very similar elements, which allows for reusing a lot of code and implementing composables that are "styled" programmatically as needed.

For example, [AccountsScreen](app/src/main/java/com/example/compose/rally/ui/accounts/AccountsScreen.kt) and [BillsScreen](app/src/main/java/com/example/compose/rally/ui/bills/BillsScreen.kt) wrap the same [`StatementBody`](app/src/main/java/com/example/compose/rally/ui/components/DetailsScreen.kt) composable which takes a list of _items_, their colors, amounts and even a slot to compose the item itself. Instead of passing lists with all this meta information, it's much more convenient, reusable and performant to pass functions and delegate how to fetch this information to each caller, making `StatementBody` completely generic:

```kotlin
@Composable
fun <T> StatementBody(
items: List<T>,
colors: (T) -> Color,
amounts: (T) -> Float,
rows: @Composable (T) -> Unit
...
```

```kotlin
@Composable
fun AccountsBody(accounts: List<Account>) {
StatementBody(
items = accounts,
colors = { account -> account.color },
amounts = { account -> account.balance },
rows = { account -> AccountRow(...) }
...
```

### Theming
Rally follows [Material Design][materialtheming], customizing [colors](app/src/main/java/com/example/compose/rally/ui/theme/Color.kt) and [typography](app/src/main/java/com/example/compose/rally/ui/theme/RallyTheme.kt) used in the app via the [RallyTheme](app/src/main/java/com/example/compose/rally/ui/theme/RallyTheme.kt). Rally's design only contains a dark theme, therefore the theme does not contain any light colors.

### Charts and animations
This sample features a donut chart that combines drawing using [`Canvas`](https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Canvas) with animations combining two animated parameters: `AngleOffset` and `Shift`. This creates the animation with minimum boilerplate:

```kotlin
private enum class AnimatedCircleProgress { START, END }

private val CircularTransition = transitionDefinition<AnimatedCircleProgress> {
state(AnimatedCircleProgress.START) {
this[AngleOffset] = 0f
this[Shift] = 0f
}
state(AnimatedCircleProgress.END) {
this[AngleOffset] = 360f
this[Shift] = 30f
}
transition(fromState = AnimatedCircleProgress.START, toState = AnimatedCircleProgress.END) {
AngleOffset using tween(
delayMillis = 500,
durationMillis = 900,
easing = CubicBezierEasing(0f, 0.75f, 0.35f, 0.85f)
)
Shift using tween(
delayMillis = 500,
durationMillis = 900,
easing = LinearOutSlowInEasing
)
}
}
```

<img src="screenshots/donut.gif"/>

## License
```
Copyright 2020 The Android Open Source Project
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -106,4 +29,5 @@ limitations under the License.

[compose]: https://developer.android.com/jetpack/compose
[rally]: https://material.io/design/material-studies/rally.html
[materialtheming]: https://material.io/design/material-theming/overview.html#material-theming
[navcodelab]: https://developer.android.com/codelabs/jetpack-compose-navigation
[testcodelab]: https://developer.android.com/codelabs/jetpack-compose-testing
1 change: 0 additions & 1 deletion Rally/app/.gitignore

This file was deleted.

Loading

0 comments on commit 5c9605b

Please sign in to comment.