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
b24e9054
Commit
b24e9054
authored
Jan 13, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix qunatity formatted string res
parent
8b13b35c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
18 deletions
+76
-18
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+34
-0
ScreenPresenter.kt
...al/roompark/presentation/screen/estate/ScreenPresenter.kt
+31
-14
ScreenViewState.kt
...al/roompark/presentation/screen/estate/ScreenViewState.kt
+2
-0
simple_text_tabs.xml
app/src/main/res/layout/simple_text_tabs.xml
+2
-2
strings.xml
app/src/main/res/values/strings.xml
+7
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
b24e9054
...
...
@@ -22,6 +22,7 @@ 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
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxbinding3.widget.checkedChanges
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
...
...
@@ -43,6 +44,25 @@ class EstateScreenController :
,
EstateScreenPresenter
>
,
EstateScreen
{
override
fun
showCommonInfo
():
Observable
<
Int
>
=
commonInfoTab
.
clicks
()
.
doOnNext
{
commonInfoTab
.
background
=
resources
?.
getDrawable
(
R
.
drawable
.
bottom_line_text_view
)
explicationTab
.
background
=
null
}
.
map
{
1
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
showExplication
():
Observable
<
Int
>
=
explicationTab
.
clicks
()
.
doOnNext
{
explicationTab
.
background
=
resources
?.
getDrawable
(
R
.
drawable
.
bottom_line_text_view
)
commonInfoTab
.
background
=
null
}
.
map
{
planTypesTabLayout
.
selectedTabPosition
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
private
fun
ViewGroup
.
switchMatch
()
=
this
.
findViewById
<
SwitchMaterial
>(
R
.
id
.
switch1
)
.
checkedChanges
()
...
...
@@ -122,6 +142,13 @@ class EstateScreenController :
lateinit
var
wallsSwitcher
:
ViewGroup
@BindView
(
R
.
id
.
common_info_tab
)
lateinit
var
commonInfoTab
:
MaterialTextView
@BindView
(
R
.
id
.
explication_tab
)
lateinit
var
explicationTab
:
MaterialTextView
private
fun
setToolbar
(){
toolBar
.
showAll
()
toolBar
.
appBar
.
setExpanded
(
false
,
false
)
...
...
@@ -157,6 +184,7 @@ class EstateScreenController :
is
EstateScreenViewState
.
LoadPlan
->
render
(
viewState
)
is
EstateScreenViewState
.
PlanTypeSelected
->
render
(
viewState
)
is
EstateScreenViewState
.
SomeError
->
render
(
viewState
)
is
EstateScreenViewState
.
ShowEstateInfo
->
render
(
viewState
)
}
}
...
...
@@ -173,6 +201,12 @@ class EstateScreenController :
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
ShowEstateInfo
)
{
(
flatInfoRecyclerView
.
adapter
as
FlatInfoAdapter
).
setItems
(
viewState
.
info
)
}
private
fun
render
(
viewState
:
EstateScreenViewState
.
LoadPlanTypes
)
{
planTypesTabLayout
.
removeAllTabs
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenPresenter.kt
View file @
b24e9054
package
com.biganto.visual.roompark.presentation.screen.estate
import
android.app.Activity
import
android.content.Context
import
androidx.annotation.StringRes
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.EstateInteractor
import
com.biganto.visual.roompark.domain.model.CommonInfoModel
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.domain.model.FeatureModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.util.extensions.toRubly
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
...
...
@@ -99,11 +96,15 @@ class EstateScreenPresenter @Inject constructor(
val
showInfo
=
intent
(
EstateScreen
::
showCommonInfo
)
.
doOnNext
{
showType
=
InfoShowType
.
COMMON_INFO
}
.
map
{
pair
->
val
plan
=
planList
?.
first
{
it
.
planId
==
pair
.
first
}
plan
?.
switchFeature
<
FeatureModel
.
Electric
>(
pair
.
second
)
plan
}.
flatMap
(
::
getPlan
)
.
map
{
estate
?.
commonInfo
}
.
map
(
::
mapCommonInfo
)
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
val
showExplication
=
intent
(
EstateScreen
::
showExplication
)
.
doOnNext
{
showType
=
InfoShowType
.
EXPLICATIONS
}
.
map
{
planList
?.
get
(
it
)
?.
explication
}
.
map
(
::
mapCommonInfo
)
.
map
{
EstateScreenViewState
.
ShowEstateInfo
(
showType
,
it
)
}
val
state
=
restoreStateObservable
.
mergeWith
(
prefetchCards
)
...
...
@@ -113,6 +114,8 @@ class EstateScreenPresenter @Inject constructor(
.
mergeWith
(
switchFurn
)
.
mergeWith
(
switchSizes
)
.
mergeWith
(
switchWalls
)
.
mergeWith
(
showInfo
)
.
mergeWith
(
showExplication
)
.
doOnError
{
Timber
.
e
(
it
)
}
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
@@ -123,10 +126,17 @@ class EstateScreenPresenter @Inject constructor(
private
fun
langString
(
@StringRes
id
:
Int
)
=
context
.
resources
.
getString
(
id
)
private
fun
langString
(
@StringRes
id
:
Int
,
vararg
args
:
Any
)
=
context
.
resources
.
getString
(
id
,
args
)
context
.
resources
.
getString
(
id
,*
args
)
private
fun
mapCommonInfo
(
list
:
List
<
ExplicationModel
>):
ArrayList
<
DisplayInfoModel
>
=
ArrayList
(
List
(
list
.
size
){
Timber
.
d
(
"area value: ${list[it].area}"
);
DisplayInfoModel
(
list
[
it
].
title
,
langString
(
R
.
string
.
area_value
,
list
[
it
].
area
))
}
)
private
fun
mapCommonInfo
(
info
:
CommonInfoModel
)
{
private
fun
mapCommonInfo
(
info
:
CommonInfoModel
)
:
ArrayList
<
DisplayInfoModel
>
{
val
r
=
arrayListOf
<
DisplayInfoModel
>()
info
.
building
.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
building
),
"$it"
))
...
...
@@ -151,12 +161,19 @@ class EstateScreenPresenter @Inject constructor(
}
info
.
windows_face
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
window_face
),
it
))}
info
.
direction
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
direction
),
it
))}
info
.
price_meter
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
price_meter
),
it
.
toRubly
()))}
info
.
price
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
price
),
it
.
toRubly
()))}
info
.
discount
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
max_discount
)
,
langString
(
R
.
string
.
discount_value
,
it
)))}
info
.
discount_amount
?.
let
{
r
.
add
(
DisplayInfoModel
(
langString
(
R
.
string
.
discounted_price
)
,
it
.
toRubly
()))}
return
r
}
}
private
enum
class
InfoShowType
{
enum
class
InfoShowType
{
COMMON_INFO
,
EXPLICATIONS
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenViewState.kt
View file @
b24e9054
...
...
@@ -3,6 +3,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.PlanPresetModel
import
com.biganto.visual.roompark.presentation.screen.estate.util.DisplayInfoModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
/**
...
...
@@ -17,4 +18,5 @@ sealed class EstateScreenViewState : BigantoBaseViewState() {
class
PlanTypeSelected
(
val
item
:
PlanPresetModel
)
:
EstateScreenViewState
()
class
LoadPlan
(
val
planBody
:
String
)
:
EstateScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
EstateScreenViewState
()
class
ShowEstateInfo
(
val
showType
:
InfoShowType
,
val
info
:
List
<
DisplayInfoModel
>)
:
EstateScreenViewState
()
}
\ No newline at end of file
app/src/main/res/layout/simple_text_tabs.xml
View file @
b24e9054
...
...
@@ -6,7 +6,7 @@
android:weightSum=
"2"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
tab_variant_1
"
android:id=
"@+id/
common_info_tab
"
style=
"@style/Default_TextView.Accent_Text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -23,7 +23,7 @@
android:text=
"/"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/
tab_variant_2
"
android:id=
"@+id/
explication_tab
"
style=
"@style/Default_TextView.Accent_Text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/values/strings.xml
View file @
b24e9054
...
...
@@ -55,15 +55,20 @@
<string
name=
"section_begin"
>
Секция
</string>
<string
name=
"floor"
>
Этаж
</string>
<string
name=
"area"
>
Общая площадь
</string>
<string
name=
"area_value"
>
%.1f м\u00B2
</string>
<string
name=
"area_value"
>
%
,
.1f м\u00B2
</string>
<string
name=
"area_living"
>
Жилая площадь
</string>
<string
name=
"rooms"
>
Кол-во комнат
</string>
<string
name=
"flat_kind"
>
Тип квартиры
</string>
<string
name=
"flat_decoration"
>
Наличие отделки
</string>
<string
name=
"ceiling"
>
Высота потолков
</string>
<string
name=
"meters_value"
>
%.1f м
</string>
<string
name=
"meters_value"
>
%
,
.1f м
</string>
<string
name=
"window_face"
>
Вид из окон
</string>
<string
name=
"direction"
>
Сторона света
</string>
<string
name=
"price_meter"
>
Цена за м\u00B2
</string>
<string
name=
"price"
>
Стоимость
</string>
<string
name=
"max_discount"
>
Максимальная скидка с учетом всех акций
</string>
<string
name=
"discount_value"
>
%,.1f \%
</string>
<string
name=
"discounted_price"
>
Стоимость со скидкой
</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