Awesome
<p align="center"> <img src="/previews/screenshot.jpg" /> </p> <p align="center"> <a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"/></a> <a href="https://android-arsenal.com/api?level=21"><img alt="API" src="https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat"/></a> <a href="https://mailchi.mp/kotlinweekly/kotlin-weekly-274"><img alt="KotlinWeekly" src="https://skydoves.github.io/badges/kotlin-weekly.svg"/></a> <a href="https://github.com/skydoves/AvengersChat/actions/workflows/android.yml"><img alt="API" src="https://github.com/skydoves/AvengersChat/actions/workflows/android.yml/badge.svg"/></a> <a href="https://getstream.io/tutorials/android-chat?utm_source=Github&utm_medium=Jaewoong_OSS&utm_content=Developer&utm_campaign=Github_Sept2022_AvengersChat&utm_term=DevRelOss"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HayesGordon/e7f3c4587859c17f3e593fd3ff5b13f4/raw/11d9d9385c9f34374ede25f6471dc743b977a914/badge.json" alt="Stream Feeds"></a> </p>AvengersChat demonstrates modern Android development based on MVVM architecture and Stream Chat SDK for Android.
The purpose of this repository is to demonstrate below:
- Implementing each different feature with modularization and navigation.
- Implementation of Android architecture components with Jetpack libraries, such as Hilt and AppStartup.
- Performing background tasks with Kotlin Coroutines.
- Integrating chat systems with Stream Chat SDK for Android for real-time event handling.
✍️ Tutorials
You can learn more about this project from the blog posts and Youtube videos. If you're interested in the materials, check out the Tutorials Page!
:bulb: Additional Repositories
If you're interested in additional repositories that were built with Jetpack Compose and Stream SDK, check out the repositories below:
- WhatsApp Clone Android: 📱 WhatsApp clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat SDK for Compose.
- Slack Clone Android: 📱 A chat demo app built with Jetpack Compose and Stream Chat SDK following clean architecture principles.
- Stream Draw Android: 🛥 Stream Draw is a real-time multiplayer drawing & chat game app built entirely with Jetpack Compose.
- Facebook Messenger Clone: Facebook Messenger clone using Stream SDK & Jetpack Compose.
📲 Download APK
Go to the Releases to download the latest APK.
<a href="https://getstream.io/tutorials/android-chat?utm_source=Github&utm_medium=Jaewoong_OSS&utm_content=Developer&utm_campaign=Github_Sept2022_AvengersChat&utm_term=DevRelOss"> <img src="https://user-images.githubusercontent.com/24237865/138428440-b92e5fb7-89f8-41aa-96b1-71a5486c5849.png" align="right" width="12%"/> </a>⛴ Stream Chat SDK for Android
AvengersChat was built with Stream Chat SDK for Android for implementing messaging systems. You can learn more about the SDK with the materials below:
- Chat Messaging Tutorial: Basic tutorials for getting started by building a simple messaging app.
- Stream Chat Android repository: Official Android SDK for Stream Chat.
- Chat Client Documentation: Full documentation of the Chat client for requesting API calls.
- UI Components Documentation: Full documentation of the Stream UI Components.
- UI Components Sample: Official sample app for building messaging app.
📷 Previews
If you find funny moments on this demo application, feel free to join and share the moment in this thread!
<p align="center"> <img src="/previews/preview0.gif" width="32%"/> <img src="/previews/preview1.gif" width="32%"/> <img src="/previews/preview2.gif" width="32%"/> </p> <p align="center"> <img src="https://user-images.githubusercontent.com/24237865/139976413-675a3b32-1edf-4bfc-b600-a8ffb734f1ec.jpeg" width="32%"/> <img src="https://user-images.githubusercontent.com/24237865/139976435-5da608b9-e453-47c0-be78-73f0039b4ab1.jpeg" width="32%"/> <img src="https://user-images.githubusercontent.com/24237865/139976345-dedc9c4c-2140-4fbc-9d02-7d815380d900.jpeg" width="32%"/> </p> <img src="/previews/preview0.gif" align="right" width="32%"/>🛠 Tech stack & Open source libraries
- Minimum SDK level 21.
- 100% Kotlin based + Coroutines + Flow for asynchronous.
- Hilt for dependency injection.
- Jetpack
- Lifecycle: Dispose observing data when lifecycle state changes.
- ViewModel: UI related data holder and lifecycle aware.
- App Startup: Provides a straightforward, performant way to initialize components at application startup.
- Navigation: For navigating screens and provides deeplinks.
- Room: Constructs Database by providing an abstraction layer over SQLite to allow fluent database access.
- Hilt: Dependency Injection.
- Architecture
- MVVM Architecture: View - DataBinding - ViewModel - Model
- Bindables: Android DataBinding kit for notifying data changes to UI layers.
- Repository pattern
- Material Design & Animations: Design system created by Google to help teams build high-quality digital experiences.
- Retrofit2 & OkHttp3: Construct the REST APIs and paging network data.
- Sandwich: Construct lightweight http API response and handling error responses.
- Moshi: A modern JSON library for Kotlin and Java.
- Coil: Image loading for Android backed by Kotlin Coroutines.
- TransformationLayout: Implementing transformation motion animations.
- android-youtube-player: YouTube Player library for Android and Chromecast, stable and customizable.
- DiscreteScrollView: Implementing a scrollable list of items.
- Timber: A logger with a small, extensible API which provides utility.
✅ Supported features
- Light and Dark themes.
- Different color themes by a chosen character.
- 100% offline mode supports.
- Live stream chat example.
- Channel and message lists.
- Direct message and group messages.
- Mentioned message list.
- Custom emoji reactions.
- Guest mode.
- User online/offline status.
- User last active date.
- User info & direct message dialogs.
- Visual animations like transition.
- And a lot of features by Stream Android SDK!
☑️ TODO
Anyone can contribute to our open source project! Please kindly read this Contributing Guideline before contributing to our project. 😎
- Modify a user profile image.
- Login with a new guest user.
- Push notifications for new messages.
- Create group chats by selecting users.
- Access user info dialog everywhere.
- Add unit test cases for all business logic.
🏛 Architecture
AvengersChat is based on the MVVM architecture and the Repository pattern, which follows the Google's official architecture guidance.
The overall architecture of AvengersChat is composed of two layers; the UI layer and the data layer. Each layer has dedicated components and they have each different responsibilities, as defined below:
AvengersChat was built with Guide to app architecture, so it would be a great sample to show how the architecture works in real-world projects.
Architecture Overview
- Each layer follows unidirectional event/data flow; the UI layer emits user events to the data layer, and the data layer exposes data as a stream to other layers.
- The data layer is designed to work independently from other layers and must be pure, which means it doesn't have any dependencies on the other layers.
With this loosely coupled architecture, you can increase the reusability of components and scalability of your app.
UI Layer
The UI layer consists of UI elements to configure screens that could interact with users and ViewModel that holds app states and restores data when configuration changes.
- UI elements observe the data flow via DataBinding, which is the most essential part of the MVVM architecture.
- With Bindables, which is an Android DataBinding kit for notifying data changes, you can implement two-way binding, and data observation in XML very clean.
Data Layer
The data Layer consists of repositories, which include business logic, such as querying data from the local database and requesting remote data from the network. It is implemented as an offline-first source of business logic and follows the single source of truth principle.<br>
AvengersChat is an offline-first app is an app that is able to perform all, or a critical subset of its core functionality without access to the internet. So users don't need to be up-to-date on the network resources every time and it will decrease users' data consumption. For further information, you can check out Build an offline-first app.
Modularization
AvengersChat adopted modularization strategies below:
- Reusability: Modulizing reusable codes properly enable opportunities for code sharing and limits code accessibility in other modules at the same time.
- Parallel Building: Each module can be run in parallel and it reduces the build time.
- Strict visibility control: Modules restrict to expose dedicated components and access to other layers, so it prevents they're being used outside the module
- Decentralized focusing: Each developer team can assign their dedicated module and they can focus on their own modules.
For more information, check out the Guide to Android app modularization.
💯 MAD Score
<img src="https://user-images.githubusercontent.com/24237865/141415477-d1af2b48-2498-4ff0-8fdf-95dff092e317.png" align="right" width="22%"/>Content Credits
All copyrights of the contents, concepts, and phrases that are used in this open-source project belong to Marvel Studios.
Find this repository useful? 💙
Support it by joining stargazers for this repository. :star: <br> Also, follow maintainers on GitHub for our next creations! 🤩
License
Copyright 2021 Stream.IO, Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.