Fixes for merging from upstream

This commit is contained in:
Jay 2020-01-09 19:31:09 -08:00
parent b1d221c117
commit 5f2eb19ea3
12 changed files with 37 additions and 30 deletions

View File

@ -81,7 +81,7 @@ class CategoryController : NucleusController<CategoryPresenter>(),
super.onViewCreated(view) super.onViewCreated(view)
adapter = CategoryAdapter(this@CategoryController) adapter = CategoryAdapter(this@CategoryController)
recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context) recycler.layoutManager = LinearLayoutManager(view.context)
recycler.setHasFixedSize(true) recycler.setHasFixedSize(true)
recycler.adapter = adapter recycler.adapter = adapter
adapter?.isHandleDragEnabled = true adapter?.isHandleDragEnabled = true
@ -93,10 +93,13 @@ class CategoryController : NucleusController<CategoryPresenter>(),
val fabBaseMarginBottom = fab?.marginBottom ?: 0 val fabBaseMarginBottom = fab?.marginBottom ?: 0
recycler.doOnApplyWindowInsets { v, insets, padding -> recycler.doOnApplyWindowInsets { v, insets, padding ->
v.updatePaddingRelative(bottom = padding.bottom + insets.systemWindowInsetBottom)
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> { fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom bottomMargin = fabBaseMarginBottom + insets.systemWindowInsetBottom
} }
// offset the recycler by the fab's inset + some inset on top
v.updatePaddingRelative(bottom = padding.bottom + (fab?.marginBottom ?: 0) +
fabBaseMarginBottom + (fab?.height ?: 0))
} }
} }

View File

@ -18,6 +18,7 @@ import androidx.appcompat.view.ActionMode
import androidx.appcompat.widget.SearchView import androidx.appcompat.widget.SearchView
import androidx.core.graphics.drawable.DrawableCompat import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.GravityCompat import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout
import com.bluelinelabs.conductor.ControllerChangeHandler import com.bluelinelabs.conductor.ControllerChangeHandler
import com.bluelinelabs.conductor.ControllerChangeType import com.bluelinelabs.conductor.ControllerChangeType
import com.f2prateek.rx.preferences.Preference import com.f2prateek.rx.preferences.Preference
@ -215,7 +216,7 @@ class LibraryController(
super.onDetach(view) super.onDetach(view)
} }
override fun createSecondaryDrawer(drawer: androidx.drawerlayout.widget.DrawerLayout): ViewGroup { override fun createSecondaryDrawer(drawer: DrawerLayout): ViewGroup {
val view = drawer.inflate(R.layout.library_drawer) as LibraryNavigationView val view = drawer.inflate(R.layout.library_drawer) as LibraryNavigationView
navView = view navView = view
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END) drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, GravityCompat.END)

View File

@ -25,6 +25,7 @@ import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.engine.GlideException import com.bumptech.glide.load.engine.GlideException
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.request.RequestListener
import com.bumptech.glide.request.target.CustomTarget import com.bumptech.glide.request.target.CustomTarget
import com.bumptech.glide.request.transition.Transition import com.bumptech.glide.request.transition.Transition
import com.google.android.material.snackbar.BaseTransientBottomBar import com.google.android.material.snackbar.BaseTransientBottomBar
@ -578,18 +579,17 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
3 -> centerCrop().transform(MaskTransformation(R.drawable.mask_star)) 3 -> centerCrop().transform(MaskTransformation(R.drawable.mask_star))
} }
} }
.listener(object : RequestListener<Bitmap> { .into(object : CustomTarget<Bitmap>(96, 96) {
override fun onResourceReady(resource: Bitmap, model: Any, target: Target<Bitmap>, dataSource: DataSource, isFirstResource: Boolean): Boolean { override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
createShortcut(resource) createShortcut(resource)
return true
} }
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean { override fun onLoadCleared(placeholder: Drawable?) { }
override fun onLoadFailed(errorDrawable: Drawable?) {
activity?.toast(R.string.icon_creation_fail) activity?.toast(R.string.icon_creation_fail)
return true
} }
}) })
.submit()
} }
/** /**

View File

@ -77,12 +77,14 @@ class PreMigrationController(bundle: Bundle? = null) : BaseController(bundle), F
val bottomSheet = dialog?.findViewById<FrameLayout>( val bottomSheet = dialog?.findViewById<FrameLayout>(
com.google.android.material.R.id.design_bottom_sheet com.google.android.material.R.id.design_bottom_sheet
) )
if (bottomSheet != null) {
val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet) val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet)
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_EXPANDED
behavior.skipCollapsed = true behavior.skipCollapsed = true
} }
} }
} }
}
override fun startMigration(extraParam:String?) { override fun startMigration(extraParam:String?) {
val listOfSources = adapter?.items?.filter { val listOfSources = adapter?.items?.filter {

View File

@ -9,6 +9,7 @@ import android.content.pm.ActivityInfo
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Bitmap import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.KeyEvent import android.view.KeyEvent
import android.view.Menu import android.view.Menu

View File

@ -30,7 +30,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
private val preferences by injectLazy<PreferencesHelper>() private val preferences by injectLazy<PreferencesHelper>()
private var behavior: BottomSheetBehavior<*>? = null private var sheetBehavior: BottomSheetBehavior<*>? = null
/** /**
* Subscriptions used for this dialog * Subscriptions used for this dialog
@ -51,7 +51,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
val view = activity.layoutInflater.inflate(R.layout.reader_color_filter_sheet, null) val view = activity.layoutInflater.inflate(R.layout.reader_color_filter_sheet, null)
setContentView(view) setContentView(view)
behavior = BottomSheetBehavior.from(view.parent as ViewGroup) sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup)
// Initialize subscriptions. // Initialize subscriptions.
subscriptions += preferences.colorFilter().asObservable() subscriptions += preferences.colorFilter().asObservable()
@ -138,8 +138,8 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
behavior?.skipCollapsed = true sheetBehavior?.skipCollapsed = true
behavior?.state = BottomSheetBehavior.STATE_EXPANDED sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
} }
override fun onDetachedFromWindow() { override fun onDetachedFromWindow() {

View File

@ -33,9 +33,9 @@ class DownloadPageLoader(
return downloadManager.buildPageList(source, manga, chapter.chapter) return downloadManager.buildPageList(source, manga, chapter.chapter)
.map { pages -> .map { pages ->
pages.map { page -> pages.map { page ->
ReaderPage(page.index, page.url, page.imageUrl) { ReaderPage(page.index, page.url, page.imageUrl, {
context.contentResolver.openInputStream(page.uri ?: Uri.EMPTY)!! context.contentResolver.openInputStream(page.uri ?: Uri.EMPTY)!!
}.apply { }).apply {
status = Page.READY status = Page.READY
} }
} }

View File

@ -21,6 +21,7 @@ import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.amulyakhare.textdrawable.TextDrawable import com.amulyakhare.textdrawable.TextDrawable
import com.amulyakhare.textdrawable.util.ColorGenerator import com.amulyakhare.textdrawable.util.ColorGenerator
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import kotlin.math.min
/** /**
* Returns coordinates of view. * Returns coordinates of view.
@ -42,7 +43,7 @@ Unit)? = null): Snackbar {
val snack = Snackbar.make(this, message, length) val snack = Snackbar.make(this, message, length)
val textView: TextView = snack.view.findViewById(com.google.android.material.R.id.snackbar_text) val textView: TextView = snack.view.findViewById(com.google.android.material.R.id.snackbar_text)
textView.setTextColor(context.getResourceColor(R.attr.snackbar_text)) textView.setTextColor(context.getResourceColor(R.attr.snackbar_text))
when { /* when {
Build.VERSION.SDK_INT >= 23 -> { Build.VERSION.SDK_INT >= 23 -> {
val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft val leftM = if (this is CoordinatorLayout) 0 else rootWindowInsets.systemWindowInsetLeft
val rightM = if (this is CoordinatorLayout) 0 val rightM = if (this is CoordinatorLayout) 0
@ -51,21 +52,22 @@ Unit)? = null): Snackbar {
.systemWindowInsetBottom, rightM, leftM) .systemWindowInsetBottom, rightM, leftM)
} }
else -> snack.config(context) else -> snack.config(context)
} }*/
snack.config(context)
if (f != null) { if (f != null) {
snack.f() snack.f()
} }
if (Build.VERSION.SDK_INT < 23) { // if (Build.VERSION.SDK_INT < 23) {
val view = if (this !is CoordinatorLayout) this else snack.view val view = if (this !is CoordinatorLayout) this else snack.view
view.doOnApplyWindowInsets { _, insets, _ -> view.doOnApplyWindowInsets { _, insets, _ ->
snack.view.updateLayoutParams<ViewGroup.MarginLayoutParams> { snack.view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
bottomMargin = 12 + insets.systemWindowInsetBottom bottomMargin = 12 + insets.systemWindowInsetBottom
} }
} }
} /*}
else { else {
snack.view.doOnApplyWindowInsets { _,_,_ -> } snack.view.doOnApplyWindowInsets { _,_,_ -> }
} }*/
snack.show() snack.show()
return snack return snack
} }

View File

@ -32,7 +32,7 @@ class FABMoveBehaviour(context: Context, attrs: AttributeSet) :
val dependencies = parent.getDependencies(fab) val dependencies = parent.getDependencies(fab)
for (i in 0 until dependencies.size) { for (i in 0 until dependencies.size) {
val view = dependencies[i] val view = dependencies[i]
if (view is Snackbar.SnackbarLayout) { if (view is Snackbar.SnackbarLayout && view.isShown) {
minOffset = min(minOffset, view.translationY - view.height) minOffset = min(minOffset, view.translationY - view.height)
} }
} }

View File

@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorSplash" /> <item android:drawable="@color/cardBackground" />
<item> <item>
<bitmap <bitmap
android:gravity="center" android:gravity="center"
android:src="@drawable/splash_icon" /> android:src="@drawable/splash_icon"
android:tint="@color/snackbarBackground"/>
</item> </item>
</layer-list> </layer-list>

View File

@ -20,7 +20,7 @@
android:id="@+id/fab" android:id="@+id/fab"
app:layout_anchor="@id/recycler" app:layout_anchor="@id/recycler"
app:srcCompat="@drawable/ic_add_white_24dp" app:srcCompat="@drawable/ic_add_white_24dp"
style="@style/Theme.Widget.FAB"/> style="@style/Theme.Widget.FABFixed"/>
<eu.kanade.tachiyomi.widget.EmptyView <eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/empty_view" android:id="@+id/empty_view"

View File

@ -97,9 +97,6 @@
<item name="background_card">@color/dialogDark</item> <item name="background_card">@color/dialogDark</item>
<item name="icon_color">@color/iconColorDark</item> <item name="icon_color">@color/iconColorDark</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">?colorPrimaryDark</item>
<item name="android:navigationBarColor">?colorPrimaryDark</item>
</style> </style>
<style name="Theme.Base.Reader.Light" parent="Theme.AppCompat.Light.NoActionBar"> <style name="Theme.Base.Reader.Light" parent="Theme.AppCompat.Light.NoActionBar">