This file contains 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
class CustomAlertDialog : DialogFragment() { | |
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { | |
AlertDialog.Builder(requireContext()) | |
.setMessage(getString(R.string.order_confirmation)) | |
.setPositiveButton(getString(R.string.ok)) { _,_ -> } | |
.create() | |
} | |
} |
This file contains 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
AlertDialog.Builder(context) | |
.setPositiveButton(R.string.ok) { dialog, id -> | |
// User clicked OK button | |
} | |
.setNegativeButton(R.string.cancel) { dialog, id -> | |
// User cancelled the dialog | |
} | |
.create() | |
.show() |
This file contains 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
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleEventObserver | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.lifecycleScope | |
import kotlinx.coroutines.InternalCoroutinesApi | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.launch |
This file contains 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
@Parcelize | |
data class Example(val id: String, val name: String) : Parcelable |
This file contains 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
class FirstScreenViewModel( | |
private val navigator: Navigator | |
) : ViewModel { | |
... | |
fun navigateExample() { | |
navigator.navigate(NavigationActions.FirstScreen.firstScreenToSecondScreen()) | |
} | |
This file contains 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
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.State | |
import androidx.compose.runtime.collectAsState | |
import androidx.compose.runtime.remember | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.flowWithLifecycle | |
import kotlinx.coroutines.flow.Flow | |
@Composable |