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
4ff314c8
Commit
4ff314c8
authored
Apr 03, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tours layout
parent
692f8415
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
27 deletions
+135
-27
tours.kt
...va/com/biganto/visual/roompark/domain/interactor/tours.kt
+5
-5
ScreenContract.kt
...ual/roompark/presentation/screen/estate/ScreenContract.kt
+1
-0
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+14
-2
ScreenPresenter.kt
...al/roompark/presentation/screen/estate/ScreenPresenter.kt
+35
-20
ScreenViewState.kt
...al/roompark/presentation/screen/estate/ScreenViewState.kt
+2
-0
tour_chooser_viewholder.xml
app/src/main/res/layout/tour_chooser_viewholder.xml
+45
-0
tours_chooser_screen.xml
app/src/main/res/layout/tours_chooser_screen.xml
+33
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/tours.kt
View file @
4ff314c8
...
@@ -10,16 +10,16 @@ import javax.inject.Inject
...
@@ -10,16 +10,16 @@ import javax.inject.Inject
*/
*/
class
ToursInteractor
@Inject
constructor
(
class
ToursInteractor
@Inject
constructor
(
val
downloadUseCase
:
DownloadUseCase
,
private
val
downloadUseCase
:
DownloadUseCase
,
val
tourUseCase
:
TourPreviewsUseCase
private
val
tourUseCase
:
TourPreviewsUseCase
){
){
fun
getEstateTourList
(
estate
:
EstateModel
)
{
fun
getEstateTourList
(
estate
:
EstateModel
)
=
tourUseCase
.
fetchTourOffer
(
estate
.
multitourId
tourUseCase
.
fetchTourOffer
(
estate
.
multitourId
?:
error
(
"Отсутсвуют виртуальные туры для данного объекта"
),
estate
.
id
)
?:
error
(
"Отсутсвуют виртуальные туры для данного объекта"
),
estate
.
id
)
}
fun
downloadTour
(
tourId
:
String
,
cancellationToken
:
DownloadUseCase
.
CancellationToken
)
=
downloadUseCase
.
startTourDownloading
(
tourId
,
cancellationToken
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenContract.kt
View file @
4ff314c8
...
@@ -15,5 +15,6 @@ interface EstateScreen : BigantoBaseContract<EstateScreenViewState> {
...
@@ -15,5 +15,6 @@ interface EstateScreen : BigantoBaseContract<EstateScreenViewState> {
fun
switchElectric
():
Observable
<
Pair
<
Int
,
Boolean
>>
fun
switchElectric
():
Observable
<
Pair
<
Int
,
Boolean
>>
fun
showCommonInfo
():
Observable
<
Int
>
fun
showCommonInfo
():
Observable
<
Int
>
fun
showExplication
():
Observable
<
Int
>
fun
showExplication
():
Observable
<
Int
>
fun
tourCardClicked
():
Observable
<
Int
>
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
4ff314c8
...
@@ -70,6 +70,12 @@ class EstateScreenController :
...
@@ -70,6 +70,12 @@ class EstateScreenController :
.
map
{
planTypesTabLayout
.
selectedTabPosition
}
.
map
{
planTypesTabLayout
.
selectedTabPosition
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
tourCardClicked
():
Observable
<
Int
>
=
startToourCard
.
clicks
()
.
map
{
1
}
.
debounce
(
320L
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
private
fun
ViewGroup
.
switchMatch
()
=
private
fun
ViewGroup
.
switchMatch
()
=
this
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
)
this
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
)
.
checkedChanges
()
.
checkedChanges
()
...
@@ -110,6 +116,10 @@ class EstateScreenController :
...
@@ -110,6 +116,10 @@ class EstateScreenController :
@Inject
@Inject
override
lateinit
var
injectedPresenter
:
EstateScreenPresenter
override
lateinit
var
injectedPresenter
:
EstateScreenPresenter
@BindView
(
R
.
id
.
start_tour_image_view
)
lateinit
var
startToourCard
:
View
@BindView
(
R
.
id
.
flatTypesCustomView
)
@BindView
(
R
.
id
.
flatTypesCustomView
)
lateinit
var
flatTypeView
:
ViewGroup
lateinit
var
flatTypeView
:
ViewGroup
...
@@ -251,6 +261,8 @@ class EstateScreenController :
...
@@ -251,6 +261,8 @@ class EstateScreenController :
is
EstateScreenViewState
.
PlanTypeSelected
->
render
(
viewState
)
is
EstateScreenViewState
.
PlanTypeSelected
->
render
(
viewState
)
is
EstateScreenViewState
.
SomeError
->
render
(
viewState
)
is
EstateScreenViewState
.
SomeError
->
render
(
viewState
)
is
EstateScreenViewState
.
ShowEstateInfo
->
render
(
viewState
)
is
EstateScreenViewState
.
ShowEstateInfo
->
render
(
viewState
)
is
EstateScreenViewState
.
ToursLoaded
->
render
(
viewState
)
}
}
}
}
...
@@ -302,12 +314,12 @@ class EstateScreenController :
...
@@ -302,12 +314,12 @@ class EstateScreenController :
}
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
ShowEstateInfo
)
{
private
fun
render
(
viewState
:
EstateScreenViewState
.
ShowEstateInfo
)
{
(
flatInfoRecyclerView
.
adapter
as
FlatInfoAdapter
).
setItems
(
viewState
.
info
)
(
flatInfoRecyclerView
.
adapter
as
FlatInfoAdapter
).
setItems
(
viewState
.
info
)
}
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
ToursLoaded
)
{
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
LoadPlanTypes
)
{
private
fun
render
(
viewState
:
EstateScreenViewState
.
LoadPlanTypes
)
{
planTypesTabLayout
.
removeAllTabs
()
planTypesTabLayout
.
removeAllTabs
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenPresenter.kt
View file @
4ff314c8
...
@@ -5,6 +5,7 @@ import androidx.annotation.StringRes
...
@@ -5,6 +5,7 @@ import androidx.annotation.StringRes
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
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.interactor.ToursInteractor
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.util.extensions.toRubly
import
com.biganto.visual.roompark.util.extensions.toRubly
...
@@ -23,6 +24,7 @@ import javax.inject.Named
...
@@ -23,6 +24,7 @@ import javax.inject.Named
class
EstateScreenPresenter
@Inject
constructor
(
class
EstateScreenPresenter
@Inject
constructor
(
private
val
interactor
:
EstateInteractor
,
private
val
interactor
:
EstateInteractor
,
private
val
toursInteractor
:
ToursInteractor
,
private
val
context
:
Context
,
private
val
context
:
Context
,
@Named
(
SELECTED_ESTATE_ID_KEY
)
private
val
estateId
:
Int
@Named
(
SELECTED_ESTATE_ID_KEY
)
private
val
estateId
:
Int
)
)
...
@@ -53,7 +55,7 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -53,7 +55,7 @@ class EstateScreenPresenter @Inject constructor(
val
fetchPlan
=
intent
(
EstateScreen
::
planTypesTabSelected
)
val
fetchPlan
=
intent
(
EstateScreen
::
planTypesTabSelected
)
.
map
{
planList
?.
get
(
it
)
}
.
map
{
planList
?.
get
(
it
)
}
.
flatMap
{
planPreset
->
.
flatMap
{
planPreset
->
interactor
.
getPlan
(
planPreset
)
interactor
.
getPlan
(
planPreset
)
.
map
<
EstateScreenViewState
>
{
plan
->
EstateScreenViewState
.
LoadPlan
(
plan
)
}
.
map
<
EstateScreenViewState
>
{
plan
->
EstateScreenViewState
.
LoadPlan
(
plan
)
}
.
startWith
(
.
startWith
(
...
@@ -66,7 +68,7 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -66,7 +68,7 @@ class EstateScreenPresenter @Inject constructor(
EstateScreenViewState
.
ShowEstateInfo
(
EstateScreenViewState
.
ShowEstateInfo
(
showType
showType
,
if
(
showType
==
InfoShowType
.
COMMON_INFO
)
,
if
(
showType
==
InfoShowType
.
COMMON_INFO
)
mapCommonInfo
(
estate
?.
commonInfo
)
mapCommonInfo
(
estate
?.
commonInfo
)
else
mapCommonInfo
(
planPreset
.
explication
)
else
mapCommonInfo
(
planPreset
.
explication
)
)
)
...
@@ -105,26 +107,39 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -105,26 +107,39 @@ class EstateScreenPresenter @Inject constructor(
val
showInfo
=
intent
(
EstateScreen
::
showCommonInfo
)
val
showInfo
=
intent
(
EstateScreen
::
showCommonInfo
)
.
doOnNext
{
showType
=
InfoShowType
.
COMMON_INFO
}
.
doOnNext
{
showType
=
InfoShowType
.
COMMON_INFO
}
.
map
{
estate
?.
commonInfo
}
.
map
{
estate
?.
commonInfo
}
.
map
(
::
mapCommonInfo
)
.
map
(
::
mapCommonInfo
)
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
val
showExplication
=
intent
(
EstateScreen
::
showExplication
)
val
showExplication
=
intent
(
EstateScreen
::
showExplication
)
.
doOnNext
{
showType
=
InfoShowType
.
EXPLICATIONS
}
.
doOnNext
{
showType
=
InfoShowType
.
EXPLICATIONS
}
.
map
{
planList
?.
get
(
it
)
?.
explication
}
.
map
{
planList
?.
get
(
it
)
?.
explication
}
.
map
(
::
mapCommonInfo
)
.
map
(
::
mapCommonInfo
)
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
val
onStartTours
=
intent
(
EstateScreen
::
tourCardClicked
)
.
mergeWith
(
fetchPlans
)
.
map
{
estate
}
.
mergeWith
(
fetchPlan
)
.
flatMap
{
estate
->
toursInteractor
.
getEstateTourList
(
estate
)
.
mergeWith
(
switchElectric
)
.
map
{
EstateScreenViewState
.
ToursLoaded
(
it
)
}
.
mergeWith
(
switchFurn
)
}
.
mergeWith
(
switchSizes
)
.
mergeWith
(
switchWalls
)
.
mergeWith
(
showInfo
)
val
state
=
Observable
.
mergeDelayError
(
.
mergeWith
(
showExplication
)
arrayListOf
(
restoreStateObservable
,
prefetchCards
,
fetchPlans
,
fetchPlan
,
switchElectric
,
switchFurn
,
switchSizes
,
switchWalls
,
showInfo
,
onStartTours
,
showExplication
)
)
.
doOnError
{
Timber
.
e
(
it
)
}
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenViewState.kt
View file @
4ff314c8
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.estate
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.estate
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.conductor.BigantoBaseViewState
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.TourModel
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
...
@@ -19,4 +20,5 @@ sealed class EstateScreenViewState : BigantoBaseViewState() {
...
@@ -19,4 +20,5 @@ sealed class EstateScreenViewState : BigantoBaseViewState() {
class
LoadPlan
(
val
planBody
:
String
)
:
EstateScreenViewState
()
class
LoadPlan
(
val
planBody
:
String
)
:
EstateScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
EstateScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
EstateScreenViewState
()
class
ShowEstateInfo
(
val
showType
:
InfoShowType
,
val
info
:
List
<
DisplayInfoModel
>)
:
EstateScreenViewState
()
class
ShowEstateInfo
(
val
showType
:
InfoShowType
,
val
info
:
List
<
DisplayInfoModel
>)
:
EstateScreenViewState
()
class
ToursLoaded
(
val
tours
:
List
<
TourModel
>)
:
EstateScreenViewState
()
}
}
\ No newline at end of file
app/src/main/res/layout/tour_chooser_viewholder.xml
0 → 100644
View file @
4ff314c8
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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"
>
<ImageView
android:id=
"@+id/tour_preview_imageView"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_marginStart=
"19dp"
android:layout_marginTop=
"16dp"
android:layout_marginBottom=
"16dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_bell_on"
/>
<com.google.android.material.textview.MaterialTextView
style=
"@style/Default_TextView"
android:id=
"@+id/tour_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:layout_marginBottom=
"8dp"
android:ellipsize=
"end"
android:text=
"Тур"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@+id/tour_status_imageView"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toEndOf=
"@+id/tour_preview_imageView"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/tour_status_imageView"
android:layout_width=
"32dp"
android:layout_height=
"32dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"16dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:srcCompat=
"@drawable/ic_back"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/tours_chooser_screen.xml
0 → 100644
View file @
4ff314c8
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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=
"match_parent"
android:background=
"@color/playTourCardOpacityLight"
>
<com.google.android.material.card.MaterialCardView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"32dp"
android:layout_marginEnd=
"32dp"
app:cardElevation=
"2dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_bias=
"0.32999998"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/toursList"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"16dp"
android:layout_marginBottom=
"8dp"
android:orientation=
"vertical"
tools:itemCount=
"3"
tools:listitem=
"@layout/tour_chooser_viewholder"
>
</androidx.recyclerview.widget.RecyclerView>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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