Search in sources :

Example 6 with FriendRequest

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;
}
Also used : PageActivity(com.abewy.android.apps.klyph.app.PageActivity) Group(com.abewy.android.apps.klyph.core.fql.Group) Relative(com.abewy.android.apps.klyph.core.fql.User.Relative) User(com.abewy.android.apps.klyph.core.fql.User) Intent(android.content.Intent) Page(com.abewy.android.apps.klyph.core.fql.Page) FriendRequest(com.abewy.android.apps.klyph.core.fql.FriendRequest) UserActivity(com.abewy.android.apps.klyph.app.UserActivity) EventActivity(com.abewy.android.apps.klyph.app.EventActivity) GroupActivity(com.abewy.android.apps.klyph.app.GroupActivity) Friend(com.abewy.android.apps.klyph.core.fql.Friend) Event(com.abewy.android.apps.klyph.core.fql.Event) Stream(com.abewy.android.apps.klyph.core.fql.Stream) Tag(com.abewy.android.apps.klyph.core.fql.Tag)

Example 7 with FriendRequest

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));
    }
}
Also used : Intent(android.content.Intent) FriendRequest(com.abewy.android.apps.klyph.core.fql.FriendRequest) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) Notification(com.abewy.android.apps.klyph.core.fql.Notification) KlyphNotification(com.abewy.android.apps.klyph.KlyphNotification)

Aggregations

FriendRequest (com.abewy.android.apps.klyph.core.fql.FriendRequest)7 KlyphNotification (com.abewy.android.apps.klyph.KlyphNotification)3 Notification (com.abewy.android.apps.klyph.core.fql.Notification)3 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)3 Intent (android.content.Intent)2 ArrayList (java.util.ArrayList)2 IntentFilter (android.content.IntentFilter)1 PicturePrimarySecondaryTextHolder (com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)1 EventActivity (com.abewy.android.apps.klyph.app.EventActivity)1 GroupActivity (com.abewy.android.apps.klyph.app.GroupActivity)1 PageActivity (com.abewy.android.apps.klyph.app.PageActivity)1 UserActivity (com.abewy.android.apps.klyph.app.UserActivity)1 Event (com.abewy.android.apps.klyph.core.fql.Event)1 Friend (com.abewy.android.apps.klyph.core.fql.Friend)1 Group (com.abewy.android.apps.klyph.core.fql.Group)1 Page (com.abewy.android.apps.klyph.core.fql.Page)1 Stream (com.abewy.android.apps.klyph.core.fql.Stream)1 Tag (com.abewy.android.apps.klyph.core.fql.Tag)1 User (com.abewy.android.apps.klyph.core.fql.User)1 Relative (com.abewy.android.apps.klyph.core.fql.User.Relative)1