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" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi"> package="eu.kanade.tachiyomi">
<!-- Internet -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- Storage -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- For background jobs --> <!-- For background jobs -->

View File

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

View File

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