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
48c17059
Commit
48c17059
authored
Jan 16, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix childs naming
parent
b6bf36b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
FilesRepository.kt
...nto/visual/roompark/data/data_provider/FilesRepository.kt
+9
-2
FileModule.kt
...iganto/visual/roompark/data/repository/file/FileModule.kt
+15
-4
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FilesRepository.kt
View file @
48c17059
package
com.biganto.visual.roompark.data.data_provider
import
android.app.Application
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.file.FileModule
import
com.biganto.visual.roompark.domain.contract.FilesContract
import
javax.inject.Inject
import
kotlin.reflect.full.primaryConstructor
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
...
...
@@ -14,10 +16,15 @@ import javax.inject.Inject
class
FilesContractModule
@Inject
constructor
(
private
val
files
:
FileModule
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
private
val
db
:
IDb
,
private
val
context
:
Application
):
FilesContract
{
inline
fun
<
reified
T
:
FileModule
.
FileDirectory
>
getDirectory
():
T
?
=
T
::
class
.
primaryConstructor
?.
call
()
fun
getPlansSize
()
=
getDirectorySize
<>()
}
app/src/main/java/com/biganto/visual/roompark/data/repository/file/FileModule.kt
View file @
48c17059
...
...
@@ -73,9 +73,13 @@ class FileModule @Inject constructor(val context: Application) {
fun
assetsDirectory
(
context
:
Context
):
String
=
context
.
filesDir
.
absolutePath
}
sealed
class
FileDirectory
(
val
dir
:
String
)
{
class
PlanTypeDir
:
FileDirectory
{
constructor
(
dir
:
String
=
"/estates"
,
childName
:
String
?
=
null
)
:
super
(
dir
.
plus
(
"/$childName"
))
constructor
(
dir
:
String
=
"/estates"
,
childName
:
String
?
=
null
)
:
super
(
dir
.
plus
(
childName
.
slashed
()))
constructor
(
catalog
:
String
=
"/estates"
,
estateId
:
Int
...
...
@@ -93,8 +97,15 @@ class FileModule @Inject constructor(val context: Application) {
.
plus
(
".html"
))
}
class
ToursDir
(
dir
:
String
=
"/tours"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
"/childName"
))
class
FeedsDir
(
dir
:
String
=
"/feeds"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
"/childName"
))
class
Albums
(
dir
:
String
=
"/photos"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
"/childName"
))
class
ToursDir
(
dir
:
String
=
"/tours"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
childName
.
slashed
()))
class
FeedsDir
(
dir
:
String
=
"/feeds"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
childName
.
slashed
()))
class
Albums
(
dir
:
String
=
"/photos"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
childName
.
slashed
()))
}
}
private
fun
String
?.
slashed
():
String
{
return
this
?.
padStart
(
this
.
length
+
1
,
'/'
)
?:
""
}
\ 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