mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 05:45:07 +01:00
parent
e571fcb1be
commit
21953424c0
@ -209,6 +209,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
|
|||||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||||
super.onChangeStarted(handler, type)
|
super.onChangeStarted(handler, type)
|
||||||
if (!type.isPush && handler is SettingsSourcesFadeChangeHandler) {
|
if (!type.isPush && handler is SettingsSourcesFadeChangeHandler) {
|
||||||
|
view?.applyWindowInsetsForRootController(activity!!.bottom_nav)
|
||||||
ext_bottom_sheet.updateExtTitle()
|
ext_bottom_sheet.updateExtTitle()
|
||||||
ext_bottom_sheet.presenter.refreshExtensions()
|
ext_bottom_sheet.presenter.refreshExtensions()
|
||||||
}
|
}
|
||||||
|
@ -61,13 +61,17 @@ import eu.kanade.tachiyomi.util.system.toast
|
|||||||
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
|
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
|
||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
||||||
|
import eu.kanade.tachiyomi.util.view.setStyle
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||||
import kotlinx.android.synthetic.main.filter_bottom_sheet.*
|
import kotlinx.android.synthetic.main.filter_bottom_sheet.*
|
||||||
import kotlinx.android.synthetic.main.library_grid_recycler.*
|
import kotlinx.android.synthetic.main.library_grid_recycler.*
|
||||||
|
import kotlinx.android.synthetic.main.library_grid_recycler.recycler
|
||||||
import kotlinx.android.synthetic.main.library_list_controller.*
|
import kotlinx.android.synthetic.main.library_list_controller.*
|
||||||
|
import kotlinx.android.synthetic.main.library_list_controller.swipe_refresh
|
||||||
import kotlinx.android.synthetic.main.main_activity.*
|
import kotlinx.android.synthetic.main.main_activity.*
|
||||||
|
import kotlinx.android.synthetic.main.recents_controller.*
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
@ -262,7 +266,7 @@ class LibraryController(
|
|||||||
|
|
||||||
val tv = TypedValue()
|
val tv = TypedValue()
|
||||||
activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true)
|
activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true)
|
||||||
|
swipe_refresh.setStyle()
|
||||||
scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh) { insets ->
|
scrollViewWith(recycler, swipeRefreshLayout = swipe_refresh) { insets ->
|
||||||
fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
fast_scroller.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
topMargin = insets.systemWindowInsetTop
|
topMargin = insets.systemWindowInsetTop
|
||||||
@ -392,6 +396,7 @@ class LibraryController(
|
|||||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||||
super.onChangeStarted(handler, type)
|
super.onChangeStarted(handler, type)
|
||||||
if (type.isEnter) {
|
if (type.isEnter) {
|
||||||
|
view?.applyWindowInsetsForRootController(activity!!.bottom_nav)
|
||||||
presenter.getLibrary()
|
presenter.getLibrary()
|
||||||
DownloadService.callListeners()
|
DownloadService.callListeners()
|
||||||
LibraryUpdateService.setListener(this)
|
LibraryUpdateService.setListener(this)
|
||||||
|
@ -98,6 +98,7 @@ import eu.kanade.tachiyomi.util.system.toast
|
|||||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.view.getText
|
import eu.kanade.tachiyomi.util.view.getText
|
||||||
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
||||||
|
import eu.kanade.tachiyomi.util.view.setStyle
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||||
@ -218,6 +219,7 @@ class MangaDetailsController : BaseController,
|
|||||||
array.recycle()
|
array.recycle()
|
||||||
val offset = 10.dpToPx
|
val offset = 10.dpToPx
|
||||||
var statusBarHeight = -1
|
var statusBarHeight = -1
|
||||||
|
swipe_refresh.setStyle()
|
||||||
swipe_refresh.setDistanceToTriggerSync(70.dpToPx)
|
swipe_refresh.setDistanceToTriggerSync(70.dpToPx)
|
||||||
|
|
||||||
recycler.doOnApplyWindowInsets { v, insets, _ ->
|
recycler.doOnApplyWindowInsets { v, insets, _ ->
|
||||||
|
@ -25,6 +25,7 @@ import eu.kanade.tachiyomi.ui.manga.chapter.BaseChapterAdapter
|
|||||||
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
import eu.kanade.tachiyomi.ui.reader.ReaderActivity
|
||||||
import eu.kanade.tachiyomi.util.system.notificationManager
|
import eu.kanade.tachiyomi.util.system.notificationManager
|
||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
|
import eu.kanade.tachiyomi.util.view.setStyle
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import kotlinx.android.synthetic.main.download_bottom_sheet.*
|
import kotlinx.android.synthetic.main.download_bottom_sheet.*
|
||||||
import kotlinx.android.synthetic.main.recent_chapters_controller.*
|
import kotlinx.android.synthetic.main.recent_chapters_controller.*
|
||||||
@ -81,7 +82,7 @@ class RecentChaptersController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
ItemTouchHelper.LEFT
|
ItemTouchHelper.LEFT
|
||||||
)
|
)
|
||||||
if (presenter.chapters.isNotEmpty()) adapter?.updateDataSet(presenter.chapters.toList())
|
if (presenter.chapters.isNotEmpty()) adapter?.updateDataSet(presenter.chapters.toList())
|
||||||
|
swipe_refresh.setStyle()
|
||||||
swipe_refresh.setDistanceToTriggerSync((2 * 64 * view.resources.displayMetrics.density).toInt())
|
swipe_refresh.setDistanceToTriggerSync((2 * 64 * view.resources.displayMetrics.density).toInt())
|
||||||
swipe_refresh.setOnRefreshListener {
|
swipe_refresh.setOnRefreshListener {
|
||||||
if (!LibraryUpdateService.isRunning()) {
|
if (!LibraryUpdateService.isRunning()) {
|
||||||
|
@ -36,6 +36,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx
|
|||||||
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
|
import eu.kanade.tachiyomi.util.view.applyWindowInsetsForRootController
|
||||||
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
import eu.kanade.tachiyomi.util.view.scrollViewWith
|
||||||
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
import eu.kanade.tachiyomi.util.view.setOnQueryTextChangeListener
|
||||||
|
import eu.kanade.tachiyomi.util.view.setStyle
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||||
@ -59,6 +60,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
|
retainViewMode = RetainViewMode.RETAIN_DETACH
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -105,6 +107,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
val array = view.context.obtainStyledAttributes(attrsArray)
|
val array = view.context.obtainStyledAttributes(attrsArray)
|
||||||
val appBarHeight = array.getDimensionPixelSize(0, 0)
|
val appBarHeight = array.getDimensionPixelSize(0, 0)
|
||||||
array.recycle()
|
array.recycle()
|
||||||
|
swipe_refresh.setStyle()
|
||||||
scrollViewWith(recycler, skipFirstSnap = true, swipeRefreshLayout = swipe_refresh) {
|
scrollViewWith(recycler, skipFirstSnap = true, swipeRefreshLayout = swipe_refresh) {
|
||||||
headerHeight = it.systemWindowInsetTop + appBarHeight
|
headerHeight = it.systemWindowInsetTop + appBarHeight
|
||||||
}
|
}
|
||||||
@ -150,20 +153,15 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
shadow.alpha = if (state == BottomSheetBehavior.STATE_COLLAPSED) 0.5f else 0f
|
shadow.alpha = if (state == BottomSheetBehavior.STATE_COLLAPSED) 0.5f else 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
retainViewMode =
|
|
||||||
if (state == BottomSheetBehavior.STATE_EXPANDED) RetainViewMode.RETAIN_DETACH else RetainViewMode.RELEASE_DETACH
|
|
||||||
sheet_layout?.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
|
sheet_layout?.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
|
||||||
sheet_layout?.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
|
sheet_layout?.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
|
||||||
setPadding(dl_bottom_sheet.sheetBehavior?.isHideable == true)
|
setPadding(dl_bottom_sheet.sheetBehavior?.isHideable == true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
swipe_refresh.isRefreshing = LibraryUpdateService.isRunning()
|
||||||
swipe_refresh.setOnRefreshListener {
|
swipe_refresh.setOnRefreshListener {
|
||||||
if (!LibraryUpdateService.isRunning()) {
|
if (!LibraryUpdateService.isRunning()) {
|
||||||
LibraryUpdateService.start(view.context)
|
LibraryUpdateService.start(view.context)
|
||||||
snack = view.snack(R.string.updating_library) {
|
|
||||||
anchorView = (activity as? MainActivity)?.bottom_nav
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,15 +171,16 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
setPadding(dl_bottom_sheet.sheetBehavior?.isHideable == true)
|
setPadding(dl_bottom_sheet.sheetBehavior?.isHideable == true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemMove(fromPosition: Int, toPosition: Int) {
|
fun reEnableSwipe() {
|
||||||
|
swipe_refresh.isRefreshing = false
|
||||||
}
|
}
|
||||||
|
override fun onItemMove(fromPosition: Int, toPosition: Int) { }
|
||||||
|
|
||||||
override fun shouldMoveItem(fromPosition: Int, toPosition: Int): Boolean {
|
override fun shouldMoveItem(fromPosition: Int, toPosition: Int) = true
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onActionStateChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
|
override fun onActionStateChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) {
|
||||||
swipe_refresh.isEnabled = actionState != ItemTouchHelper.ACTION_STATE_SWIPE
|
swipe_refresh.isEnabled = actionState != ItemTouchHelper.ACTION_STATE_SWIPE ||
|
||||||
|
swipe_refresh.isRefreshing
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleSheetBack(): Boolean {
|
override fun handleSheetBack(): Boolean {
|
||||||
@ -217,6 +216,7 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
fun refresh() = presenter.getRecents()
|
fun refresh() = presenter.getRecents()
|
||||||
|
|
||||||
fun showLists(recents: List<RecentMangaItem>) {
|
fun showLists(recents: List<RecentMangaItem>) {
|
||||||
|
swipe_refresh.isRefreshing = LibraryUpdateService.isRunning()
|
||||||
recentItems = recents
|
recentItems = recents
|
||||||
adapter.updateDataSet(recents)
|
adapter.updateDataSet(recents)
|
||||||
if (lastChapterId != null) {
|
if (lastChapterId != null) {
|
||||||
@ -347,9 +347,11 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
override fun onChangeStarted(handler: ControllerChangeHandler, type: ControllerChangeType) {
|
||||||
super.onChangeStarted(handler, type)
|
super.onChangeStarted(handler, type)
|
||||||
if (type.isEnter) {
|
if (type.isEnter) {
|
||||||
if (type == ControllerChangeType.POP_EXIT) presenter.onCreate()
|
view?.applyWindowInsetsForRootController(activity!!.bottom_nav)
|
||||||
|
if (type == ControllerChangeType.POP_ENTER) presenter.onCreate()
|
||||||
setHasOptionsMenu(true)
|
setHasOptionsMenu(true)
|
||||||
} else {
|
} else {
|
||||||
|
if (type == ControllerChangeType.POP_EXIT) presenter.onDestroy()
|
||||||
snack?.dismiss()
|
snack?.dismiss()
|
||||||
setHasOptionsMenu(false)
|
setHasOptionsMenu(false)
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,8 @@ class RecentsPresenter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onUpdateManga(manga: LibraryManga) {
|
override fun onUpdateManga(manga: LibraryManga) {
|
||||||
getRecents()
|
if (manga.id == null) scope.launch(Dispatchers.Main) { controller.reEnableSwipe() }
|
||||||
|
else getRecents()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,10 +27,13 @@ import eu.kanade.tachiyomi.util.system.openInBrowser
|
|||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.util.view.invisible
|
import eu.kanade.tachiyomi.util.view.invisible
|
||||||
import eu.kanade.tachiyomi.util.view.marginBottom
|
import eu.kanade.tachiyomi.util.view.marginBottom
|
||||||
|
import eu.kanade.tachiyomi.util.view.setStyle
|
||||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePadding
|
import eu.kanade.tachiyomi.util.view.updatePadding
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
|
import kotlinx.android.synthetic.main.library_list_controller.*
|
||||||
import kotlinx.android.synthetic.main.webview_activity.*
|
import kotlinx.android.synthetic.main.webview_activity.*
|
||||||
|
import kotlinx.android.synthetic.main.webview_activity.swipe_refresh
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class WebViewActivity : BaseActivity() {
|
class WebViewActivity : BaseActivity() {
|
||||||
@ -91,6 +94,7 @@ class WebViewActivity : BaseActivity() {
|
|||||||
0, insets.systemWindowInsetBottom
|
0, insets.systemWindowInsetBottom
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
swipe_refresh.setStyle()
|
||||||
swipe_refresh.setOnRefreshListener {
|
swipe_refresh.setOnRefreshListener {
|
||||||
refreshPage()
|
refreshPage()
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ fun Controller.scrollViewWith(
|
|||||||
bottom = if (padBottom) insets.systemWindowInsetBottom else view.paddingBottom
|
bottom = if (padBottom) insets.systemWindowInsetBottom else view.paddingBottom
|
||||||
)
|
)
|
||||||
swipeRefreshLayout?.setProgressViewOffset(
|
swipeRefreshLayout?.setProgressViewOffset(
|
||||||
false, headerHeight + (-60).dpToPx, headerHeight
|
true, headerHeight + (-60).dpToPx, headerHeight + 10.dpToPx
|
||||||
)
|
)
|
||||||
statusBarHeight = insets.systemWindowInsetTop
|
statusBarHeight = insets.systemWindowInsetTop
|
||||||
afterInsets?.invoke(insets)
|
afterInsets?.invoke(insets)
|
||||||
@ -453,6 +453,11 @@ fun setBottomEdge(view: View, activity: Activity) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun SwipeRefreshLayout.setStyle() {
|
||||||
|
setColorSchemeColors(context.getResourceColor(R.attr.actionBarTintColor))
|
||||||
|
setProgressBackgroundColorSchemeColor(context.getResourceColor(R.attr.colorPrimaryVariant))
|
||||||
|
}
|
||||||
|
|
||||||
fun MaterialButton.resetStrokeColor() {
|
fun MaterialButton.resetStrokeColor() {
|
||||||
strokeColor = ColorStateList.valueOf(
|
strokeColor = ColorStateList.valueOf(
|
||||||
ColorUtils.setAlphaComponent(
|
ColorUtils.setAlphaComponent(
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
tools:listitem="@layout/catalogue_main_controller_card" />
|
tools:listitem="@layout/recent_manga_item" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
Loading…
Reference in New Issue
Block a user