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

statuses for tests

parent b8965e49
package com.biganto.visual.roompark.domain.interactor
import com.biganto.visual.roompark.domain.model.*
import io.reactivex.Single
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class DealInteractor @Inject constructor(
){
fun getDeal(id:Int) = Single.just(dealFlat)
fun getStatusList() = Single.just(statusList.sortedBy{ it.orderId })
companion object{
val statusList = arrayListOf<StatusModel>(
StatusModel(
1,
"Квартира забронирована за Вами. Скоро начнется подготовка договора",
"Бронь"
),
StatusModel(
2,
"Договор находится в процессе подготовки",
"Подготовка договора"
),
StatusModel(
3,
"Договор подготовлен и отправлен в офис продаж",
"Договор подготовлен"
),
StatusModel(
4,
"Договор находится в офисе продаж. Просим Вас приехать на подписание в назначенное время",
"Договор готов к подписанию"
),
StatusModel(
5,
"Договор передан на подписание Застройщику",
"ДДУ подписан с покупателем"
),
StatusModel(
6,
"Договор подписан Застройщиком",
"Договор подписан"
),
StatusModel(
7,
"Договор скоро будет отправлен в Росреестр",
"Договор готовится для подачи на гос. регистрацию"
),
StatusModel(
8,
"Договор передан в Росреестр для гос. регистрации",
"Договор на регистрации"
),
StatusModel(
9,
"Ваш договор успешно зарегистрирован в Росреестре",
"Зарегистрирован"
),
StatusModel(
10,
"Договор находится в офисе продаж. Вы можете забрать его в любое время",
"Договор готов к выдаче"
)
)
val dealParkign = DealModel(
amount_pay_sum = 4535860,
estate = EstateModel(
albumId = 10,
commonInfo = CommonInfoModel(
area = 55.4f,
area_living = 31.5f,
building = 1,
ceiling = 2.95f,
decoration = "\u0411\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u043a\u0438, \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0430\u044f \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u043a\u0430",
dependent = null,
direction = "\u0441\u0435\u0432\u0435\u0440\u043e-\u0437\u0430\u043f\u0430\u0434,\u044e\u0433\u043e-\u0432\u043e\u0441\u0442\u043e\u043a",
discount = 5.0f,
discount_amount = 6925215,
floor = 10,
floor_max = 22,
kind = "2\u043a-2\u0440",
price = 7289700,
price_meter = 131583,
rooms = 2,
section_begin = 14,
windows_face = "\u0414\u0432\u043e\u0440 \u0438 \u0423\u043b\u0438\u0446\u0430"
),
// explications = arrayListOf(ExplicationListModel(
// items = arrayListOf(
// ExplicationModel(
// area = 16.9f,
// living = true,
// title = "\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
// ),ExplicationModel(
// area = 14.6f,
// living = true,
// title = "\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
// ),ExplicationModel(
// area = 10.8f,
// living = false,
// title = "\u041a\u0443\u0445\u043d\u044f"
// ),ExplicationModel(
// area = 3.6f,
// living = false,
// title = "\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
// ),ExplicationModel(
// area = 3.4f,
// living = false,
// title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
// ),ExplicationModel(
// area = 2.8f,
// living = false,
// title = "\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
// ),ExplicationModel(
// area = 1.9f,
// living = false,
// title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
// ),ExplicationModel(
// area = 1.4f,
// living = false,
// title = "\u041b\u043e\u0434\u0436\u0438\u044f"
// )
// ),
// planId = 0
// ),
// ExplicationListModel(
// items = arrayListOf(
// ExplicationModel(
// area = 16.2f,
// living = true,
// title = "\u0413\u043e\u0441\u0442\u0438\u043d\u0430\u044f"
// ),ExplicationModel(
// area = 13.7f,
// living = true,
// title = "\u0421\u043f\u0430\u043b\u044c\u043d\u044f"
// ),ExplicationModel(
// area = 10.2f,
// living = false,
// title = "\u041a\u0443\u0445\u043d\u044f"
// ),ExplicationModel(
// area = 4.3f,
// living = false,
// title = "\u041a\u043e\u0440\u0438\u0434\u043e\u0440"
// ),ExplicationModel(
// area = 4.2f,
// living = false,
// title = "\u041f\u0440\u0438\u0445\u043e\u0436\u0430\u044f"
// ),ExplicationModel(
// area = 4.1f,
// living = false,
// title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
// ),ExplicationModel(
// area = 1.4f,
// living = false,
// title = "\u041b\u043e\u0434\u0436\u0438\u044f"
// ),ExplicationModel(
// area = 1.3f,
// living = false,
// title = "\u0421\u0430\u043d\u0443\u0437\u0435\u043b"
// )
// ),
// planId = 1
// )
// ),
id = 75,
multitourId = 4911,
number = "1086",
planJPG = PlanModel(
height = 549,
url = "/assets/estates/plan_jpg/00/00/00/75-9027cf.jpeg",
width = 1280
),
planPNG = PlanModel(
height = 180,
url = "/assets/estates/plan_png/00/00/00/75-92ed97.png",
width = 420
),
type = "flat",
url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/"
),
estate_id = "20dfe300-b85c-e711-80d7-00155d0a0a0e",
id = "9abdcb37-306a-e811-80e6-00155d0a0a0e",
managerName = "\u0411\u043e\u0441\u043e\u0432\u0430, \u0418\u0440\u0438\u043d\u0430",
opportunitySum= 5035860,
paymentSum= 500000,
statusId = 10
)
val dealFlat = DealModel(
amount_pay_sum = 5118160,
estate = EstateModel(
albumId= 10,
commonInfo= CommonInfoModel(
area = 61.2f,
area_living = 30.3f,
building = 1,
ceiling = 2.95f,
decoration = "Без отделки, свободная планировка",
dependent = null,
direction = "север,восток",
discount = 5.0f,
discount_amount = 7356325,
floor = 10,
floor_max = 15,
kind = "2к-4л",
price = 7743500,
price_meter = 126527,
rooms = 2,
section_begin = 2,
windows_face = "Двор"
),
// explications = arrayListOf(
// ExplicationListModel(
// items = arrayListOf(
// ExplicationModel(
// area = 15.8f,
// living = true,
// title = "Гостиная"
// ),ExplicationModel(
// area = 14.5f,
// living = true,
// title = "Спальня"
// ),ExplicationModel(
// area = 20.2f,
// living = false,
// title = "Кухня"
// ),ExplicationModel(
// area = 5.0f,
// living = false,
// title = "Прихожая"
// ),ExplicationModel(
// area = 4.1f,
// living = false,
// title = "Санузел"
// ),ExplicationModel(
// area = 1.6f,
// living = false,
// title = "Лоджия"
// )
// ),
// planId = 0
// ),
// ExplicationListModel(
// items = arrayListOf(
// ExplicationModel(
// area = 15.5f,
// living = true,
// title = "Спальня"
// ),ExplicationModel(
// area = 14.5f,
// living = true,
// title = "Спальня"
// ),ExplicationModel(
// area = 20.2f,
// living = false,
// title = "Кухня-гостиная"
// ),ExplicationModel(
// area = 5.3f,
// living = false,
// title = "Прихожая"
// ),ExplicationModel(
// area = 4.1f,
// living = false,
// title = "Санузел"
// ),ExplicationModel(
// area = 1.6f,
// living = false,
// title = "Лоджия"
// )
// ),
// planId = 1
// )
// ),
id = 1201,
multitourId = 6500,
number = "88",
planJPG = PlanModel(
height = 720,
url = "/assets/estates/plan_jpg/00/00/04/1201-52d64f.jpeg",
width = 785
),
planPNG = PlanModel(
height = 292,
url = "/assets/estates/plan_png/00/00/04/1201-91169f.png",
width = 318
),
type = "flat",
url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/"
),
estate_id = "54d7e300-b85c-e711-80d7-00155d0a0a0e",
id = "2419877b-2d6a-e811-80e6-00155d0a0a0e",
managerName = "Босова, Ирина",
opportunitySum = 5618160,
paymentSum = 500000,
statusId = 10
)
}
}
\ No newline at end of file
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