Tweak error button appearance

This commit is contained in:
arkon 2020-03-29 12:10:36 -04:00
parent 920ffa8c24
commit e86103fdcc
3 changed files with 13 additions and 9 deletions

View File

@ -366,15 +366,17 @@ open class BrowseCatalogueController(bundle: Bundle) :
} }
presenter.requestNext() presenter.requestNext()
} }
if (adapter.isEmpty) {
val actions = mutableListOf(EmptyView.Action(R.string.action_retry, retryAction))
if (presenter.source is HttpSource) {
val openInWebViewAction = View.OnClickListener { val openInWebViewAction = View.OnClickListener {
openInWebView() openInWebView()
} }
actions += EmptyView.Action(R.string.action_open_in_web_view, openInWebViewAction)
}
if (adapter.isEmpty) { empty_view.show(message, actions)
empty_view.show(message, listOf(
EmptyView.Action(R.string.action_retry, retryAction),
EmptyView.Action(R.string.action_open_in_web_view, openInWebViewAction)
))
} else { } else {
empty_view.hide() empty_view.hide()

View File

@ -3,10 +3,10 @@ package eu.kanade.tachiyomi.widget
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.widget.Button
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.appcompat.widget.AppCompatButton
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.visible import eu.kanade.tachiyomi.util.view.visible
@ -44,7 +44,7 @@ class EmptyView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
actions_container.removeAllViews() actions_container.removeAllViews()
if (!actions.isNullOrEmpty()) { if (!actions.isNullOrEmpty()) {
actions.forEach { actions.forEach {
val button = Button(context).apply { val button = AppCompatButton(context).apply {
layoutParams = LinearLayout.LayoutParams( layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT) LinearLayout.LayoutParams.WRAP_CONTENT)

View File

@ -50,6 +50,7 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="dialogTheme">@style/Theme.AlertDialog.Light</item> <item name="dialogTheme">@style/Theme.AlertDialog.Light</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item> <item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
<item name="buttonStyle">@style/Theme.Widget.Button.Outlined.Accent</item>
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item> <item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item> <item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item> <item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>
@ -127,6 +128,7 @@
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="dialogTheme">@style/Theme.AlertDialog.Dark</item> <item name="dialogTheme">@style/Theme.AlertDialog.Dark</item>
<item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item> <item name="alertDialogTheme">@style/Theme.AlertDialog.Dark</item>
<item name="buttonStyle">@style/Theme.Widget.Button.Outlined.Accent</item>
<item name="snackbarButtonStyle">@style/Theme.Widget.Button</item> <item name="snackbarButtonStyle">@style/Theme.Widget.Button</item>
<item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item> <item name="textAppearanceButton">@style/TextAppearance.Widget.Button</item>
<item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item> <item name="android:itemTextAppearance">@style/TextAppearance.Widget.Menu</item>