use of com.abewy.klyph.items.Title 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);
}
use of com.abewy.klyph.items.Title in project Klyph by jonathangerbaud.
the class TitleAdapter method mergeViewWithData.
@Override
protected void mergeViewWithData(View view, GraphObject data) {
TitleHolder holder = (TitleHolder) view.getTag();
Title title = (Title) data;
holder.getTitle().setText(title.getName());
holder.getShadow().setVisibility(title.getShadow() == true ? View.VISIBLE : View.GONE);
}
use of com.abewy.klyph.items.Title in project Klyph by jonathangerbaud.
the class PageAbout method addItemsForMap.
private boolean addItemsForMap(int resTitle, SparseArray<String> map, List<GraphObject> data) {
int originalSize = data.size();
int n = map.size();
for (int i = 0; i < n; i++) {
int key = map.keyAt(i);
String value = map.get(key);
if (isNotEmpty(value)) {
Item item = new Item();
item.setName(getResources().getString(key));
item.setDesc(value);
data.add(item);
}
}
int finalSize = data.size();
if (finalSize > originalSize) {
Item item = (Item) data.get(finalSize - 1);
item.setShadow(true);
Title titleItem = new Title();
titleItem.setName(getResources().getString(resTitle));
data.add(originalSize, titleItem);
}
return finalSize > originalSize;
}
use of com.abewy.klyph.items.Title in project Klyph by jonathangerbaud.
the class UserAbout method addItemsForMap.
private boolean addItemsForMap(String title, HashMap<String, String> map, List<GraphObject> data) {
int originalSize = data.size();
for (String key : map.keySet()) {
String value = map.get(key);
if (value != null && value.length() > 0) {
Item item = new Item();
item.setName(key);
item.setDesc(value);
data.add(item);
}
}
int finalSize = data.size();
if (finalSize > originalSize) {
Item item = (Item) data.get(finalSize - 1);
item.setShadow(true);
Title titleItem = new Title();
titleItem.setName(title);
data.add(originalSize, titleItem);
}
return finalSize > originalSize;
}
Aggregations