Commit d1d9a545 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

deal card, added status title

parent 102fada9
...@@ -14,7 +14,7 @@ import com.biganto.visual.roompark.domain.model.StatusModel ...@@ -14,7 +14,7 @@ import com.biganto.visual.roompark.domain.model.StatusModel
import com.biganto.visual.roompark.presentation.screen.deals.DealPreviewModel import com.biganto.visual.roompark.presentation.screen.deals.DealPreviewModel
import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressAnimationState import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressAnimationState
import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil import com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
import timber.log.Timber import com.google.android.material.textview.MaterialTextView
/** /**
* Created by Vladislav Bogdashkin on 16.10.2019. * Created by Vladislav Bogdashkin on 16.10.2019.
...@@ -61,8 +61,10 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { ...@@ -61,8 +61,10 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
@BindView(R.id.progress_holder) lateinit var statusContainer:LinearLayout @BindView(R.id.progress_holder) lateinit var statusContainer:LinearLayout
@BindView(R.id.statusContainer) lateinit var statusLayout:LinearLayout
fun typeName(type:String) = when(type){
private fun typeName(type:String) = when(type){
"flat" -> "КВАРТИРА" "flat" -> "КВАРТИРА"
"parking" -> "МАШИНОМЕСТО" "parking" -> "МАШИНОМЕСТО"
"storage" -> "КЛАДОВКА" "storage" -> "КЛАДОВКА"
...@@ -74,19 +76,18 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { ...@@ -74,19 +76,18 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
} }
fun bindModel(deal: DealPreviewModel) { fun bindModel(deal: DealPreviewModel) {
val fullObjName = "${typeName(deal.type)}\n${deal.name}" val fullObjName = "${typeName(deal.type)}\n${deal.name}"
estateTitle.text = fullObjName estateTitle.text = fullObjName
renderCommonInfo(deal) renderCommonInfo(deal)
if (deal.dealTourIds.isNullOrEmpty()) startTour.visibility = View.VISIBLE if (deal.dealTourIds.isNullOrEmpty()) startTour.visibility = View.GONE
else startTour.visibility = View.GONE else startTour.visibility = View.VISIBLE
dealSum.text = deal.dealSum.toRubly() dealSum.text = deal.dealSum.toRubly()
dealPayed.text = deal.dealPayout.toRubly() dealPayed.text = deal.dealPayout.toRubly()
dealSumToPay.text = deal.dealToPay.toRubly() dealSumToPay.text = deal.dealToPay.toRubly()
createStatusView(statusContainer,deal.statusList,deal.statusNo,false) createStatusView(statusLayout,statusContainer,deal.statusList,deal.statusNo,false)
} }
private fun renderCommonInfo(info:DealPreviewModel){ private fun renderCommonInfo(info:DealPreviewModel){
...@@ -112,14 +113,14 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { ...@@ -112,14 +113,14 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
} }
} }
fun createStatusView(container:ViewGroup,list:List<StatusModel>,currentStatus:Int, isVertical:Boolean){ fun createStatusView(mainContainer: LinearLayout,container:ViewGroup,list:List<StatusModel>,currentStatus:Int, isVertical:Boolean){
container.removeAllViews() container.removeAllViews()
val scale = container.resources.displayMetrics.density.toDouble() val scale = container.resources.displayMetrics.density.toDouble()
val param24dp = kotlin.math.ceil(24 * scale).toInt() val param24dp = kotlin.math.ceil(24 * scale).toInt()
val wrapContent = ViewGroup.LayoutParams.WRAP_CONTENT val wrapContent = ViewGroup.LayoutParams.WRAP_CONTENT
(container as LinearLayout).weightSum =10f (container as LinearLayout).weightSum = list.size.toFloat()
list.sortedBy { it.orderId }.forEach{ list.sortedBy { it.orderId }.forEach{
val ceil = LayoutInflater.from(container.context) val ceil = LayoutInflater.from(container.context)
...@@ -128,24 +129,24 @@ fun createStatusView(container:ViewGroup,list:List<StatusModel>,currentStatus:In ...@@ -128,24 +129,24 @@ fun createStatusView(container:ViewGroup,list:List<StatusModel>,currentStatus:In
ceil.layoutParams.width = if (isVertical) param24dp else wrapContent ceil.layoutParams.width = if (isVertical) param24dp else wrapContent
(ceil.layoutParams as LinearLayout.LayoutParams).weight = 1f (ceil.layoutParams as LinearLayout.LayoutParams).weight = 1f
(ceil.layoutParams as LinearLayout.LayoutParams).gravity = Gravity.BOTTOM (ceil.layoutParams as LinearLayout.LayoutParams).gravity = Gravity.BOTTOM
Timber.d("${it.orderId-1} != ${list.size}")
ceil.setHasEnd(it.orderId != list.size) ceil.setHasEnd(it.orderId != list.size)
ceil.setHasStart(it.orderId>1) ceil.setHasStart(it.orderId>1)
Timber.d("${it.orderId} == ${currentStatus}")
ceil.setIsEnabled(it.orderId <= currentStatus) ceil.setIsEnabled(it.orderId <= currentStatus)
Timber.d("${it.orderId} <= ${currentStatus}")
ceil.setNext(it.orderId < currentStatus) ceil.setNext(it.orderId < currentStatus)
if (it.orderId > currentStatus) if (it.orderId > currentStatus)
ceil.setAnimState(StatusProgressAnimationState.DISABLE) ceil.setAnimState(StatusProgressAnimationState.DISABLE)
ceil.invalidate() ceil.invalidate()
container.addView(ceil) container.addView(ceil)
Timber.d("created view : $param24dp")
} }
container.invalidate() container.invalidate()
val currentStatusText = LayoutInflater.from(container.context)
.inflate(R.layout.status_title_textview,container,false) as MaterialTextView
currentStatusText.text = list[currentStatus-1].title
mainContainer.addView(currentStatusText,0)
mainContainer.invalidate()
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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"
android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginBottom="8dp"
android:orientation="vertical"
app:cardElevation="6dp"
app:cardMaxElevation="8dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="600dp" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
...@@ -15,16 +20,17 @@ ...@@ -15,16 +20,17 @@
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_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="КВАРТИРА\n№452" /> android:text="КВАРТИРА\n№452" />
<include layout="@layout/horizontal_divider" <include
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_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" android:layout_marginTop="16dp"
android:layout_marginTop="16dp"/> android:layout_marginEnd="16dp" />
<LinearLayout <LinearLayout
android:id="@+id/common_info_block" android:id="@+id/common_info_block"
...@@ -65,31 +71,29 @@ ...@@ -65,31 +71,29 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/progress_holder" android:id="@+id/statusContainer"
android:orientation="horizontal"
android:layout_height="60dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient_background_accent" android:background="@drawable/gradient_background_accent"
> android:orientation="vertical"
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil android:padding="16dp">
android:layout_width="24dp"
android:layout_height="wrap_content"/> <LinearLayout
android:id="@+id/progress_holder"
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil android:layout_width="match_parent"
android:layout_width="24dp" android:layout_height="wrap_content"
android:layout_height="wrap_content"/> android:orientation="horizontal">
</LinearLayout>
<com.biganto.visual.roompark.view_utils.status_progress_view.StatusProgressCeil
android:layout_width="24dp"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:weightSum="2" android:weightSum="2">
>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_sum_header_text_view" android:id="@+id/deal_sum_header_text_view"
style="@style/Accent_Minor_TextView.Inverted" style="@style/Accent_Minor_TextView.Inverted"
...@@ -99,8 +103,9 @@ ...@@ -99,8 +103,9 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="Сумма договора" android:gravity="bottom"
android:textAlignment="viewStart" /> android:includeFontPadding="true"
android:text="Сумма договора"/>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
...@@ -112,17 +117,17 @@ ...@@ -112,17 +117,17 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="5 165 301 ₽" android:gravity="bottom|end"
android:textAlignment="textEnd" /> android:includeFontPadding="false"
android:text="5 165 301 ₽" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:weightSum="2" android:weightSum="2">
>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_payed_header_text_view" android:id="@+id/deal_payed_header_text_view"
style="@style/Accent_Minor_TextView.Inverted" style="@style/Accent_Minor_TextView.Inverted"
...@@ -132,8 +137,9 @@ ...@@ -132,8 +137,9 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="Сумма платежей" android:gravity="bottom"
android:textAlignment="viewStart" /> android:includeFontPadding="true"
android:text="Сумма платежей" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
...@@ -145,16 +151,17 @@ ...@@ -145,16 +151,17 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="1 332 543 ₽" android:gravity="bottom|end"
android:textAlignment="viewEnd" /> android:includeFontPadding="false"
android:text="1 332 543 ₽" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:weightSum="2" android:weightSum="2">
>
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_to_pay_header_text_view" android:id="@+id/deal_to_pay_header_text_view"
style="@style/Accent_Minor_TextView.Inverted" style="@style/Accent_Minor_TextView.Inverted"
...@@ -164,8 +171,9 @@ ...@@ -164,8 +171,9 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="Сумма к оплате" android:gravity="bottom"
android:textAlignment="viewStart" /> android:includeFontPadding="true"
android:text="Сумма к оплате" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
...@@ -177,8 +185,9 @@ ...@@ -177,8 +185,9 @@
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="32 543 ₽" android:gravity="bottom|end"
android:textAlignment="viewEnd" /> android:includeFontPadding="false"
android:text="32 543 ₽" />
</LinearLayout> </LinearLayout>
<include <include
...@@ -193,9 +202,9 @@ ...@@ -193,9 +202,9 @@
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="64dp" android:layout_height="64dp"
android:layout_marginStart="16dp" android:layout_margin="16dp"
android:layout_marginTop="16dp" app:cardElevation="4dp"
android:layout_marginEnd="16dp"> app:cardMaxElevation="8dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp" android:layout_margin="16dp"
android:elevation="4dp" app:cardElevation="4dp"
app:cardMaxElevation="8dp"
android:padding="16dp" android:padding="16dp"
app:cardCornerRadius="4dp" app:cardCornerRadius="4dp">
app:cardElevation="4dp">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textview.MaterialTextView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Default_TextView.Inverted_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_marginBottom="24dp"
android:gravity="center"
android:orientation="vertical"
android:text="Договор готовится для подачи на гос. регистрацию">
</com.google.android.material.textview.MaterialTextView>
\ 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