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
02226f64
Commit
02226f64
authored
Apr 20, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish fetching sizes plan types
parent
cc82fe5f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
38 deletions
+23
-38
PlanRepository.kt
...anto/visual/roompark/data/data_provider/PlanRepository.kt
+15
-11
planTypesUseCase.kt
...ganto/visual/roompark/domain/use_case/planTypesUseCase.kt
+5
-24
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+2
-2
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+1
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/PlanRepository.kt
View file @
02226f64
...
@@ -151,34 +151,38 @@ private fun BitSet.getOrNull(index:Int) =
...
@@ -151,34 +151,38 @@ private fun BitSet.getOrNull(index:Int) =
if
(
index
<
0
||
index
>=
this
.
size
())
null
if
(
index
<
0
||
index
>=
this
.
size
())
null
else
get
(
index
)
else
get
(
index
)
private
fun
Int
.
getBit
(
index
:
Int
):
Boolean
?
{
if
(
index
<
0
)
return
null
return
Integer
.
toBinaryString
(
shr
(
index
)).
last
()==
'1'
}
val
PlanPresetModel
.
featuresVariants
:
List
<
PlanFeaturesVariant
>
val
PlanPresetModel
.
featuresVariants
:
List
<
PlanFeaturesVariant
>
get
()
{
get
()
{
if
(
this
.
features
.
isNullOrEmpty
())
return
arrayListOf
()
if
(
this
.
features
.
isNullOrEmpty
())
return
arrayListOf
()
val
maxInd
=
this
.
features
.
size
val
maxInd
=
this
.
features
.
size
val
variants
=
BitSet
(
maxInd
).
apply
{
for
(
i
in
0
until
size
())
set
(
i
,
false
)
}
val
f
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Furniture
}
val
f
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Furniture
}
val
s
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Sizes
}
val
s
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Sizes
}
val
e
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Electric
}
val
e
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Electric
}
val
w
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Walls
}
val
w
=
features
.
indexOfFirst
{
it
is
FeatureModel
.
Walls
}
val
trueBit
=
BitSet
(
1
).
apply
{
set
(
0
,
true
)
}
var
firstRun
=
true
val
resList
=
mutableListOf
<
PlanFeaturesVariant
>()
val
resList
=
mutableListOf
<
PlanFeaturesVariant
>()
var
increment
=
0
var
allTrue
:
Boolean
do
{
do
{
if
(
firstRun
)
firstRun
=
false
else
variants
.
and
(
trueBit
)
val
v
=
PlanFeaturesVariant
(
val
v
=
PlanFeaturesVariant
(
estateId
,
planId
,
estateId
,
planId
,
furniture
=
variants
.
getOrNull
(
f
),
furniture
=
increment
.
getBit
(
f
),
sizes
=
variants
.
getOrNull
(
s
),
sizes
=
increment
.
getBit
(
s
),
electric
=
variants
.
getOrNull
(
e
),
electric
=
increment
.
getBit
(
e
),
walls
=
variants
.
getOrNull
(
w
)
walls
=
increment
.
getBit
(
w
)
)
)
allTrue
=
v
.
furniture
?:
true
&&
v
.
electric
?:
true
&&
v
.
sizes
?:
true
&&
v
.
walls
?:
true
resList
.
add
(
v
)
resList
.
add
(
v
)
}
while
(
variants
.
cardinality
()
!=
variants
.
size
())
increment
++
}
while
(!
allTrue
)
return
resList
return
resList
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/planTypesUseCase.kt
View file @
02226f64
...
@@ -4,9 +4,6 @@ import com.biganto.visual.roompark.data.data_provider.featuresVariants
...
@@ -4,9 +4,6 @@ import com.biganto.visual.roompark.data.data_provider.featuresVariants
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.FlatPlanContract
import
com.biganto.visual.roompark.domain.contract.FlatPlanContract
import
io.reactivex.BackpressureStrategy
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -28,26 +25,10 @@ class PlanTypesUseCase @Inject constructor(
...
@@ -28,26 +25,10 @@ class PlanTypesUseCase @Inject constructor(
list
list
}
}
.
flatMapIterable
{
it
}
.
flatMapIterable
{
it
}
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
.
flatMap
{
.
parallel
(
4
)
planContract
.
getPlanTypes
(
it
.
id
)
.
runOn
(
Schedulers
.
io
())
.
map
{
plantypes
->
plantypes
.
flatMap
{
plan
->
plan
.
featuresVariants
}}
.
flatMap
{
planContract
.
getPlanTypes
(
it
.
id
)
.
map
{
plantypes
->
plantypes
.
flatMap
{
plan
->
plan
.
featuresVariants
}
}
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
}
}
.
sequential
()
.
map
{
list
->
list
.
sumBy
{
if
(
planContract
.
getPlanFile
(
it
).
exists
())
0
else
1
}}
.
toList
()
.
scan
{
t1
:
Int
,
t2
:
Int
->
t1
+
t2
}
.
toObservable
()
.
map
{
it
.
flatten
()
}
.
doOnNext
{
Timber
.
d
(
" plaanzz: $it"
)
}
.
map
{
list
->
list
.
sumBy
{
if
(
planContract
.
getPlanFile
(
it
).
exists
())
0
else
1
}
}
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
02226f64
...
@@ -136,11 +136,11 @@ class SettingsScreenController :
...
@@ -136,11 +136,11 @@ class SettingsScreenController :
toursDownloaderTitle
.
text
=
toursDownloaderTitle
.
text
=
resources
resources
?.
getString
(
R
.
string
.
download_all_tours_settings_with_size
,
""
)
?.
getString
(
R
.
string
.
download_all_tours_settings_with_size
,
"
-
"
)
flatDownloaderTitle
.
text
=
flatDownloaderTitle
.
text
=
resources
resources
?.
getString
(
R
.
string
.
download_all_plan_types_settings_with_sizes
,
""
)
?.
getString
(
R
.
string
.
download_all_plan_types_settings_with_sizes
,
"
-
"
)
setToolbar
()
setToolbar
()
bindRecycler
()
bindRecycler
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
02226f64
...
@@ -42,7 +42,7 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -42,7 +42,7 @@ class SettingsScreenPresenter @Inject constructor(
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
val
fetchPlansSize
=
interactor
.
fetchPlanTypesSizes
()
val
fetchPlansSize
=
interactor
.
fetchPlanTypesSizes
()
.
map
{
it
*
1024L
}
.
map
{
it
*
1024L
*
1024L
}
.
map
{
SettingsScreenViewState
.
OnPlanTypesPrefetch
(
it
)
}
.
map
{
SettingsScreenViewState
.
OnPlanTypesPrefetch
(
it
)
}
val
onDownloadTours
=
intent
(
SettingsScreen
::
downloadAllTours
)
val
onDownloadTours
=
intent
(
SettingsScreen
::
downloadAllTours
)
...
...
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