Skip to content

This is a collection of various code samples of Jetpack Compose and Kotin coroutines. The app is intended to demonstrate the correct and wrong usage of certain concepts.

Notifications You must be signed in to change notification settings

nsmirosh/Interactive-Android-Concepts

Repository files navigation

Screenshot 2024-11-05 at 17 01 28

Interactive Android Concepts Examples

This is a collection of code samples and demonstrations focusing on Android development, specifically Jetpack Compose and Kotlin coroutines.

The goal of this repository is to visually illustrate the usage of hard-to-understand Android and Kotlin concepts. The samples aim to be interactive.

All of the video illustrations have corresponding code representations.

Feel free to play around with these examples to get a better understanding of each of the concepts.

Contribution guidelines

You're welcome to contribute your own code samples.

To contribute your own interactive example:

  1. Find a concept that is not straightforward and not yet covered.
  2. Contact me to make sure that your MR will get accepted before you start working on it.
  3. Make sure that what you want to contribute is an interactive and / or visual representation of a certain Android / Kotlin concept.
  4. Write a detailed post with an explanation of what's going on in your example. Consult this screen for reference and see the constant EXPLANATION_LINK.
  5. Open an MR with your changes.

To contribute your refactoring / infrastructure changes:

  1. Contact me to make sure that your MR will get accepted before you start working on it.
  2. Once you're finished -open an MR with your changes.

Contents

  1. Coroutines Examples
    • Coroutine cooperation. Building a cooperative coroutine. Link
    • The difference between async {} and launch{}. How it influences coroutine execution and cancellation. Link
    • How coroutineScope {} influences the order of execution in coroutines Link
    • Why is CancellationException special? How exception propagation works. Link
  2. Jetpack Compose Examples
    • Modifier precedence importance. A Drag-Drop example of modifier usage. Link
    • Demonstration of the usage of rememberUpdatedState() for updating a scheduled lambda Link
    • How rememberCoroutineScope can be used to cancel the execution of a coroutine Link
  3. Other Android Concepts
    • Multiple processes. How you can have your app run in different processes. Link
  4. Progress animation

Coroutines Examples

Coroutine Cooperation

Learn how isActive and CancellationException can be utilized for efficient coroutine cooperation.

async{} vs launch{}

Explore the differences between async{} and launch{} and how scopes affect their execution and cancellation.

My.Movie.5.mp4

coroutineScope {} influence

Understand how coroutineScope influences coroutine order of execution.

My.Movie.6.mp4

CancellationException vs ordinary exceptions. Exception propagation.

Learn why CancellationException is special in Kotlin coroutines and how exceptions are propagated from child to parent.

exceptions_video.mov

Jetpack Compose Examples

LaunchedEffect and rememberUpdatedState()

Demonstrates the usage of LaunchedEffect and rememberUpdatedState in Jetpack Compose.

My.Movie.2.mp4

Usage of rememberCoroutineScope()

Discover the use of rememberCoroutineScope() for canceling coroutine execution within Compose.

example.mp4

Drag-drop Modifier

You can drag and drop the two modifiers in order to discover how it will influence the Composable.

newrecording.mov

Other Android Concepts

Multiple processes

Two services are launched in different processes and both of the have a RuntimeException().
One service crashes the app and the one that is in the separate process does not.

a865c3cb-fa81-48a1-9898-4595a19a16f9.mp4

Progress Animation

Canvas-Based Animation

A creative progress animation developed using Canvas, inspired by UX flame.

circle_loading.mp4

About

This is a collection of various code samples of Jetpack Compose and Kotin coroutines. The app is intended to demonstrate the correct and wrong usage of certain concepts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published