use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class GroupMembers method onGridItemClick.
@Override
public void onGridItemClick(KlyphGridView l, View v, int position, long id) {
Friend friend = (Friend) l.getItemAtPosition(position);
startActivity(Klyph.getIntentForGraphObject(getActivity(), friend));
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class PostShare method onActivityResult.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SELECT_FRIEND_CODE) {
if (resultCode == Activity.RESULT_OK) {
Friend friend = new Friend();
friend.setUid(data.getStringExtra(KlyphBundleExtras.USER_ID));
friend.setName(data.getStringExtra(KlyphBundleExtras.USER_NAME));
SpinnerAdapter adapter = (SpinnerAdapter) spinner.getAdapter();
int position = -1;
for (int i = 2; i < adapter.getCount(); i++) {
if (adapter.getItem(i).getUid().equals(friend.getUid())) {
position = i;
break;
}
}
if (position == -1) {
adapter.add(friend);
adapter.notifyDataSetChanged();
position = adapter.getCount() - 1;
}
spinner.setSelection(position);
} else {
spinner.setSelection(previousPosition);
}
}
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class SearchUserRequest method handleResult.
@Override
public List<GraphObject> handleResult(JSONArray result) {
Log.d("SearchUser", "handleResult");
List<GraphObject> list = new ArrayList<GraphObject>();
int n = result.length();
for (int i = 0; i < n; i++) {
Friend friend = new Friend();
JSONObject json = result.optJSONObject(i);
friend.setUid(json.optString("id"));
friend.setName(json.optString("name"));
JSONObject pic = json.optJSONObject("picture");
JSONObject data = pic.optJSONObject("data");
friend.setPic(data.optString("url"));
list.add(friend);
}
setHasMoreData(false);
return list;
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class Friends method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
MultiObjectAdapter moa = new MultiObjectAdapter(getListView());
moa.setFilter(new Filter() {
@SuppressWarnings("unchecked")
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
setFilteredResults((List<GraphObject>) results.values);
}
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults results = new FilterResults();
List<Friend> filteredFriends = new ArrayList<Friend>();
// perform your search here using the searchConstraint String.
constraint = constraint.toString().toLowerCase();
for (int i = 0; i < friends.size(); i++) {
Friend friend = (Friend) friends.get(i);
if (friend.getName().toLowerCase().startsWith(constraint.toString())) {
filteredFriends.add(friend);
}
}
results.count = filteredFriends.size();
results.values = filteredFriends;
return results;
}
});
setListAdapter(moa);
defineEmptyText(R.string.empty_list_no_friend);
setListVisible(false);
setRequestType(Query.FRIENDS);
super.onViewCreated(view, savedInstanceState);
}
use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.
the class Friends method onGridItemClick.
@Override
public void onGridItemClick(KlyphGridView l, View v, int position, long id) {
Friend friend = (Friend) l.getItemAtPosition(position);
startActivity(Klyph.getIntentForGraphObject(getActivity(), friend));
}
Aggregations