Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
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
e1987e37
Commit
e1987e37
authored
Jan 28, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deals card viewholder buttons
parent
b1d17e78
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
137 additions
and
47 deletions
+137
-47
DealPreviewModel.kt
.../biganto/visual/roompark/domain/model/DealPreviewModel.kt
+4
-0
ScreenController.kt
...ual/roompark/presentation/screen/deal/ScreenController.kt
+48
-16
ScreenController.kt
...al/roompark/presentation/screen/deals/ScreenController.kt
+20
-0
Adapter.kt
...visual/roompark/presentation/screen/deals/util/Adapter.kt
+18
-12
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+25
-8
ScreenController.kt
...oompark/presentation/screen/favorites/ScreenController.kt
+5
-1
Adapter.kt
...ual/roompark/presentation/screen/settings/util/Adapter.kt
+7
-3
deal_card_viewholder.xml
app/src/main/res/layout/deal_card_viewholder.xml
+1
-0
deal_screen.xml
app/src/main/res/layout/deal_screen.xml
+2
-1
flat_plan_type_selector_view.xml
app/src/main/res/layout/flat_plan_type_selector_view.xml
+6
-6
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/model/DealPreviewModel.kt
View file @
e1987e37
...
...
@@ -2,6 +2,8 @@ package com.biganto.visual.roompark.domain.model
data class
DealPreviewModel
(
val
id
:
String
,
val
estateId
:
Int
,
val
tourId
:
Int
?,
val
type
:
FlatType
,
val
name
:
String
,
val
building
:
Int
?,
...
...
@@ -19,6 +21,8 @@ data class DealPreviewModel(
){
constructor
(
data
:
Pair
<
DealModel
,
List
<
StatusModel
>>)
:
this
(
data
.
first
.
id
,
data
.
first
.
estate
.
id
,
data
.
first
.
estate
.
multitourId
,
data
.
first
.
estate
.
type
,
data
.
first
.
estate
.
number
,
data
.
first
.
estate
.
commonInfo
?.
building
,
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deal/ScreenController.kt
View file @
e1987e37
...
...
@@ -15,9 +15,12 @@ import com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.domain.model.DealModel
import
com.biganto.visual.roompark.domain.model.typeDoubleString
import
com.biganto.visual.roompark.domain.model.typeShortString
import
com.biganto.visual.roompark.presentation.screen.estate.EstateScreenController
import
com.biganto.visual.roompark.util.extensions.toRubly
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxbinding3.view.scrollChangeEvents
...
...
@@ -75,22 +78,32 @@ class DealScreenController :
@BindView
(
R
.
id
.
deal_payed_value_text_view
)
lateinit
var
dealPayed
:
MaterialTextView
@BindView
(
R
.
id
.
deal_to_pay_value_text_view
)
lateinit
var
dealSumToPay
:
MaterialTextView
private
fun
setToolbar
(){
toolBar
.
setToolbar
(
HeaderToolbarModel
(
true
,
resources
?.
getString
(
R
.
string
.
deal_back_chevron_title
)
,
null
,
null
)
@BindView
(
R
.
id
.
flat_card_card_view
)
lateinit
var
toFlatView
:
View
@BindView
(
R
.
id
.
start_tour_card
)
lateinit
var
startTourView
:
View
private
var
servedDeal
:
DealModel
?
=
null
override
fun
onAttach
(
view
:
View
)
{
super
.
onAttach
(
view
)
detachDisposable
.
addAll
(
toFlatView
.
clicks
()
.
map
{
servedDeal
?.
estate
?.
id
?:
-
1000
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
Timber
.
d
(
"got card clicked $it"
)
router
.
pushController
(
RouterTransaction
.
with
(
EstateScreenController
(
it
))
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
}
)
toolBar
.
headerToolbarBack
?.
let
{
detachDisposable
.
add
(
it
.
clicks
()
.
doOnNext
{
Timber
.
d
(
"clicked: 1"
)
}
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
handleBack
()
}
)
}
detachDisposable
.
add
(
dealContainer
.
scrollChangeEvents
()
...
...
@@ -119,6 +132,26 @@ class DealScreenController :
)
}
)
toolBar
.
headerToolbarBack
?.
let
{
detachDisposable
.
add
(
it
.
clicks
()
.
doOnNext
{
Timber
.
d
(
"clicked: 1"
)
}
.
subscribeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
handleBack
()
}
)
}
}
private
fun
setToolbar
(){
toolBar
.
setToolbar
(
HeaderToolbarModel
(
true
,
resources
?.
getString
(
R
.
string
.
deal_back_chevron_title
)
,
null
,
null
)
)
}
private
fun
bindRecycler
()
{
...
...
@@ -156,8 +189,7 @@ class DealScreenController :
private
var
dealModel
:
DealModel
?
=
null
private
fun
render
(
viewState
:
DealScreenViewState
.
LoadDeal
)
{
servedDeal
=
viewState
.
estate
dealTitle
.
text
=
resources
?.
getString
(
viewState
.
estate
.
estate
.
type
.
typeDoubleString
(),
viewState
.
estate
.
estate
.
number
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenController.kt
View file @
e1987e37
...
...
@@ -11,6 +11,7 @@ import com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.deal.DealScreenController
import
com.biganto.visual.roompark.presentation.screen.deals.util.DealsListAdapter
import
com.biganto.visual.roompark.presentation.screen.estate.EstateScreenController
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
...
...
@@ -77,6 +78,25 @@ class DealsScreenController :
.
pushChangeHandler
(
FadeChangeHandler
())
.
popChangeHandler
(
FadeChangeHandler
())
)
},
(
dealsRecyclerView
.
adapter
as
DealsListAdapter
)
.
startFlat
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
Timber
.
d
(
"got estate clicked $it"
)
router
.
pushController
(
RouterTransaction
.
with
(
EstateScreenController
(
it
!!
))
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
},
(
dealsRecyclerView
.
adapter
as
DealsListAdapter
)
.
startTour
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
Timber
.
d
(
"got tour clicked $it"
)
showMessage
(
R
.
string
.
tour_not_allowed
)
}
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/util/Adapter.kt
View file @
e1987e37
...
...
@@ -7,7 +7,6 @@ import android.view.ViewGroup
import
android.widget.LinearLayout
import
android.widget.TextView
import
butterknife.BindView
import
butterknife.ButterKnife
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.DealPreviewModel
import
com.biganto.visual.roompark.domain.model.StatusModel
...
...
@@ -19,7 +18,10 @@ import com.biganto.visual.roompark.util.view_utils.image_view.RoundedImageView
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressAnimationState
import
com.biganto.visual.roompark.util.view_utils.status_progress_view.StatusProgressCeil
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.view.clicks
import
com.squareup.picasso.Picasso
import
io.reactivex.Observable
import
io.reactivex.subjects.PublishSubject
/**
* Created by Vladislav Bogdashkin on 16.10.2019.
...
...
@@ -28,6 +30,18 @@ import com.squareup.picasso.Picasso
class
DealsListAdapter
:
CommonRecyclerAdapter
<
DealViewHolder
,
DealPreviewModel
>()
{
override
val
vhKlazz
=
DealViewHolder
::
class
override
fun
getVhLayout
()
=
R
.
layout
.
deal_card_viewholder
private
val
onFlatClicked
=
PublishSubject
.
create
<
Int
>()
private
val
onTourClickced
=
PublishSubject
.
create
<
Int
>()
override
fun
onBindViewHolder
(
holder
:
DealViewHolder
,
position
:
Int
)
{
super
.
onBindViewHolder
(
holder
,
position
)
holder
.
onStartFlatObs
.
subscribe
(
onFlatClicked
)
holder
.
onStartTourObs
.
subscribe
(
onTourClickced
)
}
val
startFlat
get
()
=
onFlatClicked
val
startTour
get
()
=
onTourClickced
}
...
...
@@ -37,6 +51,7 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
@BindView
(
R
.
id
.
deal_card_header
)
lateinit
var
estateTitle
:
TextView
@BindView
(
R
.
id
.
common_info_block
)
lateinit
var
commonInfo
:
View
@BindView
(
R
.
id
.
start_tour_button
)
lateinit
var
startTour
:
View
@BindView
(
R
.
id
.
flat_card_card_view
)
lateinit
var
startFlat
:
View
@BindView
(
R
.
id
.
info_ceil_1
)
lateinit
var
info1
:
View
@BindView
(
R
.
id
.
info_ceil_2
)
lateinit
var
info2
:
View
...
...
@@ -53,17 +68,8 @@ class DealViewHolder(itemView: View) : CommonViewHolder<DealPreviewModel>(itemVi
@BindView
(
R
.
id
.
start_tour_image_view
)
lateinit
var
tourScreen
:
RoundedImageView
private
fun
typeName
(
type
:
String
)
=
when
(
type
){
"flat"
->
"КВАРТИРА"
"parking"
->
"МАШИНОМЕСТО"
"storage"
->
"КЛАДОВКА"
else
->
"ОБЪЕКТ"
}
init
{
ButterKnife
.
bind
(
this
,
itemView
)
}
val
onStartFlatObs
:
Observable
<
Int
?>
get
()
=
startFlat
.
clicks
().
map
{
bindedModel
.
estateId
}
val
onStartTourObs
:
Observable
<
Int
?>
get
()
=
startTour
.
clicks
().
map
{
bindedModel
.
tourId
}
override
fun
onViewBound
(
model
:
DealPreviewModel
)
{
estateTitle
.
text
=
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
e1987e37
...
...
@@ -173,6 +173,15 @@ class EstateScreenController :
@BindView
(
R
.
id
.
start_tour_card_divider
)
lateinit
var
startTourDivider
:
View
@BindView
(
R
.
id
.
sizes_divider
)
lateinit
var
sizesDivider
:
View
@BindView
(
R
.
id
.
electricity_divider
)
lateinit
var
electricityDivider
:
View
@BindView
(
R
.
id
.
walls_divider
)
lateinit
var
wallsDivider
:
View
@BindView
(
R
.
id
.
furniture_divider
)
lateinit
var
furnitureDivider
:
View
private
fun
setToolbar
(){
toolBar
.
setToolbar
(
null
,
StatusToolbarModel
())
...
...
@@ -310,36 +319,44 @@ class EstateScreenController :
}
private
fun
planTypeSelected
(
plan
:
PlanPresetModel
){
wallsContainer
.
visibility
=
View
.
GONE
sizesContainer
.
visibility
=
View
.
GONE
electricContainer
.
visibility
=
View
.
GONE
furnContainer
.
visibility
=
View
.
GONE
wallsContainer
.
setGone
(
true
)
sizesContainer
.
setGone
(
true
)
electricContainer
.
setGone
(
true
)
furnContainer
.
setGone
(
true
)
furnitureDivider
.
setGone
(
true
)
wallsDivider
.
setGone
(
true
)
sizesDivider
.
setGone
(
true
)
electricityDivider
.
setGone
(
true
)
plan
.
features
.
forEach
{
when
(
it
){
is
FeatureModel
.
Furniture
->
{
furnContainer
.
visibility
=
View
.
VISIBLE
furnContainer
.
setGone
(
false
)
furnTitle
.
text
=
it
.
featureTitle
furnSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
furnitureDivider
.
setGone
(
false
)
}
is
FeatureModel
.
Walls
->{
wallsContainer
.
visibility
=
View
.
VISIBLE
wallsContainer
.
setGone
(
false
)
wallsTitle
.
text
=
it
.
featureTitle
wallsSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
wallsDivider
.
setGone
(
false
)
}
is
FeatureModel
.
Sizes
->{
sizesContainer
.
visibility
=
View
.
VISIBLE
sizesContainer
.
setGone
(
false
)
sizesTitle
.
text
=
it
.
featureTitle
sizesSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
sizesDivider
.
setGone
(
false
)
}
is
FeatureModel
.
Electric
->{
electricContainer
.
visibility
=
View
.
VISIBLE
electricContainer
.
setGone
(
false
)
electricTitle
.
text
=
it
.
featureTitle
electricSwitcher
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
).
isChecked
=
it
.
switchedOn
electricityDivider
.
setGone
(
false
)
}
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenController.kt
View file @
e1987e37
...
...
@@ -13,6 +13,7 @@ import com.biganto.visual.roompark.presentation.screen.estate.EstateScreenContro
import
com.biganto.visual.roompark.presentation.screen.favorites.util.FavoritesListAdapter
import
com.biganto.visual.roompark.util.view_utils.grid.CeilsDecoration
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
io.reactivex.android.schedulers.AndroidSchedulers
import
timber.log.Timber
import
javax.inject.Inject
...
...
@@ -46,7 +47,10 @@ class FavoritesScreenController :
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
{
Timber
.
d
(
"got card clicked $it"
)
router
.
pushController
(
RouterTransaction
.
with
(
EstateScreenController
(
it
.
id
)))
router
.
pushController
(
RouterTransaction
.
with
(
EstateScreenController
(
it
.
id
))
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
}
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/util/Adapter.kt
View file @
e1987e37
...
...
@@ -79,15 +79,19 @@ abstract class CommonViewHolder<M:Any>(itemView: View): RecyclerView.ViewHolder(
fun
bindModel
(
model
:
M
){
ButterKnife
.
bind
(
this
,
itemView
)
bindModel
=
model
bind
ed
Model
=
model
onViewBound
(
model
)
}
fun
onClicked
():
Observable
<
M
>
=
itemView
.
clicks
().
map
{
bindModel
}
fun
onClicked
():
Observable
<
M
>
=
itemView
.
clicks
().
map
{
bind
ed
Model
}
pr
ivate
lateinit
var
bin
dModel
:
M
pr
otected
lateinit
var
binde
dModel
:
M
}
class
PushListAdapter
:
CommonRecyclerAdapter
<
PushViewHolder
,
PushSwitchModel
>()
{
override
val
vhKlazz
:
KClass
<
PushViewHolder
>
get
()
=
PushViewHolder
::
class
...
...
app/src/main/res/layout/deal_card_viewholder.xml
View file @
e1987e37
...
...
@@ -200,6 +200,7 @@
android:layout_marginEnd=
"16dp"
/>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/flat_card_card_view"
android:layout_width=
"match_parent"
android:layout_height=
"64dp"
android:layout_margin=
"16dp"
...
...
app/src/main/res/layout/deal_screen.xml
View file @
e1987e37
...
...
@@ -245,11 +245,12 @@
<LinearLayout
android:id=
"@+id/flat_card_card_view"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"24dp"
android:layout_marginEnd=
"16dp"
android:layout_marginStart=
"16dp"
android:layout_marginBottom=
"16dp"
android:background=
"@color/colorCommonBackground"
android:weightSum=
"3"
>
...
...
app/src/main/res/layout/flat_plan_type_selector_view.xml
View file @
e1987e37
...
...
@@ -63,7 +63,7 @@
<include
android:id=
"@+id/
include6
"
android:id=
"@+id/
sizes_divider
"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
...
...
@@ -84,7 +84,7 @@
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/
include6
"
>
app:layout_constraintTop_toBottomOf=
"@+id/
sizes_divider
"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/sizes_switch_header"
...
...
@@ -106,7 +106,7 @@
<include
android:id=
"@+id/
include7
"
android:id=
"@+id/
furniture_divider
"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
...
...
@@ -127,7 +127,7 @@
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/
include7
"
>
app:layout_constraintTop_toBottomOf=
"@+id/
furniture_divider
"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/furniture_switch_header"
...
...
@@ -149,7 +149,7 @@
<include
android:id=
"@+id/
include8
"
android:id=
"@+id/
electricity_divider
"
layout=
"@layout/horizontal_divider"
android:layout_width=
"match_parent"
android:layout_height=
"1dp"
...
...
@@ -170,7 +170,7 @@
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/
include8
"
>
app:layout_constraintTop_toBottomOf=
"@+id/
electricity_divider
"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/electricity_switch_header"
...
...
app/src/main/res/values/strings.xml
View file @
e1987e37
...
...
@@ -89,6 +89,7 @@
<string
name=
"estate_type_parking_short"
>
М\\М %s
</string>
<string
name=
"estate_type_store_short"
>
КЛ.%s
</string>
<string
name=
"estate_type_other_short"
>
ОБ.%s
</string>
<string
name=
"tour_not_allowed"
>
Запуск туров пока недоступен!
</string>
<!--endregion-->
</resources>
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