Fix crashing on search
This commit is contained in:
parent
b43399cc02
commit
0cfe61f65b
2 changed files with 3 additions and 6 deletions
|
@ -18,10 +18,7 @@ import code.name.monkey.retromusic.mvp.BaseView
|
||||||
import code.name.monkey.retromusic.mvp.Presenter
|
import code.name.monkey.retromusic.mvp.Presenter
|
||||||
import code.name.monkey.retromusic.mvp.PresenterImpl
|
import code.name.monkey.retromusic.mvp.PresenterImpl
|
||||||
import code.name.monkey.retromusic.providers.interfaces.Repository
|
import code.name.monkey.retromusic.providers.interfaces.Repository
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
|
@ -55,7 +52,7 @@ interface SearchPresenter : Presenter<SearchView> {
|
||||||
override fun search(query: String?) {
|
override fun search(query: String?) {
|
||||||
launch {
|
launch {
|
||||||
val result = repository.search(query)
|
val result = repository.search(query)
|
||||||
view?.showData(result)
|
withContext(Dispatchers.Main) { view?.showData(result) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:paddingVertical="12dp"
|
android:paddingVertical="12dp"
|
||||||
android:textAppearance="@style/TextViewHeadline6"
|
android:textAppearance="@style/TextViewOverline"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
tools:text="@tools:sample/full_names" />
|
tools:text="@tools:sample/full_names" />
|
Loading…
Reference in a new issue