Fix crashing on search

This commit is contained in:
Hemanth S 2020-06-06 16:39:27 +05:30
parent b43399cc02
commit 0cfe61f65b
2 changed files with 3 additions and 6 deletions

View file

@ -18,10 +18,7 @@ import code.name.monkey.retromusic.mvp.BaseView
import code.name.monkey.retromusic.mvp.Presenter
import code.name.monkey.retromusic.mvp.PresenterImpl
import code.name.monkey.retromusic.providers.interfaces.Repository
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlinx.coroutines.*
import javax.inject.Inject
import kotlin.coroutines.CoroutineContext
@ -55,7 +52,7 @@ interface SearchPresenter : Presenter<SearchView> {
override fun search(query: String?) {
launch {
val result = repository.search(query)
view?.showData(result)
withContext(Dispatchers.Main) { view?.showData(result) }
}
}
}

View file

@ -8,6 +8,6 @@
android:gravity="start"
android:paddingHorizontal="16dp"
android:paddingVertical="12dp"
android:textAppearance="@style/TextViewHeadline6"
android:textAppearance="@style/TextViewOverline"
android:textStyle="bold"
tools:text="@tools:sample/full_names" />