Commit 76a81cd5 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added actions to show properly explication or commoninfo based on selected plan type

parent 73e20f68
...@@ -214,7 +214,6 @@ class EstateScreenController : ...@@ -214,7 +214,6 @@ class EstateScreenController :
viewState.types.forEach { viewState.types.forEach {
try { try {
val tab = planTypesTabLayout.newTab() val tab = planTypesTabLayout.newTab()
.setCustomView(R.layout.select_text_tab).setTag(it.planId) .setCustomView(R.layout.select_text_tab).setTag(it.planId)
......
...@@ -53,13 +53,22 @@ class EstateScreenPresenter @Inject constructor( ...@@ -53,13 +53,22 @@ class EstateScreenPresenter @Inject constructor(
val fetchPlan = intent(EstateScreen::planTypesTabSelected) val fetchPlan = intent(EstateScreen::planTypesTabSelected)
.map { planList?.get(it) } .map { planList?.get(it) }
.flatMap { .flatMap {planPreset ->
interactor.getPlan(it) interactor.getPlan(planPreset)
.map<EstateScreenViewState> { plan -> EstateScreenViewState.LoadPlan(plan) } .map<EstateScreenViewState> { plan -> EstateScreenViewState.LoadPlan(plan) }
.startWith( .startWith(
Observable.just<EstateScreenViewState>( Observable.just<EstateScreenViewState>(
EstateScreenViewState.PlanTypeSelected( EstateScreenViewState.PlanTypeSelected(planPreset)
it )
)
.startWith(
Observable.just<EstateScreenViewState>(
EstateScreenViewState.ShowEstateInfo(
showType
,if (showType==InfoShowType.COMMON_INFO)
mapCommonInfo(estate?.commonInfo)
else mapCommonInfo(planPreset.explication)
) )
) )
) )
...@@ -136,8 +145,9 @@ class EstateScreenPresenter @Inject constructor( ...@@ -136,8 +145,9 @@ class EstateScreenPresenter @Inject constructor(
} }
) )
private fun mapCommonInfo(info: CommonInfoModel): ArrayList<DisplayInfoModel> { private fun mapCommonInfo(info: CommonInfoModel?): ArrayList<DisplayInfoModel> {
val r = arrayListOf<DisplayInfoModel>() val r = arrayListOf<DisplayInfoModel>()
if (info == null) return r
info.building.let { info.building.let {
r.add(DisplayInfoModel(langString(R.string.building),"$it")) r.add(DisplayInfoModel(langString(R.string.building),"$it"))
} }
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
android:id="@+id/include10" android:id="@+id/include10"
layout="@layout/horizontal_divider" layout="@layout/horizontal_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1dp"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginTop="32dp" android:layout_marginTop="8dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
android:id="@+id/include11" android:id="@+id/include11"
layout="@layout/horizontal_divider" layout="@layout/horizontal_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="1dp"
android:layout_marginTop="32dp" android:layout_marginTop="32dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
...@@ -331,8 +331,12 @@ ...@@ -331,8 +331,12 @@
layout="@layout/site_link_viewholder" layout="@layout/site_link_viewholder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp" android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include11" /> app:layout_constraintTop_toBottomOf="@+id/include11" />
......
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