Using filled/outlined icons in tab bar + refactoring

pull/3117/head
Jay 5 years ago
parent e05c374d2c
commit 6ab222bdc8

@ -121,7 +121,7 @@ class CatalogueController : NucleusController<CataloguePresenter>(),
*/ */
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
view.applyWindowInsetsForRootController(activity!!.navigationView) view.applyWindowInsetsForRootController(activity!!.bottom_nav)
adapter = CatalogueAdapter(this) adapter = CatalogueAdapter(this)

@ -182,7 +182,6 @@ class LibraryCategoryAdapter(val libraryListener: LibraryListener) :
fun sortCategory(catId: Int, sortBy: Int) fun sortCategory(catId: Int, sortBy: Int)
fun selectAll(position: Int) fun selectAll(position: Int)
fun allSelected(position: Int): Boolean fun allSelected(position: Int): Boolean
fun showCategories(position: Int, view: View)
fun recyclerIsScrolling(): Boolean fun recyclerIsScrolling(): Boolean
} }
} }

@ -398,6 +398,5 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
override fun sortCategory(catId: Int, sortBy: Int) { } override fun sortCategory(catId: Int, sortBy: Int) { }
override fun selectAll(position: Int) { } override fun selectAll(position: Int) { }
override fun allSelected(position: Int): Boolean = false override fun allSelected(position: Int): Boolean = false
override fun showCategories(position: Int, view: View) { }
override fun recyclerIsScrolling() = false override fun recyclerIsScrolling() = false
} }

@ -12,6 +12,7 @@ import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
@ -175,7 +176,7 @@ open class LibraryController(
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
view.applyWindowInsetsForRootController(activity!!.navigationView) view.applyWindowInsetsForRootController(activity!!.bottom_nav)
mangaPerRow = getColumnsPreferenceForCurrentOrientation().getOrDefault() mangaPerRow = getColumnsPreferenceForCurrentOrientation().getOrDefault()
if (!::presenter.isInitialized) if (!::presenter.isInitialized)
presenter = LibraryPresenter(this) presenter = LibraryPresenter(this)
@ -193,7 +194,8 @@ open class LibraryController(
when (it) { when (it) {
FilterBottomSheet.ACTION_REFRESH -> onRefresh() FilterBottomSheet.ACTION_REFRESH -> onRefresh()
FilterBottomSheet.ACTION_FILTER -> onFilterChanged() FilterBottomSheet.ACTION_FILTER -> onFilterChanged()
FilterBottomSheet.ACTION_HIDE_FILTER_TIP -> activity?.toast(R.string.hide_filters_tip) FilterBottomSheet.ACTION_HIDE_FILTER_TIP -> activity?.toast(R.string
.hide_filters_tip, Toast.LENGTH_LONG)
} }
} }

@ -8,13 +8,11 @@ import android.graphics.Rect
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.TypedValue import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.PopupMenu
import androidx.coordinatorlayout.widget.CoordinatorLayout import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -38,7 +36,6 @@ import eu.kanade.tachiyomi.ui.main.SpinnerTitleInterface
import eu.kanade.tachiyomi.ui.main.SwipeGestureInterface import eu.kanade.tachiyomi.ui.main.SwipeGestureInterface
import eu.kanade.tachiyomi.util.system.dpToPx import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.inflate
import eu.kanade.tachiyomi.util.view.scrollViewWith import eu.kanade.tachiyomi.util.view.scrollViewWith
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
@ -47,9 +44,7 @@ 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_list_controller.* import kotlinx.android.synthetic.main.library_list_controller.*
import kotlinx.android.synthetic.main.main_activity.* import kotlinx.android.synthetic.main.main_activity.*
import kotlinx.android.synthetic.main.spinner_title.view.*
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import timber.log.Timber
import java.util.Locale import java.util.Locale
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.max import kotlin.math.max
@ -73,42 +68,29 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
private var updateScroll = true private var updateScroll = true
private var spinnerAdapter: SpinnerAdapter? = null
private var lastItemPosition:Int? = null private var lastItemPosition:Int? = null
private var lastItem:IFlexible<*>? = null private var lastItem:IFlexible<*>? = null
private lateinit var customTitleSpinner: ViewGroup
private lateinit var titlePopupMenu:PopupMenu
private var switchingCategories = false private var switchingCategories = false
var startPosX:Float? = null private var startPosX:Float? = null
var startPosY:Float? = null private var startPosY:Float? = null
var moved = false private var moved = false
var lockedRecycler = false private var lockedRecycler = false
var lockedY = false private var lockedY = false
var nextCategory:Int? = null private var nextCategory:Int? = null
var ogCategory:Int? = null private var ogCategory:Int? = null
var prevCategory:Int? = null private var prevCategory:Int? = null
private val swipeDistance = 300f private val swipeDistance = 300f
var flinging = false private var flinging = false
var isDragging = false private var isDragging = false
/**
* Recycler view of the list of manga.
*/
// private lateinit var recycler: RecyclerView
override fun contentView():View = recycler_layout override fun contentView():View = recycler_layout
override fun getTitle(): String? { override fun getTitle(): String? {
return if (::customTitleSpinner.isInitialized) customTitleSpinner.category_title.text.toString() return if (view != null && presenter.categories.size > 1) presenter.categories.find {
it.order == activeCategory }?.name ?: super.getTitle()
else super.getTitle() else super.getTitle()
// when {
// spinnerAdapter?.array?.size ?: 0 > 1 -> null
// spinnerAdapter?.array?.size == 1 -> return spinnerAdapter?.array?.firstOrNull()
// else -> return super.getTitle()
// }
} }
private var scrollListener = object : RecyclerView.OnScrollListener () { private var scrollListener = object : RecyclerView.OnScrollListener () {
@ -118,12 +100,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
if (order != null && order != activeCategory) { if (order != null && order != activeCategory) {
preferences.lastUsedCategory().set(order) preferences.lastUsedCategory().set(order)
activeCategory = order activeCategory = order
val category = presenter.categories.find { it.order == order } setTitle()
customTitleSpinner.category_title.text = category?.name ?: ""
val isCurrentController = router?.backstack?.lastOrNull()?.controller() ==
this@LibraryListController
if (isCurrentController) setTitle()
} }
} }
} }
@ -151,24 +128,24 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
} }
val sheetRect = Rect() val sheetRect = Rect()
val recyclerRect = Rect() val recyclerRect = Rect()
val appBarRect = Rect()
bottom_sheet.getGlobalVisibleRect(sheetRect) bottom_sheet.getGlobalVisibleRect(sheetRect)
view?.getGlobalVisibleRect(recyclerRect) view?.getGlobalVisibleRect(recyclerRect)
activity?.appbar?.getGlobalVisibleRect(appBarRect)
if (startPosX == null) { if (startPosX == null) {
startPosX = event.rawX startPosX = event.rawX
startPosY = event.rawY startPosY = event.rawY
val position = (recycler.layoutManager as LinearLayoutManager) val position =
.findFirstVisibleItemPosition() (recycler.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
val order = getCategoryOrder() val order = activeCategory
if (order != null) {
ogCategory = order ogCategory = order
var newOffsetN = order + 1 var newOffsetN = order + 1
while (adapter.indexOf(newOffsetN) == -1 && presenter.categories.any { it.order == newOffsetN }) { while (adapter.indexOf(newOffsetN) == -1 && presenter.categories.any { it.order == newOffsetN }) {
newOffsetN += 1 newOffsetN += 1
} }
if (adapter.indexOf(newOffsetN) != -1) if (adapter.indexOf(newOffsetN) != -1) nextCategory = newOffsetN
nextCategory = newOffsetN
if (position == 0) prevCategory = null if (position == 0) prevCategory = null
else { else {
@ -176,9 +153,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
while (adapter.indexOf(newOffsetP) == -1 && presenter.categories.any { it.order == newOffsetP }) { while (adapter.indexOf(newOffsetP) == -1 && presenter.categories.any { it.order == newOffsetP }) {
newOffsetP -= 1 newOffsetP -= 1
} }
if (adapter.indexOf(newOffsetP) != -1) if (adapter.indexOf(newOffsetP) != -1) prevCategory = newOffsetP
prevCategory = newOffsetP
}
} }
return return
} }
@ -193,7 +168,8 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
} }
if (startPosX != null && startPosY != null && if (startPosX != null && startPosY != null &&
(sheetRect.contains(startPosX!!.toInt(), startPosY!!.toInt()) || (sheetRect.contains(startPosX!!.toInt(), startPosY!!.toInt()) ||
!recyclerRect.contains(startPosX!!.toInt(), startPosY!!.toInt()))) { !recyclerRect.contains(startPosX!!.toInt(), startPosY!!.toInt())
|| appBarRect.contains(startPosX!!.toInt(), startPosY!!.toInt()))) {
return return
} }
if (event.actionMasked != MotionEvent.ACTION_UP && startPosX != null) { if (event.actionMasked != MotionEvent.ACTION_UP && startPosX != null) {
@ -330,21 +306,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
val tv = TypedValue() val tv = TypedValue()
activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true) activity!!.theme.resolveAttribute(R.attr.actionBarTintColor, tv, true)
customTitleSpinner = library_layout.inflate(R.layout.spinner_title) as ViewGroup
spinnerAdapter = SpinnerAdapter(
view.context,
R.layout.library_spinner_textview,
arrayOf(resources!!.getString(R.string.label_library))
)
customTitleSpinner.category_title.text = view.resources.getString(R.string.label_library)
titlePopupMenu = PopupMenu(view.context, customTitleSpinner, Gravity.END or Gravity.CENTER)
customTitleSpinner.setOnTouchListener(titlePopupMenu.dragToOpenListener)
titlePopupMenu.setOnMenuItemClickListener { item ->
scrollToHeader(item.itemId)
true
}
scrollViewWith(recycler) { insets -> scrollViewWith(recycler) { insets ->
fast_scroller.updateLayoutParams<CoordinatorLayout.LayoutParams> { fast_scroller.updateLayoutParams<CoordinatorLayout.LayoutParams> {
topMargin = insets.systemWindowInsetTop topMargin = insets.systemWindowInsetTop
@ -396,19 +357,11 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
adapter.setItems(mangaMap) adapter.setItems(mangaMap)
val categoryNames = presenter.categories.map { it.name }.toTypedArray() val categoryNames = presenter.categories.map { it.name }.toTypedArray()
spinnerAdapter = SpinnerAdapter(recyclerLayout.context, R.layout.library_spinner_textview,
if (categoryNames.isNotEmpty()) categoryNames
else arrayOf(recyclerLayout.context.getString(R.string.label_library))
)
val isCurrentController = router?.backstack?.lastOrNull()?.controller() == val isCurrentController = router?.backstack?.lastOrNull()?.controller() ==
this this
/*customTitleSpinner.category_title.text = setTitle()
presenter.categories[clamp(activeCategory,
0,
presenter.categories.size - 1)].name
if (isCurrentController) setTitle()*/
updateScroll = false updateScroll = false
if (!freshStart) { if (!freshStart) {
justStarted = false justStarted = false
@ -432,9 +385,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
null null
} }
titlePopupMenu.menu.clear()
presenter.categories.forEach { category -> presenter.categories.forEach { category ->
titlePopupMenu.menu.add(0, category.order, max(0, category.order), category.name)
popupMenu?.menu?.add(0, category.order, max(0, category.order), category.name) popupMenu?.menu?.add(0, category.order, max(0, category.order), category.name)
} }
@ -442,10 +393,6 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
scrollToHeader(item.itemId) scrollToHeader(item.itemId)
true true
} }
customTitleSpinner.setOnClickListener {
titlePopupMenu.show()
}
} }
private fun scrollToHeader(pos: Int) { private fun scrollToHeader(pos: Int) {
@ -453,14 +400,12 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
switchingCategories = true switchingCategories = true
if (headerPosition > -1) { if (headerPosition > -1) {
val appbar = activity?.appbar val appbar = activity?.appbar
//if (headerPosition == 0)
//activity?.appbar?.y = 0f
recycler.suppressLayout(true) recycler.suppressLayout(true)
val appbarOffset = val appbarOffset =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (appbar?.y ?: 0f > -20) 0 else if (appbar?.y ?: 0f > -20) 0 else
(appbar?.y?.plus(view?.rootWindowInsets?.systemWindowInsetTop ?: 0) (appbar?.y?.plus(view?.rootWindowInsets?.systemWindowInsetTop ?: 0)
?: 0f).roundToInt() + 10.dpToPx ?: 0f).roundToInt() + 30.dpToPx
} }
else { else {
0 0
@ -470,11 +415,10 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
+ appbarOffset + appbarOffset
) )
val headerItem = adapter.getItem(headerPosition) as? LibraryHeaderItem /*val headerItem = adapter.getItem(headerPosition) as? LibraryHeaderItem
if (headerItem != null) { if (headerItem != null) {
customTitleSpinner.category_title.text = headerItem.category.name
setTitle() setTitle()
} }*/
recycler.suppressLayout(false) recycler.suppressLayout(false)
} }
launchUI { launchUI {
@ -573,11 +517,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
} }
override fun canDrag(): Boolean { override fun canDrag(): Boolean {
val filterOff = preferences.filterCompleted().getOrDefault() + val filterOff = !bottom_sheet.hasActiveFilters() &&
preferences.filterTracked().getOrDefault() +
preferences.filterUnread().getOrDefault() +
preferences.filterMangaType().getOrDefault() +
preferences.filterCompleted().getOrDefault() == 0 &&
!preferences.hideCategories().getOrDefault() !preferences.hideCategories().getOrDefault()
return filterOff && adapter.mode != SelectableAdapter.Mode.MULTI return filterOff && adapter.mode != SelectableAdapter.Mode.MULTI
} }
@ -775,28 +715,10 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
return items.all { adapter.isSelected(it) } return items.all { adapter.isSelected(it) }
} }
override fun showCategories(position: Int, view: View) {
if (presenter.categories.size <= 1) return
val header = adapter.getSectionHeader(position) as? LibraryHeaderItem ?: return
if (presenter.categories.size <= 1) return
val category = header.category
val popupMenu = PopupMenu(view.context, view)
presenter.categories.forEach {
if (it.id != category.id)
popupMenu.menu.add(0, it.order, it.order, it.name)
}
popupMenu.setOnMenuItemClickListener {
scrollToHeader(it.itemId)
true
}
popupMenu.show()
}
override fun onSwipeBottom(x: Float, y: Float) { } override fun onSwipeBottom(x: Float, y: Float) { }
override fun onSwipeTop(x: Float, y: Float) { override fun onSwipeTop(x: Float, y: Float) {
val sheetRect = Rect() val sheetRect = Rect()
activity!!.navigationView.getGlobalVisibleRect(sheetRect) activity!!.bottom_nav.getGlobalVisibleRect(sheetRect)
if (sheetRect.contains(x.toInt(), y.toInt())) { if (sheetRect.contains(x.toInt(), y.toInt())) {
if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) if (bottom_sheet.sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED)
toggleFilters() toggleFilters()
@ -840,9 +762,7 @@ class LibraryListController(bundle: Bundle? = null) : LibraryController(bundle),
} }
override fun onAnimationCancel(animation: Animator?) {} override fun onAnimationCancel(animation: Animator?) {}
override fun onAnimationRepeat(animation: Animator?) {} override fun onAnimationRepeat(animation: Animator?) {}
override fun onAnimationStart(animation: Animator?) {} override fun onAnimationStart(animation: Animator?) {}
}) })
} }

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.library.filter
import android.content.Context import android.content.Context
import android.content.res.Configuration import android.content.res.Configuration
import android.os.Parcelable
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -14,7 +15,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.view.gone import eu.kanade.tachiyomi.util.view.gone
import eu.kanade.tachiyomi.util.view.inflate import eu.kanade.tachiyomi.util.view.inflate
@ -70,25 +70,18 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
var onGroupClicked: (Int) -> Unit = { _ -> } var onGroupClicked: (Int) -> Unit = { _ -> }
var pager:View? = null var pager:View? = null
var phoneLandscape = false
fun onCreate(pagerView:View) { fun onCreate(pagerView:View) {
clearButton = clear_button clearButton = clear_button
filter_layout.removeView(clearButton) filter_layout.removeView(clearButton)
sheetBehavior = BottomSheetBehavior.from(this) sheetBehavior = BottomSheetBehavior.from(this)
val phoneLandscape = (isLandscape() && !isTablet()) phoneLandscape = (isLandscape() && !isTablet())
sheetBehavior?.isHideable = true sheetBehavior?.isHideable = true
sheetBehavior?.skipCollapsed = phoneLandscape sheetBehavior?.skipCollapsed = phoneLandscape
top_bar.setOnClickListener {
if (sheetBehavior?.state != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
} else {
sheetBehavior?.state = BottomSheetBehavior.STATE_COLLAPSED
}
}
pager = pagerView pager = pagerView
val shadow2:View = (pagerView.parent as ViewGroup).findViewById(R.id.shadow2) val shadow2:View = (pagerView.parent as ViewGroup).findViewById(R.id.shadow2)
val shadow:View = (pagerView.parent as ViewGroup).findViewById(R.id.shadow) val shadow:View = (pagerView.parent as ViewGroup).findViewById(R.id.shadow)
// val snackbarLayout:View = (pagerView.parent as ViewGroup).findViewById(R.id.snackbar_layout)
if (phoneLandscape) { if (phoneLandscape) {
sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
} }
@ -96,47 +89,24 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
override fun onSlide(bottomSheet: View, progress: Float) { override fun onSlide(bottomSheet: View, progress: Float) {
top_bar.alpha = 1 - max(0f, progress) top_bar.alpha = 1 - max(0f, progress)
shadow2.alpha = (1 - max(0f, progress)) * 0.25f shadow2.alpha = (1 - max(0f, progress)) * 0.25f
if (phoneLandscape) if (phoneLandscape) shadow.alpha = progress
shadow.alpha = progress else shadow.alpha = 1 + min(0f, progress)
else
shadow.alpha = 1 + min(0f, progress)
//if (progress >= 0)
updateRootPadding(progress) updateRootPadding(progress)
} }
override fun onStateChanged(p0: View, state: Int) { override fun onStateChanged(p0: View, state: Int) {
if (state == BottomSheetBehavior.STATE_COLLAPSED) { stateChanged(state)
if (phoneLandscape)
reSortViews()
if (phoneLandscape)
shadow.alpha = 0f
else
shadow.alpha = 1f
pager?.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0)
}
if (state == BottomSheetBehavior.STATE_EXPANDED) {
top_bar.alpha = 0f
if (phoneLandscape)
shadow.alpha = 1f
}
if (state == BottomSheetBehavior.STATE_HIDDEN) {
reSortViews()
shadow.alpha = 0f
pager?.updatePaddingRelative(bottom = 0)
// snackbarLayout.updatePaddingRelative(bottom = 0)
}
//top_bar.isClickable = state == BottomSheetBehavior.STATE_COLLAPSED
//top_bar.isFocusable = state == BottomSheetBehavior.STATE_COLLAPSED
} }
}) })
if (preferences.hideFiltersAtStart().getOrDefault()) { if (preferences.hideFiltersAtStart().getOrDefault()) {
sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN sheetBehavior?.state = BottomSheetBehavior.STATE_HIDDEN
shadow.alpha = 0f
}
else {
pager?.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0)
// snackbarLayout.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0)
} }
updateRootPadding(when (sheetBehavior?.state) {
BottomSheetBehavior.STATE_HIDDEN -> -1f
BottomSheetBehavior.STATE_EXPANDED -> 1f
else -> 0f
})
shadow.alpha = if (sheetBehavior?.state == BottomSheetBehavior.STATE_HIDDEN) 0f else 1f
if (phoneLandscape && shadow2.visibility != View.GONE) { if (phoneLandscape && shadow2.visibility != View.GONE) {
shadow2.gone() shadow2.gone()
} }
@ -150,6 +120,30 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
clearButton.setOnClickListener { clearFilters() } clearButton.setOnClickListener { clearFilters() }
} }
private fun stateChanged(state: Int) {
val shadow = ((pager?.parent as? ViewGroup)?.findViewById(R.id.shadow) as? View)
if (state == BottomSheetBehavior.STATE_COLLAPSED) {
shadow?.alpha = 1f
pager?.updatePaddingRelative(bottom = sheetBehavior?.peekHeight ?: 0)
}
if (state == BottomSheetBehavior.STATE_EXPANDED) {
top_bar.alpha = 0f
if (phoneLandscape)
shadow?.alpha = 1f
}
if (state == BottomSheetBehavior.STATE_HIDDEN) {
reSortViews()
shadow?.alpha = 0f
pager?.updatePaddingRelative(bottom = 0)
}
}
override fun onRestoreInstanceState(state: Parcelable?) {
super.onRestoreInstanceState(state)
val sheetBehavior = BottomSheetBehavior.from(this)
stateChanged(sheetBehavior.state)
}
private fun isLandscape(): Boolean { private fun isLandscape(): Boolean {
return context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE return context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE
} }
@ -176,11 +170,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
fun hasActiveFilters() = filterItems.any { it.isActivated } fun hasActiveFilters() = filterItems.any { it.isActivated }
private fun createTags() { private fun createTags() {
//categories = inflate(R.layout.filter_buttons) as FilterTagGroup
// categories.setup(this, R.string.action_hide_categories)
// list.add(categories)
hide_categories.isChecked = preferences.hideCategories().getOrDefault() hide_categories.isChecked = preferences.hideCategories().getOrDefault()
hide_categories.setOnCheckedChangeListener { _, isChecked -> hide_categories.setOnCheckedChangeListener { _, isChecked ->
preferences.hideCategories().set(isChecked) preferences.hideCategories().set(isChecked)
@ -212,11 +201,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
db.getCategories().executeAsBlocking() db.getCategories().executeAsBlocking()
.isNotEmpty() .isNotEmpty()
} }
val librryManga = db.getLibraryMangas().executeAsBlocking() val libraryManga = db.getLibraryMangas().executeAsBlocking()
val types = mutableListOf<Int>() val types = mutableListOf<Int>()
if (librryManga.any { it.mangaType() == Manga.TYPE_MANHWA }) types.add(R.string.manhwa) if (libraryManga.any { it.mangaType() == Manga.TYPE_MANHWA }) types.add(R.string.manhwa)
if (librryManga.any { it.mangaType() == Manga.TYPE_MANHUA }) types.add(R.string.manhua) if (libraryManga.any { it.mangaType() == Manga.TYPE_MANHUA }) types.add(R.string.manhua)
if (librryManga.any { it.mangaType() == Manga.TYPE_COMIC }) types.add(R.string.comic) if (libraryManga.any { it.mangaType() == Manga.TYPE_COMIC }) types.add(R.string.comic)
val hasTracking = Injekt.get<TrackManager>().hasLoggedServices()
if (types.isNotEmpty()) { if (types.isNotEmpty()) {
launchUI { launchUI {
val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup val mangaType = inflate(R.layout.filter_buttons) as FilterTagGroup
@ -230,12 +220,12 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
filter_layout.addView(mangaType) filter_layout.addView(mangaType)
filterItems.remove(tracked) filterItems.remove(tracked)
filterItems.add(mangaType) filterItems.add(mangaType)
if (hasTracking)
filterItems.add(tracked) filterItems.add(tracked)
} }
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
hide_categories.visibleIf(showCategoriesCheckBox) hide_categories.visibleIf(showCategoriesCheckBox)
// categories.setState(preferences.hideCategories().getOrDefault())
downloaded.setState(preferences.filterDownloaded()) downloaded.setState(preferences.filterDownloaded())
completed.setState(preferences.filterCompleted()) completed.setState(preferences.filterCompleted())
unread.setState(preferences.filterUnread()) unread.setState(preferences.filterUnread())
@ -305,10 +295,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
} }
private fun clearFilters() { private fun clearFilters() {
val action = if (preferences.hideCategories().getOrDefault()) ACTION_REFRESH
else ACTION_FILTER
preferences.hideCategories().set(false)
preferences.filterDownloaded().set(0) preferences.filterDownloaded().set(0)
preferences.filterUnread().set(0) preferences.filterUnread().set(0)
preferences.filterCompleted().set(0) preferences.filterCompleted().set(0)
@ -322,8 +308,10 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
filterItems.forEach { filterItems.forEach {
it.reset() it.reset()
} }
if (trackers != null)
filterItems.remove(trackers!!)
reSortViews() reSortViews()
onGroupClicked(action) onGroupClicked(ACTION_FILTER)
} }
private fun reSortViews() { private fun reSortViews() {
@ -339,10 +327,6 @@ class FilterBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
filter_scroll.scrollTo(0, 0) filter_scroll.scrollTo(0, 0)
} }
fun adjustFiltersMargin(downloading: Boolean) {
filter_scroll.updatePaddingRelative(end = (if (downloading) 80 else 20).dpToPx)
}
companion object { companion object {
const val ACTION_REFRESH = 0 const val ACTION_REFRESH = 0
const val ACTION_FILTER = 1 const val ACTION_FILTER = 1

@ -139,13 +139,13 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
// tabAnimator = TabsAnimator(tabs) // tabAnimator = TabsAnimator(tabs)
var continueSwitchingTabs = false var continueSwitchingTabs = false
navigationView.setOnNavigationItemSelectedListener { item -> bottom_nav.setOnNavigationItemSelectedListener { item ->
val id = item.itemId val id = item.itemId
val currentController = router.backstack.lastOrNull()?.controller() val currentController = router.backstack.lastOrNull()?.controller()
if (!continueSwitchingTabs && currentController is BottomNavBarInterface) { if (!continueSwitchingTabs && currentController is BottomNavBarInterface) {
if (!currentController.canChangeTabs { if (!currentController.canChangeTabs {
continueSwitchingTabs = true continueSwitchingTabs = true
this@MainActivity.navigationView.selectedItemId = id this@MainActivity.bottom_nav.selectedItemId = id
}) return@setOnNavigationItemSelectedListener false }) return@setOnNavigationItemSelectedListener false
} }
continueSwitchingTabs = false continueSwitchingTabs = false
@ -175,7 +175,6 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (!showRecents) setRoot(RecentChaptersController(), id) if (!showRecents) setRoot(RecentChaptersController(), id)
else setRoot(RecentlyReadController(), id) else setRoot(RecentlyReadController(), id)
preferences.showRecentUpdates().set(!showRecents) preferences.showRecentUpdates().set(!showRecents)
updateRecentsIcon()
} }
R.id.nav_library -> { R.id.nav_library -> {
val controller = val controller =
@ -190,6 +189,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
} }
} }
} }
updateIcons(id)
true true
} }
val container: ViewGroup = findViewById(R.id.controller_container) val container: ViewGroup = findViewById(R.id.controller_container)
@ -206,19 +206,18 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
/*dwawerContainer.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or /*dwawerContainer.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION*/ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION*/
updateRecentsIcon()
content.viewTreeObserver.addOnGlobalLayoutListener { content.viewTreeObserver.addOnGlobalLayoutListener {
val heightDiff: Int = content.rootView.height - content.height val heightDiff: Int = content.rootView.height - content.height
if (heightDiff > 200 && if (heightDiff > 200 &&
window.attributes.softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { window.attributes.softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
//keyboard is open, hide layout //keyboard is open, hide layout
navigationView.gone() bottom_nav.gone()
} else if (navigationView.visibility == View.GONE } else if (bottom_nav.visibility == View.GONE
&& window.attributes.softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { && window.attributes.softInputMode == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) {
//keyboard is hidden, show layout //keyboard is hidden, show layout
// use coroutine to delay so the bottom bar doesn't flash on top of the keyboard // use coroutine to delay so the bottom bar doesn't flash on top of the keyboard
launchUI { launchUI {
navigationView.visible() bottom_nav.visible()
} }
} }
} }
@ -272,7 +271,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
appbar.updatePadding( appbar.updatePadding(
top = insets.systemWindowInsetTop top = insets.systemWindowInsetTop
) )
navigationView.updatePadding(bottom = insets.systemWindowInsetBottom) bottom_nav.updatePadding(bottom = insets.systemWindowInsetBottom)
/*controller_container.updateLayoutParams<ConstraintLayout.LayoutParams> { /*controller_container.updateLayoutParams<ConstraintLayout.LayoutParams> {
val attrsArray = intArrayOf(android.R.attr.actionBarSize) val attrsArray = intArrayOf(android.R.attr.actionBarSize)
@ -308,7 +307,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (!router.hasRootController()) { if (!router.hasRootController()) {
// Set start screen // Set start screen
if (!handleIntentAction(intent)) { if (!handleIntentAction(intent)) {
navigationView.selectedItemId = R.id.nav_library bottom_nav.selectedItemId = R.id.nav_library
} }
} }
@ -320,8 +319,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
else onBackPressed() else onBackPressed()
} }
navigationView.visibility = if (router.backstackSize > 1) View.GONE else View.VISIBLE bottom_nav.visibility = if (router.backstackSize > 1) View.GONE else View.VISIBLE
navigationView.alpha = if (router.backstackSize > 1) 0f else 1f bottom_nav.alpha = if (router.backstackSize > 1) 0f else 1f
router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener { router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener {
override fun onChangeStarted(to: Controller?, from: Controller?, isPush: Boolean, override fun onChangeStarted(to: Controller?, from: Controller?, isPush: Boolean,
container: ViewGroup, handler: ControllerChangeHandler) { container: ViewGroup, handler: ControllerChangeHandler) {
@ -369,11 +368,31 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
setExtensionsBadge() setExtensionsBadge()
} }
fun updateRecentsIcon() { override fun onRestoreInstanceState(savedInstanceState: Bundle) {
navigationView.menu.findItem(R.id.nav_recents).icon = super.onRestoreInstanceState(savedInstanceState)
AppCompatResources.getDrawable(this, updateIcons(bottom_nav.selectedItemId)
if (preferences.showRecentUpdates().getOrDefault()) R.drawable.ic_update_black_24dp }
else R.drawable.ic_history_black_24dp)
fun updateIcons(id: Int) {
bottom_nav.menu.findItem(R.id.nav_library).icon = AppCompatResources.getDrawable(
this, if (id == R.id.nav_library) R.drawable.library_24dp
else R.drawable.library_outline_24dp
)
bottom_nav.menu.findItem(R.id.nav_recents).icon = AppCompatResources.getDrawable(
this, if (id == R.id.nav_recents) {
if (preferences.showRecentUpdates().getOrDefault()) R.drawable.recent_updates_24dp
else R.drawable.recent_read_24dp
} else {
if (preferences.showRecentUpdates()
.getOrDefault()
) R.drawable.recent_updates_outline_24dp
else R.drawable.recent_read_outline_24dp
}
)
bottom_nav.menu.findItem(R.id.nav_catalogues).icon = AppCompatResources.getDrawable(
this, if (id == R.id.nav_catalogues) R.drawable.browse_24dp
else R.drawable.browse_outline_24dp
)
} }
override fun startSupportActionMode(callback: androidx.appcompat.view.ActionMode.Callback): androidx.appcompat.view.ActionMode? { override fun startSupportActionMode(callback: androidx.appcompat.view.ActionMode.Callback): androidx.appcompat.view.ActionMode? {
@ -400,13 +419,13 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
private fun setExtensionsBadge() { private fun setExtensionsBadge() {
val updates = preferences.extensionUpdatesCount().getOrDefault() val updates = preferences.extensionUpdatesCount().getOrDefault()
if (updates > 0) { if (updates > 0) {
val badge = navigationView.getOrCreateBadge(R.id.nav_catalogues) val badge = bottom_nav.getOrCreateBadge(R.id.nav_catalogues)
badge.number = updates badge.number = updates
badge.backgroundColor = getResourceColor(R.attr.badgeColor) badge.backgroundColor = getResourceColor(R.attr.badgeColor)
badge.badgeTextColor = Color.WHITE badge.badgeTextColor = Color.WHITE
} }
else { else {
navigationView.removeBadge(R.id.nav_catalogues) bottom_nav.removeBadge(R.id.nav_catalogues)
} }
} }
@ -443,17 +462,16 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
applicationContext, notificationId, intent.getIntExtra("groupId", 0) applicationContext, notificationId, intent.getIntExtra("groupId", 0)
) )
when (intent.action) { when (intent.action) {
SHORTCUT_LIBRARY -> navigationView.selectedItemId = R.id.nav_library SHORTCUT_LIBRARY -> bottom_nav.selectedItemId = R.id.nav_library
SHORTCUT_RECENTLY_UPDATED, SHORTCUT_RECENTLY_READ -> { SHORTCUT_RECENTLY_UPDATED, SHORTCUT_RECENTLY_READ -> {
preferences.showRecentUpdates().set(intent.action == SHORTCUT_RECENTLY_UPDATED) preferences.showRecentUpdates().set(intent.action == SHORTCUT_RECENTLY_UPDATED)
navigationView.selectedItemId = R.id.nav_recents bottom_nav.selectedItemId = R.id.nav_recents
updateRecentsIcon()
} }
SHORTCUT_CATALOGUES -> navigationView.selectedItemId = R.id.nav_catalogues SHORTCUT_CATALOGUES -> bottom_nav.selectedItemId = R.id.nav_catalogues
SHORTCUT_EXTENSIONS -> { SHORTCUT_EXTENSIONS -> {
if (router.backstack.none { it.controller() is ExtensionController }) { if (router.backstack.none { it.controller() is ExtensionController }) {
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) {
navigationView.selectedItemId = R.id.nav_library bottom_nav.selectedItemId = R.id.nav_library
router.pushController( router.pushController(
RouterTransaction.with(ExtensionController()).pushChangeHandler( RouterTransaction.with(ExtensionController()).pushChangeHandler(
SimpleSwapChangeHandler() SimpleSwapChangeHandler()
@ -467,14 +485,14 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
SHORTCUT_MANGA -> { SHORTCUT_MANGA -> {
val extras = intent.extras ?: return false val extras = intent.extras ?: return false
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) {
navigationView.selectedItemId = R.id.nav_library bottom_nav.selectedItemId = R.id.nav_library
} }
router.pushController(MangaDetailsController(extras).withFadeTransaction()) router.pushController(MangaDetailsController(extras).withFadeTransaction())
} }
SHORTCUT_DOWNLOADS -> { SHORTCUT_DOWNLOADS -> {
if (router.backstack.none { it.controller() is DownloadController }) { if (router.backstack.none { it.controller() is DownloadController }) {
if (router.backstack.isEmpty()) { if (router.backstack.isEmpty()) {
navigationView.selectedItemId = R.id.nav_library bottom_nav.selectedItemId = R.id.nav_library
router.pushController(RouterTransaction.with(DownloadController()) router.pushController(RouterTransaction.with(DownloadController())
.pushChangeHandler(SimpleSwapChangeHandler()) .pushChangeHandler(SimpleSwapChangeHandler())
.popChangeHandler(FadeChangeHandler())) .popChangeHandler(FadeChangeHandler()))
@ -627,21 +645,21 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
if (to !is SpinnerTitleInterface) toolbar.removeSpinner() if (to !is SpinnerTitleInterface) toolbar.removeSpinner()
if (to !is DialogController) { if (to !is DialogController) {
navigationView.visibility = if (router.backstackSize == 0 || bottom_nav.visibility = if (router.backstackSize == 0 ||
(router.backstackSize <= 1 && !isPush)) (router.backstackSize <= 1 && !isPush))
View.VISIBLE else navigationView.visibility View.VISIBLE else bottom_nav.visibility
animationSet?.cancel() animationSet?.cancel()
animationSet = AnimatorSet() animationSet = AnimatorSet()
val alphaAnimation = ValueAnimator.ofFloat( val alphaAnimation = ValueAnimator.ofFloat(
navigationView.alpha, bottom_nav.alpha,
if (router.backstackSize > 1) 0f else 1f if (router.backstackSize > 1) 0f else 1f
) )
alphaAnimation.addUpdateListener { valueAnimator -> alphaAnimation.addUpdateListener { valueAnimator ->
navigationView.alpha = valueAnimator.animatedValue as Float bottom_nav.alpha = valueAnimator.animatedValue as Float
} }
alphaAnimation.addListener(object : Animator.AnimatorListener { alphaAnimation.addListener(object : Animator.AnimatorListener {
override fun onAnimationEnd(animation: Animator?) { override fun onAnimationEnd(animation: Animator?) {
navigationView.visibility = if (router.backstackSize > 1) View.GONE else View.VISIBLE bottom_nav.visibility = if (router.backstackSize > 1) View.GONE else View.VISIBLE
} }
override fun onAnimationCancel(animation: Animator?) { } override fun onAnimationCancel(animation: Animator?) { }

@ -54,7 +54,7 @@ class SearchActivity: MainActivity() {
} else { } else {
appbar.enableElevation() appbar.enableElevation()
} }
navigationView.gone() bottom_nav.gone()
} }
override fun handleIntentAction(intent: Intent): Boolean { override fun handleIntentAction(intent: Intent): Boolean {

@ -54,7 +54,11 @@ class MangaDetailsPresenter(private val controller: MangaDetailsController,
DownloadQueue.DownloadListener, DownloadQueue.DownloadListener,
LibraryServiceListener { LibraryServiceListener {
<<<<<<< Updated upstream
private var scope = CoroutineScope(Job() + Dispatchers.Default) private var scope = CoroutineScope(Job() + Dispatchers.Default)
=======
var scope = CoroutineScope(Job() + Dispatchers.Default)
>>>>>>> Stashed changes
var isLockedFromSearch = false var isLockedFromSearch = false
var hasRequested = false var hasRequested = false
@ -711,7 +715,11 @@ class MangaDetailsPresenter(private val controller: MangaDetailsController,
fun trackSearch(query: String, service: TrackService) { fun trackSearch(query: String, service: TrackService) {
scope.launch(Dispatchers.IO) { scope.launch(Dispatchers.IO) {
<<<<<<< Updated upstream
val results = try {service.search(query) } val results = try {service.search(query) }
=======
val results = try {service.search(query).toBlocking().single() }
>>>>>>> Stashed changes
catch (e: Exception) { catch (e: Exception) {
withContext(Dispatchers.Main) { controller.trackSearchError(e) } withContext(Dispatchers.Main) { controller.trackSearchError(e) }
null } null }
@ -726,7 +734,11 @@ class MangaDetailsPresenter(private val controller: MangaDetailsController,
item.manga_id = manga.id!! item.manga_id = manga.id!!
scope.launch { scope.launch {
<<<<<<< Updated upstream
val binding = try { service.bind(item) } val binding = try { service.bind(item) }
=======
val binding = try { service.bind(item).toBlocking().single() }
>>>>>>> Stashed changes
catch (e: Exception) { catch (e: Exception) {
trackError(e) trackError(e)
null null
@ -746,7 +758,11 @@ class MangaDetailsPresenter(private val controller: MangaDetailsController,
private fun updateRemote(track: Track, service: TrackService) { private fun updateRemote(track: Track, service: TrackService) {
scope.launch { scope.launch {
<<<<<<< Updated upstream
val binding = try { service.update(track) } val binding = try { service.update(track) }
=======
val binding = try { service.update(track).toBlocking().single() }
>>>>>>> Stashed changes
catch (e: Exception) { catch (e: Exception) {
trackError(e) trackError(e)
null null

@ -86,7 +86,7 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
*/ */
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
view.applyWindowInsetsForRootController(activity!!.navigationView) view.applyWindowInsetsForRootController(activity!!.bottom_nav)
view.context.notificationManager.cancel(Notifications.ID_NEW_CHAPTERS) view.context.notificationManager.cancel(Notifications.ID_NEW_CHAPTERS)
// Init RecyclerView and adapter // Init RecyclerView and adapter
@ -109,7 +109,7 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
LibraryUpdateService.start(view.context) LibraryUpdateService.start(view.context)
view.snack(R.string.updating_library) { view.snack(R.string.updating_library) {
anchorView = (this@RecentChaptersController.activity as? MainActivity) anchorView = (this@RecentChaptersController.activity as? MainActivity)
?.navigationView ?.bottom_nav
} }
} }
// It can be a very long operation, so we disable swipe refresh and show a snackbar. // It can be a very long operation, so we disable swipe refresh and show a snackbar.
@ -385,7 +385,7 @@ class RecentChaptersController : NucleusController<RecentChaptersPresenter>(),
router.setRoot( router.setRoot(
RecentlyReadController().withFadeTransaction().tag(R.id.nav_recents.toString())) RecentlyReadController().withFadeTransaction().tag(R.id.nav_recents.toString()))
Injekt.get<PreferencesHelper>().showRecentUpdates().set(false) Injekt.get<PreferencesHelper>().showRecentUpdates().set(false)
(activity as? MainActivity)?.updateRecentsIcon() (activity as? MainActivity)?.updateIcons(R.id.nav_recents)
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)

@ -84,7 +84,7 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
*/ */
override fun onViewCreated(view: View) { override fun onViewCreated(view: View) {
super.onViewCreated(view) super.onViewCreated(view)
view.applyWindowInsetsForRootController(activity!!.navigationView) view.applyWindowInsetsForRootController(activity!!.bottom_nav)
// Initialize adapter // Initialize adapter
adapter = RecentlyReadAdapter(this) adapter = RecentlyReadAdapter(this)
recycler.adapter = adapter recycler.adapter = adapter
@ -239,7 +239,7 @@ class RecentlyReadController(bundle: Bundle? = null) : BaseController(bundle),
router.setRoot( router.setRoot(
RecentChaptersController().withFadeTransaction().tag(R.id.nav_recents.toString())) RecentChaptersController().withFadeTransaction().tag(R.id.nav_recents.toString()))
Injekt.get<PreferencesHelper>().showRecentUpdates().set(true) Injekt.get<PreferencesHelper>().showRecentUpdates().set(true)
(activity as? MainActivity)?.updateRecentsIcon() (activity as? MainActivity)?.updateIcons(R.id.nav_recents)
} }
} }
return super.onOptionsItemSelected(item) return super.onOptionsItemSelected(item)

@ -0,0 +1,8 @@
<!-- drawable/compass_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M7,17L10.2,10.2L17,7L13.8,13.8L7,17M12,11.1A0.9,0.9 0 0,0 11.1,12A0.9,0.9 0 0,0 12,12.9A0.9,0.9 0 0,0 12.9,12A0.9,0.9 0 0,0 12,11.1M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z" />
</vector>

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M4,6L2,6v14c0,1.1 0.9,2 2,2h14v-2L4,20L4,6zM20,2L8,2c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM17,4v5l-1,-0.75L15,9L15,4h2zM20,16L8,16L8,4h5v9l3,-2.25L19,13L19,4h1v12z"/>
</vector>

@ -0,0 +1,8 @@
<!-- drawable/clock.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M16.2,16.2L11,13V7H12.5V12.2L17,14.9L16.2,16.2Z" />
</vector>

@ -0,0 +1,8 @@
<!-- drawable/clock_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z" />
</vector>

@ -0,0 +1,8 @@
<!-- drawable/alert_circle.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
</vector>

@ -0,0 +1,8 @@
<!-- drawable/alert_circle_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z" />
</vector>

@ -125,13 +125,13 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="8dp" android:layout_marginStart="10dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="10dp"
android:orientation="vertical" android:orientation="vertical"
android:layout_height="30sp"> android:layout_height="30sp">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/title" android:id="@+id/title"
style="@style/TextAppearance.MaterialComponents.Body1" style="@style/TextAppearance.Regular.Body1.Light"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" android:ellipsize="end"
@ -143,13 +143,12 @@
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/subtitle" android:id="@+id/subtitle"
style="@style/TextAppearance.MaterialComponents.Body1" style="@style/TextAppearance.Regular.Body1.Secondary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="-1dp" android:layout_marginTop="-1dp"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:textColor="?android:attr/textColorSecondary"
android:textSize="12sp" android:textSize="12sp"
tools:text="Sample artist" /> tools:text="Sample artist" />
</LinearLayout> </LinearLayout>

@ -88,7 +88,7 @@
</eu.kanade.tachiyomi.widget.ElevationAppBarLayout> </eu.kanade.tachiyomi.widget.ElevationAppBarLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView <com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigationView" android:id="@+id/bottom_nav"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorPrimary" android:background="?attr/colorPrimary"

@ -18,7 +18,7 @@
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/download_text" android:id="@+id/download_text"
style="@style/TextAppearance.MaterialComponents.Caption" style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/pale_red" android:background="@color/pale_red"
@ -48,7 +48,7 @@
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/unread_text" android:id="@+id/unread_text"
style="@style/TextAppearance.MaterialComponents.Caption" style="@style/TextAppearance.Regular.Caption.Light"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorAccent" android:background="@color/colorAccent"

@ -5,15 +5,15 @@
<item <item
android:checked="true" android:checked="true"
android:id="@+id/nav_library" android:id="@+id/nav_library"
android:icon="@drawable/ic_collections_bookmark_white_24dp" android:icon="@drawable/library_outline_24dp"
android:title="@string/label_library" /> android:title="@string/label_library" />
<item <item
android:id="@+id/nav_recents" android:id="@+id/nav_recents"
android:icon="@drawable/ic_update_black_24dp" android:icon="@drawable/recent_updates_outline_24dp"
android:title="@string/short_recents" /> android:title="@string/short_recents" />
<item <item
android:id="@+id/nav_catalogues" android:id="@+id/nav_catalogues"
android:icon="@drawable/ic_explore_black_24dp" android:icon="@drawable/browse_outline_24dp"
android:title="@string/short_catalogues" /> android:title="@string/short_catalogues" />
</group> </group>
</menu> </menu>

@ -17,6 +17,9 @@
<item <item
android:id="@+id/download_next" android:id="@+id/download_next"
android:title="@string/download_first" /> android:title="@string/download_first" />
<item
android:id="@+id/download_next_5"
android:title="@string/download_5" />
<item <item
android:id="@+id/download_custom" android:id="@+id/download_custom"
android:title="@string/download_custom" /> android:title="@string/download_custom" />

Loading…
Cancel
Save