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
a0a4dcac
Commit
a0a4dcac
authored
Sep 30, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor MainActivity to use EmptyCallback
parent
bd840c83
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
13 deletions
+3
-13
app/src/main/java/app/insti/activity/MainActivity.java
app/src/main/java/app/insti/activity/MainActivity.java
+3
-13
No files found.
app/src/main/java/app/insti/activity/MainActivity.java
View file @
a0a4dcac
...
...
@@ -171,7 +171,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private
void
fetchNotifications
()
{
RetrofitInterface
retrofitInterface
=
getRetrofitInterface
();
retrofitInterface
.
getNotifications
(
getSessionIDHeader
()).
enqueue
(
new
Callback
<
List
<
Notification
>>()
{
retrofitInterface
.
getNotifications
(
getSessionIDHeader
()).
enqueue
(
new
Empty
Callback
<
List
<
Notification
>>()
{
@Override
public
void
onResponse
(
Call
<
List
<
Notification
>>
call
,
Response
<
List
<
Notification
>>
response
)
{
if
(
response
.
isSuccessful
())
{
...
...
@@ -183,10 +183,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
}
@Override
public
void
onFailure
(
Call
<
List
<
Notification
>>
call
,
Throwable
t
)
{
}
});
}
...
...
@@ -347,7 +343,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
/** Open the event fragment from the provided id */
private
void
openEventFragment
(
String
id
)
{
RetrofitInterface
retrofitInterface
=
getRetrofitInterface
();
retrofitInterface
.
getEvent
(
getSessionIDHeader
(),
id
).
enqueue
(
new
Callback
<
Event
>()
{
retrofitInterface
.
getEvent
(
getSessionIDHeader
(),
id
).
enqueue
(
new
Empty
Callback
<
Event
>()
{
@Override
public
void
onResponse
(
Call
<
Event
>
call
,
Response
<
Event
>
response
)
{
EventFragment
eventFragment
=
new
EventFragment
();
...
...
@@ -356,9 +352,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
eventFragment
.
setArguments
(
bundle
);
updateFragment
(
eventFragment
);
}
@Override
public
void
onFailure
(
Call
<
Event
>
call
,
Throwable
t
)
{}
});
}
...
...
@@ -408,7 +401,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
final
String
fcmId
=
instanceIdResult
.
getToken
();
RetrofitInterface
retrofitInterface
=
getRetrofitInterface
();
retrofitInterface
.
patchUserMe
(
getSessionIDHeader
(),
new
UserFCMPatchRequest
(
fcmId
,
getCurrentVersion
())).
enqueue
(
new
Callback
<
User
>()
{
retrofitInterface
.
patchUserMe
(
getSessionIDHeader
(),
new
UserFCMPatchRequest
(
fcmId
,
getCurrentVersion
())).
enqueue
(
new
Empty
Callback
<
User
>()
{
@Override
public
void
onResponse
(
Call
<
User
>
call
,
Response
<
User
>
response
)
{
if
(
response
.
isSuccessful
())
{
...
...
@@ -420,9 +413,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Toast
.
makeText
(
MainActivity
.
this
,
"Your session has expired!"
,
Toast
.
LENGTH_LONG
).
show
();
}
}
@Override
public
void
onFailure
(
Call
<
User
>
call
,
Throwable
t
)
{}
});
}
});
...
...
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