mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 16:31:50 +01:00
Better Tablet support
This commit is contained in:
parent
eb5d9015a2
commit
10c6d4f8f2
@ -251,6 +251,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package eu.kanade.tachiyomi.data.database.models
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
|
||||
open class MangaImpl : Manga {
|
||||
|
||||
override var id: Long? = null
|
||||
@ -34,6 +36,12 @@ open class MangaImpl : Manga {
|
||||
|
||||
override var hide_title: Boolean = false
|
||||
|
||||
override fun copyFrom(other: SManga) {
|
||||
if (other is MangaImpl && (other as MangaImpl)::title.isInitialized && other.title != title)
|
||||
title = other.title
|
||||
super.copyFrom(other)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other == null || javaClass != other.javaClass) return false
|
||||
|
@ -23,8 +23,6 @@ interface SManga : Serializable {
|
||||
var initialized: Boolean
|
||||
|
||||
fun copyFrom(other: SManga) {
|
||||
if (other.title != title)
|
||||
title = other.title
|
||||
|
||||
if (other.author != null)
|
||||
author = other.author
|
||||
|
@ -151,11 +151,15 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||
container = (view as ViewGroup).findViewById(R.id.manga_info_layout) as? View
|
||||
val bottomM = manga_genres_tags.marginBottom
|
||||
val fabBaseMarginBottom = fab_favorite.marginBottom
|
||||
val manga_coverMarginBottom = fab_favorite.marginBottom
|
||||
container?.doOnApplyWindowInsets { v, insets, padding ->
|
||||
if (resources?.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
fab_favorite?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom
|
||||
}
|
||||
manga_cover?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin = manga_coverMarginBottom + insets.systemWindowInsetBottom
|
||||
}
|
||||
}
|
||||
else {
|
||||
manga_genres_tags?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Rect
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
@ -55,11 +56,17 @@ class FABAnimationUpDown @JvmOverloads constructor(ctx: Context, attrs: Attribut
|
||||
}
|
||||
|
||||
override fun onDependentViewChanged(parent: CoordinatorLayout, child: FloatingActionButton, dependency: View): Boolean {
|
||||
if (isTablet(child.context)) return true
|
||||
val translationY = getFabTranslationYForSnackbar(parent, child)
|
||||
child.translationY = translationY
|
||||
return true
|
||||
}
|
||||
|
||||
private fun isTablet(context: Context): Boolean {
|
||||
return (context.resources.configuration.screenLayout and Configuration
|
||||
.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||
}
|
||||
|
||||
private fun getFabTranslationYForSnackbar(parent: CoordinatorLayout, fab:
|
||||
FloatingActionButton): Float {
|
||||
var minOffset = 0f
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
@ -15,11 +16,17 @@ class FABMoveBehaviour(context: Context, attrs: AttributeSet) :
|
||||
return dependency is Snackbar.SnackbarLayout
|
||||
}
|
||||
override fun onDependentViewChanged(parent: CoordinatorLayout, child: FloatingActionButton, dependency: View): Boolean {
|
||||
if (isTablet(child.context)) return true
|
||||
val translationY = getFabTranslationYForSnackbar(parent, child)
|
||||
child.translationY = translationY
|
||||
return true
|
||||
}
|
||||
|
||||
private fun isTablet(context: Context): Boolean {
|
||||
return (context.resources.configuration.screenLayout and Configuration
|
||||
.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||
}
|
||||
|
||||
private fun getFabTranslationYForSnackbar(parent: CoordinatorLayout, fab: FloatingActionButton): Float {
|
||||
var minOffset = 0f
|
||||
val dependencies = parent.getDependencies(fab)
|
||||
|
Loading…
Reference in New Issue
Block a user