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