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
e: java.lang.IllegalStateException: Backend Internal error: Exception during code generation | |
Element is unknownThe root cause java.util.NoSuchElementException was thrown at: androidx.compose.plugins.kotlin.compiler.lower.ComposableCallTransformer.irComposableExpr(ComposableCallTransformer.kt:1362) | |
at org.jetbrains.kotlin.codegen.CompilationErrorHandler.lambda$static$0(CompilationErrorHandler.java:35) | |
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:93) | |
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm$default(JvmBackendFacade.kt:64) | |
at org.jetbrains.kotlin.backend.jvm.JvmBackendFacade.doGenerateFilesInternal$backend_jvm(JvmBackendFacade.kt:52) | |
at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:36) | |
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:47) | |
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles |
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.usabilla.coroutines | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.async | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.catch | |
import kotlinx.coroutines.flow.collect |
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 kotlin.test.assertEquals | |
import kotlin.test.assertTrue | |
internal class Verifier<T> { | |
val function: (T) -> Unit = { | |
invokedValues.add(it) | |
} | |
private var invokedValues = mutableListOf<T>() |
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
apply plugin: 'com.android.application' | |
apply from: "$rootDir/coverage.gradle" | |
//... | |
android { | |
//... | |
buildTypes { | |
//... | |
debug { |
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.gumil.giphy.list | |
import androidx.arch.core.executor.testing.InstantTaskExecutorRule | |
import androidx.lifecycle.Observer | |
import com.gumil.giphy.GiphyItem | |
import com.gumil.giphy.ImageItem | |
import com.gumil.giphy.R | |
import com.gumil.giphy.TestRepository | |
import com.gumil.giphy.UserItem | |
import com.gumil.giphy.util.just |
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
fun ListState.render(): Unit? = when (this) { | |
is ListState.Screen -> { | |
when(loadingMode) { | |
ListState.Mode.REFRESH -> { swipeRefreshLayout.isRefreshing = true } | |
ListState.Mode.LOAD_MORE -> adapter.showFooter() | |
ListState.Mode.IDLE_LOAD_MORE -> { | |
adapter.addItems(giphies) | |
isLoading = false | |
restoreRecyclerView(giphies) |
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
fun actions() = Observable.merge<ListAction>( | |
recyclerView.scrollEvents() | |
// filter when we do a scroll up | |
.filter { it.dy > 0 } | |
// filter when recyclerView is currently loading | |
.filter { !isLoading } | |
// filter threshold | |
.filter { | |
val layoutManager = it.view.layoutManager as StaggeredGridLayoutManager | |
val visibleItemCount = recyclerView.childCount |
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
fun <A : ListAction> Observable<ActionState<A, ListState>>.loadTrending( | |
mode: ListState.Mode, | |
offset: Int = 0, | |
limit: Int = 10, | |
listStateFunction: (ListState.Screen, List<GiphyItem>) -> ListState.Screen | |
): Observable<ListState> = this | |
.map { it.state as ListState.Screen } | |
.flatMap { state -> | |
repository.getTrending(offset, limit) | |
.map { giphies -> |
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
on<ListAction.Refresh> { | |
flatMap { | |
if (it.action.limit > ListAction.DEFAULT_LIMIT) { | |
cache.get<List<GiphyItem>>(GiphyListViewModel.KEY_GIPHIES)?.let { giphies -> | |
return@flatMap ListState.Screen(giphies, ListState.Mode.IDLE_REFRESH).just() | |
} | |
} | |
loadTrending(ListState.Mode.REFRESH, limit = it.action.limit) { _, list -> | |
ListState.Screen(list, ListState.Mode.IDLE_REFRESH) |
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
Kaskade.create<ListAction, ListState>(ListState.Screen()) { | |
rx({ | |
object : DisposableObserver<ListState>() { | |
override fun onComplete() { | |
Timber.d("flow completed") | |
} | |
override fun onNext(state: ListState) { | |
Timber.d("currentState = $state") | |
} |
NewerOlder