Java 类android.widget.ExpandableListView.OnChildClickListener 实例源码
项目:mobilesafe
文件:CommonNumberQueryActivity.java
/**
* ������չListView������,�������
*/
private void initData() {
CommonnumDao commonnumDao = new CommonnumDao();
mGroup = commonnumDao.getGroup();
mAdapter = new MyAdapter();
elv_common_number.setAdapter(mAdapter);
//������չlistviewע�����¼�
elv_common_number.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
//����绰
startCall(mAdapter.getChild(groupPosition, childPosition).number);
return false;
}
});
}
项目:Habit-Cookbook
文件:HomeScreen.java
/**
* Method for defining the all the listeners on the Home Screen.
*/
private void setChildListener(){
expListView.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
final String selected = (String) expListAdapter.getChild(
groupPosition, childPosition);
if (selected.equals("Add New Habit")) {
//Creating an Intent Bundle to pass over to the Add Medication Screen.
Intent intent = new Intent(HomeScreen.this, AddMedication.class);
Bundle extras = new Bundle();
extras.putString("OPERATION","ADD");
extras.putInt("ParentPosition", groupPosition);
intent.putExtras(extras);
startActivity(intent);
}
return true;
}
});
}
项目:bbsbrowser_android
文件:RecommendBoardView.java
/**
* 返回推荐版面
*/
public View createRecommendBoardView() {
final ExpandableListView recommendBoardList = new ExpandableListView(context);
recommendBoardList.setDividerHeight(0);
recommendBoardList.setGroupIndicator(context.getResources().getDrawable(R.drawable.recommend_indicator_selector));
recommendBoardList.setAdapter(new RecommendBoardListAdapter(getAllBoard()));
recommendBoardList.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
BoardObject board = getAllBoard().get(groupPosition).getRecommendBoardList().get(childPosition);
Intent intent = new Intent(context, DocListActivity.class);
intent.putExtra("board", board);
intent.putExtra("action", actionParam);
context.startActivity(intent);
return false;
}
});
return recommendBoardList;
}
项目:android-project-wo2b
文件:BlossomHomeFragment.java
@Override
protected void bindEvents()
{
expandableListView.setOnChildClickListener(new OnChildClickListener()
{
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
AlbumInfo albumInfo = (AlbumInfo) parent.getExpandableListAdapter().getChild(groupPosition,
childPosition);
Intent intent = new Intent(getContext(), ImageGridActivity.class);
intent.putExtra(RockyIntent.EXTRA_ALBUM, albumInfo);
startActivity(intent);
return false;
}
});
}
项目:ActivityLauncher
文件:AllTasksListFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frament_all_list, null);
this.list = (ExpandableListView) view.findViewById(R.id.expandableListView1);
this.list.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
ExpandableListAdapter adapter = parent.getExpandableListAdapter();
MyActivityInfo info = (MyActivityInfo)adapter.getChild(groupPosition, childPosition);
LauncherIconCreator.launchActivity(getActivity(), info.component_name);
return false;
}
});
AllTasksListAsyncProvider provider = new AllTasksListAsyncProvider(this.getActivity(), this);
provider.execute();
return view;
}
项目:yiim_v2
文件:InviteFriendActivity.java
@Override
protected void installListeners() {
// TODO Auto-generated method stub
mListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
FriendItem item = new FriendItem(groupPosition, childPosition);
if (mSelectedFriendItems.contains(item)) {
mSelectedFriendItems.remove(item);
} else {
mSelectedFriendItems.add(item);
}
mAdapter.notifyDataSetChanged();
return false;
}
});
}
项目:zen4android
文件:ZenMenuFragment.java
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Context context = getActivity();
ZenJSONUtil.loadBoardsFromJSON("boards.json");
mAdapter = new ZenMenuAdapter(context, ZenJSONUtil.headers, ZenJSONUtil.boards);
mBoards = (ExpandableListView)getView().findViewById(R.id.zen_boards);
mBoards.setGroupIndicator(null);
mBoards.setAdapter(mAdapter);
mBoards.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
@SuppressWarnings("unchecked")
Map<String, String> child = (Map<String, String>)mAdapter.getChild(groupPosition, childPosition);
Map<String, String> board = child;
switchContent(board.get("fid"), board.get("name"));
return false;
}
});
}
项目:software
文件:OnlineFragment.java
/** The system calls this to perform work in the UI thread and delivers
* the result from doInBackground() */
@Override
protected void onPostExecute(final List<ACMDatabaseInfo> result) {
listAdapter.setListData(result);
expListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
final ACMDatabaseInfo.DeploymentPackage image = result.get(groupPosition)
.getDeviceImages().get(childPosition);
new Thread(new Runnable() {
@Override public void run() {
IOHandler.getInstance().store(image);
}
}).start();
return false;
}
});
listAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
}
项目:buddycloud-android
文件:GenericChannelsFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.channel_list, container, false);
OnChildClickListener channelItemListener = new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
JSONObject channelItem = (JSONObject) adapter.getChild(groupPosition, childPosition);
channelSelected(channelItem);
return true;
}
};
ExpandableListView channelsView = (ExpandableListView) view.findViewById(R.id.channelListView);
channelsView.setEmptyView(view.findViewById(R.id.channelListProgress));
channelsView.setAdapter(adapter);
channelsView.setOnChildClickListener(channelItemListener);
PauseOnScrollListener listener = new PauseOnScrollListener(ImageLoader.getInstance(), true, true);
channelsView.setOnScrollListener(listener);
expandAll(view);
return view;
}
项目:EntboostIM
文件:FriendMainFragment.java
private void initContactView(View view) {
contactListView = (ExpandableListView) view.findViewById(R.id.friendlist);
friendAdapter = new ContactAdapter(view.getContext(), contactListView);
//点击子节点事件
OnChildClickListener contactListener = new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Object obj = friendAdapter.getChild(groupPosition, childPosition);
if (obj instanceof ContactInfo) {
ContactInfo mi = (ContactInfo) obj;
Intent intent = new Intent(activity, ChatActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_SINGLE_TOP
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
String name = null;
if (StringUtils.isNotBlank(mi.getName())) {
name = mi.getName();
} else {
name = mi.getContact();
}
intent.putExtra(ChatActivity.INTENT_TITLE, name);
intent.putExtra(ChatActivity.INTENT_TOID, mi.getCon_uid());
startActivity(intent);
}
return true;
}
};
contactListView.setAdapter(friendAdapter);
contactListView.setOnChildClickListener(contactListener);
}
项目:quickmark
文件:FragmentPage3.java
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Calendar c = Calendar.getInstance();// 获取当前系统日期
defaultYear = c.get(Calendar.YEAR);// 获取年份
defaultMonth = c.get(Calendar.MONTH) + 1;// 获取月份
findViews();
initData(0);
elv.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View view,
int groupPosition, int childPosition, long id) {
TextView txno = (TextView) view.findViewById(R.id.no);
TextView txkind = (TextView) view.findViewById(R.id.kind);
String strtype = ((String) txkind.getText()).substring(1,
((String) txkind.getText()).indexOf(']')).trim();// 从收入信息中截取收支类型
String strno = (String) txno.getText(); // 从信息中截取收支编号
Intent intent = new Intent(getActivity(), AddPay.class);// 创建Intent对象
if (strtype.equals("收入")) {
intent.putExtra("cwp.message", new String[] { strno,
"btnininfo" });// 设置传递数据
}
if (strtype.equals("支出")) {
intent.putExtra("cwp.message", new String[] { strno,
"btnoutinfo" });// 设置传递数据
}
intent.putExtra("cwp.id", userid);
intent.putExtra("cwp.frament3", "3");
startActivity(intent);// 执行Intent操作
return false;
}
});
}
项目:androidsummary
文件:ContacterFragment.java
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mActivity = (ContacterActivity)this.getActivity();
application = (MyApplication) mActivity.getApplication();
View view = inflater.inflate(R.layout.im_contact_list, null);
mListView = (ExpandableListView) view.findViewById(R.id.contact_list);
mGroupNames = new ArrayList<String>();
mIMRosterGroups = new ArrayList<IMRosterGroup>();
mContacterListAdapter = new ContacterExpandableListAdapter(mActivity, mIMRosterGroups);
mListView.setAdapter(mContacterListAdapter);
mListView.setOnChildClickListener(new OnChildClickListener() {
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
IMRosterGroup mIMRosterGroup = mIMRosterGroups.get(groupPosition);
List<IMUser> mUsers = mIMRosterGroup.getUsers();
IMUser user = mUsers.get(childPosition);
toChat(user.getName());
return true;
}
});
initContacter();
return view;
}
项目:MonsterHunter3UDatabase
文件:ArmorExpandableListFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View v = inflater.inflate(R.layout.fragment_armor_expandablelist, null);
// setContextMenu(v);
elv = (ExpandableListView) v
.findViewById(R.id.expandableListView);
elv.setAdapter(new ArmorListAdapter(slots));
elv.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView arg0, View arg1,
int arg2, int arg3, long id) {
Intent i = new Intent(getActivity(), ArmorDetailActivity.class);
i.putExtra(ArmorDetailActivity.EXTRA_ARMOR_ID, (long) arg1.getTag());
startActivity(i);
return false;
}
});
return v;
}
项目:maas
文件:ClusterSaharaActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_clustersahara);
ExpandableListView elv = (ExpandableListView) findViewById(R.id.cluster_elv) ;
elAdapter = new ExpandListAdapter(getApplicationContext(), arr_cluster, arr_node) ;
elv.setAdapter(elAdapter) ;
elv.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView arg0, View arg1, int arg2,
int arg3, long arg4) {
// TODO Auto-generated method stub
if(arr_cluster.get(arg2).isActive()) {
if(arr_node.get(arg2).get(arg3).isMaster()) {
Conf.address_node = arr_node.get(arg2).get(arg3).getIp() ;
Intent it = new Intent(getApplicationContext(), MainActivity.class) ;
startActivity(it) ;
} else
Toast.makeText(getApplicationContext(), "Please choose Master node !", Toast.LENGTH_SHORT).show();
} else
Toast.makeText(getApplicationContext(), "Cluster is not active !", Toast.LENGTH_SHORT).show();
return false;
}
}) ;
new loadClustersSahara().execute() ;
}
项目:ChicagoWaterWalk-Android
文件:AllRoutesFragment.java
public void onActivityCreated (Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mAdapter = new AllRoutesAdapter(getActivity(), mImageFetcher, getListHeaders());
mList.setAdapter(mAdapter);
mList.setFastScrollEnabled(true);
mList.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
RowItem rowItem = (RowItem) mAdapter.getChild(groupPosition, childPosition);
Intent intent = new Intent(AllRoutesFragment.this.getActivity(), PointOfInterestDetailActivity.class);
intent.putExtra(Constants.INTENT_TITLE, rowItem.getTitle());
intent.putExtra(Constants.INTENT_RES_ID, rowItem.getResId());
intent.putExtra(Constants.INTENT_DRAWER_POSITION, 1);
AllRoutesFragment.this.startActivity(intent);
return false;
}
});
ViewTreeObserver vto = mList.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@SuppressLint("NewApi")
@Override
public void onGlobalLayout() {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
mList.setIndicatorBounds(mList.getRight()- 70, mList.getWidth());
} else {
mList.setIndicatorBoundsRelative(mList.getRight()- 70, mList.getWidth());
}
}
});
}
项目:opentasks
文件:TaskListFragment.java
/**
* prepares the update of the view after the group descriptor was changed
*/
public void prepareReload()
{
mAdapter = new ExpandableGroupDescriptorAdapter(getActivity(), getLoaderManager(), mGroupDescriptor);
mExpandableListView.setAdapter(mAdapter);
mExpandableListView.setOnChildClickListener((android.widget.ExpandableListView.OnChildClickListener) mTaskItemClickListener);
mExpandableListView.setOnGroupCollapseListener((android.widget.ExpandableListView.OnGroupCollapseListener) mTaskListCollapseListener);
mAdapter.setOnChildLoadedListener(this);
mAdapter.setChildCursorFilter(COMPLETED_FILTER);
restoreFilterState();
}
项目:DebianDroid
文件:SUBSFragment.java
public void setupSubsList(ExpandableListView expandableList) {
expandableList.setDividerHeight(1);
expandableList.setClickable(true);
setSubscribedData();
final DExpandableAdapter adapter = new DExpandableAdapter(parentItems, childItems);
adapter.setInflater((LayoutInflater) getSherlockActivity().getSystemService(
Context.LAYOUT_INFLATER_SERVICE));
expandableList.setAdapter(adapter);
registerForContextMenu(expandableList);
// Add autocollapsing of list if enabled
if (SettingsActivity.isAutoCollapseEnabled(getSherlockActivity())) {
expandableList.setOnGroupExpandListener(new AutoGroupCollapseListener(expandableList));
}
expandableList.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View view, int groupPosition,
int childPosition, long id) {
String itemClicked = ((TextView) view).getText().toString();
if (groupPosition == 0) {
SearchCacher.setLastSearchByPckgName(itemClicked);
// Move to pts fragment
UIUtils.loadFragment(getActivity().getSupportFragmentManager(), ContentHelper.PTS, null,
true);
} else if (groupPosition == 1) {
String[] items = itemClicked.split("\\|");
if (items.length > 1) {
SearchCacher.setLastBugSearch(items[0], items[1]);
// Move to bts fragment
UIUtils.loadFragment(getActivity().getSupportFragmentManager(), ContentHelper.BTS,
null, true);
}
}
return true;
}
});
}
项目:BehatReporter
文件:ReportHandler.java
public void show(JsonNode reportJson, OnChildClickListener listener) {
ReportParser reportParser = new ReportParser(reportJson);
List<JsonNode> features = null;
try {
features = reportParser.parseSubItems();
} catch (ParserException e) {
Message.getInstance(activity).showError(e);
return;
}
ItemsAdapterFactory featuresAdapterFactory = new FeaturesAdapterFactory();
ListHandler.getInstance(activity).show(reportParser, features, featuresAdapterFactory, listener);
ItemDepth.getInstance(activity).jumpForwardToStart();
}
项目:BehatReporter
文件:ListHandler.java
public void show(ItemParser superItemParser, List<JsonNode> items, ItemsAdapterFactory adapterFactory, OnChildClickListener listener) {
ExpandableListView listView = getListView(adapterFactory);
showTitle(superItemParser, adapterFactory);
showItems(items, adapterFactory, listView);
listView.setOnChildClickListener(listener);
}
项目:BehatReporter
文件:ItemHandler.java
public void show(ExpandableListView parent, int groupPosition, int childPosition, OnChildClickListener listener) {
ItemsAdapter itemsAdapter = (ItemsAdapter) parent.getExpandableListAdapter();
JsonNode item = itemsAdapter.getChild(groupPosition, childPosition);
ItemParser itemParser = itemsAdapter.getItemParserFactory().getItemParser(item);
showSubItems(itemsAdapter, item, itemParser, listener);
}
项目:BehatReporter
文件:ItemHandler.java
private void showSubItems(ItemsAdapter itemsAdapter, JsonNode item, ItemParser itemParser, OnChildClickListener listener) {
if (itemParser.hasSubItems()) {
List<JsonNode> subItems = getSubItems(itemParser);
if (subItems != null) {
ItemsAdapterFactory subItemsAdapterFactory = itemsAdapter.getSubItemsAdapterFactory(item);
ListHandler.getInstance(activity).show(itemParser, subItems, subItemsAdapterFactory, listener);
ItemDepth.getInstance(activity).stepForward();
}
}
}
项目:AndroidViewHelper
文件:ExpandableListViewWrapper.java
/**
* @see ExpandableListView#setOnChildClickListener(OnChildClickListener)
*/
public W setOnChildClickListener(OnChildClickListener onChildClickListener) {
mView.setOnChildClickListener(onChildClickListener);
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);
}
项目:EntboostIM
文件:MemberSelectActivity.java
private void initContactView() {
contactlistView = (ExpandableListView) findViewById(R.id.friendlist);
friendAdapter = new ContactAdapter(this, contactlistView);
friendAdapter.setExcludeUids(excludeUids);
friendAdapter.setSelectMember(true);
if (selectType==SELECT_TYPE_SINGLE)
friendAdapter.setSelectOne(true);
//点击成员事件
contactListener = new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Object obj = friendAdapter.getChild(groupPosition, childPosition);
if (obj instanceof ContactInfo) {
//if (checkSelfGroup(obj)) {
ContactInfo contactInfo = (ContactInfo)obj;
if (selectType==SELECT_TYPE_MULTI) {
ImageView selectImg = (ImageView) v.findViewById(R.id.user_select);
if (selectImg.getVisibility() == View.GONE || selectImg.getVisibility() == View.INVISIBLE) {
return true;
}
Drawable srcImg = selectImg.getDrawable();
//List<Object> selectedMap = MyApplication.getInstance().getSelectedUserList();
if (srcImg == null) {
selectImg.setImageResource(R.drawable.uitb_57);
MemberSelectActivity.addSelectedContact(contactInfo);
//selectedMap.add(obj);
} else {
selectImg.setImageDrawable(null);
MemberSelectActivity.removeSelectedContact(contactInfo);
//selectedMap.remove(obj);
}
MemberSelectActivity.this.onSelectedMembersChange();
} else {
if (contactInfo.getCon_uid()!=null && !excludeUids.contains(contactInfo.getCon_uid())) {
MemberSelectActivity.addSelectedContact(contactInfo);
MemberSelectActivity.this.onClickOneMember();
}
}
//}
}
return true;
}
};
contactlistView.setAdapter(friendAdapter);
contactlistView.setOnChildClickListener(contactListener);
}
项目:AndroidPAD
文件:SuperTreeViewAdapter.java
public SuperTreeViewAdapter(Context view,OnChildClickListener stvClickEvent) {
parentContext = view;
this.stvClickEvent=stvClickEvent;
}
项目:dv-quiz
文件:MainActivity.java
private void loadListData() {
listDataHeader = new ArrayList<Category>();
listDataChild = new HashMap<Category, List<Quiz>>();
// get the listview
expListView = (ExpandableListView) findViewById(R.id.lvExp);
for (Category aCategory : Category.allOrderBy("Name ASC"))
{
List<Quiz> aQuizList = new ArrayList<Quiz>();
listDataHeader.add(aCategory);
for (Quiz aQuiz : aCategory.getQuizzesOrderBy("Name ASC"))
{
aQuizList.add(aQuiz);
}
listDataChild.put(aCategory, aQuizList);
}
listAdapter = new dvExpandableListAdapter<Category, Quiz>(this, listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
expListView.setOnChildClickListener(new OnChildClickListener()
{
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
//Ask the user if they want to quit
selectedQuiz = (Quiz) MainActivity.this.listAdapter.getChild(groupPosition, childPosition);
dvQuizContext.getInstance().setValue("selectedQuiz", selectedQuiz);
// TODO i18n
AlertDialog.Builder confirmDialog = new AlertDialog.Builder(MainActivity.this);
confirmDialog.setIcon(android.R.drawable.ic_dialog_info);
confirmDialog.setTitle("Start Quiz");
confirmDialog.setMessage(String.format("Do you want to start the Quiz: %s?", selectedQuiz.toString()));
confirmDialog.setPositiveButton("Yes", new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
MainActivity.this.startActivity(new Intent(MainActivity.this, QuizActivity.class));
}
});
confirmDialog.setNegativeButton("No", null);
confirmDialog.show();
return true;
}
});
}
项目:andRoc
文件:ActLocoExpList.java
public void initView() {
setContentView(R.layout.locoexplist);
m_ListView = (ExpandableListView) findViewById(R.id.locoExpList);
Iterator<Mobile> it = m_RocrailService.m_Model.m_LocoMap.values().iterator();
while( it.hasNext() ) {
Mobile loco = it.next();
if(loco.isShow())
m_MobileList.add(loco);
}
it = m_RocrailService.m_Model.m_CarMap.values().iterator();
while( it.hasNext() ) {
Mobile car = it.next();
if(car.isShow())
m_MobileList.add(car);
}
Collections.sort(m_MobileList, new LocoSort(m_RocrailService.Prefs.SortByAddr));
m_ListView.setOnChildClickListener(new OnChildClickListener()
{
@Override
public boolean onChildClick(ExpandableListView list, View view, int group, int position, long id) {
// Set selected loco.
System.out.println("group/position="+group+"/"+position);
position = m_Adapter.getRealPosition(group, position);
System.out.println("real position="+position);
ActLocoExpList.this.setResult(position);
finish();
return false;
}
});
m_Adapter = new LocoExpListAdapter(this, m_MobileList, m_RocrailService.Prefs.Category);
m_ListView.setAdapter(m_Adapter);
setResult(-1);
}
项目:rsmovel-android
文件:Item_1_Fragment.java
@Override
protected void onPostExecute(JSONArray json) {
final List<String> listDataHeader = new ArrayList<String>();
final HashMap<String, List<Child>> listDataChild = new HashMap<String, List<Child>>();
JSONArray itens = null;
try {
setDestaques();
alternateViewPager();
List<Child> temp = new ArrayList<Child>();
Child child = null;
for (int i = 0; i < json.length(); i++) {
String categoria = (json.getJSONObject(i).getString(TAG_CATEGORIA));
itens = json.getJSONObject(i).getJSONArray(TAG_ITENS);
listDataHeader.add(categoria);
temp = new ArrayList<Child>();
for (int j = 0; j < itens.length(); j++) {
child = new Child();
child.setTitulo(itens.getJSONObject(j).getString(TAG_TITULO));
child.setUrl(itens.getJSONObject(j).getString(TAG_URL));
temp.add(child);
listDataChild.put(listDataHeader.get(i), temp);
}
}
listAdapter = new ExpandableListAdapter(getActivity(), listDataHeader, listDataChild);
expListView.setAdapter(listAdapter);
expListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
String item = ((Child) listAdapter.getChild(groupPosition, childPosition))
.getTitulo();
String url = ((Child) listAdapter.getChild(groupPosition, childPosition)).getUrl();
redirect(url, item);
return false;
}
});
} catch (Exception e) {
e.printStackTrace();
}
if (dialog.isShowing())
dialog.dismiss();
}
项目:AEISTMobileDROID
文件:EventosFrag.java
public void doAfter(final LayoutInflater inflater) {
JsonArrayRequest req2 = new JsonArrayRequest(url2,
new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
//be proud of this one
try {
int evAnt = ((JSONObject) response.get(0)).getInt("evento_id");
for (int i = 0,k=0; i < response.length(); i++) {
JSONObject evento = (JSONObject) response.get(i);
//caso o Evento nao tenha info adicional
if(evento.getString("texto_add").equals("nada")) {
Log.d(TAG, "it happens");
evAnt=evento.getInt("evento_id");
k++;
continue;
}
//se o proximo evento for diferente do anterior
if(evAnt!=evento.getInt("evento_id")) {
evAnt=evento.getInt("evento_id");
k++;
}
EventoContainer temp = eventosList.get(k);
temp.addMisc(evento.getString("texto_add"));
eventosList.put(k, temp);
}
} catch(JSONException e) {
e.printStackTrace();
Toast.makeText(getActivity().getApplicationContext(),
"Error: " + e.getMessage(),
Toast.LENGTH_LONG).show();
}
//DEPOIS DE RECEBER DADOS JSON
ViewGroup header = (ViewGroup) inflater.inflate(R.layout.header_eventos, listaEventos,
false);
listaEventos.addHeaderView(header, null, false);
eventosListAdapter = new EventoExpAdapter(eventosList,getActivity());
listaEventos.setAdapter(eventosListAdapter);
listaEventos.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
if(childPosition==1) {
int realPos = eventosList.size() - groupPosition - 1;
String link = eventosList.get(realPos).getEventoLink();
if(link.contains("http://") || link.contains("https://")) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
startActivity(browserIntent);
}
}
return false;
}
});
AppController.getInstance().hidepDialog();
}
}
, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Erroir: " + error.getMessage());
AppController.getInstance().hidepDialog();
}
});
AppController.getInstance().addToRequestQueue(req2);
}
项目:AndroidPAD
文件:SuperTreeViewAdapter.java
public SuperTreeViewAdapter(Context view,OnChildClickListener stvClickEvent) {
parentContext = view;
this.stvClickEvent=stvClickEvent;
}
项目:task4java
文件:MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initializeView();
if (expandableListView != null) {
expandableListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
MainMenuItem item = ((ExpandableListAdapter)parent.getExpandableListAdapter()).getChild(groupPosition, childPosition);
Intent itemIntent = new Intent(MainActivity.this, item.targetClass);
startActivity(itemIntent);
return false;
}
});
}
loadData();
}