[go: nahoru, domu]

tree: 97bf3572bdbea81d559c3ff6322b13b53cc087cf [path history] [tgz]
  1. .idea/
  2. api/
  3. gradle/
  4. integration-tests/
  5. samples/
  6. ui-android-view/
  7. ui-animation/
  8. ui-animation-core/
  9. ui-core/
  10. ui-desktop/
  11. ui-foundation/
  12. ui-geometry/
  13. ui-graphics/
  14. ui-internal-lint-checks/
  15. ui-layout/
  16. ui-livedata/
  17. ui-material/
  18. ui-rxjava2/
  19. ui-saved-instance-state/
  20. ui-test/
  21. ui-test-font/
  22. ui-text/
  23. ui-text-android/
  24. ui-text-core/
  25. ui-tooling/
  26. ui-unit/
  27. ui-util/
  28. ui-vector/
  29. build.gradle
  30. gradle.properties
  31. gradlew
  32. idea.properties
  33. README.md
  34. settings.gradle
  35. studiow
ui/README.md

Jetpack Compose

Intro

Jetpack Compose is a suite of libraries within the AndroidX ecosystem. For more information, see our project page

Syntax

Jetpack Compose uses composable functions instead of XML layouts to define UI components. You can see this in action in the demos, like androidx.ui.material.demos.ButtonDemo.kt. More information can be found in the compiler README.

You may notice some parts of the codebase use an XML-like syntax. This was an exploration done early on in the project, and we have since decided to move away from it. Usages of this syntax will eventually be converted to use the standard kotlin DSL instead.

Compiler

Composable functions are built using a custom Kotlin compiler plugin. More information about the compiler plugin is available in this README.

Getting started

To try out Jetpack Compose you need to set up the toolchain for AndroidX development. Follow the process here to check out the code.

To start the required version of Android Studio, you need to run the studiow command from the /ui subfolder

cd path/to/checkout/frameworks/support/ui/
./studiow

Also if you would like to build from the command line, all gradle commands need to be run from the /ui subfolder. E.g. to build the demo app, run:

cd path/to/checkout/frameworks/support/ui/
./gradlew ui:integration-tests:demos:installDebug

Currently available components

Jetpack Compose is in very early stages of development. Developers wanting to build sample apps will probably want to include the material, layout and framework modules. You can see how to setup your dependencies in material/integration-tests/material-studies/build.gradle.

Run the demos app to see examples of individual components.

A sample implementation of the Material Rally app is under material/integration-tests/material-studies.

To build the Material Rally app via the command line run:

cd path/to/checkout/frameworks/support/ui/
./gradlew :ui-material:integration-tests:ui-material-studies:assembleDebug

Structure

Library code for Jetpack Compose lives under the frameworks/support/ui directory. Additionally, sample code can be found within each module in the integration-tests subdirectories and the compiler and runtime code can be found in frameworks/support/compose.

The modules within UI are structured as follows:

  • ui-android-view/

    Wrappers and adapters for existing Android Views

  • ui-animation/

    Animation components

  • ui-animation-core/

    Internal declarations for the animations system

  • ui-core/

    Classes and components used across the system for layout, drawing, root views, etc.

  • integration-tests/demos/

    Module that collects all demos across ui and packages them into one demo APK

  • ui-layout/

    Basic layout components

  • ui-material/

    Set of UI components built according to the Material spec

  • ui-test/

    Testing framework

  • ui-text/

    Base Text composables

  • ui-text-core/

    Text engine that contains base text components

  • ui-text-android/

    Android specific text stack dependent implementations

Feedback

To provide feedback or report bugs, please refer to the main AndroidX contribution guide and report your bugs here