Search in sources :

Example 1 with Work

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

the class FriendDeserializer method deserializeObject.

@Override
public GraphObject deserializeObject(JSONObject data) {
    Friend friend = new Friend();
    deserializePrimitives(friend, data);
    friend.setEducation(new EducationDeserializer().deserializeArray(getJsonArray(data, "education"), Education.class));
    friend.setWork(new WorkDeserializer().deserializeArray(getJsonArray(data, "work"), Work.class));
    return friend;
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Education(com.abewy.android.apps.klyph.core.fql.User.Education) WorkDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.UserDeserializer.WorkDeserializer) EducationDeserializer(com.abewy.android.apps.klyph.core.fql.serializer.UserDeserializer.EducationDeserializer) Work(com.abewy.android.apps.klyph.core.fql.User.Work)

Example 2 with Work

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

the class UserDeserializer method deserializeObject.

@Override
public GraphObject deserializeObject(JSONObject data) {
    User user = new User();
    deserializePrimitives(user, data);
    user.setEducation(new EducationDeserializer().deserializeArray(getJsonArray(data, "education"), Education.class));
    user.setWork(new WorkDeserializer().deserializeArray(getJsonArray(data, "work"), Work.class));
    user.setPic_cover((Cover) new CoverDeserializer().deserializeObject(getJsonObject(data, "pic_cover")));
    user.setCurrent_address((Location) new LocationDeserializer().deserializeObject(getJsonObject(data, "current_address")));
    user.setCurrent_location((Location) new LocationDeserializer().deserializeObject(getJsonObject(data, "current_location")));
    user.setHometown_location((Location) new LocationDeserializer().deserializeObject(getJsonObject(data, "hometown_location")));
    user.setFamily(new RelativeDeserializer().deserializeArray(getJsonArray(data, "family"), Relative.class));
    return user;
}
Also used : Relative(com.abewy.android.apps.klyph.core.fql.User.Relative) User(com.abewy.android.apps.klyph.core.fql.User) Education(com.abewy.android.apps.klyph.core.fql.User.Education) Work(com.abewy.android.apps.klyph.core.fql.User.Work)

Example 3 with Work

use of com.abewy.android.apps.klyph.core.fql.User.Work 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 4 with Work

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

the class WorkAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    WorkEducationHolder holder = (WorkEducationHolder) view.getTag();
    // holder.getEmployerPicture().setImageDrawable(null);
    Work item = (Work) data;
    holder.getEmployer().setText(item.getEmployer().getName());
    if (item.getPosition().getName() != null && item.getPosition().getName().length() > 0) {
        holder.getJob().setText(item.getPosition().getName());
        holder.getJob().setVisibility(View.VISIBLE);
    } else {
        holder.getJob().setVisibility(View.GONE);
    }
    if (item.getLocation().getName() != null && item.getLocation().getName().length() > 0 && item.getStart_date() != null && item.getStart_date().length() > 0) {
        int dateRes = R.string.work_date;
        if (item.getEnd_date().length() == 0)
            dateRes = R.string.work_date_until_today;
        String date = String.format(getContext(view).getResources().getString(dateRes), item.getStart_date(), item.getEnd_date());
        holder.getPlaceDate().setText(item.getLocation().getName() + " - " + date);
        holder.getPlaceDate().setVisibility(View.VISIBLE);
    } else {
        holder.getPlaceDate().setVisibility(View.GONE);
    }
    String url = FacebookUtil.getImageURLForId(item.getEmployer().getId());
    loadImage(holder.getEmployerPicture(), url, data);
    holder.getShadow().setVisibility(item.getShadow() == true ? View.VISIBLE : View.GONE);
}
Also used : Work(com.abewy.android.apps.klyph.core.fql.User.Work) WorkEducationHolder(com.abewy.android.apps.klyph.adapter.holder.WorkEducationHolder)

Example 5 with Work

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

the class MemberAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    super.mergeViewWithData(view, data);
    PicturePrimarySecondaryTextHolder holder = (PicturePrimarySecondaryTextHolder) getHolder(view);
    // holder.getPicture().setImageDrawable(null);
    Friend friend = (Friend) data;
    holder.getPrimaryText().setText(friend.getName());
    if (friend.getWork().size() > 0) {
        Work work = friend.getWork().get(0);
        StringBuilder str = new StringBuilder(work.getEmployer().getName());
        if (work.getPosition().getName().length() > 0)
            str.append(", ").append(work.getPosition().getName());
        holder.getSecondaryText().setText(str);
        holder.getSecondaryText().setVisibility(View.VISIBLE);
    } else if (friend.getEducation().size() > 0) {
        Education education = friend.getEducation().get(0);
        StringBuilder str = new StringBuilder(education.getSchool().getName());
        if (education.getYear().getName().length() > 0)
            str.append(", ").append(education.getYear().getName());
        if (education.getConcentration().getName().length() > 0)
            str.append(", ").append(education.getConcentration().getName());
        holder.getSecondaryText().setText(str);
        holder.getSecondaryText().setVisibility(View.VISIBLE);
    } else {
        holder.getSecondaryText().setVisibility(View.GONE);
    }
    // FacebookUtil.getProfilePictureURLForId(friend.getUid());
    String url = friend.getPic();
    loadImage(holder.getPicture(), url, AttrUtil.getResourceId(getContext(view), R.attr.squarePlaceHolderIcon), data);
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Education(com.abewy.android.apps.klyph.core.fql.User.Education) Work(com.abewy.android.apps.klyph.core.fql.User.Work) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Aggregations

Work (com.abewy.android.apps.klyph.core.fql.User.Work)5 Education (com.abewy.android.apps.klyph.core.fql.User.Education)4 Friend (com.abewy.android.apps.klyph.core.fql.Friend)2 User (com.abewy.android.apps.klyph.core.fql.User)2 Relative (com.abewy.android.apps.klyph.core.fql.User.Relative)2 PicturePrimarySecondaryTextHolder (com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)1 WorkEducationHolder (com.abewy.android.apps.klyph.adapter.holder.WorkEducationHolder)1 EducationDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.UserDeserializer.EducationDeserializer)1 WorkDeserializer (com.abewy.android.apps.klyph.core.fql.serializer.UserDeserializer.WorkDeserializer)1 Title (com.abewy.klyph.items.Title)1 TitleTextItem (com.abewy.klyph.items.TitleTextItem)1 HashMap (java.util.HashMap)1