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
087eea30
Commit
087eea30
authored
Jan 10, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag cannot be used as store ..
parent
6180b58b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
2 deletions
+84
-2
deals.kt
...in/java/com/biganto/visual/roompark/domain/model/deals.kt
+6
-1
planType.kt
...java/com/biganto/visual/roompark/domain/model/planType.kt
+1
-1
ScreenContract.kt
...ual/roompark/presentation/screen/estate/ScreenContract.kt
+4
-0
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+37
-0
ScreenPresenter.kt
...al/roompark/presentation/screen/estate/ScreenPresenter.kt
+36
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/model/deals.kt
View file @
087eea30
...
@@ -126,7 +126,12 @@ data class PlanPresetModel(
...
@@ -126,7 +126,12 @@ data class PlanPresetModel(
var
estateId
:
Int
,
var
estateId
:
Int
,
val
title
:
String
,
val
title
:
String
,
val
features
:
List
<
FeatureModel
>
val
features
:
List
<
FeatureModel
>
)
){
inline
fun
<
reified
T
:
FeatureModel
>
switchFeature
(
value
:
Boolean
){
features
.
first
{
it
is
T
}.
switchedOn
=
value
}
}
data class
ExplicationModel
(
data class
ExplicationModel
(
val
living
:
Boolean
,
val
living
:
Boolean
,
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/planType.kt
View file @
087eea30
...
@@ -15,7 +15,7 @@ data class PlanTypeModel(
...
@@ -15,7 +15,7 @@ data class PlanTypeModel(
sealed
class
FeatureModel
(
sealed
class
FeatureModel
(
val
featureName
:
String
,
val
featureName
:
String
,
val
featureTitle
:
String
,
val
featureTitle
:
String
,
va
l
switchedOn
:
Boolean
va
r
switchedOn
:
Boolean
){
){
companion
object
{
companion
object
{
fun
fromFeature
(
featureAlias
:
String
):
FeatureModel
=
fun
fromFeature
(
featureAlias
:
String
):
FeatureModel
=
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenContract.kt
View file @
087eea30
...
@@ -9,5 +9,9 @@ import io.reactivex.Observable
...
@@ -9,5 +9,9 @@ import io.reactivex.Observable
interface
EstateScreen
:
BigantoBaseContract
<
EstateScreenViewState
>
{
interface
EstateScreen
:
BigantoBaseContract
<
EstateScreenViewState
>
{
fun
planTypesTabSelected
():
Observable
<
Int
>
fun
planTypesTabSelected
():
Observable
<
Int
>
fun
switchSizes
():
Observable
<
Pair
<
Int
,
Boolean
>>
fun
switchWalls
():
Observable
<
Pair
<
Int
,
Boolean
>>
fun
switchFurniture
():
Observable
<
Pair
<
Int
,
Boolean
>>
fun
switchElectric
():
Observable
<
Pair
<
Int
,
Boolean
>>
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
087eea30
...
@@ -7,6 +7,8 @@ import android.view.ViewGroup
...
@@ -7,6 +7,8 @@ import android.view.ViewGroup
import
android.webkit.WebView
import
android.webkit.WebView
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
androidx.core.os.bundleOf
import
androidx.core.os.bundleOf
import
androidx.core.view.get
import
androidx.core.view.isNotEmpty
import
butterknife.BindView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
...
@@ -18,6 +20,7 @@ import com.google.android.material.switchmaterial.SwitchMaterial
...
@@ -18,6 +20,7 @@ import com.google.android.material.switchmaterial.SwitchMaterial
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.material.selections
import
com.jakewharton.rxbinding3.material.selections
import
com.jakewharton.rxbinding3.widget.checkedChanges
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
timber.log.Timber
...
@@ -38,6 +41,38 @@ class EstateScreenController :
...
@@ -38,6 +41,38 @@ class EstateScreenController :
,
EstateScreenPresenter
>
,
EstateScreenPresenter
>
,
EstateScreen
{
,
EstateScreen
{
private
fun
ViewGroup
.
switchMatch
()
=
this
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
)
.
checkedChanges
()
.
filter
{
planTypesTabLayout
.
isNotEmpty
()}
.
filter
{
planTypesTabLayout
.
selectedTabPosition
>=
0
}
.
doOnNext
{
Timber
.
d
(
"tag: ${planTypesTabLayout.getTabAt(0)?.tag}"
)
}
.
doOnNext
{
Timber
.
d
(
"tag: ${planTypesTabLayout.getTabAt(0)?.customView}"
)
}
.
doOnNext
{
Timber
.
d
(
"tag: ${planTypesTabLayout.getTabAt(0)?.view}"
)
}
.
doOnNext
{
Timber
.
d
(
"tabs tag: ${planTypesTabLayout.getTag(planTypesTabLayout.selectedTabPosition)}"
)
Timber
.
d
(
"tabs tag: ${planTypesTabLayout.getTabAt(0)?.customView?.tag}"
)
}
.
doOnNext
{
Timber
.
d
(
"tag: ${planTypesTabLayout.selectedTabPosition}"
)
}
.
doOnNext
{
Timber
.
d
(
"tag: ${planTypesTabLayout[planTypesTabLayout.selectedTabPosition].tag}"
)
}
.
map
{
Pair
(
planTypesTabLayout
.
getTabAt
(
0
)
?.
customView
?.
tag
as
Int
,
it
)
}
override
fun
switchSizes
():
Observable
<
Pair
<
Int
,
Boolean
>>
=
sizesSwitcher
.
switchMatch
()
override
fun
switchWalls
():
Observable
<
Pair
<
Int
,
Boolean
>>
=
wallsSwitcher
.
switchMatch
()
override
fun
switchFurniture
():
Observable
<
Pair
<
Int
,
Boolean
>>
=
furnSwitcher
.
switchMatch
()
override
fun
switchElectric
():
Observable
<
Pair
<
Int
,
Boolean
>>
=
electricSwitcher
.
switchMatch
()
override
fun
planTypesTabSelected
():
Observable
<
Int
>
=
override
fun
planTypesTabSelected
():
Observable
<
Int
>
=
planTypesTabLayout
.
selections
()
planTypesTabLayout
.
selections
()
...
@@ -147,6 +182,8 @@ class EstateScreenController :
...
@@ -147,6 +182,8 @@ class EstateScreenController :
val
tab
=
planTypesTabLayout
.
newTab
()
val
tab
=
planTypesTabLayout
.
newTab
()
.
setCustomView
(
R
.
layout
.
select_text_tab
).
setTag
(
it
.
planId
)
.
setCustomView
(
R
.
layout
.
select_text_tab
).
setTag
(
it
.
planId
)
Timber
.
d
(
"tabs tag: ${tab}"
)
Timber
.
d
(
"tabs tag: ${tab.tag}"
)
(
tab
.
customView
as
MaterialTextView
).
text
=
"Вариант $i"
(
tab
.
customView
as
MaterialTextView
).
text
=
"Вариант $i"
planTypesTabLayout
.
addTab
(
tab
)
planTypesTabLayout
.
addTab
(
tab
)
i
++
i
++
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenPresenter.kt
View file @
087eea30
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.estate
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.estate
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.EstateInteractor
import
com.biganto.visual.roompark.domain.interactor.EstateInteractor
import
com.biganto.visual.roompark.domain.model.FeatureModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -27,6 +28,11 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -27,6 +28,11 @@ class EstateScreenPresenter @Inject constructor(
override
fun
defaultErrorViewStateHandler
()
=
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
EstateScreenViewState
.
SomeError
(
e
)
}
{
e
:
ExceptionString
->
EstateScreenViewState
.
SomeError
(
e
)
}
private
fun
getPlan
(
plan
:
PlanPresetModel
):
Observable
<
EstateScreenViewState
>
=
interactor
.
getPlan
(
plan
)
.
map
<
EstateScreenViewState
>
{
EstateScreenViewState
.
LoadPlan
(
it
)}
override
fun
bindIntents
()
{
override
fun
bindIntents
()
{
val
prefetchCards
=
interactor
.
getEstate
(
estateId
)
val
prefetchCards
=
interactor
.
getEstate
(
estateId
)
...
@@ -44,12 +50,42 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -44,12 +50,42 @@ class EstateScreenPresenter @Inject constructor(
.
startWith
(
Observable
.
just
<
EstateScreenViewState
>(
EstateScreenViewState
.
PlanTypeSelected
(
it
)))
.
startWith
(
Observable
.
just
<
EstateScreenViewState
>(
EstateScreenViewState
.
PlanTypeSelected
(
it
)))
}
}
val
switchSizes
=
intent
(
EstateScreen
::
switchSizes
)
.
map
{
pair
->
val
plan
=
planList
?.
first
{
it
.
planId
==
pair
.
first
}
plan
?.
switchFeature
<
FeatureModel
.
Sizes
>(
pair
.
second
)
plan
}.
flatMap
(
::
getPlan
)
val
switchFurn
=
intent
(
EstateScreen
::
switchFurniture
)
.
map
{
pair
->
val
plan
=
planList
?.
first
{
it
.
planId
==
pair
.
first
}
plan
?.
switchFeature
<
FeatureModel
.
Furniture
>(
pair
.
second
)
plan
}.
flatMap
(
::
getPlan
)
val
switchWalls
=
intent
(
EstateScreen
::
switchWalls
)
.
map
{
pair
->
val
plan
=
planList
?.
first
{
it
.
planId
==
pair
.
first
}
plan
?.
switchFeature
<
FeatureModel
.
Walls
>(
pair
.
second
)
plan
}.
flatMap
(
::
getPlan
)
val
switchElectric
=
intent
(
EstateScreen
::
switchElectric
)
.
map
{
pair
->
val
plan
=
planList
?.
first
{
it
.
planId
==
pair
.
first
}
plan
?.
switchFeature
<
FeatureModel
.
Electric
>(
pair
.
second
)
plan
}.
flatMap
(
::
getPlan
)
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
.
mergeWith
(
prefetchCards
)
.
mergeWith
(
fetchPlans
)
.
mergeWith
(
fetchPlans
)
.
mergeWith
(
fetchPlan
)
.
mergeWith
(
fetchPlan
)
.
mergeWith
(
switchElectric
)
.
mergeWith
(
switchFurn
)
.
mergeWith
(
switchSizes
)
.
mergeWith
(
switchWalls
)
.
doOnError
{
Timber
.
e
(
it
)}
.
doOnError
{
Timber
.
e
(
it
)}
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
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