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

toolbar workaround behaviour

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