Java Code Examples for android.widget.ExpandableListView.OnChildClickListener

The following are top voted examples for showing how to use android.widget.ExpandableListView.OnChildClickListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: mobilesafe   File: CommonNumberQueryActivity.java   Source Code and License 6 votes vote down vote up
/**
 * ������չ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;
		}
	});
}
 
Example 2
Project: Habit-Cookbook   File: HomeScreen.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
        }
    });
}
 
Example 3
Project: bbsbrowser_android   File: RecommendBoardView.java   Source Code and License 6 votes vote down vote up
/**
 * 返回推荐版面
 */
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;		
}
 
Example 4
Project: android-project-wo2b   File: BlossomHomeFragment.java   Source Code and License 6 votes vote down vote up
@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;
		}
	});
}
 
Example 5
Project: ActivityLauncher   File: AllTasksListFragment.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 6
Project: yiim_v2   File: InviteFriendActivity.java   Source Code and License 6 votes vote down vote up
@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;
		}
	});
}
 
Example 7
Project: zen4android   File: ZenMenuFragment.java   Source Code and License 6 votes vote down vote up
@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;
		}
	});
}
 
Example 8
Project: software   File: OnlineFragment.java   Source Code and License 6 votes vote down vote up
/** 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);
}
 
Example 9
Project: buddycloud-android   File: GenericChannelsFragment.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 10
Project: EntboostIM   File: FriendMainFragment.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 11
Project: quickmark   File: FragmentPage3.java   Source Code and License 5 votes vote down vote up
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;
		}

	});
}
 
Example 12
Project: androidsummary   File: ContacterFragment.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 13
Project: MonsterHunter3UDatabase   File: ArmorExpandableListFragment.java   Source Code and License 5 votes vote down vote up
@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;
	}
 
Example 14
Project: maas   File: ClusterSaharaActivity.java   Source Code and License 5 votes vote down vote up
@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() ;
}
 
Example 15
Project: ChicagoWaterWalk-Android   File: AllRoutesFragment.java   Source Code and License 5 votes vote down vote up
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());
     		}
     	}
     });
 }
 
Example 16
Project: opentasks   File: TaskListFragment.java   Source Code and License 5 votes vote down vote up
/**
 * 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();

}
 
Example 17
Project: DebianDroid   File: SUBSFragment.java   Source Code and License 5 votes vote down vote up
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;
        }
    });
}
 
Example 18
Project: BehatReporter   File: ReportHandler.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 19
Project: BehatReporter   File: ListHandler.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 20
Project: BehatReporter   File: ItemHandler.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 21
Project: BehatReporter   File: ItemHandler.java   Source Code and License 5 votes vote down vote up
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();
		}
	}
}
 
Example 22
Project: AndroidViewHelper   File: ExpandableListViewWrapper.java   Source Code and License 4 votes vote down vote up
/**
* @see ExpandableListView#setOnChildClickListener(OnChildClickListener)
*/
 public W setOnChildClickListener(OnChildClickListener onChildClickListener) {
     mView.setOnChildClickListener(onChildClickListener);
     return (W) this;
 }
 
Example 23
Project: EntboostIM   File: MemberSelectActivity.java   Source Code and License 4 votes vote down vote up
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);
	}
 
Example 24
Project: EntboostIM   File: MemberSelectActivity.java   Source Code and License 4 votes vote down vote up
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);
}
 
Example 25
Project: EntboostIM   File: MemberSelectActivity.java   Source Code and License 4 votes vote down vote up
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);
}
 
Example 26
Project: AndroidPAD   File: SuperTreeViewAdapter.java   Source Code and License 4 votes vote down vote up
public SuperTreeViewAdapter(Context view,OnChildClickListener stvClickEvent) {
	parentContext = view;
	this.stvClickEvent=stvClickEvent;
}
 
Example 27
Project: dv-quiz   File: MainActivity.java   Source Code and License 4 votes vote down vote up
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;				
}
     	
     });
 }
 
Example 28
Project: andRoc   File: ActLocoExpList.java   Source Code and License 4 votes vote down vote up
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);

}
 
Example 29
Project: rsmovel-android   File: Item_1_Fragment.java   Source Code and License 4 votes vote down vote up
@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();

}
 
Example 30
Project: AEISTMobileDROID   File: EventosFrag.java   Source Code and License 4 votes vote down vote up
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); 
}
 
Example 31
Project: AndroidPAD   File: SuperTreeViewAdapter.java   Source Code and License 4 votes vote down vote up
public SuperTreeViewAdapter(Context view,OnChildClickListener stvClickEvent) {
	parentContext = view;
	this.stvClickEvent=stvClickEvent;
}
 
Example 32
Project: task4java   File: MainActivity.java   Source Code and License 3 votes vote down vote up
@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();
}