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(
url = "/assets/estates/plan_png/00/00/00/75-92ed97.png",
width = 420
),
type = "flat",
type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/"
),
estate_id = "2156",
......@@ -310,7 +310,7 @@ class DealInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/04/1201-91169f.png",
width = 318
),
type = "flat",
type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/"
),
estate_id = "6222",
......
......@@ -192,7 +192,7 @@ class DealsInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/00/75-92ed97.png",
width = 420
),
type = "flat",
type = FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/14/1086/"
),
estate_id = "1425",
......@@ -301,7 +301,7 @@ class DealsInteractor @Inject constructor(
url = "/assets/estates/plan_png/00/00/04/1201-91169f.png",
width = 318
),
type = "flat",
type =FlatType.valueOf("flat".toUpperCase()),
url = "https://stage.room-park.ru:38386/choose/flat/1/2/88/"
),
estate_id = "1231",
......
......@@ -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.EstateModel
import com.biganto.visual.roompark.domain.model.FlatType
import com.biganto.visual.roompark.domain.model.PlanModel
import com.biganto.visual.roompark.domain.use_case.EstateUseCase
import javax.inject.Inject
......@@ -25,7 +26,7 @@ class FavoritesInteractor @Inject constructor(
EstateModel(
id = 2273,
type = "parking",
type = FlatType.valueOf("parking".toUpperCase()),
number = "П1.021",
commonInfo = CommonInfoModel(
building = 1,
......@@ -54,7 +55,7 @@ class FavoritesInteractor @Inject constructor(
),
EstateModel(
id = 1905,
type = "storage",
type = FlatType.valueOf("storage".toUpperCase()),
number = "104.23",
commonInfo = CommonInfoModel(
building = 1,
......@@ -83,7 +84,7 @@ class FavoritesInteractor @Inject constructor(
),
EstateModel(
id = 1774,
type = "flat",
type = FlatType.valueOf("flat".toUpperCase()),
number = "417",
commonInfo = CommonInfoModel(
building = 1,
......
package com.biganto.visual.roompark.domain.model
import androidx.annotation.StringRes
import com.biganto.visual.roompark.R
data class DealPreviewModel(
val id:String,
val type:String,
val type:FlatType,
val name:String,
val building:Int?,
val section:Int?,
......@@ -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(
data class EstateModel(
val id:Int,
val type:String,
val type:FlatType,
val number:String,
val sectionBegin:Int?=null,
val sectionEnd:Int?=null,
......@@ -60,26 +60,32 @@ data class EstateModel(
val url:String?
)
@StringRes fun EstateModel.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
enum class FlatType{
FLAT,
PARKING,
STORAGE
}
@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
}
@StringRes fun EstateModel.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
@StringRes fun FlatType.typeShortString() =
when(this){
FlatType.FLAT -> R.string.estate_type_flat_short
FlatType.PARKING -> R.string.estate_type_parking_short
FlatType.STORAGE -> R.string.estate_type_store_short
else -> R.string.estate_type_other_short
}
fun fromEntity(entity:EstateEntity): EstateModel {
val model = EstateModel(
id = entity.id,
type = entity.type,
type = FlatType.valueOf(entity.type.toUpperCase()),
number = entity.number,
sectionBegin = entity.sectionBegin,
sectionEnd = entity.sectionEnd,
......
......@@ -103,7 +103,7 @@ class DealScreenController :
HeaderToolbarModel(
true
, resources?.getString(R.string.deal_back_chevron_title)
, resources?.getString(deal.estate.typeShortString()
, resources?.getString(deal.estate.type.typeShortString()
,deal.estate.number)
, true
)
......
......@@ -66,9 +66,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
}
override fun onViewBound(model: DealPreviewModel) {
val fullObjName = "${typeName(model.type)}\n№${model.name}"
estateTitle.text =
itemView.context.resources?.getString(model.typeDoubleString(),model.name)
itemView.context.resources?.getString(model.type.typeDoubleString(),model.name)
renderCommonInfo(model)
if (model.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE
......
......@@ -164,6 +164,9 @@ class EstateScreenController :
@BindView(R.id.site_link_viewholder)
lateinit var siteLink: View
@BindView(R.id.start_tour_card)
lateinit var startTour: View
private fun setToolbar(){
toolBar.setToolbar(null, StatusToolbarModel())
......@@ -185,7 +188,7 @@ class EstateScreenController :
StatusState.AVAILABLE
, null
, resources?.getString(
estateModel?.typeShortString() ?: -1
estateModel?.type?.typeShortString() ?: -1
, estateModel?.number
)
)
......@@ -246,7 +249,7 @@ class EstateScreenController :
toolBar.setToolbar(
null, StatusToolbarModel(StatusState.AVAILABLE,null, null)
)
flatTitle.text = resources?.getString(viewState.estate.typeShortString()
flatTitle.text = resources?.getString(viewState.estate.type.typeShortString()
,viewState.estate.number)
siteLink.setGone(viewState.estate.url == null)
......@@ -255,6 +258,7 @@ class EstateScreenController :
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
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.domain.model.CommonInfoModel
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.presentation.screen.settings.util.CommonRecyclerAdapter
import com.biganto.visual.roompark.presentation.screen.settings.util.CommonViewHolder
......@@ -50,11 +51,11 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
override fun onViewBound(model: EstateModel) {
estateTitle.text =
itemView.context.resources?.getString(model.typeDoubleString(),model.number)
itemView.context.resources?.getString(model.type.typeDoubleString(),model.number)
commonInfo.setGone(model.commonInfo == null)
model.commonInfo?.let {renderCommonInfo(it)}
startTour.setGone(model.type != "flat")
startTour.setGone(model.type != FlatType.FLAT)
siteLink.setGone(model.url == null)
siteLinkDivider.setGone(model.url == null)
......
......@@ -231,24 +231,11 @@
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
android:id="@+id/start_tour_card"
layout="@layout/start_tour_viewholder_big"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" />
android:layout_height="wrap_content"/>
<include
layout="@layout/horizontal_divider"
......
......@@ -303,32 +303,15 @@
app:layout_constraintStart_toStartOf="parent"
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
android:id="@+id/start_tour_card"
layout="@layout/start_tour_viewholder_big"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/start_virtual_tour_header" />
app:layout_constraintTop_toBottomOf="@+id/include10" />
<include
android:id="@+id/include11"
......
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
......@@ -23,10 +41,11 @@
android:foregroundTintMode="src_in"
android:scaleType="centerCrop"
android:src="@drawable/default_image_placeholder"
app:image_corner_radius="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toBottomOf="parent" />
<ImageView
......@@ -46,4 +65,5 @@
app:srcCompat="@drawable/ic_feeds" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
</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