mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 07:11:52 +01:00
Swipe down updates active category. Closes #292. Not sure I'll keep this
This commit is contained in:
parent
62d5deaa6f
commit
7cc4405c09
@ -9,10 +9,12 @@ import com.f2prateek.rx.preferences.Preference
|
|||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||||
import eu.kanade.tachiyomi.event.LibraryMangaEvent
|
import eu.kanade.tachiyomi.event.LibraryMangaEvent
|
||||||
import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder
|
import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder
|
||||||
import eu.kanade.tachiyomi.ui.base.fragment.BaseFragment
|
import eu.kanade.tachiyomi.ui.base.fragment.BaseFragment
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaActivity
|
import eu.kanade.tachiyomi.ui.manga.MangaActivity
|
||||||
|
import eu.kanade.tachiyomi.util.toast
|
||||||
import kotlinx.android.synthetic.main.fragment_library_category.*
|
import kotlinx.android.synthetic.main.fragment_library_category.*
|
||||||
import rx.Subscription
|
import rx.Subscription
|
||||||
|
|
||||||
@ -99,6 +101,17 @@ class LibraryCategoryFragment : BaseFragment(), FlexibleViewHolder.OnListItemCli
|
|||||||
adapter.clearSelection()
|
adapter.clearSelection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swipe_refresh.setOnRefreshListener {
|
||||||
|
if (!LibraryUpdateService.isRunning(activity)) {
|
||||||
|
libraryPresenter.categories.getOrNull(position)?.let {
|
||||||
|
LibraryUpdateService.start(activity, true, it)
|
||||||
|
context.toast(R.string.updating_category)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// It can be a very long operation, so we disable swipe refresh and show a toast.
|
||||||
|
swipe_refresh.isRefreshing = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -4,12 +4,19 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<eu.kanade.tachiyomi.widget.AutofitRecyclerView
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/recycler"
|
android:id="@+id/swipe_refresh"
|
||||||
style="@style/Theme.Widget.GridView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:columnWidth="140dp"
|
|
||||||
tools:listitem="@layout/item_catalogue_grid"/>
|
<eu.kanade.tachiyomi.widget.AutofitRecyclerView
|
||||||
|
android:id="@+id/recycler"
|
||||||
|
style="@style/Theme.Widget.GridView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:columnWidth="140dp"
|
||||||
|
tools:listitem="@layout/item_catalogue_grid"/>
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
@ -190,6 +190,7 @@
|
|||||||
<!-- Library fragment -->
|
<!-- Library fragment -->
|
||||||
<string name="library_search_hint">Title or author…</string>
|
<string name="library_search_hint">Title or author…</string>
|
||||||
<string name="library_selection_title">Selected</string>
|
<string name="library_selection_title">Selected</string>
|
||||||
|
<string name="updating_category">Updating category</string>
|
||||||
|
|
||||||
<!-- Catalogue fragment -->
|
<!-- Catalogue fragment -->
|
||||||
<string name="source_requires_login">This source requires you to log in</string>
|
<string name="source_requires_login">This source requires you to log in</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user