Add "Continue" FAB to navigation rail
This commit is contained in:
@@ -92,6 +92,7 @@ class MainActivity :
|
||||
|
||||
navBar.setOnItemSelectedListener(this)
|
||||
binding.fab.setOnClickListener(this)
|
||||
binding.navRail?.headerView?.setOnClickListener(this)
|
||||
binding.searchView.isVoiceSearchEnabled = voiceInputLauncher.resolve(this, null) != null
|
||||
|
||||
supportFragmentManager.findFragmentByTag(TAG_PRIMARY)?.let {
|
||||
@@ -150,6 +151,7 @@ class MainActivity :
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.fab -> viewModel.openLastReader()
|
||||
R.id.railFab -> viewModel.openLastReader()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,8 +260,8 @@ class MainActivity :
|
||||
}
|
||||
|
||||
private fun onOpenReader(manga: Manga) {
|
||||
val options = ActivityOptions.makeScaleUpAnimation(binding.fab, 0, 0, binding.fab.width, binding.fab.height)
|
||||
startActivity(ReaderActivity.newIntent(this, manga), options?.toBundle())
|
||||
// val options = ActivityOptions.makeScaleUpAnimation(binding.fab, 0, 0, binding.fab.width, binding.fab.height)
|
||||
startActivity(ReaderActivity.newIntent(this, manga))
|
||||
}
|
||||
|
||||
private fun onError(e: Throwable) {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package org.koitharu.kotatsu.main.ui
|
||||
|
||||
import android.view.View
|
||||
import androidx.core.view.OnApplyWindowInsetsListener
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.core.view.updatePadding
|
||||
import java.lang.ref.WeakReference
|
||||
import com.google.android.material.R as materialR
|
||||
|
||||
class NavigationViewInsetsListener : OnApplyWindowInsetsListener {
|
||||
|
||||
private var menuViewRef: WeakReference<View>? = null
|
||||
|
||||
override fun onApplyWindowInsets(v: View, insets: WindowInsetsCompat): WindowInsetsCompat {
|
||||
val menuView = menuViewRef?.get() ?: v.findViewById<View>(materialR.id.design_navigation_view).also {
|
||||
menuViewRef = WeakReference(it)
|
||||
}
|
||||
val systemWindowInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||
v.updatePadding(top = systemWindowInsets.top)
|
||||
// NavigationView doesn't dispatch insets to the menu view, so pad the bottom here.
|
||||
menuView.updatePadding(bottom = systemWindowInsets.bottom)
|
||||
return WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
}
|
||||
@@ -43,11 +43,12 @@ class SearchSuggestionFragment :
|
||||
}
|
||||
|
||||
override fun onWindowInsetsChanged(insets: Insets) {
|
||||
val headerHeight = (activity as? AppBarOwner)?.appBar?.measureHeight() ?: insets.top
|
||||
val extraPadding = resources.getDimensionPixelOffset(R.dimen.list_spacing)
|
||||
binding.root.updatePadding(
|
||||
top = headerHeight + extraPadding,
|
||||
bottom = insets.bottom + extraPadding,
|
||||
top = extraPadding,
|
||||
right = insets.right,
|
||||
left = insets.left,
|
||||
bottom = insets.bottom
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user