-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LifecycleOwner support to BindableAdapter.
This is in response to an issue found in #2392. See this commit's PR description for more details.
- Loading branch information
1 parent
1144075
commit b4dc253
Showing
14 changed files
with
554 additions
and
209 deletions.
There are no files selected for viewing
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
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
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
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
16 changes: 16 additions & 0 deletions
16
app/src/main/java/org/oppia/android/app/testing/BindableAdapterTestDataModel.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.oppia.android.app.testing | ||
|
||
import androidx.lifecycle.LiveData | ||
|
||
/** Test data model for bindable adapter tests. */ | ||
sealed class BindableAdapterTestDataModel { | ||
val boundStringValue get() = (this as StringModel).stringValue | ||
val boundIntValue get() = (this as IntModel).intValue | ||
val boundLiveDataValue get() = (this as LiveDataModel).liveData | ||
|
||
data class StringModel(val stringValue: String) : BindableAdapterTestDataModel() | ||
|
||
data class IntModel(val intValue: Int) : BindableAdapterTestDataModel() | ||
|
||
data class LiveDataModel(val liveData: LiveData<String>) : BindableAdapterTestDataModel() | ||
} |
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
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
Oops, something went wrong.