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
30f30333
Commit
30f30333
authored
Jul 11, 2018
by
Varun Patil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Open fragments on clicking notifications (news & P)
parent
d4ea85cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
9 deletions
+26
-9
app/src/main/java/app/insti/fragment/NotificationsFragment.java
...c/main/java/app/insti/fragment/NotificationsFragment.java
+26
-9
No files found.
app/src/main/java/app/insti/fragment/NotificationsFragment.java
View file @
30f30333
...
@@ -24,6 +24,7 @@ import app.insti.adapter.NotificationsAdapter;
...
@@ -24,6 +24,7 @@ import app.insti.adapter.NotificationsAdapter;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.RetrofitInterface
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.api.ServiceGenerator
;
import
app.insti.data.Notification
;
import
app.insti.data.Notification
;
import
app.insti.data.PlacementBlogPost
;
import
retrofit2.Call
;
import
retrofit2.Call
;
import
retrofit2.Callback
;
import
retrofit2.Callback
;
import
retrofit2.Response
;
import
retrofit2.Response
;
...
@@ -87,27 +88,43 @@ public class NotificationsFragment extends BaseFragment {
...
@@ -87,27 +88,43 @@ public class NotificationsFragment extends BaseFragment {
/* Mark notification read */
/* Mark notification read */
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
String
sessId
=
((
MainActivity
)
getActivity
()).
getSessionIDHeader
();
String
sessId
=
((
MainActivity
)
getActivity
()).
getSessionIDHeader
();
retrofitInterface
.
markNotificationRead
(
sessId
,
notification
.
getNotificationId
()).
enqueue
(
new
Callback
<
Void
>()
{
/*
retrofitInterface.markNotificationRead(sessId, notification.getNotificationId()).enqueue(new Callback<Void>() {
@Override
@Override
public void onResponse(Call<Void> call, Response<Void> response) { }
public void onResponse(Call<Void> call, Response<Void> response) { }
@Override
@Override
public void onFailure(Call<Void> call, Throwable t) { }
public void onFailure(Call<Void> call, Throwable t) { }
});
});*/
FragmentManager
manager
=
getActivity
().
getSupportFragmentManager
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
String
tag
=
""
;
Bundle
bundle
=
getArguments
();
if
(
bundle
==
null
)
{
bundle
=
new
Bundle
();
}
bundle
.
putString
(
Constants
.
SESSION_ID
,
((
MainActivity
)
getActivity
()).
getSessionIDHeader
());
/* Open event */
/* Open event */
if
(
notification
.
getNotificationActorType
().
contains
(
"event"
))
{
if
(
notification
.
getNotificationActorType
().
contains
(
"event"
))
{
String
eventJson
=
new
Gson
().
toJson
(
notification
.
getNotificationActor
());
String
eventJson
=
new
Gson
().
toJson
(
notification
.
getNotificationActor
());
Bundle
bundle
=
getArguments
();
if
(
bundle
==
null
)
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
EVENT_JSON
,
eventJson
);
bundle
.
putString
(
Constants
.
EVENT_JSON
,
eventJson
);
EventFragment
eventFragment
=
new
EventFragment
();
EventFragment
eventFragment
=
new
EventFragment
();
eventFragment
.
setArguments
(
bundle
);
eventFragment
.
setArguments
(
bundle
);
FragmentManager
manager
=
getActivity
().
getSupportFragmentManager
();
tag
=
eventFragment
.
getTag
();
FragmentTransaction
transaction
=
manager
.
beginTransaction
();
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
eventFragment
,
tag
);
transaction
.
setCustomAnimations
(
R
.
anim
.
slide_in_left
,
R
.
anim
.
slide_out_left
,
R
.
anim
.
slide_in_right
,
R
.
anim
.
slide_out_right
);
}
else
if
(
notification
.
getNotificationActorType
().
contains
(
"newsentry"
))
{
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
eventFragment
,
eventFragment
.
getTag
());
NewsFragment
newsFragment
=
new
NewsFragment
();
transaction
.
addToBackStack
(
eventFragment
.
getTag
()).
commit
();
tag
=
newsFragment
.
getTag
();
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
newsFragment
,
tag
);
newsFragment
.
setArguments
(
bundle
);
}
else
if
(
notification
.
getNotificationActorType
().
contains
(
"blogentry"
))
{
PlacementBlogFragment
placementBlogFragment
=
new
PlacementBlogFragment
();
placementBlogFragment
.
setArguments
(
bundle
);
tag
=
placementBlogFragment
.
getTag
();
transaction
.
replace
(
R
.
id
.
framelayout_for_fragment
,
placementBlogFragment
,
tag
);
}
}
transaction
.
setCustomAnimations
(
R
.
anim
.
slide_in_left
,
R
.
anim
.
slide_out_left
,
R
.
anim
.
slide_in_right
,
R
.
anim
.
slide_out_right
);
transaction
.
addToBackStack
(
tag
).
commit
();
}
}
});
});
notificationsRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
notifications_recycler_view
);
notificationsRecyclerView
=
(
RecyclerView
)
getActivity
().
findViewById
(
R
.
id
.
notifications_recycler_view
);
...
...
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