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

refactor deal status generation

parent 2c600827
......@@ -89,12 +89,17 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
dealSumToPay.text = deal.dealToPay.toRubly()
createStatusView(
statusLayout,
statusContainer,
deal.statusList,
deal.statusNo,
false
)
val currentStatusText = LayoutInflater.from(itemView.context)
.inflate(R.layout.status_title_textview,statusContainer,false)
as MaterialTextView
currentStatusText.text = deal.statusList[deal.statusNo-1].title
statusLayout.addView(currentStatusText,0)
statusLayout.invalidate()
}
private fun renderCommonInfo(info:DealPreviewModel){
......@@ -117,7 +122,12 @@ class DealViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}
fun createStatusView(mainContainer: LinearLayout,container:ViewGroup,list:List<StatusModel>,currentStatus:Int, isVertical:Boolean){
fun createStatusView(
container: ViewGroup,
list: List<StatusModel>,
currentStatus: Int,
isVertical: Boolean
){
container.removeAllViews()
val scale = container.resources.displayMetrics.density.toDouble()
......@@ -143,17 +153,5 @@ fun createStatusView(mainContainer: LinearLayout,container:ViewGroup,list:List<S
container.addView(ceil)
}
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()
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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"
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="wrap_content"
android:orientation="vertical">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_card_header"
style="@style/Currency_TextView.Currency"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="КВАРТИРА\n№452" />
<include
layout="@layout/horizontal_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" />
<LinearLayout
android:id="@+id/common_info_block"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:orientation="horizontal">
<include
android:id="@+id/info_ceil_1"
layout="@layout/info_ceil_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<include
android:id="@+id/info_ceil_2"
layout="@layout/info_ceil_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<include
android:id="@+id/info_ceil_3"
layout="@layout/info_ceil_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<include
android:id="@+id/info_ceil_4"
layout="@layout/info_ceil_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/statusContainer"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/gradient_background_accent"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:id="@+id/progress_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"></LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_sum_header_text_view"
style="@style/Accent_Minor_TextView.Inverted"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="true"
android:text="Сумма договора"/>
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_sum_value_text_view"
style="@style/Default_TextView.Header_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
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">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_payed_header_text_view"
style="@style/Accent_Minor_TextView.Inverted"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="true"
android:text="Сумма платежей" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_payed_value_text_view"
style="@style/Default_TextView.Header_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
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">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_to_pay_header_text_view"
style="@style/Accent_Minor_TextView.Inverted"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:gravity="bottom"
android:includeFontPadding="true"
android:text="Сумма к оплате" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/deal_to_pay_value_text_view"
style="@style/Default_TextView.Accent_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="1"
android:gravity="bottom|end"
android:includeFontPadding="false"
android:text="32 543 ₽" />
</LinearLayout>
<include
android:id="@+id/start_tour_button"
layout="@layout/start_tour_viewholder"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" />
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_margin="16dp"
app:cardElevation="4dp"
app:cardMaxElevation="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorCommonBackground"
android:weightSum="3">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="end|center_vertical"
android:layout_weight="1"
android:baselineAlignBottom="false"
android:src="@drawable/ic_flat" />
<com.google.android.material.textview.MaterialTextView
style="@style/Default_TextView.Header_Text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|center_vertical"
android:layout_weight="2"
android:gravity="center"
android:text="КАРТОЧКА КВАРТИРЫ"
android:textAlignment="gravity" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
\ 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