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

fix backstack behaviour

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