Commit 2271b480 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

estate card

parent 25709434
package com.biganto.visual.roompark.presentation.screen.favorites.util
import android.app.Activity
import android.view.View
import android.widget.TextView
import butterknife.BindView
......@@ -11,6 +12,7 @@ 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
import com.biganto.visual.roompark.util.extensions.setGone
import com.biganto.visual.roompark.util.extensions.startUrl
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
......@@ -37,6 +39,11 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
@BindView(R.id.info_ceil_7) lateinit var info7:View
@BindView(R.id.info_ceil_8) lateinit var info8:View
@BindView(R.id.site_link) lateinit var siteLink:View
@BindView(R.id.link_divider) lateinit var siteLinkDivider:View
init {
ButterKnife.bind(this, itemView)
}
......@@ -48,6 +55,14 @@ class FavoriteViewHolder(itemView: View) : CommonViewHolder<EstateModel>(itemVie
model.commonInfo?.let {renderCommonInfo(it)}
startTour.setGone(model.type != "flat")
siteLink.setGone(model.url == null)
siteLinkDivider.setGone(model.url == null)
model.url?.let {url ->
siteLink.setOnClickListener{
(itemView.context as? Activity)?.startUrl(url)
}
}
}
private fun renderCommonInfo(info:CommonInfoModel){
......
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
......@@ -36,28 +37,20 @@
android:text="СВОБОДНА"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="@+id/feed_read"
app:layout_constraintEnd_toStartOf="@+id/object_plan_icon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/feed_read"
app:layout_constraintTop_toTopOf="@+id/feed_read" />
<ImageView
android:id="@+id/object_plan_icon"
android:layout_width="24dp"
android:layout_height="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_favorites" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/object_card_title"
style="@style/Header_TextView.Main_Header"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginTop="16dp"
android:text="КВАРТИРА\n№ 452"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/object_plan_icon" />
app:layout_constraintTop_toBottomOf="@+id/feed_date_text_view3" />
<include
android:id="@+id/header_divider"
......@@ -87,6 +80,28 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/common_info_block" />
<include
android:id="@+id/link_divider"
layout="@layout/horizontal_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/start_tour_button" />
<include
android:id="@+id/site_link"
layout="@layout/site_link_viewholder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/link_divider" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
\ No newline at end of file
......@@ -20,7 +20,7 @@
<ImageView
android:id="@+id/room_park_link_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="24dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent"
......
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