use of com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView in project Klyph by jonathangerbaud.
the class MainActivity method refreshUserPics.
private void refreshUserPics() {
ProfileImageView picView = (ProfileImageView) findViewById(R.id.user_profile_picture);
ImageView coverView = (ImageView) findViewById(R.id.user_cover_picture);
picView.disableBorder();
ImageLoader.display(picView, userPicUrl, KlyphUtil.getProfilePlaceHolder(picView.getContext()));
String userCoverUrl = userCover != null ? userCover.getSource() : null;
if (userCoverUrl != null && userCoverUrl.length() > 0) {
UserCoverImageView userCoverImageView = (UserCoverImageView) coverView;
userCoverImageView.setOffset(userCover.getOffset_y());
ImageLoader.display(coverView, userCoverUrl, R.drawable.picture_place_holder_square_dark);
} else {
coverView.setImageResource(R.drawable.picture_place_holder_square_dark);
}
}
use of com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView in project Klyph by jonathangerbaud.
the class UserActivity method initComponentsOnRequestSucces.
@Override
protected void initComponentsOnRequestSucces(List<GraphObject> result) {
user = (User) result.get(0);
if (result.size() > 1) {
FriendRequest fr = (FriendRequest) result.get(1);
setFriendButtonState(user.isFriend(), fr.getUid_to().equals(KlyphSession.getSessionUserId()), fr.getUid_from().equals(KlyphSession.getSessionUserId()));
} else {
setFriendButtonState(user.isFriend(), hasReceivedFriendRequest, hasSentFriendRequest);
}
headerName.setText(user.getName());
// ImageLoader.display((ImageView) mHeaderPicture, ImageLoader.FAKE_URI, true, KlyphUtil.getPlaceHolder(this));
ImageLoader.display(getHeaderPicture(), user.getPic_cover().getSource(), true, R.drawable.cover_place_holder, new SimpleListener() {
@Override
public void onSuccess() {
super.onSuccess();
// that would destroy the view
if (getHeaderPicture() != null)
((UserCoverImageView) getHeaderPicture()).setOffset(user.getPic_cover().getOffset_y());
}
});
ImageLoader.display(getHeaderLogo(), user.getPic(), true, KlyphUtil.getProfilePlaceHolder(this));
Log.d("UserActivity", "initComponentsOnRequestSucces: " + listGridHeaderHeight);
((TabsAdapter) getPagerAdapter()).setUser(user);
((TabsAdapter) getPagerAdapter()).init(listGridHeaderHeight);
;
((TabsAdapter) getPagerAdapter()).setInitialPositionAndShow();
}
use of com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView in project Klyph by jonathangerbaud.
the class ElementTimelineAdapter method manageUser.
private void manageUser(View view, ElementTimelineHolder holder, User user) {
// User can have no cover image
String source = user.getPic_cover().getSource();
if (source != null && source.length() > 0) {
UserCoverImageView userCoverImageView = (UserCoverImageView) holder.getElementCoverImage();
userCoverImageView.setOffset(user.getPic_cover().getOffset_y());
loadImage(holder.getElementCoverImage(), source, true);
} else
holder.getElementCoverImage().setImageResource(placeHolder);
loadImage(holder.getElementProfileImage(), user.getPic(), KlyphUtil.getProfilePlaceHolder(view.getContext()), true);
ArrayList<String> data = new ArrayList<String>();
Resources res = getContext(view).getResources();
if (user.getSex().length() > 0)
data.add(res.getString(R.string.user_about_sex, user.getSex()));
if (user.getBirthday().length() > 0)
data.add(res.getString(R.string.user_about_birthday, user.getBirthday()));
if (user.getRelationship_status().length() > 0)
data.add(res.getString(R.string.user_about_ralationship_status, user.getRelationship_status()));
/*
* if (user.getLocation() != null &&
* user.getLocation().getName().length() > 0) data.add("Habite à : " +
* user.getLocation().getName()); if (user.getHometown() != null &&
* user.getHometown().getName().length() > 0) data.add("Originaire de : "
* + user.getHometown().getName());
*/
// work
// study
ArrayList<TextView> elementDetails = new ArrayList<TextView>();
elementDetails.add(holder.getElementDetail1());
elementDetails.add(holder.getElementDetail2());
elementDetails.add(holder.getElementDetail3());
elementDetails.add(holder.getElementDetail4());
elementDetails.add(holder.getLikes());
elementDetails.add(holder.getTalkAbout());
for (TextView tv : elementDetails) {
tv.setVisibility(View.GONE);
}
for (int i = 0; i < data.size(); i++) {
if (i > elementDetails.size() - 3)
break;
TextView tv = elementDetails.get(i);
tv.setText(data.get(i));
tv.setVisibility(View.VISIBLE);
}
}
use of com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView in project Klyph by jonathangerbaud.
the class ElementTimelineAdapter method managePage.
private void managePage(View view, ElementTimelineHolder holder, Page page) {
String source = page.getPic_cover().getSource();
if (source != null && source.length() > 0) {
UserCoverImageView userCoverImageView = (UserCoverImageView) holder.getElementCoverImage();
userCoverImageView.setOffset(page.getPic_cover().getOffset_y());
loadImage(holder.getElementCoverImage(), source, 0, false);
} else {
holder.getElementCoverImage().setImageResource(placeHolder);
}
loadImage(holder.getElementProfileImage(), page.getPic(), KlyphUtil.getProfilePlaceHolder(view.getContext()), true);
ArrayList<TextView> elementDetails = new ArrayList<TextView>();
elementDetails.add(holder.getElementDetail1());
elementDetails.add(holder.getElementDetail2());
elementDetails.add(holder.getElementDetail3());
elementDetails.add(holder.getElementDetail4());
elementDetails.add(holder.getLikes());
elementDetails.add(holder.getTalkAbout());
for (TextView tv : elementDetails) {
tv.setVisibility(View.VISIBLE);
}
holder.getElementDetail1().setText(page.getType().toUpperCase());
holder.getElementDetail2().setText(page.getAbout());
int n = page.getFan_count();
if (n == 0) {
holder.getLikes().setText(R.string.no_like);
} else if (n == 1) {
holder.getLikes().setText(R.string.one_like);
} else {
holder.getLikes().setText(getContext(view).getResources().getString(R.string.several_likes, n));
}
n = page.getTalking_about_count();
if (n == 0) {
holder.getTalkAbout().setText(R.string.noone_talk_about_it);
} else if (n == 1) {
holder.getTalkAbout().setText(R.string.one_talk_about_it);
} else {
holder.getTalkAbout().setText(getContext(view).getResources().getString(R.string.several_talk_about_it, n));
}
holder.getElementDetail3().setVisibility(View.GONE);
holder.getElementDetail4().setVisibility(View.GONE);
// if (page.isTvShow())
}
use of com.abewy.android.apps.klyph.widget.coverImage.UserCoverImageView in project Klyph by jonathangerbaud.
the class PageActivity method initComponentsOnRequestSucces.
@Override
protected void initComponentsOnRequestSucces(List<GraphObject> result) {
page = (Page) result.get(0);
headerName.setText(page.getName());
// ImageLoader.display((ImageView) mHeaderPicture, ImageLoader.FAKE_URI, true, KlyphUtil.getPlaceHolder(this));
ImageLoader.display(getHeaderPicture(), page.getPic_cover().getSource(), true, R.drawable.cover_place_holder, new SimpleListener() {
@Override
public void onSuccess() {
super.onSuccess();
// that would destroy the view
if (getHeaderPicture() != null)
((UserCoverImageView) getHeaderPicture()).setOffset(page.getPic_cover().getOffset_y());
}
});
ImageLoader.display(getHeaderLogo(), page.getPic(), true, KlyphUtil.getProfilePlaceHolder(this));
((TabsAdapter) getPagerAdapter()).setPage(page);
((TabsAdapter) getPagerAdapter()).init(listGridHeaderHeight);
;
((TabsAdapter) getPagerAdapter()).setInitialPositionAndShow();
}
Aggregations