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 ProfileViewModel : ViewModel() { | |
private val _name = MutableStateFlow("Ada") | |
private val _lastName = MutableStateFlow("Lovelace") | |
private val _likes = MutableStateFlow(0) | |
val name: StateFlow<String> = _name | |
val lastName: StateFlow<String> = _lastName | |
val likes: StateFlow<Int> = _likes | |
// popularity is exposed as StateFlow using a transformation and the stateIn operator. |
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
-keep class com.example.myapplication.Person { | |
public java.lang.String name; | |
} |
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
// app/build.gradle | |
android { | |
... | |
dynamicFeatures = [":camera", ":video", ":payment"] | |
} |
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
// payment/build.gradle | |
dependencies { | |
implementation project(':app') | |
} | |
// camera/build.gradle | |
dependencies { | |
implementation project(':app') | |
} |
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
<fragment | |
android:id="@+id/nav_host_fragment" | |
android:name="androidx.navigation.fragment.NavHostFragment" | |
app:navGraph="@navigation/nav_graph" | |
… /> |
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
<fragment | |
android:id="@+id/nav_host_fragment" | |
android:name="androidx.navigation.dynamicfeatures. | |
fragment.DynamicNavHostFragment" | |
app:navGraph="@navigation/nav_graph" | |
… /> |
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
<navigation> | |
<fragment | |
app:moduleName="featureA" | |
android:name="full.path.to.MyFragment"/> | |
<activity | |
app:moduleName="featureB" | |
android:name="full.path.to.MyActivity"/> | |
</navigation> |
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
dependencies { | |
def nav_version = "2.3.0-alpha04" | |
api "androidx.navigation:navigation-fragment-ktx:$nav_version" | |
api "androidx.navigation:navigation-ui-ktx:$nav_version" | |
api "androidx.navigation:navigation-dynamic-features-fragment:$nav_version" | |
} |
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 listener = SplitInstallStateUpdatedListener( | |
onRequiresConfirmation = { state -> // ← REQUIRED ARGUMENTS | |
// HANDLE CONFIRMATION DIALOG | |
}, | |
onInstalled = { | |
// HANDLE INSTALLED STATE | |
}, | |
onDownloading = { state -> // ← OPTIONAL ARGUMENTS | |
// SHOW PROGRESS | |
}, |
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
viewModelScope.launch { | |
manager.requestProgressFlow() | |
.filter { "myModule" in it.moduleNames } | |
.collect { state -> … } | |
} |
NewerOlder