Commit 72b52335 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

tour start card refactor and hide

flat type refactor
parent 1c4cc126
...@@ -201,7 +201,7 @@ class DealInteractor @Inject constructor( ...@@ -201,7 +201,7 @@ class DealInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/00/75-92ed97.png", url = "/assets/estates/plan_png/00/00/00/75-92ed97.png",
width = 420 width = 420
), ),
type = "flat", type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/" url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/"
), ),
estate_id = "2156", estate_id = "2156",
...@@ -310,7 +310,7 @@ class DealInteractor @Inject constructor( ...@@ -310,7 +310,7 @@ class DealInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/04/1201-91169f.png", url = "/assets/estates/plan_png/00/00/04/1201-91169f.png",
width = 318 width = 318
), ),
type = "flat", type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/" url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/"
), ),
estate_id = "6222", estate_id = "6222",
......
...@@ -192,7 +192,7 @@ class DealsInteractor @Inject constructor( ...@@ -192,7 +192,7 @@ class DealsInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/00/75-92ed97.png", url = "/assets/estates/plan_png/00/00/00/75-92ed97.png",
width = 420 width = 420
), ),
type = "flat", type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/" url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/"
), ),
estate_id = "1425", estate_id = "1425",
...@@ -301,7 +301,7 @@ class DealsInteractor @Inject constructor( ...@@ -301,7 +301,7 @@ class DealsInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/04/1201-91169f.png", url = "/assets/estates/plan_png/00/00/04/1201-91169f.png",
width = 318 width = 318
), ),
type = "flat", type =FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/" url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/"
), ),
estate_id = "1231", estate_id = "1231",
......
...@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.domain.interactor ...@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.domain.interactor
import com.biganto.visual.roompark.domain.model.CommonInfoModel import com.biganto.visual.roompark.domain.model.CommonInfoModel
import com.biganto.visual.roompark.domain.model.EstateModel import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.FlatType
import com.biganto.visual.roompark.domain.model.PlanModel import com.biganto.visual.roompark.domain.model.PlanModel
import com.biganto.visual.roompark.domain.use_case.EstateUseCase import com.biganto.visual.roompark.domain.use_case.EstateUseCase
import javax.inject.Inject import javax.inject.Inject
...@@ -25,7 +26,7 @@ class FavoritesInteractor @Inject constructor( ...@@ -25,7 +26,7 @@ class FavoritesInteractor @Inject constructor(
EstateModel( EstateModel(
id = 2273, id = 2273,
type = "parking", type = FlatType.valueOf("parking".toUpperCase()),
number = "П1.021", number = "П1.021",
commonInfo = CommonInfoModel( commonInfo = CommonInfoModel(
building = 1, building = 1,
...@@ -54,7 +55,7 @@ class FavoritesInteractor @Inject constructor( ...@@ -54,7 +55,7 @@ class FavoritesInteractor @Inject constructor(
), ),
EstateModel( EstateModel(
id = 1905, id = 1905,
type = "storage", type = FlatType.valueOf("storage".toUpperCase()),
number = "104.23", number = "104.23",
commonInfo = CommonInfoModel( commonInfo = CommonInfoModel(
building = 1, building = 1,
...@@ -83,7 +84,7 @@ class FavoritesInteractor @Inject constructor( ...@@ -83,7 +84,7 @@ class FavoritesInteractor @Inject constructor(
), ),
EstateModel( EstateModel(
id = 1774, id = 1774,
type = "flat", type = FlatType.valueOf("flat".toUpperCase()),
number = "417", number = "417",
commonInfo = CommonInfoModel( commonInfo = CommonInfoModel(
building = 1, building = 1,
......
package com.biganto.visual.roompark.domain.model package com.biganto.visual.roompark.domain.model
import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
data class DealPreviewModel( data class DealPreviewModel(
val id:String, val id:String,
val type:String, val type:FlatType,
val name:String, val name:String,
val building:Int?, val building:Int?,
val section:Int?, val section:Int?,
...@@ -39,22 +36,3 @@ data class DealPreviewModel( ...@@ -39,22 +36,3 @@ data class DealPreviewModel(
) )
} }
@StringRes
fun DealPreviewModel.typeDoubleString() =
when(this.type){
"flat" -> R.string.estate_type_flat_long
"parking" -> R.string.estate_type_parking_long
"storage" -> R.string.estate_type_store_long
else -> R.string.estate_type_other_long
}
@StringRes
fun DealPreviewModel.typeShortString() =
when(this.type){
"flat" -> R.string.estate_type_flat_short
"parking" -> R.string.estate_type_parking_short
"storage" -> R.string.estate_type_store_short
else -> R.string.estate_type_other_short
}
\ No newline at end of file
...@@ -47,7 +47,7 @@ fun fromEntity(entity:DealEntity) = DealModel( ...@@ -47,7 +47,7 @@ fun fromEntity(entity:DealEntity) = DealModel(
data class EstateModel( data class EstateModel(
val id:Int, val id:Int,
val type:String, val type:FlatType,
val number:String, val number:String,
val sectionBegin:Int?=null, val sectionBegin:Int?=null,
val sectionEnd:Int?=null, val sectionEnd:Int?=null,
...@@ -60,26 +60,32 @@ data class EstateModel( ...@@ -60,26 +60,32 @@ data class EstateModel(
val url:String? val url:String?
) )
@StringRes fun EstateModel.typeDoubleString() = enum class FlatType{
when(this.type){ FLAT,
"flat" -> R.string.estate_type_flat_long PARKING,
"parking" -> R.string.estate_type_parking_long STORAGE
"storage" -> R.string.estate_type_store_long }
@StringRes fun FlatType.typeDoubleString() =
when(this){
FlatType.FLAT -> R.string.estate_type_flat_long
FlatType.PARKING -> R.string.estate_type_parking_long
FlatType.STORAGE -> R.string.estate_type_store_long
else -> R.string.estate_type_other_long else -> R.string.estate_type_other_long
} }
@StringRes fun EstateModel.typeShortString() = @StringRes fun FlatType.typeShortString() =
when(this.type){ when(this){
"flat" -> R.string.estate_type_flat_short FlatType.FLAT -> R.string.estate_type_flat_short
"parking" -> R.string.estate_type_parking_short FlatType.PARKING -> R.string.estate_type_parking_short
"storage" -> R.string.estate_type_store_short FlatType.STORAGE -> R.string.estate_type_store_short
else -> R.string.estate_type_other_short else -> R.string.estate_type_other_short
} }
fun fromEntity(entity:EstateEntity): EstateModel { fun fromEntity(entity:EstateEntity): EstateModel {
val model = EstateModel( val model = EstateModel(
id = entity.id, id = entity.id,
type = entity.type, type = FlatType.valueOf(entity.type.toUpperCase()),
number = entity.number, number = entity.number,
sectionBegin = entity.sectionBegin, sectionBegin = entity.sectionBegin,
sectionEnd = entity.sectionEnd, sectionEnd = entity.sectionEnd,
......
...@@ -103,7 +103,7 @@ class DealScreenController : ...@@ -103,7 +103,7 @@ class DealScreenController :
HeaderToolbarModel( HeaderToolbarModel(
true true
, resources?.getString(R.string.deal_back_chevron_title) , resources?.getString(R.string.deal_back_chevron_title)
, resources?.getString(deal.estate.typeShortString() , resources?.getString(deal.estate.type.typeShortString()
,deal.estate.number) ,deal.estate.number)
, true , true
) )
......
...@@ -66,9 +66,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi ...@@ -66,9 +66,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
} }
override fun onViewBound(model: DealPreviewModel) { override fun onViewBound(model: DealPreviewModel) {
val fullObjName = "${typeName(model.type)}\n№${model.name}"
estateTitle.text = estateTitle.text =
itemView.context.resources?.getString(model.typeDoubleString(),model.name) itemView.context.resources?.getString(model.type.typeDoubleString(),model.name)
renderCommonInfo(model) renderCommonInfo(model)
if (model.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE if (model.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE
......
...@@ -164,6 +164,9 @@ class EstateScreenController : ...@@ -164,6 +164,9 @@ class EstateScreenController :
@BindView(R.id.site_link_viewholder) @BindView(R.id.site_link_viewholder)
lateinit var siteLink: View lateinit var siteLink: View
@BindView(R.id.start_tour_card)
lateinit var startTour: View
private fun setToolbar(){ private fun setToolbar(){
toolBar.setToolbar(null, StatusToolbarModel()) toolBar.setToolbar(null, StatusToolbarModel())
...@@ -185,7 +188,7 @@ class EstateScreenController : ...@@ -185,7 +188,7 @@ class EstateScreenController :
StatusState.AVAILABLE StatusState.AVAILABLE
, null , null
, resources?.getString( , resources?.getString(
estateModel?.typeShortString() ?: -1 estateModel?.type?.typeShortString() ?: -1
, estateModel?.number , estateModel?.number
) )
) )
...@@ -246,7 +249,7 @@ class EstateScreenController : ...@@ -246,7 +249,7 @@ class EstateScreenController :
toolBar.setToolbar( toolBar.setToolbar(
null, StatusToolbarModel(StatusState.AVAILABLE,null, null) null, StatusToolbarModel(StatusState.AVAILABLE,null, null)
) )
flatTitle.text = resources?.getString(viewState.estate.typeShortString() flatTitle.text = resources?.getString(viewState.estate.type.typeShortString()
,viewState.estate.number) ,viewState.estate.number)
siteLink.setGone(viewState.estate.url == null) siteLink.setGone(viewState.estate.url == null)
...@@ -255,6 +258,7 @@ class EstateScreenController : ...@@ -255,6 +258,7 @@ class EstateScreenController :
activity?.startUrl(url) activity?.startUrl(url)
} }
} }
startTour.setGone(viewState.estate.multitourId == null)
} }
......
package com.biganto.visual.roompark.presentation.screen.estate.util
import android.view.View
import com.biganto.visual.roompark.domain.model.PlanModel
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
*/
class PlanPresetAdapterAdapter : CommonRecyclerAdapter<PlenPresetViewHolder, PlanModel>() {
override val vhKlazz = PlenPresetViewHolder::class
override fun getVhLayout(): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class PlenPresetViewHolder(itemView: View) : CommonViewHolder<PlanModel>(itemView) {
override fun onViewBound(model: PlanModel) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
\ No newline at end of file
...@@ -8,6 +8,7 @@ import butterknife.ButterKnife ...@@ -8,6 +8,7 @@ import butterknife.ButterKnife
import com.biganto.visual.roompark.R import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.CommonInfoModel import com.biganto.visual.roompark.domain.model.CommonInfoModel
import com.biganto.visual.roompark.domain.model.EstateModel import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.FlatType
import com.biganto.visual.roompark.domain.model.typeDoubleString import com.biganto.visual.roompark.domain.model.typeDoubleString
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter import com.biganto.visual.roompark.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
...@@ -50,11 +51,11 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie ...@@ -50,11 +51,11 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
override fun onViewBound(model: EstateModel) { override fun onViewBound(model: EstateModel) {
estateTitle.text = estateTitle.text =
itemView.context.resources?.getString(model.typeDoubleString(),model.number) itemView.context.resources?.getString(model.type.typeDoubleString(),model.number)
commonInfo.setGone(model.commonInfo == null) commonInfo.setGone(model.commonInfo == null)
model.commonInfo?.let {renderCommonInfo(it)} model.commonInfo?.let {renderCommonInfo(it)}
startTour.setGone(model.type != "flat") startTour.setGone(model.type != FlatType.FLAT)
siteLink.setGone(model.url == null) siteLink.setGone(model.url == null)
siteLinkDivider.setGone(model.url == null) siteLinkDivider.setGone(model.url == null)
......
...@@ -231,24 +231,11 @@ ...@@ -231,24 +231,11 @@
android:layout_marginTop="31dp" /> android:layout_marginTop="31dp" />
<com.google.android.material.textview.MaterialTextView
style="@style/Default_TextView.Header_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:includeFontPadding="false"
android:text="ВИРТУАЛЬНЫЙ ТУР" />
<include <include
android:id="@+id/start_tour_card" android:id="@+id/start_tour_card"
layout="@layout/start_tour_viewholder_big" layout="@layout/start_tour_viewholder_big"
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="16dp"
android:layout_marginEnd="16dp" />
<include <include
layout="@layout/horizontal_divider" layout="@layout/horizontal_divider"
......
...@@ -303,32 +303,15 @@ ...@@ -303,32 +303,15 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/flat_content_recycler_view" /> app:layout_constraintTop_toBottomOf="@+id/flat_content_recycler_view" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/start_virtual_tour_header"
style="@style/Default_TextView.Header_Text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal"
android:text="ВИРТУАЛЬНЫЙ ТУР"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/include10" />
<include <include
android:id="@+id/start_tour_card" android:id="@+id/start_tour_card"
layout="@layout/start_tour_viewholder_big" layout="@layout/start_tour_viewholder_big"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal" android:orientation="horizontal"
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/start_virtual_tour_header" /> app:layout_constraintTop_toBottomOf="@+id/include10" />
<include <include
android:id="@+id/include11" android:id="@+id/include11"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" >
<com.google.android.material.textview.MaterialTextView
android:id="@+id/start_tour_title_view"
style="@style/Default_TextView.Header_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:includeFontPadding="false"
android:text="ВИРТУАЛЬНЫЙ ТУР" />
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -23,10 +41,11 @@ ...@@ -23,10 +41,11 @@
android:foregroundTintMode="src_in" android:foregroundTintMode="src_in"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/default_image_placeholder" android:src="@drawable/default_image_placeholder"
app:image_corner_radius="4dp"
app:layout_constraintBottom_toBottomOf="parent" 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_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="parent" />
<ImageView <ImageView
...@@ -47,3 +66,4 @@ ...@@ -47,3 +66,4 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>
</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