This file contains hidden or 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
fun <A: Activity, R> ActivityScenario<T>.letInActivity(callback: (A) -> R): R { | |
data class NullWrapper<T>(val value: T) | |
lateinit var result: NullWrapper<R> | |
onActivity { activity -> result = NullWrapper(callback(activity)) } | |
return result.value | |
} |
This file contains hidden or 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 org.oppia.domain.oppialogger.analytics | |
import android.content.Context | |
import androidx.lifecycle.LiveData | |
import kotlinx.coroutines.CoroutineDispatcher | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.launch | |
import org.oppia.app.model.EventLog | |
import org.oppia.app.model.EventLog.EventAction | |
import org.oppia.app.model.EventLog.Priority |
This file contains hidden or 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 org.oppia.app.testing | |
import android.content.Context | |
import android.content.res.Configuration | |
import android.view.View | |
import androidx.recyclerview.widget.GridLayoutManager | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.test.core.app.ActivityScenario.launch | |
import androidx.test.core.app.ApplicationProvider | |
import androidx.test.espresso.intent.Intents |
This file contains hidden or 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
// Based on structure in https://gist.github.com/BenHenning/0e3a3c4a798dbe4ffb884144e2b7e592. | |
private const val CACHE_NAME = "topic_progress_database" | |
private const val CHAPTER_PROGRESS_ID = "ChapterProgressDataProvider" | |
class StoryProgressController @Inject constructor(private val persistentCacheStoreFactory: PersistentCacheStore.Factory, private val dataProviders: DataProviders) { | |
private val cacheStoreMap = mutableMapOf<ProfileId, PersistentCacheStore<TopicProgressDatabase>>() | |
fun lookUpChapterProgress(val topicId, val storyId, val explorationId, profileId: ProfileId): DataProvider<ChapterPlayState> { | |
return dataProviders.transform(retrieveCacheStore(profileId), CHAPTER_PROGRESS_ID) { database -> |
This file contains hidden or 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
message TopicProgressDatabase { | |
// Map from topic ID to TopicProgress. | |
map<string, TopicProgress> topic_progress = 1; | |
} | |
message TopicProgress { | |
// Map from story ID to StoryProgress. | |
map<string, StoryProgress> story_progress = 1; | |
} |
This file contains hidden or 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
* What went wrong: | |
Execution failed for task ':app:checkDebugAndroidTestDuplicateClasses'. | |
> 1 exception was raised by workers: | |
java.lang.RuntimeException: java.lang.RuntimeException: Duplicate class org.apache.maven.artifact.Artifact found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1) | |
Duplicate class org.apache.maven.artifact.ArtifactStatus found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1) | |
Duplicate class org.apache.maven.artifact.ArtifactUtils found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1) | |
Duplicate class org.apache.maven.artifact.DefaultArtifact found in modules maven-ant-tasks-2.1.3.jar (org.apache.maven:maven-ant-tasks:2.1.3) and maven-artifact-2.2.1.jar (org.apache.maven:maven-artifact:2.2.1 |
This file contains hidden or 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
var errorText: ObservableField("") | |
fun onSubmitClicked() { | |
val answerErrorStr = getPendingAnswerError() | |
if (answerErrorStr != null) { | |
errorText.set(answerErrorStr) | |
} else { | |
// No error--submit like normal. | |
} | |
} |
This file contains hidden or 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
fun <V> storeDataWithCustomChannelAsync(updateInMemoryCache: Boolean = true, update: (T) -> T, V): Deferred<V> { | |
return cache.updateIfPresentAsync { cachedPayload -> | |
// Although it's odd to notify before the change is made, the single threaded nature of the blocking cache ensures | |
// nothing can read from it until this update completes. | |
asyncDataSubscriptionManager.notifyChange(providerId) | |
val updatedPayload, channelValue = storeFileCache(cachedPayload, update) | |
if (updateInMemoryCache) (updatedPayload, channelValue) else (cachedPayload, channelValue) | |
} | |
} | |
This file contains hidden or 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
interface ImageLoader { | |
fun load(imageUrl: String, target: CustomTarget<Bitmap>) | |
} | |
class GlideImageLoader @Inject constructor(...): ImageLoader { | |
override fun load(...) { | |
.. | |
} | |
} |
NewerOlder