Fix snackbar in feed screen for tablets
This commit is contained in:
@@ -245,8 +245,7 @@ class MainActivity :
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
Snackbar.make(binding.container, e.getDisplayMessage(resources), Snackbar.LENGTH_SHORT).setAnchorView(bottomNav)
|
||||
.show()
|
||||
Snackbar.make(binding.container, e.getDisplayMessage(resources), Snackbar.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
private fun onCountersChanged(counters: SparseIntArray) {
|
||||
|
||||
@@ -73,7 +73,7 @@ class FeedFragment :
|
||||
addMenuProvider(
|
||||
FeedMenuProvider(
|
||||
binding.recyclerView,
|
||||
(activity as? BottomNavOwner)?.bottomNav ?: binding.recyclerView,
|
||||
(activity as? BottomNavOwner)?.bottomNav,
|
||||
viewModel,
|
||||
),
|
||||
)
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.koitharu.kotatsu.tracker.work.TrackWorker
|
||||
|
||||
class FeedMenuProvider(
|
||||
private val snackbarHost: View,
|
||||
private val anchorView: View,
|
||||
private val anchorView: View?,
|
||||
private val viewModel: FeedViewModel,
|
||||
) : MenuProvider {
|
||||
|
||||
|
||||
@@ -129,14 +129,6 @@ fun Context.getAnimationDuration(@IntegerRes resId: Int): Long {
|
||||
return (resources.getInteger(resId) * animatorDurationScale).roundToLong()
|
||||
}
|
||||
|
||||
inline fun <reified T> ViewGroup.findChild(): T? {
|
||||
return children.find { it is T } as? T
|
||||
}
|
||||
|
||||
inline fun <reified T> ViewGroup.findDescendant(): T? {
|
||||
return descendants.find { it is T } as? T
|
||||
}
|
||||
|
||||
fun isLowRamDevice(context: Context): Boolean {
|
||||
return context.activityManager?.isLowRamDevice ?: false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user