Commit 30d496d2 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

statuses for tests

parent b8965e49
package com.biganto.visual.roompark.presentation.screen.deal package com.biganto.visual.roompark.presentation.screen.deal
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.LinearLayout
import androidx.core.os.bundleOf import androidx.core.os.bundleOf
import butterknife.BindView import butterknife.BindView
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
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.conductor.BigantoBaseController import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.deals.util.createStatusView
import com.biganto.visual.roompark.presentation.screen.deals.util.deployProgressView
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
import com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
...@@ -37,8 +43,16 @@ class DealScreenController : ...@@ -37,8 +43,16 @@ class DealScreenController :
@Inject @Inject
override lateinit var injectedPresenter: DealScreenPresenter override lateinit var injectedPresenter: DealScreenPresenter
@BindView(R.id.explication_tab) @BindView(R.id.deal_card_header)
lateinit var explicationTab: MaterialTextView lateinit var dealTitle: MaterialTextView
@BindView(R.id.statusContainer)
lateinit var statusContainer: LinearLayout
@BindView(R.id.progress_holder)
lateinit var progressLayout: LinearLayout
private fun setToolbar(){ private fun setToolbar(){
toolBar.showAll() toolBar.showAll()
...@@ -78,6 +92,35 @@ class DealScreenController : ...@@ -78,6 +92,35 @@ class DealScreenController :
private fun render(viewState: DealScreenViewState.LoadDeal) { private fun render(viewState: DealScreenViewState.LoadDeal) {
viewState.statusList.forEach {
val statusLayout = LayoutInflater.from(activity)
.inflate(R.layout.progress_deal_state_pattern_view_horizontal
,progressLayout
,false)
as LinearLayout
val statusCeil = statusLayout.findViewById<StatusProgressCeil>(R.id.status)
val position = it.orderId
val statusCount = viewState.statusList.size
val lastStatusPassed = viewState.estate.statusId
statusCeil.setHasEnd(position != statusCount)
statusCeil.setHasStart(position > 1)
statusCeil.setIsEnabled(position <= lastStatusPassed)
statusCeil.setNext(position < lastStatusPassed)
if (position > lastStatusPassed)
statusCeil.setAnimState(StatusProgressAnimationState.DISABLE)
statusCeil.invalidate()
val statusTitle = statusLayout.findViewById<MaterialTextView>(R.id.title)
statusTitle.text = it.title
progressLayout.addView(statusLayout)
}
progressLayout.invalidate()
} }
private fun getComponent() = DaggerDealScreenComponent.factory() private fun getComponent() = DaggerDealScreenComponent.factory()
......
...@@ -2,18 +2,12 @@ package com.biganto.visual.roompark.presentation.screen.deal ...@@ -2,18 +2,12 @@ package com.biganto.visual.roompark.presentation.screen.deal
import android.content.Context import android.content.Context
import androidx.annotation.StringRes import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import com.biganto.visual.roompark.domain.interactor.DealInteractor import com.biganto.visual.roompark.domain.interactor.DealInteractor
import com.biganto.visual.roompark.domain.model.* import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.presentation.screen.deal.DealScreen import com.biganto.visual.roompark.domain.model.PlanPresetModel
import com.biganto.visual.roompark.presentation.screen.estate.DealScreen
import com.biganto.visual.roompark.presentation.screen.estate.DealScreenViewState
import com.biganto.visual.roompark.presentation.screen.estate.InfoShowType import com.biganto.visual.roompark.presentation.screen.estate.InfoShowType
import com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import com.biganto.visual.roompark.util.extensions.toRubly
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import timber.log.Timber import timber.log.Timber
...@@ -41,18 +35,17 @@ class DealScreenPresenter @Inject constructor( ...@@ -41,18 +35,17 @@ class DealScreenPresenter @Inject constructor(
override fun defaultErrorViewStateHandler() = override fun defaultErrorViewStateHandler() =
{ e: ExceptionString -> DealScreenViewState.SomeError(e) } { e: ExceptionString -> DealScreenViewState.SomeError(e) }
private fun getPlan(plan: PlanPresetModel): Observable<DealScreenViewState> =
interactor.getPlan(plan)
.map<DealScreenViewState> { DealScreenViewState.LoadPlan(it) }
override fun bindIntents() { override fun bindIntents() {
val prefetchCards = interactor.getDeal(estateId) val fetchDeal = interactor.getDeal(estateId)
.doOnNext { estate = it.copy() } .flatMap { deal ->
.map { DealScreenViewState.LoadDeal(it) } interactor.getStatusList().map { DealScreenViewState.LoadDeal(deal,it) }
}
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(prefetchCards) .mergeWith(fetchDeal)
.doOnError { Timber.e(it) } .doOnError { Timber.e(it) }
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
......
...@@ -2,9 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.deal ...@@ -2,9 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.deal
import com.biganto.visual.roompark.conductor.BigantoBaseViewState import com.biganto.visual.roompark.conductor.BigantoBaseViewState
import com.biganto.visual.roompark.domain.model.DealModel import com.biganto.visual.roompark.domain.model.DealModel
import com.biganto.visual.roompark.domain.model.PlanPresetModel import com.biganto.visual.roompark.domain.model.StatusModel
import com.biganto.visual.roompark.presentation.screen.estate.DealScreenViewState
import com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import com.biganto.visual.roompark.util.monades.ExceptionString import com.biganto.visual.roompark.util.monades.ExceptionString
/** /**
...@@ -14,6 +12,6 @@ import com.biganto.visual.roompark.util.monades.ExceptionString ...@@ -14,6 +12,6 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
sealed class DealScreenViewState : BigantoBaseViewState() { sealed class DealScreenViewState : BigantoBaseViewState() {
class Idle : DealScreenViewState() class Idle : DealScreenViewState()
class LoadDeal(val estate:DealModel) : DealScreenViewState() class LoadDeal(val estate:DealModel,val statusList:List<StatusModel>) : DealScreenViewState()
class SomeError(val exception: ExceptionString) : DealScreenViewState() class SomeError(val exception: ExceptionString) : DealScreenViewState()
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
android:id="@+id/status"
android:layout_width="24dp"
android:layout_height="match_parent"
app:direction="vertical"
app:hasEnd="false"
app:hasStart="false" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/title"
style="@style/Common_Text.Inverted"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:text="Договор готовится для подачи на гос. регистрацию b,kf,kf,fk">
</com.google.android.material.textview.MaterialTextView>
</LinearLayout>
\ No newline at end of file
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