Awesome
<h1 align="center"> Foldable Chat Android </h1> <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://github.com/GetStream/foldable-chat-android/actions/workflows/android.yml"><img alt="Build Status" src="https://github.com/GetStream/foldable-chat-android/actions/workflows/android.yml/badge.svg"/></a> </p> <p align="center"> A foldable chat Android demonstrates adaptive and responsive UIs with Jetpack WindowManager API.<br> <img src="https://user-images.githubusercontent.com/24237865/147445558-c749acd6-28aa-40c6-8e37-2a1121a9c165.png" /> </p>Overview
This demo project demonstrates dual-screen devices are portable devices with two symmetric screens that work together in unique ways to provide productivity in a flexible form factor. For more details, you can check it out Introduction to dual-screen devices.
Learn More about WindowManager
If you would like to learn more about the WindowManager API, check out the resources below:
- Exploring Jetpack WindowManager for Foldable Devices.
- Youtube Tutorial - Exploring Jetpack WindowManager to Support Foldable Devices
Pre-requisites
- Android SDK 31
- Android Studio Arctic Fox or higher
- Android Gradle Plugin 7.0.1+ and Java 11
- The Android Emulator v30.0.6+ includes foldables support
- Surface Duo 2 emulator
Install and run the Foldable Emulator
To get started, you need to install the Foldable emulator. This project uses Surface Duo 2 emulator, and you can check it out the links below:
<img width="1372" alt="Screen Shot 2021-12-28 at 10 07 14 AM" src="https://user-images.githubusercontent.com/24237865/147519212-e9e421bb-2fb9-48bc-9d45-db4d5feefed3.png">Jetpack WindowManager
The Jetpack WindowManager library targets foldable devices and enables application developers to support new device form factors and multi-window environments. You can find Jetpack WindowManager information in the Guide: Learn about foldables.
Including on your project
Add the below dependencies to your build.gradle
file.
dependencies {
implementation "androidx.window:window:1.0.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
}
<img align="right" width="15%" src="https://user-images.githubusercontent.com/24237865/149445065-47c2506d-a738-4fb2-b4fb-eb6841b9e202.png" />
WindowManager Example
WindowManager Example module shows how to calculate the screen size and determine device postures with Jetpack WindowManager. You can also refer to the links below for additional help:
- Exploring Jetpack WindowManager for Foldable Devices
- Support foldable and dual-screen devices with Jetpack WindowManager
- Unbundling the WindowManager
- Migrate your UI to responsive layouts
Preview
<a href="https://getstream.io/tutorials/android-chat/"> <img src="https://user-images.githubusercontent.com/24237865/138428440-b92e5fb7-89f8-41aa-96b1-71a5486c5849.png" align="right" width="12%"/></a>WindowManager Chat
WindowManager Chat module demonstrates how to build responsive chat UIs with XML layout with Stream Chat SDK. You can also refer to the links below for additional help:
Preview
<img align="right" width="15%" src="https://user-images.githubusercontent.com/24237865/149444862-961adb83-da2a-4179-9c27-37edb2f982f4.png">WindowManager Chat Compose
WindowManager Chat Compose module demonstrates how to build responsive chat UIs with Stream Jetpack Compose SDK. You can also refer to the links below for additional help:
Preview
Butterfly
<a align="center"> <img src="https://user-images.githubusercontent.com/24237865/150674436-d2713bf0-da35-4b75-8629-5c83d8500cd7.png" width="65%" align="center" /> </a>If you're looking for useful APIs for Jetpack WindowManager, check out the Butterfly. The Butterfly helps you to build adaptive and responsive UIs for Android with Jetpack WindowManager. Also, it supports useful functions for Jetpack Compose and LiveData integration.
Find this library useful? ❤️
Support it by joining stargazers for this repository. ⭐️ <br> Also, follow Stream on Twitter for our next creations!
License
Copyright 2022 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.