Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
bea5243f
Commit
bea5243f
authored
Jun 11, 2018
by
Sajal Narang
Committed by
GitHub
Jun 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #111 from yashkhem1/master
Updated TypeConverters
parents
66f25a39
f8ba871f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
...ain/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
+29
-0
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
+2
-2
No files found.
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/Converters.java
View file @
bea5243f
...
...
@@ -103,4 +103,33 @@ public class Converters {
String
json
=
gson
.
toJson
(
timestamp
);
return
json
;
}
@TypeConverter
public
static
Body
bodyfromString
(
String
value
){
Type
listType
=
new
TypeToken
<
Body
>(){
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
}
@TypeConverter
public
static
String
stringfromBody
(
Body
body
){
Gson
gson
=
new
Gson
();
String
json
=
gson
.
toJson
(
body
);
return
json
;
}
@TypeConverter
public
static
List
<
String
>
stringsfromString
(
String
value
){
Type
listType
=
new
TypeToken
<
List
<
String
>>(){
}.
getType
();
return
new
Gson
().
fromJson
(
value
,
listType
);
}
@TypeConverter
public
static
String
stringfromStrings
(
List
<
String
>
list
)
{
Gson
gson
=
new
Gson
();
String
json
=
gson
.
toJson
(
list
);
return
json
;
}
}
\ No newline at end of file
app/src/main/java/in/ac/iitb/gymkhana/iitbapp/data/User.java
View file @
bea5243f
...
...
@@ -55,7 +55,7 @@ public class User {
@SerializedName
(
"ldap_id"
)
String
userLDAPId
;
public
User
(
String
userID
,
String
userName
,
String
userProfilePictureUrl
,
List
<
Event
>
userInterestedEvents
,
List
<
Event
>
userGoingEvents
,
String
userEmail
,
String
userRollNumber
,
String
userContactNumber
,
String
userAbout
,
List
<
Body
>
userFollowedBodies
,
List
<
String
>
userFollowedBodiesID
,
String
userWebsiteURL
,
String
userLDAPI
D
)
{
public
User
(
String
userID
,
String
userName
,
String
userProfilePictureUrl
,
List
<
Event
>
userInterestedEvents
,
List
<
Event
>
userGoingEvents
,
String
userEmail
,
String
userRollNumber
,
String
userContactNumber
,
String
userAbout
,
List
<
Body
>
userFollowedBodies
,
List
<
String
>
userFollowedBodiesID
,
String
userWebsiteURL
,
String
userLDAPI
d
)
{
this
.
userID
=
userID
;
this
.
userName
=
userName
;
this
.
userProfilePictureUrl
=
userProfilePictureUrl
;
...
...
@@ -68,7 +68,7 @@ public class User {
this
.
userFollowedBodies
=
userFollowedBodies
;
this
.
userFollowedBodiesID
=
userFollowedBodiesID
;
this
.
userWebsiteURL
=
userWebsiteURL
;
this
.
userLDAPId
=
userLDAPI
D
;
this
.
userLDAPId
=
userLDAPI
d
;
}
public
static
User
fromString
(
String
json
)
{
...
...
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