use of app.insti.fragment.PlacementBlogFragment in project IITB-App by wncc.
the class NotificationsAdapter method onClick.
@Override
public void onClick(Notification notification, FragmentActivity fragmentActivity) {
/* Mark notification read */
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
String sessId = Utils.getSessionIDHeader();
retrofitInterface.markNotificationRead(sessId, notification.getNotificationId().toString()).enqueue(new EmptyCallback<Void>());
ShortcutBadger.applyCount(fragmentActivity.getApplicationContext(), NotificationId.decrementAndGetCurrentCount());
/* Close the bottom sheet */
notificationsFragment.dismiss();
Gson gson = Utils.gson;
/* Open event */
if (notification.isEvent()) {
Event event = gson.fromJson(gson.toJson(notification.getNotificationActor()), Event.class);
Utils.openEventFragment(event, fragmentActivity);
} else if (notification.isNews()) {
NewsFragment newsFragment = new NewsFragment();
NewsArticle newsArticle = gson.fromJson(gson.toJson(notification.getNotificationActor()), NewsArticle.class);
newsFragment.withId(newsArticle.getId());
Utils.updateFragment(newsFragment, fragmentActivity);
} else if (notification.isBlogPost()) {
PlacementBlogPost post = gson.fromJson(gson.toJson(notification.getNotificationActor()), PlacementBlogPost.class);
Fragment fragment;
if (post.getLink().contains("training")) {
fragment = (new TrainingBlogFragment()).withId(post.getId());
} else {
fragment = (new PlacementBlogFragment()).withId(post.getId());
}
Utils.updateFragment(fragment, fragmentActivity);
}
}
use of app.insti.fragment.PlacementBlogFragment in project IITB-App by wncc.
the class MainActivity method openPlacementBlog.
private void openPlacementBlog(String id) {
if (session.isLoggedIn()) {
PlacementBlogFragment placementBlogFragment = new PlacementBlogFragment();
if (id != null)
placementBlogFragment.withId(id);
updateFragment(placementBlogFragment);
} else {
Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show();
}
}
Aggregations