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
690c8b44
Commit
690c8b44
authored
Oct 31, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some models
need to serialize as JSON string for support types
parent
bff19611
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
449 additions
and
18 deletions
+449
-18
response.kt
...ual/roompark/data/repository/api/retrofit/raw/response.kt
+18
-18
SupportTypes.kt
...isual/roompark/data/repository/db/requrey/SupportTypes.kt
+56
-0
Article.kt
...sual/roompark/data/repository/db/requrey/model/Article.kt
+30
-0
Feed.kt
.../visual/roompark/data/repository/db/requrey/model/Feed.kt
+20
-0
ImageAlbum.kt
...l/roompark/data/repository/db/requrey/model/ImageAlbum.kt
+23
-0
Settings.kt
...ual/roompark/data/repository/db/requrey/model/Settings.kt
+24
-0
Subscription.kt
...roompark/data/repository/db/requrey/model/Subscription.kt
+21
-0
User.kt
.../visual/roompark/data/repository/db/requrey/model/User.kt
+24
-0
IntListConverter.java
...rk/data/repository/db/requrey/utils/IntListConverter.java
+62
-0
IsoDateConverter.java
...rk/data/repository/db/requrey/utils/IsoDateConverter.java
+54
-0
StringListConverter.java
...data/repository/db/requrey/utils/StringListConverter.java
+62
-0
TitledPhotoConverter.java
...ata/repository/db/requrey/utils/TitledPhotoConverter.java
+55
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/raw/response.kt
View file @
690c8b44
...
...
@@ -80,33 +80,33 @@ data class FeedRaw(
)
data class
ArticlesListPaginationRaw
(
val
page
:
Int
,
val
pagesize
:
Int
,
val
total
:
Int
,
val
pages
:
Int
,
val
items
:
List
<
NewsArticleRaw
>
val
page
:
Int
,
val
pagesize
:
Int
,
val
total
:
Int
,
val
pages
:
Int
,
val
items
:
List
<
NewsArticleRaw
>
)
data class
NewsArticleRaw
(
val
id
:
Int
,
val
published
:
Date
,
val
title
:
String
,
val
announce
:
String
,
val
preview
:
String
?
val
id
:
Int
,
val
published
:
Date
,
val
title
:
String
,
val
announce
:
String
,
val
preview
:
String
?
)
data class
ArticleRaw
(
val
id
:
Int
,
val
published
:
Date
,
val
title
:
String
,
val
body
:
String
,
val
feed_alias
:
String
,
val
photo
:
List
<
NewsPhotoRaw
>?
val
id
:
Int
,
val
published
:
Date
,
val
title
:
String
,
val
body
:
String
,
val
feed_alias
:
String
,
val
photo
:
List
<
NewsPhotoRaw
>?
)
data class
NewsPhotoRaw
(
val
title
:
String
,
val
url
:
String
val
title
:
String
,
val
url
:
String
)
data class
ImageAlbumRaw
(
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/SupportTypes.kt
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey
import
android.os.Parcel
import
android.os.Parcelable
/**
* Created by Vladislav Bogdashkin on 15.06.2018.
*/
...
...
@@ -23,3 +26,56 @@ class RevisionString(private val value:String, private val revision:String?){
*/
fun
revisionUri
()=
"$value${revision.orEmpty()}"
}
class
TitledPhoto
(
val
title
:
String
,
val
url
:
String
){
companion
object
{
private
const
val
delimiter
=
'ø'
}
constructor
(
str
:
String
)
:
this
(
title
=
str
.
substringBefore
(
delimiter
),
url
=
str
.
substringAfter
(
delimiter
)
)
}
//@Serializable
data class
ResolutionRaw
(
val
res_name
:
String
,
val
url
:
String
,
val
width
:
Int
,
val
height
:
Int
)
:
Parcelable
{
constructor
(
parcel
:
Parcel
)
:
this
(
parcel
.
readString
(),
parcel
.
readString
(),
parcel
.
readInt
(),
parcel
.
readInt
()
)
{
}
override
fun
writeToParcel
(
parcel
:
Parcel
,
flags
:
Int
)
{
parcel
.
writeString
(
res_name
)
parcel
.
writeString
(
url
)
parcel
.
writeInt
(
width
)
parcel
.
writeInt
(
height
)
}
override
fun
describeContents
():
Int
{
return
0
}
companion
object
CREATOR
:
Parcelable
.
Creator
<
ResolutionRaw
>
{
override
fun
createFromParcel
(
parcel
:
Parcel
):
ResolutionRaw
{
return
ResolutionRaw
(
parcel
)
}
override
fun
newArray
(
size
:
Int
):
Array
<
ResolutionRaw
?
>
{
return
arrayOfNulls
(
size
)
}
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Article.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
com.biganto.visual.roompark.data.repository.db.requrey.TitledPhoto
import
com.biganto.visual.roompark.data.repository.db.requrey.utils.TitledPhotoConverter
import
io.requery.*
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
interface
Article
:
Persistable
{
@get
:
Key
val
id
:
Int
val
published
:
Date
val
title
:
String
@get
:
Nullable
val
announce
:
String
?
@get
:
Nullable
val
preview
:
String
?
@get
:
Nullable
val
body
:
String
?
@get
:
ForeignKey
(
references
=
Feed
::
class
,
referencedColumn
=
"alias"
)
@get
:
ManyToOne
val
feed_alias
:
Feed
@get
:
Convert
(
TitledPhotoConverter
::
class
)
val
photo
:
List
<
TitledPhoto
>?
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Feed.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.Entity
import
io.requery.Key
import
io.requery.Persistable
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
interface
Feed
:
Persistable
{
@get
:
Key
val
id
:
Int
val
title
:
String
@get
:
Key
val
alias
:
String
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/ImageAlbum.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.Entity
import
io.requery.ForeignKey
import
io.requery.Key
import
io.requery.Persistable
import
java.util.*
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
interface
ImageAlbum
:
Persistable
{
@get
:
Key
val
id
:
Int
val
title
:
String
val
sort
:
Int
val
date
:
Date
@get
:
ForeignKey
(
references
=
ImageAlbum
::
class
,
referencedColumn
=
"id"
)
val
parent_id
:
Int
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Settings.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.Entity
import
io.requery.Generated
import
io.requery.Key
import
io.requery.Persistable
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
interface
Settings
:
Persistable
{
@get
:
Key
@get
:
Generated
val
id
:
Int
val
deviceToken
:
String
val
feedsSubscription
:
Boolean
val
authToken
:
String
val
targetResolution
:
Int
//??/?////????/? ???WERR EW WF W
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Subscription.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.*
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
interface
Subscription
:
Persistable
{
@get
:
Key
@get
:
Generated
val
id
:
Int
@get
:
ManyToOne
val
user
:
User
val
deviceToken
:
String
val
topic
:
String
val
number
:
String
val
state
:
Boolean
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/User.kt
0 → 100644
View file @
690c8b44
package
com.biganto.visual.roompark.data.repository.db.requrey.model
import
io.requery.Entity
import
io.requery.Key
import
io.requery.Persistable
import
io.requery.Table
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
@Entity
@Table
(
name
=
"UserContainer"
)
interface
User
:
Persistable
{
@get
:
Key
val
uuid
:
Int
val
name
:
String
val
email
:
String
val
authToken
:
String
val
targetResolution
:
Int
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/utils/IntListConverter.java
0 → 100644
View file @
690c8b44
package
com
.
biganto
.
visual
.
roompark
.
data
.
repository
.
db
.
requrey
.
utils
;
import
java.util.ArrayList
;
import
io.requery.Converter
;
/**
* Created by Vladislav Bogdashkin on 04.07.2018.
*/
public
class
IntListConverter
implements
Converter
<
ArrayList
<
Integer
>,
String
>
{
private
final
String
stringDelimiter
=
","
;
@SuppressWarnings
(
"unchecked"
)
@Override
public
Class
<
ArrayList
<
Integer
>>
getMappedType
()
{
return
(
Class
)
ArrayList
.
class
;
}
@Override
public
Class
<
String
>
getPersistedType
()
{
return
String
.
class
;
}
@Override
public
Integer
getPersistedSize
()
{
return
null
;
}
@Override
public
String
convertToPersisted
(
ArrayList
<
Integer
>
value
)
{
if
(
value
==
null
)
{
return
""
;
}
StringBuilder
sb
=
new
StringBuilder
();
int
index
=
0
;
for
(
Integer
str:
value
)
{
if
(
index
>
0
)
{
sb
.
append
(
stringDelimiter
);
}
sb
.
append
(
str
);
index
++;
}
return
sb
.
toString
();
}
@Override
public
ArrayList
<
Integer
>
convertToMapped
(
Class
<?
extends
ArrayList
<
Integer
>>
type
,
String
value
)
{
ArrayList
<
Integer
>
list
=
new
ArrayList
<>();
if
(!
value
.
isEmpty
())
for
(
String
_val
:
value
.
split
(
stringDelimiter
))
{
list
.
add
(
Integer
.
parseInt
(
_val
));
}
return
list
;
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/utils/IsoDateConverter.java
0 → 100644
View file @
690c8b44
package
com
.
biganto
.
visual
.
roompark
.
data
.
repository
.
db
.
requrey
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
import
io.requery.Converter
;
import
timber.log.Timber
;
/**
* Created by Vladislav Bogdashkin on 04.07.2018.
*/
public
class
IsoDateConverter
implements
Converter
<
Date
,
String
>
{
private
SimpleDateFormat
apiFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS+hh:mm"
,
Locale
.
ROOT
);
//SimpleDateFormat dbFormat =new SimpleDateFormat("YYYYMMDDThhmmss", Locale.ROOT);
@SuppressWarnings
(
"unchecked"
)
@Override
public
Class
<
Date
>
getMappedType
()
{
return
Date
.
class
;
}
@Override
public
Class
<
String
>
getPersistedType
()
{
return
String
.
class
;
}
@Override
public
Integer
getPersistedSize
()
{
return
null
;
}
@Override
public
String
convertToPersisted
(
Date
value
)
{
return
value
==
null
?
null
:
apiFormat
.
format
(
value
);
}
@Override
public
Date
convertToMapped
(
Class
<?
extends
Date
>
type
,
String
value
)
{
try
{
return
value
==
null
?
null
:
apiFormat
.
parse
(
value
);
}
catch
(
Exception
e
){
Timber
.
e
(
"Wrong stored data format! {%s}"
,
value
);
return
new
Date
();
}
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/utils/StringListConverter.java
0 → 100644
View file @
690c8b44
package
com
.
biganto
.
visual
.
roompark
.
data
.
repository
.
db
.
requrey
.
utils
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
io.requery.Converter
;
/**
* Created by Vladislav Bogdashkin on 04.07.2018.
*/
public
class
StringListConverter
implements
Converter
<
ArrayList
<
String
>,
String
>
{
private
static
final
String
stringDelimiter
=
"¹/|¹"
;
@SuppressWarnings
(
"unchecked"
)
@Override
public
Class
<
ArrayList
<
String
>>
getMappedType
()
{
return
(
Class
)
ArrayList
.
class
;
}
@Override
public
Class
<
String
>
getPersistedType
()
{
return
String
.
class
;
}
@Override
public
Integer
getPersistedSize
()
{
return
null
;
}
@Override
public
String
convertToPersisted
(
ArrayList
<
String
>
value
)
{
if
(
value
==
null
)
{
return
""
;
}
StringBuilder
sb
=
new
StringBuilder
();
int
index
=
0
;
for
(
String
str:
value
)
{
if
(
index
>
0
)
{
sb
.
append
(
stringDelimiter
);
}
sb
.
append
(
str
);
index
++;
}
return
sb
.
toString
();
}
@Override
public
ArrayList
<
String
>
convertToMapped
(
Class
<?
extends
ArrayList
<
String
>>
type
,
String
value
)
{
ArrayList
<
String
>
list
=
new
ArrayList
<>();
if
(
value
!=
null
)
{
list
.
addAll
(
Arrays
.
asList
(
value
.
split
(
stringDelimiter
)));
}
return
list
;
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/utils/TitledPhotoConverter.java
0 → 100644
View file @
690c8b44
package
com
.
biganto
.
visual
.
roompark
.
data
.
repository
.
db
.
requrey
.
utils
;
import
com.biganto.visual.roompark.data.repository.db.requrey.TitledPhoto
;
import
java.text.SimpleDateFormat
;
import
java.util.Locale
;
import
io.requery.Converter
;
import
timber.log.Timber
;
/**
* Created by Vladislav Bogdashkin on 04.07.2018.
*/
public
class
TitledPhotoConverter
implements
Converter
<
TitledPhoto
,
String
>
{
private
SimpleDateFormat
apiFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS+hh:mm"
,
Locale
.
ROOT
);
//SimpleDateFormat dbFormat =new SimpleDateFormat("YYYYMMDDThhmmss", Locale.ROOT);
@SuppressWarnings
(
"unchecked"
)
@Override
public
Class
<
TitledPhoto
>
getMappedType
()
{
return
TitledPhoto
.
class
;
}
@Override
public
Class
<
String
>
getPersistedType
()
{
return
String
.
class
;
}
@Override
public
Integer
getPersistedSize
()
{
return
null
;
}
@Override
public
String
convertToPersisted
(
TitledPhoto
value
)
{
return
value
==
null
?
null
:
apiFormat
.
format
(
value
);
}
@Override
public
TitledPhoto
convertToMapped
(
Class
<?
extends
TitledPhoto
>
type
,
String
value
)
{
try
{
return
value
==
null
?
null
:
new
TitledPhoto
(
value
);
}
catch
(
Exception
e
){
Timber
.
e
(
"Wrong stored data format! {%s}"
,
value
);
return
new
TitledPhoto
(
""
,
""
);
}
}
}
\ 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