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
/* | |
* Copyright 2021 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
package com.example.myapplication | |
import android.annotation.SuppressLint | |
import androidx.annotation.MainThread | |
import androidx.annotation.NonNull | |
import androidx.annotation.Nullable | |
import androidx.arch.core.executor.ArchTaskExecutor | |
import androidx.arch.core.internal.SafeIterableMap | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.Lifecycle.State.DESTROYED |
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
<androidx.constraintlayout.helper.widget.Layer | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
app:constraint_referenced_ids="card1, card2, card3" | |
/> |
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
<androidx.constraintlayout.helper.widget.Flow | |
android:layout_width="0dp" | |
android:layout_height="wrap_content" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintTop_toTopOf="parent" | |
app:flow_wrapMode="chain" | |
app:constraint_referenced_ids="card1, card2, card3" | |
/> |
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 <T> uiStateFrom( | |
repositoryCall: RepositoryCall<T> | |
): UiState<T> { | |
var state: UiState<T> by state<UiState<T>> { UiState.Loading } | |
onCommit(repositoryCall) { | |
state = UiState.Loading // we're loading again whenever repositoryCall changes | |
repositoryCall { result -> | |
state = when (result) { |
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
/* | |
* Copyright 2020 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Copyright 2020 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
/* | |
* Copyright 2020 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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.* | |
import androidx.ui.foundation.Text | |
import androidx.ui.graphics.Color | |
import androidx.ui.layout.Column | |
import androidx.ui.material.Button | |
import androidx.ui.material.Checkbox | |
import androidx.ui.material.MaterialTheme | |
import androidx.ui.material.Surface | |
import androidx.ui.tooling.preview.Preview |
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
<!-- activity_awesome.xml --> | |
<androidx.constraintlayout.widget.ConstraintLayout> | |
<include android:id="@+id/includes" layout="@layout/included_buttons" | |
</androidx.constraintlayout.widget.ConstraintLayout> | |
<!-- included_buttons.xml --> | |
<androidx.constraintlayout.widget.ConstraintLayout> | |
<Button android:id="@+id/include_me" /> | |
</androidx.constraintlayout.widget.ConstraintLayout> |
NewerOlder