use of com.abewy.android.apps.klyph.core.fql.Friend 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);
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class PostShare method initWithIntent.
public void initWithIntent(Intent intent) {
String photoId = intent.getStringExtra(KlyphBundleExtras.SHARE_PHOTO_ID);
String videoId = intent.getStringExtra(KlyphBundleExtras.SHARE_VIDEO_ID);
String albumId = intent.getStringExtra(KlyphBundleExtras.SHARE_ALBUM_ID);
Stream post = intent.getParcelableExtra(KlyphBundleExtras.SHARE_POST_ID);
String linkUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_URL);
if (photoId != null) {
url = PHOTO + photoId;
new AsyncRequest(Query.PHOTO, photoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onPhotoRequestComplete(response);
}
}).execute();
} else if (videoId != null) {
url = VIDEO + videoId;
new AsyncRequest(Query.VIDEO, videoId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onVideoRequestComplete(response);
}
}).execute();
} else if (albumId != null) {
url = ALBUM + albumId;
new AsyncRequest(Query.ALBUM, albumId, "", new AsyncRequest.Callback() {
@Override
public void onComplete(Response response) {
onAlbumRequestComplete(response);
}
}).execute();
} else if (post != null) {
url = post.getPermalink();
if (post.isStatus()) {
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
getActivity().setTitle(R.string.post_share_status);
} else {
Attachment att = post.getAttachment();
if (att.isPhoto() || att.isVideo() || att.isAlbum()) {
Media media = att.getMedia().get(0);
if (att.isAlbum()) {
fillViews(post.getActor_name(), att.getName(), media.getSrc());
} else {
fillViews(post.getActor_name(), media.getAlt(), media.getSrc());
}
if (att.isPhoto())
getActivity().setTitle(R.string.post_share_photo);
else if (att.isVideo())
getActivity().setTitle(R.string.post_share_video);
else
getActivity().setTitle(R.string.post_share_album);
} else {
getActivity().setTitle(R.string.post_share_status);
fillViews(post.getActor_name(), post.getMessage(), post.getActor_pic());
}
}
} else if (linkUrl != null) {
isLink = true;
url = linkUrl;
imageUrl = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_IMAGE_URL);
String linkName = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_NAME);
String linkDesc = intent.getStringExtra(KlyphBundleExtras.SHARE_LINK_DESC);
fillViews(linkName, linkDesc, imageUrl);
getActivity().setTitle(R.string.post_share_link);
} else {
Log.d("PostShare", "All null");
}
if (isLink == false) {
((ViewGroup) spinner.getParent()).setVisibility(View.GONE);
} else {
SpinnerAdapter adapter = new SpinnerAdapter(getActivity());
spinner.setAdapter(adapter);
Friend friend = new Friend();
friend.setName(getString(R.string.post_share_on_my_wall));
adapter.add(friend);
friend = new Friend();
friend.setName(getString(R.string.post_share_on_friend_wall));
adapter.add(friend);
adapter.notifyDataSetChanged();
spinner.setSelection(0);
spinner.setOnItemSelectedListener(this);
previousPosition = 0;
}
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class UserLikeDialog method onItemClick.
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
Friend friend = (Friend) arg0.getItemAtPosition(arg2);
startActivity(Klyph.getIntentForGraphObject(getActivity(), friend));
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class FriendPickerActivity method populate.
@Override
protected void populate(List<GraphObject> data) {
super.populate(data);
setNoMoreData(true);
FRIEND_LIST = data;
friends = data;
boolean friendsSelected = false;
if (initialIds != null) {
int n = data.size();
for (int i = 0; i < n; i++) {
Friend friend = (Friend) data.get(i);
for (int j = 0; j < initialIds.size(); j++) {
if (friend.getUid().equals(initialIds.get(j))) {
friendsSelected = true;
friend.setSelected(true);
getListView().setItemChecked(i, true);
initialIds.remove(j);
j--;
break;
}
}
}
}
if (friendsSelected == true) {
startActionMode();
refreshCheckedViews();
refreshActionModeTitle();
}
searchText.setVisibility(View.VISIBLE);
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class FriendAdapter method mergeViewWithData.
@Override
protected void mergeViewWithData(View view, GraphObject data) {
super.mergeViewWithData(view, data);
PicturePrimaryTextHolder holder = (PicturePrimaryTextHolder) getHolder(view);
// holder.getPicture().setImageDrawable(null);
Friend friend = (Friend) data;
holder.getPrimaryText().setText(friend.getName());
// FacebookUtil.getProfilePictureURLForId(friend.getUid());
String url = friend.getPic();
loadImage(holder.getPicture(), url, AttrUtil.getResourceId(getContext(view), R.attr.squarePlaceHolderIcon), data);
}
Aggregations