Commit 52479f5f authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

toolbar workaround behaviour

parent 2bf2aafc
...@@ -91,6 +91,11 @@ class RoomParkMainActivity( ...@@ -91,6 +91,11 @@ class RoomParkMainActivity(
override fun setToolbar(header:HeaderToolbarModel?,status:StatusToolbarModel?){ override fun setToolbar(header:HeaderToolbarModel?,status:StatusToolbarModel?){
Timber.d("pffff appbr: ${appBar.height}")
Timber.d("pffff toolbar: ${topAppBar.height}")
Timber.d("pffff tbContainer: ${tbContainer.height}")
Timber.d("pffff headerToolbar: ${headerToolbar.height}")
Timber.d("pffff statusToolbar: ${statusToolbar.height}")
appBar.setExpanded(false,false) appBar.setExpanded(false,false)
if (header == null && status == null){ if (header == null && status == null){
hideAll() hideAll()
...@@ -137,11 +142,17 @@ class RoomParkMainActivity( ...@@ -137,11 +142,17 @@ class RoomParkMainActivity(
override fun hide() { override fun hide() {
bottomNavigation.setGone(true) bottomNavigation.setGone(true)
bottomNavigation.setGone(true) bottomNavigation.setGone(true)
val params = conductorContainer.layoutParams as CoordinatorLayout.LayoutParams
params.bottomMargin = 0
conductorContainer.requestLayout()
} }
override fun show() { override fun show() {
bottomNavigation.setGone(false) bottomNavigation.setGone(false)
bottomNavigation.setGone(false) bottomNavigation.setGone(false)
val params = conductorContainer.layoutParams as CoordinatorLayout.LayoutParams
params.bottomMargin = bottomNavigation.height
conductorContainer.requestLayout()
} }
...@@ -151,9 +162,9 @@ class RoomParkMainActivity( ...@@ -151,9 +162,9 @@ class RoomParkMainActivity(
// appBar.visibility= View.VISIBLE // appBar.visibility= View.VISIBLE
topAppBar.visibility = View.VISIBLE topAppBar.visibility = View.VISIBLE
val params = conductor_container.layoutParams as CoordinatorLayout.LayoutParams val params = conductorContainer.layoutParams as CoordinatorLayout.LayoutParams
params.behavior = AppBarLayout.ScrollingViewBehavior() params.behavior = AppBarLayout.ScrollingViewBehavior()
conductor_container.requestLayout() conductorContainer.requestLayout()
} }
override fun appBarScrollable(allow: Boolean) { override fun appBarScrollable(allow: Boolean) {
......
...@@ -47,7 +47,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -47,7 +47,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
protected abstract fun getLayoutId(): Int protected abstract fun getLayoutId(): Int
lateinit var toolBar: ICollapsingToolBar lateinit var toolBar: ICollapsingToolBar
lateinit var bottomNavigation: IBottomNavigation lateinit var bottomNavigationController: IBottomNavigation
lateinit var snackbar: ISnackBarProvider lateinit var snackbar: ISnackBarProvider
override fun onAttach(view: View) { override fun onAttach(view: View) {
...@@ -78,7 +78,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -78,7 +78,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
(activity as RoomParkMainActivity).let{ (activity as RoomParkMainActivity).let{
snackbar = ActivityModule.provideSnackBar(it) snackbar = ActivityModule.provideSnackBar(it)
toolBar = it toolBar = it
bottomNavigation = it bottomNavigationController = it
snackbar.bindRootView(toolBar.coordinatorLayout) snackbar.bindRootView(toolBar.coordinatorLayout)
} }
onViewBound(view) onViewBound(view)
......
...@@ -105,7 +105,7 @@ class AlbumsScreenController : ...@@ -105,7 +105,7 @@ class AlbumsScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.hideAll() toolBar.hideAll()
bottomNavigation.hide() bottomNavigationController.hide()
bindRecycler() bindRecycler()
} }
......
...@@ -87,7 +87,7 @@ class ArticleScreenController : ...@@ -87,7 +87,7 @@ class ArticleScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.setToolbar() toolBar.setToolbar()
bottomNavigation.hide() bottomNavigationController.hide()
bindRecycler() bindRecycler()
} }
......
...@@ -31,7 +31,7 @@ class AuthScreenController : ...@@ -31,7 +31,7 @@ class AuthScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.setToolbar() toolBar.setToolbar()
bottomNavigation.hide() bottomNavigationController.hide()
} }
@BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout @BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout
......
...@@ -130,7 +130,7 @@ class DealScreenController : ...@@ -130,7 +130,7 @@ class DealScreenController :
} }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.hide() bottomNavigationController.hide()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
} }
......
...@@ -65,7 +65,7 @@ class DealsScreenController : ...@@ -65,7 +65,7 @@ class DealsScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.show() bottomNavigationController.show()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
detachDisposable.addAll( detachDisposable.addAll(
......
...@@ -208,7 +208,7 @@ class EstateScreenController : ...@@ -208,7 +208,7 @@ class EstateScreenController :
} }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.hide() bottomNavigationController.hide()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
} }
......
...@@ -65,7 +65,7 @@ class FavoritesScreenController : ...@@ -65,7 +65,7 @@ class FavoritesScreenController :
} }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.show() bottomNavigationController.show()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
detachDisposable.addAll( detachDisposable.addAll(
......
...@@ -86,7 +86,7 @@ class ArticlesScreenController : ...@@ -86,7 +86,7 @@ class ArticlesScreenController :
} }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.hide() bottomNavigationController.hide()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
} }
......
...@@ -139,7 +139,7 @@ class FeedsScreenController : ...@@ -139,7 +139,7 @@ class FeedsScreenController :
.map { storedFeedsList[it.position] } .map { storedFeedsList[it.position] }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.show() bottomNavigationController.show()
toolBar.setToolbar() toolBar.setToolbar()
bindRecycler() bindRecycler()
......
...@@ -29,9 +29,9 @@ class HomeController : ...@@ -29,9 +29,9 @@ class HomeController :
, HomeScreen { , HomeScreen {
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.bottomNavigation.visibility = BottomNavigationView.VISIBLE bottomNavigationController.bottomNavigation.visibility = BottomNavigationView.VISIBLE
viewpager.offscreenPageLimit = 0 viewpager.offscreenPageLimit = 0
pageAdapter = BNVRouterPagerAdapter(this,bottomNavigation.bottomNavigation,viewpager, pageAdapter = BNVRouterPagerAdapter(this,bottomNavigationController.bottomNavigation,viewpager,
mapOf( mapOf(
Pair(R.id.tab_feeds,{FeedsScreenController()}) Pair(R.id.tab_feeds,{FeedsScreenController()})
,Pair(R.id.tab_favorites,{ FavoritesScreenController() }) ,Pair(R.id.tab_favorites,{ FavoritesScreenController() })
......
package com.biganto.visual.roompark.presentation.screen.home.home_routing package com.biganto.visual.roompark.presentation.screen.home.home_routing
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.util.SparseArray import android.util.SparseArray
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
...@@ -47,7 +46,7 @@ abstract class BottomNavigationController : ...@@ -47,7 +46,7 @@ abstract class BottomNavigationController :
, HomeScreenPresenter> , HomeScreenPresenter>
, HomeScreen { , HomeScreen {
lateinit var bottomNavigationView: BottomNavigationView
lateinit var controllerContainer: ChangeHandlerFrameLayout lateinit var controllerContainer: ChangeHandlerFrameLayout
...@@ -83,7 +82,7 @@ abstract class BottomNavigationController : ...@@ -83,7 +82,7 @@ abstract class BottomNavigationController :
* Must be done in onAttach to avoid artifacts if using multiple Activities, * Must be done in onAttach to avoid artifacts if using multiple Activities,
* and in case of resuming the app (i.e. when the view is not created again) * and in case of resuming the app (i.e. when the view is not created again)
*/ */
val menu = bottomNavigationView.menu val menu = bottomNavigationController.bottomNavigation.menu
val menuSize = menu.size() val menuSize = menu.size()
routerSavedStateBundles = SparseArray(menuSize) routerSavedStateBundles = SparseArray(menuSize)
val startUpMenuItem = menu.findItem(getStartupMenuId()) val startUpMenuItem = menu.findItem(getStartupMenuId())
...@@ -98,7 +97,7 @@ abstract class BottomNavigationController : ...@@ -98,7 +97,7 @@ abstract class BottomNavigationController :
* So basically all we're doing here is always setting up menuItem index 0. * So basically all we're doing here is always setting up menuItem index 0.
*/ */
val itemId = menuItem.itemId val itemId = menuItem.itemId
bottomNavigationView.selectedItemId = itemId bottomNavigationController.bottomNavigation.selectedItemId = itemId
navigateTo(getControllerFor(itemId), false) navigateTo(getControllerFor(itemId), false)
break break
} }
...@@ -191,9 +190,7 @@ abstract class BottomNavigationController : ...@@ -191,9 +190,7 @@ abstract class BottomNavigationController :
ensureMenuSelectionState(newMenuItem) ensureMenuSelectionState(newMenuItem)
} }
} else { } else {
Log.e( Timber.e("Attempted to reset backstack on BottomNavigationController with currentlySelectedItemId=$currentlySelectedItemId")
TAG,
"Attempted to reset backstack on BottomNavigationController with currentlySelectedItemId=$currentlySelectedItemId")
} }
} else { } else {
/* /*
...@@ -217,7 +214,7 @@ abstract class BottomNavigationController : ...@@ -217,7 +214,7 @@ abstract class BottomNavigationController :
router.popToTag(tag) router.popToTag(tag)
} }
} else { } else {
Log.e(TAG, "Attempted to navigate to unsupported controller=$controller") Timber.e("Attempted to navigate to unsupported controller=$controller")
} }
} }
...@@ -261,9 +258,7 @@ abstract class BottomNavigationController : ...@@ -261,9 +258,7 @@ abstract class BottomNavigationController :
getRouter().popToTag(tag) getRouter().popToTag(tag)
} }
} else { } else {
Log.e( Timber.e("Attempted to navigate to backstack with unsupported root controller=$rootController")
TAG,
"Attempted to navigate to backstack with unsupported root controller=$rootController")
} }
} }
...@@ -273,7 +268,7 @@ abstract class BottomNavigationController : ...@@ -273,7 +268,7 @@ abstract class BottomNavigationController :
* @param menuItemId * @param menuItemId
*/ */
private fun ensureMenuSelectionState(@IdRes menuItemId: Int) { private fun ensureMenuSelectionState(@IdRes menuItemId: Int) {
val menu = bottomNavigationView.menu val menu = bottomNavigationController.bottomNavigation.menu
for (i in 0 until menu.size()) { for (i in 0 until menu.size()) {
val menuItem = menu.getItem(i) val menuItem = menu.getItem(i)
if (menuItem.isChecked && menuItem.itemId != menuItemId) { if (menuItem.isChecked && menuItem.itemId != menuItemId) {
...@@ -284,7 +279,7 @@ abstract class BottomNavigationController : ...@@ -284,7 +279,7 @@ abstract class BottomNavigationController :
} }
} }
if (currentlySelectedItemId != menuItemId) { if (currentlySelectedItemId != menuItemId) {
Log.e(TAG, "Unexpected BottomNavigation selected Menu Item.") Timber.e("Unexpected BottomNavigation selected Menu Item.")
} }
} }
......
...@@ -5,7 +5,6 @@ import android.view.View ...@@ -5,7 +5,6 @@ import android.view.View
import androidx.annotation.IdRes import androidx.annotation.IdRes
import androidx.annotation.NonNull import androidx.annotation.NonNull
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.IBottomNavigation
import com.biganto.visual.roompark.base.ICollapsingToolBar import com.biganto.visual.roompark.base.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
...@@ -18,7 +17,6 @@ import com.biganto.visual.roompark.presentation.screen.home.HomeScreenViewState ...@@ -18,7 +17,6 @@ import com.biganto.visual.roompark.presentation.screen.home.HomeScreenViewState
import com.biganto.visual.roompark.presentation.screen.settings.SettingsScreenController import com.biganto.visual.roompark.presentation.screen.settings.SettingsScreenController
import com.biganto.visual.roompark.presentation.screen.to_flat.FindFlatScreenController import com.biganto.visual.roompark.presentation.screen.to_flat.FindFlatScreenController
import com.bluelinelabs.conductor.Controller import com.bluelinelabs.conductor.Controller
import com.google.android.material.bottomnavigation.BottomNavigationView
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
...@@ -87,20 +85,18 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds) ...@@ -87,20 +85,18 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
override fun onViewBound(@NonNull view: View) { override fun onViewBound(@NonNull view: View) {
bottomNavigation.show() super.onViewBound(view)
toolBar.setToolbar()
bottomNavigationController.show()
Timber.d(" onViewBound: ${this::class}") Timber.d(" onViewBound: ${this::class}")
bottomNavigationView =
((activity as RoomParkMainActivity) as IBottomNavigation).bottomNavigation
bottomNavigationView.visibility = BottomNavigationView.VISIBLE
controllerContainer = view.findViewById(R.id.tabContainer) controllerContainer = view.findViewById(R.id.tabContainer)
bottomNavigationView.setOnNavigationItemSelectedListener { item -> bottomNavigationController.bottomNavigation.setOnNavigationItemSelectedListener { item ->
navigateTo(getControllerFor(item.itemId), false) navigateTo(getControllerFor(item.itemId), false)
true true
} }
router.backstack.clear() router.backstack.clear()
val toScreen = args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds) // val toScreen = args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds)
} }
override fun getControllerFor(menuItemId: Int): Controller = when (menuItemId) { override fun getControllerFor(menuItemId: Int): Controller = when (menuItemId) {
......
...@@ -48,7 +48,7 @@ class PhotoScreenController : ...@@ -48,7 +48,7 @@ class PhotoScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.setToolbar() toolBar.setToolbar()
bottomNavigation.hide() bottomNavigationController.hide()
bindRecycler() bindRecycler()
} }
......
...@@ -100,7 +100,7 @@ class SettingsScreenController : ...@@ -100,7 +100,7 @@ class SettingsScreenController :
} }
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.show() bottomNavigationController.show()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
} }
......
...@@ -23,8 +23,8 @@ class SplashScreenController : ...@@ -23,8 +23,8 @@ class SplashScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.setToolbar() // toolBar.setToolbar()
bottomNavigation.hide() bottomNavigationController.hide()
} }
override fun injectDependencies() { override fun injectDependencies() {
......
...@@ -91,7 +91,7 @@ class FindFlatScreenController : ...@@ -91,7 +91,7 @@ class FindFlatScreenController :
) )
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
bottomNavigation.show() bottomNavigationController.show()
setToolbar() setToolbar()
estateTabs.forEach {estate -> estateTabs.forEach {estate ->
val tab = flatTabs.newTab() val tab = flatTabs.newTab()
......
...@@ -51,7 +51,7 @@ class WebCamScreenController : ...@@ -51,7 +51,7 @@ class WebCamScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.setToolbar() toolBar.setToolbar()
bottomNavigation.hide() bottomNavigationController.hide()
} }
override fun injectDependencies() { override fun injectDependencies() {
......
...@@ -12,36 +12,35 @@ ...@@ -12,36 +12,35 @@
android:id="@+id/topToolbarHolder" android:id="@+id/topToolbarHolder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="56dp"
android:padding="0dp" android:padding="0dp"
android:background="@color/colorPrimary"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar" android:id="@+id/app_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constrainedHeight="true"
android:clipToPadding="true" android:clipToPadding="true"
android:padding="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Light"
app:expanded="true"
app:layout_behavior=".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:liftOnScroll="true"
android:contentInsetStart="0dp" android:contentInsetStart="0dp"
android:contentInsetLeft="0dp" android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp" android:contentInsetEnd="0dp"
android:contentInsetRight="0dp" android:contentInsetRight="0dp"
android:minHeight="0dp"
android:padding="0dp"
android:theme="@style/ThemeOverlay.AppCompat.Light"
android:visibility="visible" android:visibility="visible"
app:contentInsetEnd="0dp" app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp" app:contentInsetLeft="0dp"
app:contentInsetRight="0dp" app:contentInsetRight="0dp"
app:contentInsetStart="0dp" app:contentInsetStart="0dp"
android:minHeight="0dp" app:expanded="true"
app:titleEnabled="false" app:layout_behavior=".util.view_utils.app_bar.DragControlAppBarLayoutBehaviour"
tools:visibility="invisible"> app:layout_constrainedHeight="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:liftOnScroll="true"
app:titleEnabled="false">
<androidx.appcompat.widget.Toolbar <androidx.appcompat.widget.Toolbar
android:id="@+id/top_toolbar" android:id="@+id/top_toolbar"
...@@ -52,9 +51,9 @@ ...@@ -52,9 +51,9 @@
android:contentInsetLeft="0dp" android:contentInsetLeft="0dp"
android:contentInsetEnd="0dp" android:contentInsetEnd="0dp"
android:contentInsetRight="0dp" android:contentInsetRight="0dp"
android:padding="0dp"
android:visibility="invisible"
android:minHeight="0dp" android:minHeight="0dp"
android:padding="0dp"
android:visibility="visible"
app:contentInsetEnd="0dp" app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp" app:contentInsetLeft="0dp"
app:contentInsetRight="0dp" app:contentInsetRight="0dp"
...@@ -93,9 +92,11 @@ ...@@ -93,9 +92,11 @@
<FrameLayout <FrameLayout
android:id="@+id/conductor_container" android:id="@+id/conductor_container"
android:background="@color/colorPrimary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"/> android:layout_marginBottom="56dp"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior" />
<!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout--> <!-- <com.bluelinelabs.conductor.ChangeHandlerFrameLayout-->
<!-- android:id="@+id/conductor_container"--> <!-- android:id="@+id/conductor_container"-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment