Search in sources :

Example 1 with Relative

use of com.abewy.android.apps.klyph.core.fql.User.Relative in project Klyph by jonathangerbaud.

the class RelativeAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    super.mergeViewWithData(view, data);
    PicturePrimarySecondaryTextHolder holder = (PicturePrimarySecondaryTextHolder) getHolder(view);
    //holder.getPicture().setImageDrawable(null);
    Relative user = (Relative) data;
    holder.getPrimaryText().setText(user.getName());
    holder.getSecondaryText().setText(user.getRelationship());
    String url = FacebookUtil.getImageURLForId(user.getUid(), FacebookUtil.NORMAL);
    loadImage(holder.getPicture(), url, AttrUtil.getResourceId(getContext(view), R.attr.squarePlaceHolderIcon), data);
    holder.getShadow().setVisibility(user.getShadow() == true ? View.VISIBLE : View.GONE);
}
Also used : Relative(com.abewy.android.apps.klyph.core.fql.User.Relative) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Example 2 with Relative

use of com.abewy.android.apps.klyph.core.fql.User.Relative in project Klyph by jonathangerbaud.

the class UserAbout method populate.

@Override
protected void populate(List<GraphObject> data) {
    if (data.size() > 0) {
        User user = (User) data.get(0);
        data.remove(0);
        if (user.getAbout_me() != null && user.getAbout_me().length() > 0) {
            TitleTextItem item = new TitleTextItem();
            item.setTitle(getResources().getString(R.string.user_about));
            item.setText(user.getAbout_me());
            item.setShadow(true);
            data.add(item);
        }
        HashMap<String, String> basicInfo = new HashMap<String, String>();
        basicInfo.put(getResources().getString(R.string.user_birthday), user.getBirthday());
        basicInfo.put(getResources().getString(R.string.user_sex), user.getSex());
        basicInfo.put(getResources().getString(R.string.user_meeting_sex), user.getMeeting_sex());
        basicInfo.put(getResources().getString(R.string.user_relationship_status), user.getRelationship_status());
        basicInfo.put(getResources().getString(R.string.user_religion), user.getReligion());
        basicInfo.put(getResources().getString(R.string.user_political), user.getPolitical());
        addItemsForMap(getResources().getString(R.string.general_infos), basicInfo, data);
        HashMap<String, String> coords = new HashMap<String, String>();
        // coords.put(getResources().getString(R.string.user_phones), user.get);
        coords.put(getResources().getString(R.string.user_address), user.getCurrent_location().getName());
        coords.put(getResources().getString(R.string.user_email), user.getEmail());
        // coords.put(getResources().getString(R.string.user_networks),
        // user.getNetwork());
        coords.put(getResources().getString(R.string.user_website), user.getWebsite());
        addItemsForMap(getResources().getString(R.string.coordinates), coords, data);
        HashMap<String, String> others = new HashMap<String, String>();
        others.put(getResources().getString(R.string.user_activities), user.getActivities());
        others.put(getResources().getString(R.string.user_books), user.getBooks());
        // others.put(getResources().getString(R.string.user_inspirational_people),
        // user.getInpirational_people());
        others.put(getResources().getString(R.string.user_interests), user.getInterests());
        others.put(getResources().getString(R.string.user_movies), user.getMovies());
        others.put(getResources().getString(R.string.user_music), user.getMusic());
        // others.put(getResources().getString(R.string.user_sports),
        // user.getSports());
        others.put(getResources().getString(R.string.user_tv), user.getTv());
        others.put(getResources().getString(R.string.user_quotes), user.getQuotes());
        addItemsForMap(getResources().getString(R.string.others), others, data);
        if (user.getFamily().size() > 0) {
            Title title = new Title();
            title.setName(getResources().getString(R.string.family));
            data.add(title);
            for (Relative relative : user.getFamily()) {
                data.add(relative);
            }
            Relative last = (Relative) data.get(data.size() - 1);
            last.setShadow(true);
        }
        if (user.getWork().size() > 0) {
            Title title = new Title();
            title.setName(getResources().getString(R.string.work));
            data.add(title);
            for (Work work : user.getWork()) {
                data.add(work);
            }
            Work last = (Work) data.get(data.size() - 1);
            last.setShadow(true);
        }
        if (user.getEducation().size() > 0) {
            Title title = new Title();
            title.setName(getResources().getString(R.string.education));
            data.add(title);
            for (Education education : user.getEducation()) {
                data.add(education);
            }
        }
    }
    super.populate(data);
    setNoMoreData(true);
}
Also used : TitleTextItem(com.abewy.klyph.items.TitleTextItem) Relative(com.abewy.android.apps.klyph.core.fql.User.Relative) User(com.abewy.android.apps.klyph.core.fql.User) HashMap(java.util.HashMap) Education(com.abewy.android.apps.klyph.core.fql.User.Education) Work(com.abewy.android.apps.klyph.core.fql.User.Work) Title(com.abewy.klyph.items.Title)

Example 3 with Relative

use of com.abewy.android.apps.klyph.core.fql.User.Relative 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)

Aggregations

Relative (com.abewy.android.apps.klyph.core.fql.User.Relative)3 User (com.abewy.android.apps.klyph.core.fql.User)2 Intent (android.content.Intent)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 FriendRequest (com.abewy.android.apps.klyph.core.fql.FriendRequest)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 Education (com.abewy.android.apps.klyph.core.fql.User.Education)1 Work (com.abewy.android.apps.klyph.core.fql.User.Work)1 Title (com.abewy.klyph.items.Title)1 TitleTextItem (com.abewy.klyph.items.TitleTextItem)1 HashMap (java.util.HashMap)1