Search in sources :

Example 1 with Friend

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));
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend)

Example 2 with 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);
        }
    }
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend)

Example 3 with Friend

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;
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 4 with Friend

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);
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Filter(android.widget.Filter) MultiObjectAdapter(com.abewy.android.apps.klyph.adapter.MultiObjectAdapter) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with Friend

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));
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend)

Aggregations

Friend (com.abewy.android.apps.klyph.core.fql.Friend)24 ArrayList (java.util.ArrayList)5 Intent (android.content.Intent)3 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)3 Filter (android.widget.Filter)2 MultiObjectAdapter (com.abewy.android.apps.klyph.adapter.MultiObjectAdapter)2 PicturePrimarySecondaryTextHolder (com.abewy.android.apps.klyph.adapter.holder.PicturePrimarySecondaryTextHolder)2 Stream (com.abewy.android.apps.klyph.core.fql.Stream)2 Tag (com.abewy.android.apps.klyph.core.fql.Tag)2 Education (com.abewy.android.apps.klyph.core.fql.User.Education)2 Work (com.abewy.android.apps.klyph.core.fql.User.Work)2 List (java.util.List)2 Resources (android.content.res.Resources)1 ViewGroup (android.view.ViewGroup)1 Checkable (android.widget.Checkable)1 FriendPickerHolder (com.abewy.android.apps.klyph.adapter.holder.FriendPickerHolder)1 PicturePrimaryTextHolder (com.abewy.android.apps.klyph.adapter.holder.PicturePrimaryTextHolder)1 ThreadHolder (com.abewy.android.apps.klyph.adapter.holder.ThreadHolder)1 EventActivity (com.abewy.android.apps.klyph.app.EventActivity)1 GroupActivity (com.abewy.android.apps.klyph.app.GroupActivity)1