Commit 62322aa7 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix backstack behaviour

parent 72b52335
...@@ -90,12 +90,6 @@ class RoomParkMainActivity( ...@@ -90,12 +90,6 @@ class RoomParkMainActivity(
get() = headerToolbar.findViewById<MaterialTextView>(R.id.back_button_chevron) get() = headerToolbar.findViewById<MaterialTextView>(R.id.back_button_chevron)
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()
......
...@@ -74,6 +74,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -74,6 +74,7 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup): View {
val view = inflater.inflate(getLayoutId(), container, false) val view = inflater.inflate(getLayoutId(), container, false)
// instantiate the view // instantiate the view
retainViewMode = RetainViewMode.RELEASE_DETACH
ButterKnife.bind(this, view) ButterKnife.bind(this, view)
(activity as RoomParkMainActivity).let{ (activity as RoomParkMainActivity).let{
snackbar = ActivityModule.provideSnackBar(it) snackbar = ActivityModule.provideSnackBar(it)
...@@ -102,7 +103,8 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon ...@@ -102,7 +103,8 @@ abstract class BigantoBaseController<VS : BigantoBaseViewState,V: BigantoBaseCon
override fun handleBack(): Boolean { override fun handleBack(): Boolean {
router.popController(this) router.popController(this)
return super.handleBack() return true
// return super.handleBack()
} }
fun showError(e: ExceptionString) = fun showError(e: ExceptionString) =
......
...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.base.RoomParkApplication ...@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.domain.model.DealModel import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.typeDoubleString
import com.biganto.visual.roompark.domain.model.typeShortString import com.biganto.visual.roompark.domain.model.typeShortString
import com.biganto.visual.roompark.util.extensions.toRubly import com.biganto.visual.roompark.util.extensions.toRubly
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
...@@ -91,12 +92,10 @@ class DealScreenController : ...@@ -91,12 +92,10 @@ class DealScreenController :
) )
} }
detachDisposable.add( detachDisposable.add(
dealContainer.scrollChangeEvents() dealContainer.scrollChangeEvents()
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
if (it.scrollY > dealTitle.measuredHeight) if (it.scrollY > dealTitle.measuredHeight)
dealModel?.let { deal -> dealModel?.let { deal ->
toolBar.setToolbar( toolBar.setToolbar(
...@@ -118,7 +117,6 @@ class DealScreenController : ...@@ -118,7 +117,6 @@ class DealScreenController :
, true , true
) )
) )
} }
) )
} }
...@@ -159,6 +157,12 @@ class DealScreenController : ...@@ -159,6 +157,12 @@ class DealScreenController :
private fun render(viewState: DealScreenViewState.LoadDeal) { private fun render(viewState: DealScreenViewState.LoadDeal) {
dealTitle.text = resources?.getString(
viewState.estate.estate.type.typeDoubleString(),
viewState.estate.estate.number
)
info1.title.text = resources?.getString(R.string.building) info1.title.text = resources?.getString(R.string.building)
info1.text.text = viewState.estate.estate.commonInfo?.building.toString() info1.text.text = viewState.estate.estate.commonInfo?.building.toString()
...@@ -218,10 +222,6 @@ class DealScreenController : ...@@ -218,10 +222,6 @@ class DealScreenController :
progressLayout.addView(statusLayout) progressLayout.addView(statusLayout)
} }
progressLayout.invalidate() progressLayout.invalidate()
} }
private fun getComponent() = DaggerDealScreenComponent.factory() private fun getComponent() = DaggerDealScreenComponent.factory()
......
...@@ -63,18 +63,17 @@ class DealsScreenController : ...@@ -63,18 +63,17 @@ class DealsScreenController :
@Inject @Inject
override lateinit var injectedPresenter: DealsScreenPresenter override lateinit var injectedPresenter: DealsScreenPresenter
override fun onAttach(view: View) {
override fun onViewBound(v: View) { super.onAttach(view)
bottomNavigationController.show() Timber.d("On attach View")
setToolbar()
bindRecycler()
detachDisposable.addAll( detachDisposable.addAll(
(dealsRecyclerView.adapter as DealsListAdapter) (dealsRecyclerView.adapter as DealsListAdapter)
.onItemClicked .onItemClicked
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe {
Timber.d("got card clicked $it") Timber.d("got card clicked $it")
router.pushController(RouterTransaction.with(DealScreenController(it.id)) router.pushController(
RouterTransaction.with(DealScreenController(it.id))
.pushChangeHandler(FadeChangeHandler()) .pushChangeHandler(FadeChangeHandler())
.popChangeHandler(FadeChangeHandler()) .popChangeHandler(FadeChangeHandler())
) )
...@@ -82,6 +81,12 @@ class DealsScreenController : ...@@ -82,6 +81,12 @@ class DealsScreenController :
) )
} }
override fun onViewBound(v: View) {
bottomNavigationController.show()
setToolbar()
bindRecycler()
}
override fun render(viewState: DealsScreenViewState) { override fun render(viewState: DealsScreenViewState) {
super.render(viewState) super.render(viewState)
Timber.d("Render state $viewState") Timber.d("Render state $viewState")
......
...@@ -38,6 +38,18 @@ class FavoritesScreenController : ...@@ -38,6 +38,18 @@ class FavoritesScreenController :
lateinit var favoritesRecyclerView: RecyclerView lateinit var favoritesRecyclerView: RecyclerView
override fun onAttach(view: View) {
super.onAttach(view)
detachDisposable.addAll(
(favoritesRecyclerView.adapter as FavoritesListAdapter)
.onItemClicked
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
Timber.d("got card clicked $it")
router.pushController(RouterTransaction.with(EstateScreenController(it.id)))
}
)
}
private fun setToolbar(){ private fun setToolbar(){
favoritesRecyclerView.isNestedScrollingEnabled = false favoritesRecyclerView.isNestedScrollingEnabled = false
...@@ -68,15 +80,6 @@ class FavoritesScreenController : ...@@ -68,15 +80,6 @@ class FavoritesScreenController :
bottomNavigationController.show() bottomNavigationController.show()
setToolbar() setToolbar()
bindRecycler() bindRecycler()
detachDisposable.addAll(
(favoritesRecyclerView.adapter as FavoritesListAdapter)
.onItemClicked
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
Timber.d("got card clicked $it")
router.pushController(RouterTransaction.with(EstateScreenController(it.id)))
}
)
} }
override fun render(viewState: FavoritesScreenViewState) { override fun render(viewState: FavoritesScreenViewState) {
...@@ -108,4 +111,5 @@ class FavoritesScreenController : ...@@ -108,4 +111,5 @@ class FavoritesScreenController :
override fun getLayoutId(): Int = R.layout.favorites_screen override fun getLayoutId(): Int = R.layout.favorites_screen
} }
\ No newline at end of file
...@@ -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.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
import com.biganto.visual.roompark.presentation.screen.deals.DealsScreenController import com.biganto.visual.roompark.presentation.screen.deals.DealsScreenController
...@@ -42,10 +41,6 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds) ...@@ -42,10 +41,6 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
override fun getStartupMenuId(): Int = override fun getStartupMenuId(): Int =
args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds) args.getInt(OPEN_CHILD_CONTROLLER_KEY, R.id.tab_feeds)
@Inject
lateinit var tb: ICollapsingToolBar
@Inject @Inject
override lateinit var injectedPresenter: HomeScreenPresenter override lateinit var injectedPresenter: HomeScreenPresenter
...@@ -131,12 +126,23 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds) ...@@ -131,12 +126,23 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
Timber.d("in back stack ") Timber.d("in back stack ")
val childRouter = getChildRouter(currentlySelectedItemId) val childRouter = getChildRouter(currentlySelectedItemId)
Timber.d("in back stack - ${childRouter?.backstackSize}") Timber.d("in back stack # ${childRouter?.backstackSize}")
if (childRouter != null) { if (childRouter != null) {
Timber.d("in back stack -1")
if (childRouter.backstackSize<2) return false if (childRouter.backstackSize<2) return false
if (childRouter.handleBack())
navigateTo(getControllerFor(R.id.tab_feeds), false) Timber.d("in back stack -2 ${childRouter.backstack}")
val handleBackResult = childRouter.handleBack()
// if ()
// navigateTo(getControllerFor(R.id.tab_feeds), false)
Timber.d("in back stack __# ${getChildRouter(currentlySelectedItemId)?.backstackSize}")
Timber.d("in back stack -3 $handleBackResult")
return true return true
......
...@@ -72,11 +72,12 @@ ...@@ -72,11 +72,12 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/statusContainer" android:id="@+id/statusContainer"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:background="@drawable/gradient_background_accent" android:background="@drawable/gradient_background_accent"
android:orientation="vertical" android:orientation="vertical"
android:padding="16dp"> android:padding="16dp">
...@@ -85,8 +86,7 @@ ...@@ -85,8 +86,7 @@
android:id="@+id/progress_holder" android:id="@+id/progress_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal"></LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
......
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