mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 11:51:50 +01:00
Cleanup + pull to refresh on web view
This commit is contained in:
parent
d4ae7d2825
commit
4b8373367b
@ -8,14 +8,12 @@ import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
@ -98,6 +96,9 @@ class WebViewActivity : BaseActivity() {
|
||||
0, insets.systemWindowInsetBottom
|
||||
)
|
||||
}
|
||||
swipe_refresh.setOnRefreshListener {
|
||||
refreshPage()
|
||||
}
|
||||
|
||||
content.setOnApplyWindowInsetsListener { v, insets ->
|
||||
window.statusBarColor = getResourceColor(R.attr.colorPrimary)
|
||||
@ -122,6 +123,8 @@ class WebViewActivity : BaseActivity() {
|
||||
insets
|
||||
}
|
||||
|
||||
swipe_refresh.isEnabled = false
|
||||
|
||||
if (bundle == null) {
|
||||
val source = sourceManager.get(intent.extras!!.getLong(SOURCE_KEY)) as? HttpSource ?: return
|
||||
val url = intent.extras!!.getString(URL_KEY) ?: return
|
||||
@ -136,11 +139,14 @@ class WebViewActivity : BaseActivity() {
|
||||
super.onPageFinished(view, url)
|
||||
invalidateOptionsMenu()
|
||||
title = view?.title
|
||||
swipe_refresh.isEnabled = true
|
||||
swipe_refresh?.isRefreshing = false
|
||||
}
|
||||
|
||||
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||
super.onPageStarted(view, url, favicon)
|
||||
invalidateOptionsMenu()
|
||||
//swipe_refresh.isEnabled = false
|
||||
}
|
||||
}
|
||||
val marginB = webview.marginBottom
|
||||
@ -160,6 +166,10 @@ class WebViewActivity : BaseActivity() {
|
||||
webview.restoreState(bundle)
|
||||
}
|
||||
}
|
||||
private fun refreshPage() {
|
||||
swipe_refresh.isRefreshing = true
|
||||
webview.reload()
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
|
@ -1,16 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/web_view_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<LinearLayout
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/web_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
@ -23,10 +26,14 @@
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
@ -35,4 +42,6 @@
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -161,7 +161,6 @@
|
||||
<string name="services">Services</string>
|
||||
<!-- Advanced section -->
|
||||
<string name="used_cache">Utilisé : %1$s</string>
|
||||
<string name="cache_deleted">Cache effacé. %1$d fichiers ont été supprimés</string>
|
||||
<string name="cache_delete_error">Une erreur est survenue lors de l\'effacement du cache</string>
|
||||
<string name="pref_clear_cookies">Effacer cookies</string>
|
||||
<string name="cookies_cleared">Cookies effacés</string>
|
||||
@ -363,7 +362,6 @@
|
||||
<string name="backup_choice">Que voulez-vous sauvegarder ?</string>
|
||||
<string name="invalid_combination">Le défaut ne peut pas être selectionné avec des autres catégories</string>
|
||||
<string name="delete_downloads_for_manga">Supprimer les chapitres téléchargés ?</string>
|
||||
<string name="notification_new_chapters_text">Pour %1$d chapitres</string>
|
||||
<string name="track">Suivi</string>
|
||||
<string name="action_sort_total">Nombre de chapitres</string>
|
||||
<string name="short_recent_updates">Mises à jour</string>
|
||||
@ -478,16 +476,12 @@ Assurez-vous que vous êtes connecté à des sources qui le demande avant de com
|
||||
<string name="filter_mode_overlay">Interface</string>
|
||||
<string name="label_help">Aide</string>
|
||||
<string name="pref_library_update_prioritization">Ordre de mise à jour de la librairie</string>
|
||||
<string name="pref_library_update_prioritization_summary">Sélectionnez l\'ordre auquel Tachiyomi doit vérifier les mises à jour</string>
|
||||
<string name="system_theme">Par défaut système</string>
|
||||
<string name="system_darkblue_theme">Par défaut système (Bleu foncé)</string>
|
||||
<string name="system_amoled_theme">Par défaut système (AMOLED)</string>
|
||||
<string name="pref_library_update_prioritization">Ordre de mise à jour de la bibliothèque</string>
|
||||
<string name="pref_library_update_prioritization_summary">Sélectionnez l\'ordre dans lequel Tachiyomi doit vérifier si des mises à jour sont disponibles</string>
|
||||
<string name="filter_mode_lighten">Densité/Éclaircir</string>
|
||||
<string name="filter_mode_darken">Brûlé / Assombri</string>
|
||||
<string name="action_forward">Suivant</string>
|
||||
<string name="action_refresh">Actualiser</string>
|
||||
<string name="action_webview_forward">Suivant</string>
|
||||
<string name="no_results_found">Aucun résultats trouvés</string>
|
||||
<string name="migration_selection_prompt">Sélectionner une source depuis laquelle migrer</string>
|
||||
</resources>
|
@ -168,6 +168,7 @@
|
||||
<string name="pref_library_update_categories">Categories to include in global update</string>
|
||||
<string name="all">All</string>
|
||||
<string name="pref_library_update_prioritization">Library update order</string>
|
||||
<string name="pref_library_update_prioritization_summary">Select the order in which Tachiyomi checks for update</string>
|
||||
<string name="pref_library_update_restriction">Library update restrictions</string>
|
||||
<string name="pref_library_update_restriction_summary">Update only when the conditions are met</string>
|
||||
<string name="wifi">Wi-Fi</string>
|
||||
|
Loading…
Reference in New Issue
Block a user