Java 类android.widget.ExpandableListView.OnGroupExpandListener 实例源码

项目:AndroidViewHelper    文件:ExpandableListViewWrapper.java   
/**
* @see ExpandableListView#setOnGroupExpandListener(OnGroupExpandListener)
*/
 public W setOnGroupExpandListener(OnGroupExpandListener onGroupExpandListener) {
     mView.setOnGroupExpandListener(onGroupExpandListener);
     return (W) this;
 }
项目:EntboostIM    文件:MemberSelectActivity.java   
private void initMyDepartment() {
        departmentlistView = (ExpandableListView) findViewById(R.id.departmentlist);
        departmentAdapter = new GroupAdapter<DepartmentInfo>(this, departmentlistView);

        departmentAdapter.setExcludeUids(excludeUids);
        departmentAdapter.setSelectMember(true);
        if (selectType==SELECT_TYPE_SINGLE)
            departmentAdapter.setSelectOne(true);
        departmentAdapter.setSelectedMemberListener(this);

        //展开事件
        departmentListener = new ExpandableListView.OnGroupExpandListener() {
            @Override
            public void onGroupExpand(final int groupPosition) {
                final GroupInfo group = (GroupInfo) departmentAdapter.getGroup(groupPosition);
                EntboostUM.loadMembers(group.getDep_code(), new LoadAllMemberListener() {
                    @Override
                    public void onFailure(int code, final String errMsg) {
                        HandlerToolKit.runOnMainThreadAsync(new Runnable() {
                            @Override
                            public void run() {
                                showToast(errMsg);
                            }
                        });
                    }

                    @Override
                    public void onLoadAllMemberSuccess() {
                        HandlerToolKit.runOnMainThreadAsync(new Runnable() {
                            @Override
                            public void run() {
                                departmentAdapter.setMembers(group.getDep_code(), false);
                                departmentAdapter.notifyDataSetChanged();
                            }
                        });
                    }
                });
            }
        };

        //点击成员事件
        departmenChildtListener = new ExpandableListView.OnChildClickListener() {
            @Override
            public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) {
                Object obj = departmentAdapter.getChild(groupPosition, childPosition);
//              if (checkSelfGroup(obj)) {
                MemberInfo memberInfo = (MemberInfo) obj;

                if (selectType==SELECT_TYPE_MULTI) { //多选视图
                    ImageView selectImg = (ImageView) view.findViewById(R.id.user_select);
                    if (selectImg.getVisibility() == View.GONE || selectImg.getVisibility() == View.INVISIBLE) {
                        return true;
                    }

                    Drawable srcImg = selectImg.getDrawable();
                    if (srcImg == null) {
                        selectImg.setImageResource(R.drawable.uitb_57);
                        MemberSelectActivity.addSelectedMember(memberInfo);
                    } else {
                        selectImg.setImageDrawable(null);
                        MemberSelectActivity.removeSelectedMember(memberInfo);
                    }

                    MemberSelectActivity.this.onSelectedMembersChange();
                } else { //单选视图
                    if (!excludeUids.contains(memberInfo.getEmp_uid())) {
                        MemberSelectActivity.addSelectedMember(memberInfo);
                        MemberSelectActivity.this.onClickOneMember();
                    }
                }
//              }
                return true;
            }
        };
        departmentlistView.setAdapter(departmentAdapter);
        departmentlistView.setOnChildClickListener(departmenChildtListener);
        departmentlistView.setOnGroupExpandListener(departmentListener);
    }
项目:EntboostIM    文件:MemberSelectActivity.java   
private void initGroup() {
    grouplistView = (ExpandableListView) findViewById(R.id.grouplist);
    groupAdapter = new GroupAdapter<PersonGroupInfo>(this, grouplistView);

    groupAdapter.setExcludeUids(excludeUids);
    groupAdapter.setSelectMember(true);
    if (selectType==SELECT_TYPE_SINGLE)
        groupAdapter.setSelectOne(true);
    groupAdapter.setSelectedMemberListener(this);

    //展开事件
    personGroupListener = new ExpandableListView.OnGroupExpandListener() {
        @Override
        public void onGroupExpand(final int groupPosition) {
            final GroupInfo group = (GroupInfo) groupAdapter.getGroup(groupPosition);
            EntboostUM.loadMembers(group.getDep_code(), new LoadAllMemberListener() {
                @Override
                public void onFailure(int code, final String errMsg) {
                    HandlerToolKit.runOnMainThreadAsync(new Runnable() {
                        @Override
                        public void run() {
                            showToast(errMsg);
                        }
                    });
                }

                @Override
                public void onLoadAllMemberSuccess() {
                    HandlerToolKit.runOnMainThreadAsync(new Runnable() {
                        @Override
                        public void run() {
                            groupAdapter.setMembers(group.getDep_code(), false);
                            groupAdapter.notifyDataSetChanged();
                        }
                    });
                }
            });
        }

    };

    //点击成员事件
    childListener = new ExpandableListView.OnChildClickListener() {
        @Override
        public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) {
            Object obj = groupAdapter.getChild(groupPosition, childPosition);
            //if (checkSelfGroup(obj)) {
            MemberInfo memberInfo = (MemberInfo) obj;

            if (selectType==SELECT_TYPE_MULTI) { //多选视图
                ImageView selectImg = (ImageView) view.findViewById(R.id.user_select);
                if (selectImg.getVisibility() == View.GONE || selectImg.getVisibility() == View.INVISIBLE) {
                    return true;
                }

                Drawable srcImg = selectImg.getDrawable();
                if (srcImg == null) {
                    selectImg.setImageResource(R.drawable.uitb_57);
                    MemberSelectActivity.addSelectedMember(memberInfo);
                } else {
                    selectImg.setImageDrawable(null);
                    MemberSelectActivity.removeSelectedMember(memberInfo);
                }
                MemberSelectActivity.this.onSelectedMembersChange();
            } else { //单选视图
                if (!excludeUids.contains(memberInfo.getEmp_uid())) {
                    MemberSelectActivity.addSelectedMember(memberInfo);
                    MemberSelectActivity.this.onClickOneMember();
                }
            }
            //}
            return true;
        }
    };
    grouplistView.setAdapter(groupAdapter);
    grouplistView.setOnChildClickListener(childListener);
    grouplistView.setOnGroupExpandListener(personGroupListener);
}
项目:IkantechSupport    文件:PinnedHeaderExpandableListView.java   
@Override
public void setOnGroupExpandListener(
        OnGroupExpandListener onGroupExpandListener)
{
    mOnGroupExpandListener = onGroupExpandListener;
}