use of com.abewy.android.apps.klyph.core.fql.FriendRequest in project Klyph by jonathangerbaud.
the class Klyph method getIntentForGraphObject.
public static Intent getIntentForGraphObject(Context context, GraphObject object) {
Intent intent = null;
if (object instanceof User) {
User user = (User) object;
if (user.getUid().length() == 0) {
return null;
}
intent = new Intent();
intent.setClass(context, UserActivity.class);
intent.putExtra(KlyphBundleExtras.USER_ID, user.getUid());
intent.putExtra(KlyphBundleExtras.USER_NAME, user.getName());
} else if (object instanceof Friend) {
Friend friend = (Friend) object;
if (friend.getUid().length() == 0) {
return null;
}
intent = new Intent();
intent.setClass(context, UserActivity.class);
intent.putExtra(KlyphBundleExtras.USER_ID, friend.getUid());
intent.putExtra(KlyphBundleExtras.USER_NAME, friend.getName());
} else if (object instanceof Page) {
Page page = (Page) object;
intent = new Intent();
intent.setClass(context, PageActivity.class);
intent.putExtra(KlyphBundleExtras.PAGE_ID, page.getPage_id());
intent.putExtra(KlyphBundleExtras.PAGE_NAME, page.getName());
} else if (object instanceof Event) {
Event event = (Event) object;
intent = new Intent();
intent.setClass(context, EventActivity.class);
intent.putExtra(KlyphBundleExtras.EVENT_ID, event.getEid());
intent.putExtra(KlyphBundleExtras.EVENT_NAME, event.getName());
} else if (object instanceof Stream) {
Stream stream = (Stream) object;
intent = new Intent();
intent.setClass(context, StreamActivity.class);
//intent.putExtra(KlyphBundleExtras.STREAM_ID, stream.getPost_id());
intent.putExtra(KlyphBundleExtras.STREAM_PARCELABLE, stream);
// intent.putExtra(CkoobafeBundleExtras.EVENT_NAME,
// event.getName());
} else if (object instanceof Group) {
Group group = (Group) object;
intent = new Intent();
intent.setClass(context, GroupActivity.class);
intent.putExtra(KlyphBundleExtras.GROUP_ID, group.getGid());
intent.putExtra(KlyphBundleExtras.GROUP_NAME, group.getName());
} else if (object instanceof Tag) {
Tag tag = (Tag) object;
if (tag.getType().equals("user") || tag.getType().equals(GraphType.FQL_USER.toString())) {
intent = new Intent();
intent.setClass(context, UserActivity.class);
intent.putExtra(KlyphBundleExtras.USER_ID, tag.getId());
intent.putExtra(KlyphBundleExtras.USER_NAME, tag.getName());
} else if (tag.getType().equals("page") || tag.getType().equals(GraphType.FQL_PAGE.toString())) {
intent = new Intent();
intent.setClass(context, PageActivity.class);
intent.putExtra(KlyphBundleExtras.PAGE_ID, tag.getId());
intent.putExtra(KlyphBundleExtras.PAGE_NAME, tag.getName());
}
} else if (object instanceof Relative) {
Relative user = (Relative) object;
if (user.getUid().length() == 0) {
return null;
}
intent = new Intent();
intent.setClass(context, UserActivity.class);
intent.putExtra(KlyphBundleExtras.USER_ID, user.getUid());
intent.putExtra(KlyphBundleExtras.USER_NAME, user.getName());
} else if (object instanceof FriendRequest) {
FriendRequest fr = (FriendRequest) object;
if (fr.getUid_from().length() == 0) {
return null;
}
intent = new Intent();
intent.setClass(context, UserActivity.class);
intent.putExtra(KlyphBundleExtras.USER_ID, fr.getUid_from());
intent.putExtra(KlyphBundleExtras.USER_NAME, fr.getUid_from_name());
}
return intent;
}
use of com.abewy.android.apps.klyph.core.fql.FriendRequest in project Klyph by jonathangerbaud.
the class Notifications method onListItemClick.
@Override
public void onListItemClick(ListView gridView, View view, int position, long id) {
GraphObject graphObject = getAdapter().getItem(position);
if (graphObject instanceof Notification) {
Notification notification = (Notification) graphObject;
if (notification.getIs_unread() == true) {
setNotificationRead(notification);
((NotificationsListener) getActivity()).onNewNotifications();
}
Intent intent = KlyphNotification.getIntentForNotification(getActivity(), notification);
if (intent != null) {
startActivity(intent);
}
} else if (graphObject instanceof FriendRequest) {
/*
* new AsyncRequest(Query.POST_READ_NOTIFICATION, ((FriendRequest) graphObject).getUid_from(), "", new AsyncRequest.Callback() {
*
* @Override
* public void onComplete(Response response)
* {
* Log.d("NotificationsNotifications", "result " + response.getError());
* }
* }).execute();
*/
startActivity(Klyph.getIntentForGraphObject(getActivity(), graphObject));
}
}
Aggregations