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
@Composable | |
fun TextFieldScreen() { | |
Column( | |
horizontalAlignment = Alignment.CenterHorizontally, | |
verticalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterVertically) | |
) { | |
val context = LocalContext.current | |
val (email, onEmailChange) = remember { |
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
@OptIn(ExperimentalFoundationApi::class) | |
@Composable | |
fun Button( | |
onClick: () -> Unit, | |
onLongClick: () -> Unit, | |
modifier: Modifier = Modifier, | |
shape: Shape = ButtonDefaults.shape, | |
containerColor: Color, | |
contentColor: Color, | |
border: BorderStroke? = null, |
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
val instanceName = if (BuildConfig.DEBUG) "beserved-development" else "beserved-production" | |
FirebaseApp.getInstance(instanceName) |
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 App : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
val devOptions = FirebaseOptions.Builder() | |
.setProjectId("beserved-development-project") | |
.setApplicationId("1:212877806437:android:fee5f52927e2f7a907ed8c") | |
.setApiKey("AIzaSyADUe90ULnQDuGShD9W23RDP0xmeDc6Mvw") | |
.build() | |
val prodOptions = FirebaseOptions.Builder() | |
.setProjectId("beserved-production-project") |
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
val options = FirebaseOptions.Builder() | |
.setProjectId("my-firebase-project") | |
.setApplicationId("1:27992087142:android:ce3b6448250083d1") | |
.setApiKey("AIzaSyADUe90ULnQDuGShD9W23RDP0xmeDc6Mvw") | |
.build() |
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
private val postViewModel: PostViewModel by fragmentViewModel() |
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
override fun invalidate(): Unit = withState(postViewModel) { | |
binding.progess.isVisible = it.post is Loading | |
when (it.post) { | |
is Success -> { | |
binding.progess.visibility = View.GONE | |
adapter.submitList(it.post.invoke()) | |
} | |
is Fail -> { | |
Toast.makeText( requireContext(), "An error occured", Toast.LENGTH_SHORT).show() | |
Log.e("message", it.post.error.localizedMessage) |
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
private val postViewModel: PostViewModel by fragmentViewModel() |
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
override fun invalidate(): Unit = withState(postViewModel) { | |
binding.progess.isVisible = it.post is Loading | |
when (it.post) { | |
is Success -> { | |
binding.progess.visibility = View.GONE | |
adapter.submitList(it.post.invoke()) | |
} | |
is Fail -> { | |
Toast.makeText( requireContext(), "An error occured", Toast.LENGTH_SHORT).show() | |
Log.e("message", it.post.error.localizedMessage) |
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
data class PostState( | |
val post: Async<List<Post>> = Uninitialized | |
) : MavericksState |
NewerOlder