For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Used as a wrapper for data that is exposed via a LiveData that represents an event. | |
| */ | |
| open class Event<out T>(private val content: T) { | |
| var hasBeenHandled = false | |
| private set // Allow external read but not write | |
| /** | |
| * Returns the content and prevents its use again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has | |
| * already been handled. | |
| * | |
| * [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. | |
| */ | |
| class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> { | |
| override fun onChanged(event: Event<T>?) { | |
| event?.getContentIfNotHandled()?.let { value -> | |
| onEventUnhandledContent(value) |
Answer: As a user navigates through, out of, and back to your app, the Activity instances in your app transition through different states in their lifecycle.
To navigate transitions between stages of the activity lifecycle, the Activity class provides a core set of six callbacks: onCreate(), onStart(), onResume(), onPause(), onStop(), and onDestroy(). The system invokes each of these callbacks as an activity enters a new state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package br.com.nglauber.jetpackcomposeplayground.screens | |
| import androidx.compose.foundation.background | |
| import androidx.compose.foundation.layout.* | |
| import androidx.compose.foundation.lazy.LazyColumn | |
| import androidx.compose.foundation.lazy.LazyRow | |
| import androidx.compose.foundation.lazy.items | |
| import androidx.compose.foundation.shape.RoundedCornerShape | |
| import androidx.compose.material.MaterialTheme | |
| import androidx.compose.material.Text |