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
4a6a88b7
Commit
4a6a88b7
authored
Jan 10, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plan file name spec
parent
4955bcd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
9 deletions
+23
-9
FileModule.kt
...iganto/visual/roompark/data/repository/file/FileModule.kt
+23
-9
No files found.
app/src/main/java/com/biganto/visual/roompark/data/repository/file/FileModule.kt
View file @
4a6a88b7
...
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.data.repository.file
import
android.app.Application
import
android.content.Context
import
android.os.Environment
import
com.biganto.visual.roompark.util.extensions.asInt
import
com.google.gson.JsonElement
import
dagger.Module
import
timber.log.Timber
...
...
@@ -66,18 +67,31 @@ class FileModule @Inject constructor(val context: Application) {
}
companion
object
{
fun
getDirectory
(
context
:
Context
?,
dirType
:
FileDirectory
):
File
=
File
(
context
?.
filesDir
?.
absolutePath
?.
plus
(
dirType
.
dir
)
?:
throw
IllegalArgumentException
(
"Context cannot be null!"
)
)
fun
assetsDirectory
(
context
:
Context
?):
String
=
context
?.
filesDir
?.
absolutePath
?:
throw
IllegalArgumentException
(
"Context cannot be null!"
)
fun
getDirectory
(
context
:
Context
,
dirType
:
FileDirectory
):
File
=
File
(
context
.
filesDir
.
absolutePath
.
plus
(
dirType
.
dir
))
fun
assetsDirectory
(
context
:
Context
):
String
=
context
.
filesDir
.
absolutePath
}
sealed
class
FileDirectory
(
val
dir
:
String
)
{
class
PlanTypeDir
(
dir
:
String
=
"/estates"
,
childName
:
String
?
=
null
)
:
FileDirectory
(
dir
.
plus
(
"/$childName"
))
class
PlanTypeDir
:
FileDirectory
{
constructor
(
dir
:
String
=
"/estates"
,
childName
:
String
?
=
null
)
:
super
(
dir
.
plus
(
"/$childName"
))
constructor
(
catalog
:
String
=
"/estates"
,
estateId
:
Int
,
planId
:
Int
,
furniture
:
Boolean
?
=
null
,
sizes
:
Boolean
?
=
null
,
walls
:
Boolean
?
=
null
,
electric
:
Boolean
?
=
null
)
:
super
(
catalog
.
plus
(
"/plan"
).
plus
(
"/$estateId"
).
plus
(
"/$planId"
)
.
plus
(
"plan_${planId}_${furniture?:"
f
$
{
furniture
.
asInt
}
"}"
+
"_${sizes?:"
f
$
{
sizes
.
asInt
}
"}"
+
"_${walls?:"
f
$
{
walls
.
asInt
}
"}"
+
"_${electric?:"
f
$
{
electric
.
asInt
}
"}"
)
.
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"
))
...
...
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