Search in sources :

Example 1 with UserActivity

use of com.abewy.android.apps.klyph.app.UserActivity in project Klyph by jonathangerbaud.

the class TextViewUtil method onTagClick.

/**
	 * Handle a tag click generated by one of the method of this class.
	 * Opens the activity/dialog assotiated with the type of tag :
	 * <ul>
	 * <li>User : UserActivity</li>
	 * <li>Page : PageActivity</li>
	 * <li>Event : EventActivity</li>
	 * <li>Album : AlbumActivity</li>
	 * <li>Several tags : UserListDialog</li>
	 */
public static void onTagClick(Context context, List<Tag> tags) {
    if (tags.size() == 1) {
        Tag tag = tags.get(0);
        String type = tag.getType();
        Intent intent = null;
        if (type.equals(GraphType.FQL_USER.name()) || type.equals("user")) {
            intent = new Intent(context, UserActivity.class);
            intent.putExtra(KlyphBundleExtras.USER_ID, tag.getId());
            intent.putExtra(KlyphBundleExtras.USER_NAME, tag.getName());
        } else if (type.equals(GraphType.FQL_PAGE.name()) || type.equals("page")) {
            intent = new Intent(context, PageActivity.class);
            intent.putExtra(KlyphBundleExtras.PAGE_ID, tag.getId());
            intent.putExtra(KlyphBundleExtras.PAGE_NAME, tag.getName());
        } else if (type.equals(GraphType.FQL_EVENT.name()) || type.equals("event")) {
            intent = new Intent(context, EventActivity.class);
            intent.putExtra(KlyphBundleExtras.EVENT_ID, tag.getId());
            intent.putExtra(KlyphBundleExtras.EVENT_NAME, tag.getName());
        } else if (type.equals(GraphType.FQL_ALBUM.name())) {
            intent = new Intent(context, AlbumActivity.class);
            intent.putExtra(KlyphBundleExtras.ALBUM_ID, tag.getId());
            intent.putExtra(KlyphBundleExtras.ALBUM_NAME, tag.getName());
        }
        if (intent != null) {
            context.startActivity(intent);
        } else {
            Log.e("TextViewUtil", "Click on an unlisted type : " + type);
        }
    } else {
        UserListDialog uld = new UserListDialog(false);
        uld.loadList(tags);
        uld.show(((FragmentActivity) context).getFragmentManager(), "userlist");
    }
}
Also used : UserListDialog(com.abewy.android.apps.klyph.fragment.UserListDialog) Intent(android.content.Intent) Tag(com.abewy.android.apps.klyph.core.fql.Tag) UserActivity(com.abewy.android.apps.klyph.app.UserActivity) EventActivity(com.abewy.android.apps.klyph.app.EventActivity)

Aggregations

Intent (android.content.Intent)1 EventActivity (com.abewy.android.apps.klyph.app.EventActivity)1 UserActivity (com.abewy.android.apps.klyph.app.UserActivity)1 Tag (com.abewy.android.apps.klyph.core.fql.Tag)1 UserListDialog (com.abewy.android.apps.klyph.fragment.UserListDialog)1