Search in sources :

Example 1 with PicturePrimarySecondaryTextHolder

use of com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder 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 PicturePrimarySecondaryTextHolder

use of com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder in project Klyph by jonathangerbaud.

the class BirthdayAdapter 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());
    String birthday = friend.getBirthday();
    Date birthdayDate = null;
    String format = "MM/dd/y";
    try {
        birthdayDate = new SimpleDateFormat(format).parse(friend.getBirthday_date());
    } catch (ParseException e) {
    //e.printStackTrace();
    }
    if (birthdayDate != null) {
        Calendar dobDate = Calendar.getInstance();
        dobDate.setTime(birthdayDate);
        int year = dobDate.get(Calendar.YEAR);
        int month = dobDate.get(Calendar.MONTH);
        int day = dobDate.get(Calendar.DAY_OF_MONTH);
        Calendar today = Calendar.getInstance();
        today.set(Calendar.DAY_OF_MONTH, day);
        today.set(Calendar.MONTH, month);
        int curYear = today.get(Calendar.YEAR);
        int curMonth = today.get(Calendar.MONTH);
        int curDay = today.get(Calendar.DAY_OF_MONTH);
        int age = curYear - year;
        if (curMonth < month || (month == curMonth && curDay < day)) {
            age--;
        }
        birthday += " - " + getContext(holder.getPrimaryText()).getString(R.string.birthday_age, age);
    }
    holder.getSecondaryText().setText(birthday);
    loadImage(holder.getPicture(), friend.getPic(), AttrUtil.getResourceId(getContext(holder.getPrimaryText()), R.attr.squarePlaceHolderIcon), data);
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Calendar(java.util.Calendar) ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Example 3 with PicturePrimarySecondaryTextHolder

use of com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder in project Klyph by jonathangerbaud.

the class BirthdayAdapter method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView userPicture = (ImageView) view.findViewById(R.id.picture);
    TextView userName = (TextView) view.findViewById(R.id.primary_text);
    TextView userBirthday = (TextView) view.findViewById(R.id.secondary_text);
    setHolder(view, new PicturePrimarySecondaryTextHolder(userPicture, userName, userBirthday));
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Example 4 with PicturePrimarySecondaryTextHolder

use of com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder in project Klyph by jonathangerbaud.

the class GroupAdapter2 method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView friendPicture = (ImageView) view.findViewById(R.id.picture);
    TextView name = (TextView) view.findViewById(R.id.primary_text);
    TextView description = (TextView) view.findViewById(R.id.secondary_text);
    setHolder(view, new PicturePrimarySecondaryTextHolder(friendPicture, name, description));
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Example 5 with PicturePrimarySecondaryTextHolder

use of com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder in project Klyph by jonathangerbaud.

the class MemberAdapter method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView friendPicture = (ImageView) view.findViewById(R.id.picture);
    TextView name = (TextView) view.findViewById(R.id.primary_text);
    TextView description = (TextView) view.findViewById(R.id.secondary_text);
    setHolder(view, new PicturePrimarySecondaryTextHolder(friendPicture, name, description));
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) PicturePrimarySecondaryTextHolder(com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)

Aggregations

PicturePrimarySecondaryTextHolder (com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)14 ImageView (android.widget.ImageView)7 TextView (android.widget.TextView)7 Friend (com.abewy.android.apps.klyph.core.fql.Friend)2 ProfileImageView (com.abewy.android.apps.klyph.widget.ProfileImageView)2 View (android.view.View)1 RelativeLayout (android.widget.RelativeLayout)1 FriendRequest (com.abewy.android.apps.klyph.core.fql.FriendRequest)1 Group (com.abewy.android.apps.klyph.core.fql.Group)1 Notification (com.abewy.android.apps.klyph.core.fql.Notification)1 Page (com.abewy.android.apps.klyph.core.fql.Page)1 Education (com.abewy.android.apps.klyph.core.fql.User.Education)1 Relative (com.abewy.android.apps.klyph.core.fql.User.Relative)1 Work (com.abewy.android.apps.klyph.core.fql.User.Work)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1