Jetpack Compose is a sample chat app built on the Node.js platform with support for WebSockets, which allows users to send messages and share media in real-time across connected devices. Jetpack Compose was designed as an example of how quickly development can happen when using this framework.
The “jetpack compose source code” is a sample chat app built with Jetpack Compose. It’s a simple chat application that uses the material design and has plenty of features for users to enjoy.
Jetchat is a Jetpack Compose-based chat application.
You’ll need Android Studio Arctic Fox to test out this example app. Following the methods below, you may clone this repository or import the project using Android Studio.
This example demonstrates:
- State management in the user interface
- Navigation, Fragments, and ViewModel integration with Components of Architecture
- Using the back button
- Input of text and control of focus
- Transitions and animations of many sorts
- Across configuration modifications, the state is saved.
- Material You dynamic color and Material Design 3 theming
- UI tests
Currently, the project is in process.
Jetchat is currently in beta, and certain features have yet to be deployed.
Features
Management of the user interface state
This screen’s entry point is the ConversationContent composable, which accepts a ConversationUiState that describes the data to be presented. This does not imply that all state is provided by a single point: composables might have their own state as well. See scrollState in ConversationContent or currentInputSelector in UserInput for examples.
Architecture Components
The ProfileFragment demonstrates how to use the Navigation component to move data across fragments and use LiveData to monitor status from a ViewModel.
Using the back button
When the Emoji picker appears, tapping the back button in the app dismisses it, interfering with any navigation actions. This feature demonstrates how to use Ambients to connect Compose and Android Framework APIs like OnBackPressedDispatcherOwner. ConversationUiState contains the implementation.
Input of text and control of focus
The keyboard must be hidden while the Emoji panel is visible, and vice versa. The FocusRequester and onFocusChanged APIs are used to do this.
Transitions and animations of many sorts
The animations used in this example range from basic AnimatedVisibility in FunctionalityNotAvailablePanel to coordinated transitions seen in the Profile screen’s FloatingActionButton and implemented in AnimatingFabContent.
UI that spans the whole screen with synchronized IME transitions
For a more immersive aesthetic, this sample is set out edge-to-edge, pulling its content behind the system bars.
When running on API 30+ devices, the sample now supports synchronized IME transitions. Look at how Modifier is used. ConversationContent has a navigationBarsWithImePadding() method.
WindowInsets support is provided by the Accompanist Insets library in this example.
Across configuration modifications, the state is saved.
Some composable states, such as currentInputSelector in UserInput, survive activity or process reconstruction.
Material You dynamic color and Material Design 3 theming
Jetchat employs the MaterialTheme composable and M3 components and adheres to the Material Design 3 principles. Jetchat now supports Material You dynamic color on Android 12 and higher, which pulls a bespoke color scheme from the device wallpaper. As a backup, Jetchat utilizes a bespoke, branded color scheme. It also uses the Karla and Montserrat font families to create unique typography.
UI tests
You’ll find a set of UI tests in androidTest that highlight noteworthy patterns in Compose:
ConversationTest
Tests for the Conversation screen’s user interface. Includes a test that examines the app’s behavior when dark mode is switched on.
NavigationTest
Demonstrates how to construct tests that assert on the Navigation Controller directly.
UserInputTest
Checks that the user input is composable, including extended controls, and that the keyboard is shown and hidden as intended.
Issues that have been identified
-
If the emoji selection is visible, clicking on the TextField may reveal both input methods. This problem is being tracked at https://issuetracker.google.com/164859446.
-
There are only two profiles, and clicking on anybody other than “me” will bring up the identical information.
License
2020 Copyright The Apache License, Version 2.0 (the “License”) applies to the Android Open Source Project; you may not use this file unless you comply with the License. The License is available at https://www.apache.org/licenses/LICENSE-2.0. Unless otherwise required by relevant law or agreed upon in writing, software distributed under the License is provided “AS IS,” with no explicit or implied warranties or conditions. The full text defining rights and limits under the License may be found in the License.
GitHub
Visit Github for further information.
The “jetpack compose example” is a sample chat app built with Jetpack Compose. It uses the latest features of the library to create a modern, functional UI.
Related Tags
- jetpack compose login form
- jetpack compose recyclerview
- jetpack compose cheat sheet
- jetpack compose chat
- jetpack compose navigation sample