Search in sources :

Example 1 with ElementTimelineHolder

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

the class GroupTimelineAdapter method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView elementCoverImage = (ImageView) view.findViewById(R.id.element_cover_image);
    ImageView elementProfileImage = (ImageView) view.findViewById(R.id.element_profile_image);
    TextView elementDetail1 = (TextView) view.findViewById(R.id.element_detail_1);
    TextView elementDetail2 = (TextView) view.findViewById(R.id.element_detail_2);
    TextView elementDetail3 = (TextView) view.findViewById(R.id.element_detail_3);
    TextView elementDetail4 = (TextView) view.findViewById(R.id.element_detail_4);
    TextView likes = (TextView) view.findViewById(R.id.likes);
    TextView talkAbout = (TextView) view.findViewById(R.id.talk_about);
    view.setTag(new ElementTimelineHolder(elementCoverImage, elementProfileImage, elementDetail1, elementDetail2, elementDetail3, elementDetail4, likes, talkAbout));
}
Also used : TextView(android.widget.TextView) GroupCoverImageView(com.abewy.android.apps.klyph.widget.coverImage.GroupCoverImageView) ImageView(android.widget.ImageView) ElementTimelineHolder(com.abewy.android.apps.klyph.adapter.holder.ElementTimelineHolder)

Example 2 with ElementTimelineHolder

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

the class GroupTimelineAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, final GraphObject data) {
    super.mergeViewWithData(view, data);
    ElementTimelineHolder holder = (ElementTimelineHolder) view.getTag();
    Group group = (Group) data;
    if (placeHolder == -1)
        placeHolder = AttrUtil.getResourceId(getContext(holder.getElementCoverImage()), R.attr.squarePlaceHolderIcon);
    holder.getElementProfileImage().setVisibility(View.GONE);
    // group can have no cover image
    String source = group.getPic_cover().getSource();
    if (source != null && source.length() > 0) {
        GroupCoverImageView groupCoverImageView = (GroupCoverImageView) holder.getElementCoverImage();
        groupCoverImageView.setOffset(group.getPic_cover().getOffset_y());
        loadImage(holder.getElementCoverImage(), source, placeHolder, true);
    } else {
        holder.getElementCoverImage().setImageResource(placeHolder);
    }
    holder.getElementDetail1().setText(group.getDescription());
    holder.getElementDetail1().setVisibility(View.VISIBLE);
    holder.getElementDetail2().setVisibility(View.GONE);
    holder.getElementDetail3().setVisibility(View.GONE);
    holder.getElementDetail4().setVisibility(View.GONE);
    if (group.getEmail().length() > 0) {
        holder.getLikes().setText(group.getEmail());
        holder.getLikes().setVisibility(View.VISIBLE);
    } else {
        holder.getLikes().setVisibility(View.GONE);
    }
    if (group.getWebsite().length() > 0) {
        holder.getTalkAbout().setText(group.getWebsite());
        holder.getTalkAbout().setVisibility(View.VISIBLE);
    } else {
        holder.getTalkAbout().setVisibility(View.GONE);
    }
}
Also used : Group(com.abewy.android.apps.klyph.core.fql.Group) GroupCoverImageView(com.abewy.android.apps.klyph.widget.coverImage.GroupCoverImageView) ElementTimelineHolder(com.abewy.android.apps.klyph.adapter.holder.ElementTimelineHolder)

Example 3 with ElementTimelineHolder

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

the class ElementTimelineAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(final View view, final GraphObject data) {
    super.mergeViewWithData(view, data);
    Log.d("ElementTimeline", "mergeData");
    ElementTimelineHolder holder = (ElementTimelineHolder) view.getTag();
    holder.getElementCoverImage().setOnClickListener(null);
    holder.getElementProfileImage().setOnClickListener(null);
    if (placeHolder == -1)
        placeHolder = AttrUtil.getResourceId(getContext(holder.getElementCoverImage()), R.attr.squarePlaceHolderIcon);
    if (data instanceof User) {
        manageUser(view, holder, (User) data);
        holder.getElementProfileImage().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getContext(view), ImageActivity.class);
                intent.putExtra(KlyphBundleExtras.USER_ID, ((User) data).getUid());
                getContext(view).startActivity(intent);
            }
        });
    } else if (data instanceof Page) {
        managePage(view, holder, (Page) data);
        holder.getElementProfileImage().setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getContext(view), ImageActivity.class);
                intent.putExtra(KlyphBundleExtras.USER_ID, ((Page) data).getPage_id());
                getContext(view).startActivity(intent);
            }
        });
    }
}
Also used : ImageActivity(com.abewy.android.apps.klyph.app.ImageActivity) User(com.abewy.android.apps.klyph.core.fql.User) Intent(android.content.Intent) Page(com.abewy.android.apps.klyph.core.fql.Page) ElementTimelineHolder(com.abewy.android.apps.klyph.adapter.holder.ElementTimelineHolder) ImageView(android.widget.ImageView) UserCoverImageView(com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView) TextView(android.widget.TextView) View(android.view.View)

Example 4 with ElementTimelineHolder

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

the class ElementTimelineAdapter method attachHolder.

@Override
protected void attachHolder(View view) {
    ImageView elementCoverImage = (ImageView) view.findViewById(R.id.element_cover_image);
    ImageView elementProfileImage = (ImageView) view.findViewById(R.id.element_profile_image);
    TextView elementDetail1 = (TextView) view.findViewById(R.id.element_detail_1);
    TextView elementDetail2 = (TextView) view.findViewById(R.id.element_detail_2);
    TextView elementDetail3 = (TextView) view.findViewById(R.id.element_detail_3);
    TextView elementDetail4 = (TextView) view.findViewById(R.id.element_detail_4);
    TextView likes = (TextView) view.findViewById(R.id.likes);
    TextView talkAbout = (TextView) view.findViewById(R.id.talk_about);
    view.setTag(new ElementTimelineHolder(elementCoverImage, elementProfileImage, elementDetail1, elementDetail2, elementDetail3, elementDetail4, likes, talkAbout));
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) UserCoverImageView(com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView) ElementTimelineHolder(com.abewy.android.apps.klyph.adapter.holder.ElementTimelineHolder)

Aggregations

ElementTimelineHolder (com.abewy.android.apps.klyph.adapter.holder.ElementTimelineHolder)4 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 GroupCoverImageView (com.abewy.android.apps.klyph.widget.coverImage.GroupCoverImageView)2 UserCoverImageView (com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView)2 Intent (android.content.Intent)1 View (android.view.View)1 ImageActivity (com.abewy.android.apps.klyph.app.ImageActivity)1 Group (com.abewy.android.apps.klyph.core.fql.Group)1 Page (com.abewy.android.apps.klyph.core.fql.Page)1 User (com.abewy.android.apps.klyph.core.fql.User)1