diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 63f8a789e4..5a51fde625 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -262,7 +262,9 @@ open class MainActivity : BaseActivity(), DownloadServiceListener { ) { syncActivityViewWithController(to, from, isPush) appbar.y = 0f - bottom_nav.translationY = 0f + if (!isPush) { + bottom_nav.translationY = 0f + } snackBar?.dismiss() } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/view/ControllerExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/view/ControllerExtensions.kt index 5e64378591..45f249cc96 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/view/ControllerExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/view/ControllerExtensions.kt @@ -4,11 +4,13 @@ import android.animation.ValueAnimator import android.content.Context import android.content.Intent import android.content.pm.PackageManager +import android.view.Gravity import android.view.View import android.view.ViewGroup import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.WindowInsets import android.view.inputmethod.InputMethodManager +import android.widget.FrameLayout import androidx.appcompat.widget.SearchView import androidx.core.content.ContextCompat import androidx.core.math.MathUtils @@ -127,6 +129,7 @@ fun Controller.scrollViewWith( val randomTag = Random.nextLong() var lastY = 0f var fakeToolbarView: View? = null + var fakeBottomNavView: View? = null if (!customPadding) { recycler.updatePaddingRelative( top = activity!!.toolbar.y.toInt() + appBarHeight @@ -179,6 +182,11 @@ fun Controller.scrollViewWith( parent.removeView(fakeToolbarView) fakeToolbarView = null } + if (fakeBottomNavView?.parent != null) { + val parent = fakeBottomNavView?.parent as? ViewGroup ?: return + parent.removeView(fakeBottomNavView) + fakeBottomNavView = null + } lastY = 0f activity!!.toolbar.tag = randomTag activity!!.toolbar.setOnClickListener { @@ -203,6 +211,20 @@ fun Controller.scrollViewWith( v.layoutParams = params onLeavingController?.invoke() } + if (!customPadding && router.backstackSize == 2) { + val parent = recycler.parent as? ViewGroup ?: return + val bottomNav = activity!!.bottom_nav ?: return + val v = View(activity) + fakeBottomNavView = v + parent.addView(v, parent.indexOfChild(recycler) + 1) + val params = fakeBottomNavView?.layoutParams + params?.height = recycler.paddingBottom + (params as? FrameLayout.LayoutParams)?.gravity = Gravity.BOTTOM + fakeBottomNavView?.translationY = bottomNav.translationY + params?.width = MATCH_PARENT + v.setBackgroundColor(v.context.getResourceColor(R.attr.colorPrimaryVariant)) + v.layoutParams = params + } elevationAnim?.cancel() if (activity!!.toolbar.tag == randomTag) activity!!.toolbar.setOnClickListener(null) }