use of com.abewy.android.apps.klyph.core.fql.Tag in project Klyph by jonathangerbaud.
the class UserListDialog method onItemClick.
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
GraphObject object = (GraphObject) arg0.getItemAtPosition(position);
if (object instanceof Tag) {
Tag tag = (Tag) object;
startActivity(Klyph.getIntentForGraphObject(getActivity(), tag));
} else if (object instanceof Friend) {
Friend friend = (Friend) object;
startActivity(Klyph.getIntentForGraphObject(getActivity(), friend));
}
}
use of com.abewy.android.apps.klyph.core.fql.Tag in project Klyph by jonathangerbaud.
the class TextViewUtil method setTextClickableForTags.
/**
* Make a clickable for the tags in parameters
* If callback is null, TextViewUtil.onTagClick is called
*/
public static void setTextClickableForTags(final Context context, TextView textView, Map<String, List<Tag>> tags, final TagCallback callback, boolean clickable) {
SpannableStringBuilder strBuilder = new SpannableStringBuilder(textView.getText());
for (final List<Tag> tagList : tags.values()) {
if (tagList.size() > 0) {
CharacterStyle span;
if (clickable) {
span = new ClickableSpan() {
@Override
public void onClick(View widget) {
if (callback != null)
callback.onTagClick(tagList);
else
onTagClick(context, tagList);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
ds.setFakeBoldText(true);
}
};
} else {
span = new StyleSpan(Typeface.BOLD);
}
Tag tag = tagList.get(0);
strBuilder.setSpan(span, tag.getOffset(), tag.getOffset() + tag.getLength(), 0);
}
}
textView.setText(strBuilder);
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
use of com.abewy.android.apps.klyph.core.fql.Tag in project Klyph by jonathangerbaud.
the class TagDeserializer method deserializeMap.
public Map<String, List<Tag>> deserializeMap(JSONObject data) {
Map<String, List<Tag>> map = new Hashtable<String, List<Tag>>();
if (data != null) {
for (Iterator iterator = data.keys(); iterator.hasNext(); ) {
String key = (String) iterator.next();
JSONArray tags = data.optJSONArray(key);
map.put(key, deserializeArray(tags, Tag.class));
}
}
return map;
}
use of com.abewy.android.apps.klyph.core.fql.Tag in project Klyph by jonathangerbaud.
the class TagDeserializer method deserializeMap.
public Map<String, List<Tag>> deserializeMap(JSONArray data) {
Map<String, List<Tag>> map = new Hashtable<String, List<Tag>>();
if (data != null) {
int n = data.length();
for (int i = 0; i < n; i++) {
JSONArray tags = data.optJSONArray(i);
map.put(String.valueOf(i), deserializeArray(tags, Tag.class));
}
}
return map;
}
use of com.abewy.android.apps.klyph.core.fql.Tag in project Klyph by jonathangerbaud.
the class TagDeserializer method deserializeObject.
@Override
public GraphObject deserializeObject(JSONObject data) {
Tag tag = new Tag();
deserializePrimitives(tag, data);
return tag;
}
Aggregations