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)
adapter = CategoryAdapter(this@CategoryController)
recycler.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(view.context)
recycler.layoutManager = LinearLayoutManager(view.context)
recycler.setHasFixedSize(true)
recycler.adapter = adapter
adapter?.isHandleDragEnabled = true
@ -93,10 +93,13 @@ class CategoryController : NucleusController<CategoryPresenter>(),
val fabBaseMarginBottom = fab?.marginBottom ?: 0
recycler.doOnApplyWindowInsets { v, insets, padding ->
v.updatePaddingRelative(bottom = padding.bottom + insets.systemWindowInsetBottom)
fab?.updateLayoutParams<ViewGroup.MarginLayoutParams> {
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.core.graphics.drawable.DrawableCompat
import androidx.core.view.GravityCompat
import androidx.drawerlayout.widget.DrawerLayout
import com.bluelinelabs.conductor.ControllerChangeHandler
import com.bluelinelabs.conductor.ControllerChangeType
import com.f2prateek.rx.preferences.Preference
@ -215,7 +216,7 @@ class LibraryController(
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
navView = view
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.GlideException
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.transition.Transition
import com.google.android.material.snackbar.BaseTransientBottomBar
@ -578,18 +579,17 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
3 -> centerCrop().transform(MaskTransformation(R.drawable.mask_star))
}
}
.listener(object : RequestListener<Bitmap> {
override fun onResourceReady(resource: Bitmap, model: Any, target: Target<Bitmap>, dataSource: DataSource, isFirstResource: Boolean): Boolean {
.into(object : CustomTarget<Bitmap>(96, 96) {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
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)
return true
}
})
.submit()
}
/**

View File

@ -77,9 +77,11 @@ class PreMigrationController(bundle: Bundle? = null) : BaseController(bundle), F
val bottomSheet = dialog?.findViewById<FrameLayout>(
com.google.android.material.R.id.design_bottom_sheet
)
val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
behavior.skipCollapsed = true
if (bottomSheet != null) {
val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet)
behavior.state = BottomSheetBehavior.STATE_EXPANDED
behavior.skipCollapsed = true
}
}
}
}

View File

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

View File

@ -30,7 +30,7 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
private val preferences by injectLazy<PreferencesHelper>()
private var behavior: BottomSheetBehavior<*>? = null
private var sheetBehavior: BottomSheetBehavior<*>? = null
/**
* 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)
setContentView(view)
behavior = BottomSheetBehavior.from(view.parent as ViewGroup)
sheetBehavior = BottomSheetBehavior.from(view.parent as ViewGroup)
// Initialize subscriptions.
subscriptions += preferences.colorFilter().asObservable()
@ -138,8 +138,8 @@ class ReaderColorFilterSheet(activity: ReaderActivity) : BottomSheetDialog(activ
override fun onStart() {
super.onStart()
behavior?.skipCollapsed = true
behavior?.state = BottomSheetBehavior.STATE_EXPANDED
sheetBehavior?.skipCollapsed = true
sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
}
override fun onDetachedFromWindow() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -97,9 +97,6 @@
<item name="background_card">@color/dialogDark</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 name="Theme.Base.Reader.Light" parent="Theme.AppCompat.Light.NoActionBar">