android / android/nowinandroid

[FR]: Provide examples of consuming UI events exactly once

Open
#52 0 comments 17 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
21.8k
Forks
4.6k
Avg merge
19h 20m
Merged PRs (30d)
2

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the problem

Since this seems to have become the most up to date modern android development sample, I think it would be a great idea to have it include at least one example of how one-time UI events should be handled. I am referring to this section https://developer.android.com/topic/architecture/ui-layer/events#views_3 from the documentation, which pushes people away from LiveData, Channel and other such approaches. To further assist devs into taking this approach instead, this sample could serve as an example of how to this right in a fully fledged app.

### Describe the solution

Particularly it'd be interesting to see handling one-time events like showing something to the screen once and then clearing the state as it's handled, or even more so, consuming events that require the app to navigate somewhere else. In my opinion these are two super common use cases while creating apps that would be great to exist inside the most up-to-date app example provided officially from Google.

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start with the Android UI events guidance linked in the issue and inspect the sample's existing UI event and navigation flows. Done means the app contains examples of showing a one-time UI message with state clearing and consuming an event that navigates elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.