Search in sources :

Example 11 with Friend

use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.

the class FriendPickerAdapter method mergeViewWithData.

@Override
protected void mergeViewWithData(View view, GraphObject data) {
    super.mergeViewWithData(view, data);
    setData(view, data);
    FriendPickerHolder holder = (FriendPickerHolder) getHolder(view);
    // holder.getFriendPicture().setImageDrawable(null);
    Friend friend = (Friend) data;
    holder.getFriendName().setText(friend.getName());
    // holder.getCheckbox().setSelected(user.isSelected());
    ((Checkable) view).setChecked(friend.isSelected());
    if (placeHolder == -1)
        placeHolder = AttrUtil.getResourceId(getContext(holder.getFriendPicture()), R.attr.squarePlaceHolderIcon);
    loadImage(holder.getFriendPicture(), friend.getPic(), placeHolder, data);
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) FriendPickerHolder(com.abewy.android.apps.klyph.adapter.holder.FriendPickerHolder) Checkable(android.widget.Checkable)

Example 12 with Friend

use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.

the class FriendPickerActivity method filter.

private void filter(String filterText) {
    if (filterText.length() == 0) {
        getAdapter().setData(friends);
    } else {
        List<GraphObject> filteredUsers = new ArrayList<GraphObject>();
        final String f = filterText.toLowerCase();
        for (GraphObject graphObject : friends) {
            Friend u = (Friend) graphObject;
            if (u.getName().toLowerCase().contains(f) == true) {
                filteredUsers.add(u);
            }
        }
        getAdapter().setData(filteredUsers);
    }
    refreshCheckedViews();
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) ArrayList(java.util.ArrayList) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject)

Example 13 with Friend

use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.

the class FriendPickerActivity method onListItemClick.

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    Friend friend = (Friend) getAdapter().getItem(position);
    if (singleChoice) {
        Intent intent = new Intent();
        intent.putExtra(KlyphBundleExtras.USER_ID, friend.getUid());
        intent.putExtra(KlyphBundleExtras.USER_NAME, friend.getName());
        setResult(RESULT_OK, intent);
        finish();
    } else {
        startActionMode();
        friend.setSelected(!friend.isSelected());
        refreshActionModeTitle();
    }
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Intent(android.content.Intent)

Example 14 with Friend

use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.

the class FriendPickerActivity method goBack.

private void goBack() {
    if (selectionConfirmed == true && friends.size() > 0) {
        List<Friend> friends = getSelectedUsers();
        String[] names = new String[friends.size()];
        String[] ids = new String[friends.size()];
        for (int i = 0; i < friends.size(); i++) {
            Friend friend = friends.get(i);
            names[i] = friend.getName();
            ids[i] = friend.getUid();
        }
        Intent intent = new Intent();
        intent.putExtra(KlyphBundleExtras.FRIEND_PICKER_NAMES, names);
        intent.putExtra(KlyphBundleExtras.FRIEND_PICKER_IDS, ids);
        setResult(RESULT_OK, intent);
    } else {
        setResult(RESULT_CANCELED, null);
    }
    finish();
}
Also used : Friend(com.abewy.android.apps.klyph.core.fql.Friend) Intent(android.content.Intent)

Example 15 with Friend

use of com.abewy.android.apps.klyph.core.fql.Friend in project Klyph by jonathangerbaud.

the class FriendPickerActivity method deselectAll.

private void deselectAll() {
    int n = friends.size();
    for (int i = 0; i < n; i++) {
        Friend friend = (Friend) friends.get(i);
        friend.setSelected(false);
    }
    refreshCheckedViews();
    refreshActionModeTitle();
}
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