Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
6180b58b
Commit
6180b58b
authored
Jan 10, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plan type selection
parent
450c1003
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
10 deletions
+159
-10
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+2
-2
planType.kt
...java/com/biganto/visual/roompark/domain/model/planType.kt
+23
-3
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+78
-0
ScreenPresenter.kt
...al/roompark/presentation/screen/estate/ScreenPresenter.kt
+6
-2
ScreenViewState.kt
...al/roompark/presentation/screen/estate/ScreenViewState.kt
+1
-0
flat_full_card_screen.xml
app/src/main/res/layout/flat_full_card_screen.xml
+49
-3
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
6180b58b
...
...
@@ -114,7 +114,7 @@ fun fromEntity(entity : PlanPreset) = PlanPresetModel(
estateId
=
entity
.
estateId
.
id
,
title
=
entity
.
title
,
features
=
entity
.
features
.
asSequence
()
.
map
{
Feature
Status
(
it
,
it
==
DEFAULT_WALLS_FEATURE_NAME
)
}.
toList
(),
.
map
{
Feature
Model
.
fromFeature
(
it
)
}.
toList
(),
//default true value for walls (otherwise plan may be empty)
explication
=
List
(
entity
.
explication
.
size
)
{
ExplicationModel
((
entity
.
explication
[
it
]
as
ExplicationEntity
))}
...
...
@@ -125,7 +125,7 @@ data class PlanPresetModel(
val
explication
:
List
<
ExplicationModel
>,
var
estateId
:
Int
,
val
title
:
String
,
val
features
:
List
<
Feature
Status
>
val
features
:
List
<
Feature
Model
>
)
data class
ExplicationModel
(
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/planType.kt
View file @
6180b58b
...
...
@@ -8,13 +8,33 @@ data class PlanTypeModel(
val
id
:
Int
,
val
planTypeId
:
Int
,
val
estateId
:
Int
,
val
features
:
List
<
Feature
Status
>,
val
features
:
List
<
Feature
Model
>,
val
uri
:
String
)
data class
FeatureStatus
(
sealed
class
FeatureModel
(
val
featureName
:
String
,
val
featureTitle
:
String
,
val
switchedOn
:
Boolean
)
){
companion
object
{
fun
fromFeature
(
featureAlias
:
String
):
FeatureModel
=
when
(
featureAlias
){
"furniture"
->
Furniture
()
"sizes"
->
Sizes
()
"electric"
->
Electric
()
"walls"
->
Walls
()
else
->
error
(
"Unsupported feature type"
)
}
}
class
Furniture
:
FeatureModel
(
"furniture"
,
"Мебель"
,
false
)
class
Sizes
:
FeatureModel
(
"sizes"
,
"Размеры"
,
false
)
class
Electric
:
FeatureModel
(
"electric"
,
"Электрика"
,
false
)
class
Walls
:
FeatureModel
(
"walls"
,
"Перегородки"
,
true
)
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
6180b58b
...
...
@@ -3,13 +3,18 @@ package com.biganto.visual.roompark.presentation.screen.estate
import
android.net.Uri
import
android.os.Bundle
import
android.view.View
import
android.view.ViewGroup
import
android.webkit.WebView
import
android.widget.LinearLayout
import
androidx.core.os.bundleOf
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.domain.model.FeatureModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.google.android.material.switchmaterial.SwitchMaterial
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.material.selections
...
...
@@ -59,6 +64,35 @@ class EstateScreenController :
lateinit
var
planWebView
:
WebView
@BindView
(
R
.
id
.
sizes_switch_container
)
lateinit
var
sizesContainer
:
LinearLayout
@BindView
(
R
.
id
.
sizes_switch_header
)
lateinit
var
sizesTitle
:
MaterialTextView
@BindView
(
R
.
id
.
sizes_switcher
)
lateinit
var
sizesSwitcher
:
ViewGroup
@BindView
(
R
.
id
.
electricity_switch_container
)
lateinit
var
electricContainer
:
LinearLayout
@BindView
(
R
.
id
.
electricity_switch_header
)
lateinit
var
electricTitle
:
MaterialTextView
@BindView
(
R
.
id
.
electricity_switcher
)
lateinit
var
electricSwitcher
:
ViewGroup
@BindView
(
R
.
id
.
furniture_switch_container
)
lateinit
var
furnContainer
:
LinearLayout
@BindView
(
R
.
id
.
furniture_switch_header
)
lateinit
var
furnTitle
:
MaterialTextView
@BindView
(
R
.
id
.
furniture_switcher
)
lateinit
var
furnSwitcher
:
ViewGroup
@BindView
(
R
.
id
.
walls_switch_container
)
lateinit
var
wallsContainer
:
LinearLayout
@BindView
(
R
.
id
.
walls_switch_header
)
lateinit
var
wallsTitle
:
MaterialTextView
@BindView
(
R
.
id
.
walls_switcher
)
lateinit
var
wallsSwitcher
:
ViewGroup
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
...
...
@@ -87,6 +121,7 @@ class EstateScreenController :
is
EstateScreenViewState
.
LoadEstate
->
render
(
viewState
)
is
EstateScreenViewState
.
LoadPlanTypes
->
render
(
viewState
)
is
EstateScreenViewState
.
LoadPlan
->
render
(
viewState
)
is
EstateScreenViewState
.
PlanTypeSelected
->
render
(
viewState
)
is
EstateScreenViewState
.
SomeError
->
render
(
viewState
)
}
}
...
...
@@ -119,8 +154,51 @@ class EstateScreenController :
Timber
.
e
(
e
)
}
}
planTypeSelected
(
viewState
.
types
.
first
())
}
private
fun
planTypeSelected
(
plan
:
PlanPresetModel
){
wallsContainer
.
visibility
=
View
.
GONE
sizesContainer
.
visibility
=
View
.
GONE
electricContainer
.
visibility
=
View
.
GONE
furnContainer
.
visibility
=
View
.
GONE
plan
.
features
.
forEach
{
when
(
it
){
is
FeatureModel
.
Furniture
->
{
furnContainer
.
visibility
=
View
.
VISIBLE
furnTitle
.
text
=
it
.
featureTitle
furnSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
}
is
FeatureModel
.
Walls
->{
wallsContainer
.
visibility
=
View
.
VISIBLE
wallsTitle
.
text
=
it
.
featureTitle
wallsSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
}
is
FeatureModel
.
Sizes
->{
sizesContainer
.
visibility
=
View
.
VISIBLE
sizesTitle
.
text
=
it
.
featureTitle
sizesSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
}
is
FeatureModel
.
Electric
->{
electricContainer
.
visibility
=
View
.
VISIBLE
electricTitle
.
text
=
it
.
featureTitle
electricSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
}
}
}
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
PlanTypeSelected
)
{
planTypeSelected
(
viewState
.
item
)
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
LoadPlan
)
{
planWebView
.
settings
.
javaScriptEnabled
=
true
planWebView
.
clearCache
(
true
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenPresenter.kt
View file @
6180b58b
...
...
@@ -4,6 +4,7 @@ import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.EstateInteractor
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
...
...
@@ -38,9 +39,12 @@ class EstateScreenPresenter @Inject constructor(
val
fetchPlan
=
intent
(
EstateScreen
::
planTypesTabSelected
)
.
map
{
plan
->
planList
?.
first
{
it
.
planId
==
plan
}
}
.
flatMap
{
interactor
.
getPlan
(
it
)
.
flatMap
{
interactor
.
getPlan
(
it
)
.
map
<
EstateScreenViewState
>
{
plan
->
EstateScreenViewState
.
LoadPlan
(
plan
)
}
.
startWith
(
Observable
.
just
<
EstateScreenViewState
>(
EstateScreenViewState
.
PlanTypeSelected
(
it
)))
}
.
map
{
EstateScreenViewState
.
LoadPlan
(
it
)
}
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenViewState.kt
View file @
6180b58b
...
...
@@ -14,6 +14,7 @@ sealed class EstateScreenViewState : BigantoBaseViewState() {
class
Idle
:
EstateScreenViewState
()
class
LoadEstate
(
val
estate
:
EstateModel
)
:
EstateScreenViewState
()
class
LoadPlanTypes
(
val
types
:
List
<
PlanPresetModel
>)
:
EstateScreenViewState
()
class
PlanTypeSelected
(
val
item
:
PlanPresetModel
)
:
EstateScreenViewState
()
class
LoadPlan
(
val
planBody
:
String
)
:
EstateScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
EstateScreenViewState
()
}
\ No newline at end of file
app/src/main/res/layout/flat_full_card_screen.xml
View file @
6180b58b
...
...
@@ -176,7 +176,7 @@
app:layout_constraintTop_toBottomOf=
"@+id/include8"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/electr
e
city_switch_header"
android:id=
"@+id/electr
i
city_switch_header"
style=
"@style/Default_TextView.Header_Text"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
...
...
@@ -185,7 +185,53 @@
android:text=
"Электрика"
/>
<include
android:id=
"@+id/furniture_switcher"
android:id=
"@+id/electricity_switcher"
layout=
"@layout/bell_switch_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"end|center_vertical"
android:layout_weight=
"0"
/>
</LinearLayout>
<include
android:id=
"@+id/walls_divider"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/electricity_switch_container"
/>
<LinearLayout
android:id=
"@+id/walls_switch_container"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:layout_marginEnd=
"16dp"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/walls_divider"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/walls_switch_header"
style=
"@style/Default_TextView.Header_Text"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_gravity=
"start|center_vertical"
android:layout_weight=
"1"
android:text=
"Стены"
/>
<include
android:id=
"@+id/walls_switcher"
layout=
"@layout/bell_switch_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -203,7 +249,7 @@
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/
electricity
_switch_container"
/>
app:layout_constraintTop_toBottomOf=
"@+id/
walls
_switch_container"
/>
<include
android:id=
"@+id/switch_flat_content_tab"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment