don't add tablet interface's jay the 7 users who use them complain (#324)

* don't add tablet interface's jay the 7 users who use them complain

* fix formatting
This commit is contained in:
Carlos 2020-05-04 19:43:01 -04:00 committed by GitHub
parent 31800027a1
commit f890f5cfff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 137 deletions

View File

@ -11,7 +11,6 @@ import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.graphics.Rect import android.graphics.Rect
@ -19,7 +18,6 @@ import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.util.DisplayMetrics
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.Menu import android.view.Menu
import android.view.MenuInflater import android.view.MenuInflater
@ -30,12 +28,10 @@ import android.view.ViewPropertyAnimator
import android.view.WindowInsets import android.view.WindowInsets
import android.view.animation.DecelerateInterpolator import android.view.animation.DecelerateInterpolator
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.LinearLayout
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.view.ActionMode import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.content.ContextCompat
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import androidx.palette.graphics.Palette import androidx.palette.graphics.Palette
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
@ -102,9 +98,7 @@ import eu.kanade.tachiyomi.util.system.dpToPx
import eu.kanade.tachiyomi.util.system.getResourceColor import eu.kanade.tachiyomi.util.system.getResourceColor
import eu.kanade.tachiyomi.util.system.isInNightMode import eu.kanade.tachiyomi.util.system.isInNightMode
import eu.kanade.tachiyomi.util.system.launchUI import eu.kanade.tachiyomi.util.system.launchUI
import eu.kanade.tachiyomi.util.system.pxToDp
import eu.kanade.tachiyomi.util.system.toast import eu.kanade.tachiyomi.util.system.toast
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.hide import eu.kanade.tachiyomi.util.view.hide
import eu.kanade.tachiyomi.util.view.requestPermissionsSafe import eu.kanade.tachiyomi.util.view.requestPermissionsSafe
@ -157,7 +151,8 @@ class MangaDetailsController : BaseController,
} }
constructor(mangaId: Long) : this( constructor(mangaId: Long) : this(
Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking()) Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking()
)
constructor(bundle: Bundle) : this(bundle.getLong(MANGA_EXTRA)) { constructor(bundle: Bundle) : this(bundle.getLong(MANGA_EXTRA)) {
val notificationId = bundle.getInt("notificationId", -1) val notificationId = bundle.getInt("notificationId", -1)
@ -184,11 +179,6 @@ class MangaDetailsController : BaseController,
private var scrollAnim: ViewPropertyAnimator? = null private var scrollAnim: ViewPropertyAnimator? = null
var chapterPopupMenu: Pair<Int, PopupMenu>? = null var chapterPopupMenu: Pair<Int, PopupMenu>? = null
// Tablet Layout
var isTablet = false
var tabletRecycler: RecyclerView? = null
private var tabletAdapter: MangaDetailsAdapter? = null
private var query = "" private var query = ""
private var adapter: MangaDetailsAdapter? = null private var adapter: MangaDetailsAdapter? = null
@ -212,7 +202,6 @@ class MangaDetailsController : BaseController,
super.onViewCreated(view) super.onViewCreated(view)
coverColor = null coverColor = null
setTabletMode(view)
setRecycler(view) setRecycler(view)
setPaletteColor() setPaletteColor()
setFastScroller() setFastScroller()
@ -231,31 +220,6 @@ class MangaDetailsController : BaseController,
super.onDestroyView(view) super.onDestroyView(view)
} }
/** Check if device is tablet, and create a second recycler to hold the details header if so */
private fun setTabletMode(view: View) {
isTablet = isTabletSize()
if (isTablet) {
tabletRecycler = RecyclerView(view.context)
linear_recycler_layout.addView(tabletRecycler, 0)
tabletRecycler?.updateLayoutParams<LinearLayout.LayoutParams> {
weight = 0.4f
height = ViewGroup.LayoutParams.MATCH_PARENT
width = ViewGroup.LayoutParams.MATCH_PARENT
}
tabletRecycler?.clipToPadding = false
tabletAdapter = MangaDetailsAdapter(this)
tabletRecycler?.adapter = tabletAdapter
tabletRecycler?.layoutManager = LinearLayoutManager(view.context)
val divider = View(view.context)
divider.setBackgroundColor(ContextCompat.getColor(view.context, R.color.divider))
linear_recycler_layout.addView(divider, 1)
divider.updateLayoutParams<LinearLayout.LayoutParams> {
height = ViewGroup.LayoutParams.MATCH_PARENT
width = 1.dpToPx
}
}
}
/** Set adapter, insets, and scroll listener for recycler view */ /** Set adapter, insets, and scroll listener for recycler view */
private fun setRecycler(view: View) { private fun setRecycler(view: View) {
adapter = MangaDetailsAdapter(this) adapter = MangaDetailsAdapter(this)
@ -276,27 +240,19 @@ class MangaDetailsController : BaseController,
swipe_refresh.setDistanceToTriggerSync(70.dpToPx) swipe_refresh.setDistanceToTriggerSync(70.dpToPx)
activity!!.appbar.elevation = 0f activity!!.appbar.elevation = 0f
if (isTablet) { scrollViewWith(recycler, padBottom = true, customPadding = true, afterInsets = { insets ->
recycler.doOnApplyWindowInsets { _, insets, _ -> setInsets(insets, appbarHeight, offset)
setInsets(insets, appbarHeight, offset) }, liftOnScroll = {
} colorToolbar(it)
} else { })
scrollViewWith(recycler, padBottom = true, customPadding = true, afterInsets = { insets ->
setInsets(insets, appbarHeight, offset)
}, liftOnScroll = {
colorToolbar(it)
})
}
recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
if (!isTablet) { val atTop = !recycler.canScrollVertically(-1)
val atTop = !recycler.canScrollVertically(-1) val tY = getHeader()?.backdrop?.translationY ?: 0f
val tY = getHeader()?.backdrop?.translationY ?: 0f getHeader()?.backdrop?.translationY = max(0f, tY + dy * 0.25f)
getHeader()?.backdrop?.translationY = max(0f, tY + dy * 0.25f) if (atTop) getHeader()?.backdrop?.translationY = 0f
if (atTop) getHeader()?.backdrop?.translationY = 0f
}
} }
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
@ -319,11 +275,9 @@ class MangaDetailsController : BaseController,
private fun setInsets(insets: WindowInsets, appbarHeight: Int, offset: Int) { private fun setInsets(insets: WindowInsets, appbarHeight: Int, offset: Int) {
recycler?.updatePaddingRelative(bottom = insets.systemWindowInsetBottom) recycler?.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
tabletRecycler?.updatePaddingRelative(bottom = insets.systemWindowInsetBottom)
headerHeight = appbarHeight + insets.systemWindowInsetTop headerHeight = appbarHeight + insets.systemWindowInsetTop
swipe_refresh.setProgressViewOffset(false, (-40).dpToPx, headerHeight + offset) swipe_refresh.setProgressViewOffset(false, (-40).dpToPx, headerHeight + offset)
// 1dp extra to line up chapter header and manga header // 1dp extra to line up chapter header and manga header
if (isTablet) recycler.updatePaddingRelative(top = headerHeight + 1.dpToPx)
getHeader()?.setTopHeight(headerHeight) getHeader()?.setTopHeight(headerHeight)
fast_scroll_layout.updateLayoutParams<ViewGroup.MarginLayoutParams> { fast_scroll_layout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = headerHeight topMargin = headerHeight
@ -365,9 +319,7 @@ class MangaDetailsController : BaseController,
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset( (recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
itemPosition, headerHeight itemPosition, headerHeight
) )
if (!isTablet) { colorToolbar(itemPosition > 0, false)
colorToolbar(itemPosition > 0, false)
}
} }
} }
} }
@ -396,15 +348,15 @@ class MangaDetailsController : BaseController,
) )
colorAnimator?.cancel() colorAnimator?.cancel()
if (animate) { if (animate) {
colorAnimator = ValueAnimator.ofObject( colorAnimator = ValueAnimator.ofObject(
android.animation.ArgbEvaluator(), colorFrom, colorTo android.animation.ArgbEvaluator(), colorFrom, colorTo
) )
colorAnimator?.duration = 250 // milliseconds colorAnimator?.duration = 250 // milliseconds
colorAnimator?.addUpdateListener { animator -> colorAnimator?.addUpdateListener { animator ->
(activity as MainActivity).toolbar.setBackgroundColor(animator.animatedValue as Int) (activity as MainActivity).toolbar.setBackgroundColor(animator.animatedValue as Int)
activity?.window?.statusBarColor = (animator.animatedValue as Int) activity?.window?.statusBarColor = (animator.animatedValue as Int)
} }
colorAnimator?.start() colorAnimator?.start()
} else { } else {
(activity as MainActivity).toolbar.setBackgroundColor(colorTo) (activity as MainActivity).toolbar.setBackgroundColor(colorTo)
activity?.window?.statusBarColor = colorTo activity?.window?.statusBarColor = colorTo
@ -444,7 +396,7 @@ class MangaDetailsController : BaseController,
} }
} }
override fun onLoadCleared(placeholder: Drawable?) { } override fun onLoadCleared(placeholder: Drawable?) {}
}) })
} }
@ -488,28 +440,12 @@ class MangaDetailsController : BaseController,
translucentColor translucentColor
} else Color.TRANSPARENT } else Color.TRANSPARENT
(activity as MainActivity).appbar.setBackgroundColor(Color.TRANSPARENT) (activity as MainActivity).appbar.setBackgroundColor(Color.TRANSPARENT)
(activity as MainActivity).toolbar.setBackgroundColor(activity?.window?.statusBarColor (activity as MainActivity).toolbar.setBackgroundColor(
?: Color.TRANSPARENT) activity?.window?.statusBarColor
?: Color.TRANSPARENT
)
} }
private fun isTabletSize(): Boolean {
val activity = activity ?: return false
if ((activity.resources.configuration.screenLayout and Configuration
.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE)
return false
val displayMetrics = DisplayMetrics()
activity.windowManager?.defaultDisplay?.getMetrics(displayMetrics)
return displayMetrics.widthPixels.pxToDp >= 720
}
fun hasTabletHeight(): Boolean {
val activity = activity ?: return false
if ((activity.resources.configuration.screenLayout and Configuration
.SCREENLAYOUT_SIZE_MASK) < Configuration.SCREENLAYOUT_SIZE_LARGE) return false
val displayMetrics = DisplayMetrics()
activity.windowManager?.defaultDisplay?.getMetrics(displayMetrics)
return displayMetrics.heightPixels.pxToDp >= 720
}
//endregion //endregion
//region Lifecycle methods //region Lifecycle methods
@ -548,7 +484,8 @@ class MangaDetailsController : BaseController,
R.attr.colorSecondary R.attr.colorSecondary
) ?: Color.BLACK ) ?: Color.BLACK
if (router.backstackSize > 0 && if (router.backstackSize > 0 &&
router.backstack.last().controller() !is MangaDetailsController) { router.backstack.last().controller() !is MangaDetailsController
) {
(activity as? MainActivity)?.appbar?.setBackgroundColor(colorSecondary) (activity as? MainActivity)?.appbar?.setBackgroundColor(colorSecondary)
(activity as? MainActivity)?.toolbar?.setBackgroundColor(colorSecondary) (activity as? MainActivity)?.toolbar?.setBackgroundColor(colorSecondary)
@ -614,8 +551,10 @@ class MangaDetailsController : BaseController,
//region Recycler methods //region Recycler methods
fun updateChapterDownload(download: Download) { fun updateChapterDownload(download: Download) {
getHolder(download.chapter)?.notifyStatus(download.status, presenter.isLockedFromSearch, getHolder(download.chapter)?.notifyStatus(
download.progress) download.status, presenter.isLockedFromSearch,
download.progress
)
} }
private fun getHolder(chapter: Chapter): ChapterHolder? { private fun getHolder(chapter: Chapter): ChapterHolder? {
@ -623,8 +562,7 @@ class MangaDetailsController : BaseController,
} }
private fun getHeader(): MangaHeaderHolder? { private fun getHeader(): MangaHeaderHolder? {
return if (isTablet) tabletRecycler?.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder return recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder
else recycler.findViewHolderForAdapterPosition(0) as? MangaHeaderHolder
} }
fun updateHeader() { fun updateHeader() {
@ -652,12 +590,7 @@ class MangaDetailsController : BaseController,
} }
private fun addMangaHeader() { private fun addMangaHeader() {
if (tabletAdapter?.scrollableHeaders?.isEmpty() == true) { if (adapter?.scrollableHeaders?.isEmpty() == true) {
tabletAdapter?.removeAllScrollableHeaders()
tabletAdapter?.addScrollableHeader(presenter.headerItem)
adapter?.removeAllScrollableHeaders()
adapter?.addScrollableHeader(presenter.tabletChapterHeaderItem!!)
} else if (!isTablet && adapter?.scrollableHeaders?.isEmpty() == true) {
adapter?.removeAllScrollableHeaders() adapter?.removeAllScrollableHeaders()
adapter?.addScrollableHeader(presenter.headerItem) adapter?.addScrollableHeader(presenter.headerItem)
} }
@ -818,8 +751,10 @@ class MangaDetailsController : BaseController,
inflater.inflate(R.menu.manga_details, menu) inflater.inflate(R.menu.manga_details, menu)
val editItem = menu.findItem(R.id.action_edit) val editItem = menu.findItem(R.id.action_edit)
editItem.isVisible = presenter.manga.favorite && !presenter.isLockedFromSearch editItem.isVisible = presenter.manga.favorite && !presenter.isLockedFromSearch
editItem.title = view?.context?.getString(if (manga?.source == LocalSource.ID) editItem.title = view?.context?.getString(
R.string.edit else R.string.edit_cover) if (manga?.source == LocalSource.ID)
R.string.edit else R.string.edit_cover
)
menu.findItem(R.id.action_download).isVisible = !presenter.isLockedFromSearch && menu.findItem(R.id.action_download).isVisible = !presenter.isLockedFromSearch &&
manga?.source != LocalSource.ID manga?.source != LocalSource.ID
menu.findItem(R.id.action_mark_all_as_read).isVisible = menu.findItem(R.id.action_mark_all_as_read).isVisible =
@ -833,8 +768,10 @@ class MangaDetailsController : BaseController,
presenter.hasBookmark() && !presenter.isLockedFromSearch presenter.hasBookmark() && !presenter.isLockedFromSearch
menu.findItem(R.id.action_migrate).isVisible = !presenter.isLockedFromSearch && menu.findItem(R.id.action_migrate).isVisible = !presenter.isLockedFromSearch &&
manga?.source != LocalSource.ID && presenter.manga.favorite manga?.source != LocalSource.ID && presenter.manga.favorite
menu.findItem(R.id.action_migrate).title = view?.context?.getString(R.string.migrate_, menu.findItem(R.id.action_migrate).title = view?.context?.getString(
presenter.manga.mangaType(view!!.context)) R.string.migrate_,
presenter.manga.mangaType(view!!.context)
)
val iconPrimary = view?.context?.getResourceColor(android.R.attr.textColorPrimary) val iconPrimary = view?.context?.getResourceColor(android.R.attr.textColorPrimary)
?: Color.BLACK ?: Color.BLACK
menu.findItem(R.id.action_download).icon?.mutate()?.setTint(iconPrimary) menu.findItem(R.id.action_download).icon?.mutate()?.setTint(iconPrimary)
@ -853,10 +790,8 @@ class MangaDetailsController : BaseController,
setOnQueryTextChangeListener(searchView) { setOnQueryTextChangeListener(searchView) {
query = it ?: "" query = it ?: ""
if (!isTablet) { if (query.isNotEmpty()) getHeader()?.collapse()
if (query.isNotEmpty()) getHeader()?.collapse() else getHeader()?.expand()
else getHeader()?.expand()
}
adapter?.setFilter(query) adapter?.setFilter(query)
adapter?.performFilter() adapter?.performFilter()
@ -898,7 +833,8 @@ class MangaDetailsController : BaseController,
PreMigrationController.navigateToMigration( PreMigrationController.navigateToMigration(
presenter.preferences.skipPreMigration().getOrDefault(), presenter.preferences.skipPreMigration().getOrDefault(),
router, router,
listOf(manga!!.id!!)) listOf(manga!!.id!!)
)
R.id.action_mark_all_as_read -> { R.id.action_mark_all_as_read -> {
MaterialDialog(view!!.context).message(R.string.mark_all_chapters_as_read) MaterialDialog(view!!.context).message(R.string.mark_all_chapters_as_read)
.positiveButton(R.string.mark_as_read) { .positiveButton(R.string.mark_as_read) {
@ -923,6 +859,7 @@ class MangaDetailsController : BaseController,
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) { override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
presenter.shareManga(resource) presenter.shareManga(resource)
} }
override fun onLoadCleared(placeholder: Drawable?) {} override fun onLoadCleared(placeholder: Drawable?) {}
override fun onLoadFailed(errorDrawable: Drawable?) { override fun onLoadFailed(errorDrawable: Drawable?) {
@ -964,8 +901,10 @@ class MangaDetailsController : BaseController,
} }
val activity = activity ?: return val activity = activity ?: return
val intent = WebViewActivity.newIntent(activity.applicationContext, source.id, url, presenter.manga val intent = WebViewActivity.newIntent(
.title) activity.applicationContext, source.id, url, presenter.manga
.title
)
startActivity(intent) startActivity(intent)
} }
@ -988,8 +927,8 @@ class MangaDetailsController : BaseController,
R.plurals.remove_n_chapters, chapters.size, chapters.size R.plurals.remove_n_chapters, chapters.size, chapters.size
) )
).positiveButton(R.string.remove) { ).positiveButton(R.string.remove) {
presenter.deleteChapters(chapters) presenter.deleteChapters(chapters)
}.negativeButton(android.R.string.cancel).show() }.negativeButton(android.R.string.cancel).show()
} }
private fun downloadChapters(choice: Int) { private fun downloadChapters(choice: Int) {
@ -1038,10 +977,13 @@ class MangaDetailsController : BaseController,
private fun downloadChapters(chapters: List<ChapterItem>) { private fun downloadChapters(chapters: List<ChapterItem>) {
val view = view ?: return val view = view ?: return
presenter.downloadChapters(chapters) presenter.downloadChapters(chapters)
val text = view.context.getString(R.string.add_x_to_library, presenter.manga.mangaType val text = view.context.getString(
(view.context).toLowerCase(Locale.ROOT)) R.string.add_x_to_library, presenter.manga.mangaType
(view.context).toLowerCase(Locale.ROOT)
)
if (!presenter.manga.favorite && (snack == null || if (!presenter.manga.favorite && (snack == null ||
snack?.getText() != text)) { snack?.getText() != text)
) {
snack = view.snack(text, Snackbar.LENGTH_INDEFINITE) { snack = view.snack(text, Snackbar.LENGTH_INDEFINITE) {
setAction(R.string.add) { setAction(R.string.add) {
presenter.setFavorite(true) presenter.setFavorite(true)
@ -1069,9 +1011,11 @@ class MangaDetailsController : BaseController,
} }
val item = presenter.getNextUnreadChapter() val item = presenter.getNextUnreadChapter()
if (item != null) { if (item != null) {
openChapter(item.chapter) openChapter(item.chapter)
} else if (snack == null || snack?.getText() != view?.context?.getString( } else if (snack == null || snack?.getText() != view?.context?.getString(
R.string.next_chapter_not_found)) { R.string.next_chapter_not_found
)
) {
snack = view?.snack(R.string.next_chapter_not_found, Snackbar.LENGTH_LONG) { snack = view?.snack(R.string.next_chapter_not_found, Snackbar.LENGTH_LONG) {
addCallback(object : BaseTransientBottomBar.BaseCallback<Snackbar>() { addCallback(object : BaseTransientBottomBar.BaseCallback<Snackbar>() {
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) { override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
@ -1131,8 +1075,8 @@ class MangaDetailsController : BaseController,
}.toTypedArray() }.toTypedArray()
ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected).showDialog( ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected).showDialog(
router router
) )
} else { } else {
if (!manga.favorite) { if (!manga.favorite) {
toggleMangaFavorite() toggleMangaFavorite()
@ -1307,8 +1251,10 @@ class MangaDetailsController : BaseController,
} }
override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean { override fun onPrepareActionMode(mode: ActionMode?, menu: Menu?): Boolean {
mode?.title = view?.context?.getString(if (startingDLChapterPos == null) mode?.title = view?.context?.getString(
R.string.select_starting_chapter else R.string.select_ending_chapter) if (startingDLChapterPos == null)
R.string.select_starting_chapter else R.string.select_ending_chapter
)
return false return false
} }
@ -1333,8 +1279,10 @@ class MangaDetailsController : BaseController,
val intent = Intent(Intent.ACTION_GET_CONTENT) val intent = Intent(Intent.ACTION_GET_CONTENT)
intent.type = "image/*" intent.type = "image/*"
startActivityForResult( startActivityForResult(
Intent.createChooser(intent, Intent.createChooser(
resources?.getString(R.string.select_cover_image)), intent,
resources?.getString(R.string.select_cover_image)
),
101 101
) )
} else { } else {

View File

@ -75,15 +75,9 @@ class MangaDetailsPresenter(
private set private set
var headerItem = MangaHeaderItem(manga, controller.fromCatalogue) var headerItem = MangaHeaderItem(manga, controller.fromCatalogue)
var tabletChapterHeaderItem: MangaHeaderItem? = null
fun onCreate() { fun onCreate() {
headerItem.startExpanded = controller.hasTabletHeight() || headerItem.startExpanded
headerItem.isTablet = controller.isTablet
if (controller.isTablet) {
tabletChapterHeaderItem = MangaHeaderItem(manga, false)
tabletChapterHeaderItem?.isChapterHeader = true
}
isLockedFromSearch = SecureActivityDelegate.shouldBeLocked() isLockedFromSearch = SecureActivityDelegate.shouldBeLocked()
headerItem.isLocked = isLockedFromSearch headerItem.isLocked = isLockedFromSearch
downloadManager.addListener(this) downloadManager.addListener(this)
@ -313,6 +307,7 @@ class MangaDetailsPresenter(
private fun hasTensOfChapters(chapters: List<ChapterItem>): Boolean { private fun hasTensOfChapters(chapters: List<ChapterItem>): Boolean {
return chapters.size in 21..300 return chapters.size in 21..300
} }
/** /**
* Returns the next unread chapter or null if everything is read. * Returns the next unread chapter or null if everything is read.
*/ */

View File

@ -36,8 +36,7 @@ import kotlinx.android.synthetic.main.manga_header_item.*
class MangaHeaderHolder( class MangaHeaderHolder(
private val view: View, private val view: View,
private val adapter: MangaDetailsAdapter, private val adapter: MangaDetailsAdapter,
startExpanded: Boolean, startExpanded: Boolean
isTablet: Boolean = false
) : BaseFlexibleViewHolder(view, adapter) { ) : BaseFlexibleViewHolder(view, adapter) {
private var showReadingButton = true private var showReadingButton = true
@ -97,7 +96,6 @@ class MangaHeaderHolder(
track_button.setOnClickListener { adapter.delegate.showTrackingSheet() } track_button.setOnClickListener { adapter.delegate.showTrackingSheet() }
if (startExpanded) expandDesc() if (startExpanded) expandDesc()
else collapseDesc() else collapseDesc()
if (isTablet) chapter_layout.gone()
} else { } else {
filter_button.updateLayoutParams<ViewGroup.MarginLayoutParams> { filter_button.updateLayoutParams<ViewGroup.MarginLayoutParams> {
marginEnd = 12.dpToPx marginEnd = 12.dpToPx

View File

@ -12,7 +12,6 @@ import eu.kanade.tachiyomi.util.system.HashCode
class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) : class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) :
AbstractFlexibleItem<MangaHeaderHolder>() { AbstractFlexibleItem<MangaHeaderHolder>() {
var isTablet = false
var isChapterHeader = false var isChapterHeader = false
var isLocked = false var isLocked = false
@ -29,7 +28,7 @@ class MangaHeaderItem(val manga: Manga, var startExpanded: Boolean) :
} }
override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): MangaHeaderHolder { override fun createViewHolder(view: View, adapter: FlexibleAdapter<IFlexible<RecyclerView.ViewHolder>>): MangaHeaderHolder {
return MangaHeaderHolder(view, adapter as MangaDetailsAdapter, startExpanded, isTablet) return MangaHeaderHolder(view, adapter as MangaDetailsAdapter, startExpanded)
} }
override fun bindViewHolder( override fun bindViewHolder(