Surface tracking search errors properly

This commit is contained in:
arkon 2021-01-22 22:47:01 -05:00
parent fdcbc4cffa
commit 16be469ecb
3 changed files with 7 additions and 5 deletions

View File

@ -2,10 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi">
<!-- Internet -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- For background jobs -->

View File

@ -99,6 +99,7 @@ class TrackController :
@Suppress("UNUSED_PARAMETER")
fun onSearchResultsError(error: Throwable) {
Timber.e(error)
activity?.toast(error.message)
getSearchDialog()?.onSearchResultsError()
}

View File

@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.core.os.bundleOf
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
@ -105,22 +104,22 @@ class TrackSearchDialog : DialogController {
private fun search(query: String) {
val binding = binding ?: return
binding.progress.isVisible = true
binding.trackSearchList.isInvisible = true
binding.trackSearchList.isVisible = false
trackController.presenter.search(query, service)
}
fun onSearchResults(results: List<TrackSearch>) {
selectedItem = null
val binding = binding ?: return
binding.progress.isInvisible = true
binding.progress.isVisible = false
binding.trackSearchList.isVisible = true
adapter?.setItems(results)
}
fun onSearchResultsError() {
val binding = binding ?: return
binding.progress.isVisible = true
binding.trackSearchList.isInvisible = true
binding.progress.isVisible = false
binding.trackSearchList.isVisible = false
adapter?.setItems(emptyList())
}