Commit 150c032a authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

estate views

parent e5e2c20d
......@@ -12,6 +12,7 @@ interface Explication : Persistable {
@get:Generated
val id: Int
@get:ForeignKey(references = PlanPreset::class)
@get:ManyToOne
val planId: Int
val living: Boolean
val area: Float
......
package com.biganto.visual.roompark.presentation.screen.estate
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import butterknife.BindView
import com.biganto.visual.roompark.R
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBaseController
import com.biganto.visual.roompark.presentation.screen.favorites.DaggerEstateScreenComponent
import com.biganto.visual.roompark.presentation.screen.favorites.util.EstateListAdapter
import com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import com.google.android.material.tabs.TabLayout
import com.google.android.material.textview.MaterialTextView
import timber.log.Timber
import javax.inject.Inject
......@@ -34,6 +32,9 @@ class EstateScreenController :
@BindView(R.id.favorites_cards_recycler_view)
lateinit var favoritesRecyclerView: RecyclerView
@BindView(R.id.planTypesTabs)
lateinit var planTypesTabLayout: TabLayout
private fun setToolbar(){
toolBar.showAll()
......@@ -43,6 +44,8 @@ class EstateScreenController :
toolBar.appBar.setLiftable(true)
toolBar.appBarScrollable(false)
favoritesRecyclerView.isNestedScrollingEnabled = false
// planTypesTabLayout.
}
private fun bindRecycler() {
......@@ -59,7 +62,8 @@ class EstateScreenController :
Timber.d("Render state $viewState")
when(viewState){
is EstateScreenViewState.Idle -> render(viewState)
is EstateScreenViewState.FavoriteEstatesLoaded -> render(viewState)
is EstateScreenViewState.LoadEstate -> render(viewState)
is EstateScreenViewState.LoadPlanTypes -> render(viewState)
is EstateScreenViewState.SomeError -> render(viewState)
}
}
......@@ -72,14 +76,26 @@ class EstateScreenController :
showError(viewState.exception)
private fun render(viewState: EstateScreenViewState.FavoriteEstatesLoaded) {
private fun render(viewState: EstateScreenViewState.LoadEstate) {
}
private fun render(viewState: EstateScreenViewState.LoadPlanTypes) {
planTypesTabLayout.removeAllTabs()
var i = 1
viewState.types.forEach {
val tab = planTypesTabLayout.newTab()
.setCustomView(R.layout.select_text_tab).setTag(it.planTypeId)
tab.customView?.findViewById<MaterialTextView>(R.id.textTitle)?.text = "Вариант $i"
i++
}
}
private fun getComponent() = DaggerEstateScreenComponent.factory()
.create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this)
override fun getLayoutId(): Int = R.layout.favorites_screen
override fun getLayoutId(): Int = R.layout.flat_full_card_screen
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.estate
import com.biganto.visual.roompark.conductor.BigantoBaseViewState
import com.biganto.visual.roompark.domain.model.EstateModel
import com.biganto.visual.roompark.domain.model.PlanTypeModel
import com.biganto.visual.roompark.util.monades.ExceptionString
/**
......@@ -11,6 +12,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
sealed class EstateScreenViewState : BigantoBaseViewState() {
class Idle : EstateScreenViewState()
class FavoriteEstatesLoaded(val items: List<EstateModel>) : EstateScreenViewState()
class LoadEstate(val estate:EstateModel) : EstateScreenViewState()
class LoadPlanTypes(val types:List<PlanTypeModel>) : EstateScreenViewState()
class SomeError(val exception: ExceptionString) : EstateScreenViewState()
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/colorAccent" />
<item android:state_focused="true" android:color="@color/colorAccent" />
<item android:state_pressed="true" android:color="@color/colorAccent" />
<item android:color="@color/colorPrimary" />
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/colorPrimary" />
<item android:state_focused="true" android:color="@color/colorPrimary" />
<item android:state_pressed="true" android:color="@color/colorPrimary" />
<item android:color="@color/colorAccent" />
</selector>
\ No newline at end of file
......@@ -18,7 +18,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tabMaxWidth="@dimen/feeds_tab_max_width"
app:tabMaxWidth="@dimen/tab_max_width"
app:tabMode="scrollable" />
<androidx.recyclerview.widget.RecyclerView
......
......@@ -14,7 +14,7 @@
android:layout_marginEnd="16dp"
android:background="#00000000"
app:tabIndicatorColor="@color/colorAccent"
app:tabMaxWidth="@dimen/feeds_tab_max_width"
app:tabMaxWidth="@dimen/tab_max_width"
app:tabMode="scrollable" />
<com.google.android.material.textfield.TextInputLayout
......
......@@ -13,17 +13,18 @@
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/variants_choose_recycler_view"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal"
<com.google.android.material.tabs.TabLayout
android:id="@+id/planTypesTabs"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:background="#00000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:tabMaxWidth="@dimen/tab_max_width"
app:tabMode="scrollable" />
<include
android:id="@+id/include5"
......
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textview.MaterialTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textTitle"
style="@style/Accent_Minor_TextView.Tab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:orientation="vertical"
android:text="Вариант 1">
</com.google.android.material.textview.MaterialTextView>
\ No newline at end of file
......@@ -347,6 +347,11 @@
<item name="android:textColor">@color/colorNoticeText</item>
</style>
<style name="Accent_Minor_TextView.Tab">
<item name="android:textColor">@color/plantype_tab_text_selector</item>
<item name="android:background">@color/plantype_tab_background_selector</item>
</style>
<style name="Accent_Minor_TextView.DatePlaceHolder">
......
......@@ -9,5 +9,5 @@
<dimen name="ceil_grid_padding">8dp</dimen>
<dimen name="feeds_tab_max_width">999dp</dimen>
<dimen name="tab_max_width">999dp</dimen>
</resources>
\ 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