Java Code Examples for android.widget.ExpandableListView#setOnGroupExpandListener()

The following examples show how to use android.widget.ExpandableListView#setOnGroupExpandListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpandableListActivity.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the screen state (current list and other views) when the
 * content changes.
 * 
 * @see Activity#onContentChanged()
 */
@Override
public void onContentChanged() {
    super.onContentChanged();
    View emptyView = findViewById(com.android.internal.R.id.empty);
    mList = (ExpandableListView)findViewById(com.android.internal.R.id.list);
    if (mList == null) {
        throw new RuntimeException(
                "Your content must have a ExpandableListView whose id attribute is " +
                "'android.R.id.list'");
    }
    if (emptyView != null) {
        mList.setEmptyView(emptyView);
    }
    mList.setOnChildClickListener(this);
    mList.setOnGroupExpandListener(this);
    mList.setOnGroupCollapseListener(this);
    
    if (mFinishedStart) {
        setListAdapter(mAdapter);
    }
    mFinishedStart = true;
}
 
Example 2
Source File: OfflineMapActivity_Old.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 初始化所有城市列表
 */
public void initAllCityList() {
	// 扩展列表
	View provinceContainer = LayoutInflater.from(OfflineMapActivity_Old.this)
			.inflate(R.layout.offline_province_listview, null);
	mAllOfflineMapList = (ExpandableListView) provinceContainer
			.findViewById(R.id.province_download_list);
	initProvinceListAndCityMap();
	// adapter = new OfflineListAdapter(provinceList, cityMap, amapManager,
	// OfflineMapActivity_Old.this);
	adapter = new OfflineListAdapter(provinceList, amapManager,
			OfflineMapActivity_Old.this);
	// 为列表绑定数据源
	mAllOfflineMapList.setAdapter(adapter);
	// adapter实现了扩展列表的展开与合并监听
	mAllOfflineMapList.setOnGroupCollapseListener(adapter);
	mAllOfflineMapList.setOnGroupExpandListener(adapter);
	mAllOfflineMapList.setGroupIndicator(null);
}
 
Example 3
Source File: RecentTabsPage.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = buildAdapter(activity, recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setOnChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setOnGroupCollapseListener(this);
    mListView.setOnGroupExpandListener(this);
    mListView.setOnCreateContextMenuListener(this);

    mView.addOnAttachStateChangeListener(this);
    ApplicationStatus.registerStateListenerForActivity(this, activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    onUpdated();
}
 
Example 4
Source File: RecentTabsPage.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(Activity activity, RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = buildAdapter(activity, recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setOnChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setOnGroupCollapseListener(this);
    mListView.setOnGroupExpandListener(this);
    mListView.setOnCreateContextMenuListener(this);

    mView.addOnAttachStateChangeListener(this);
    ApplicationStatus.registerStateListenerForActivity(this, activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    onUpdated();
}
 
Example 5
Source File: SettingView.java    From qplayer-sdk with MIT License 5 votes vote down vote up
private void init() {    	
    mInflater = LayoutInflater.from(this);
    initData();
    mAdapter = new MyExpandableListViewAdapter();
    mListView = (ExpandableListView) findViewById(R.id.my_list);
    mListView.setAdapter(mAdapter);
    mListView.setOnGroupClickListener(this);
    mListView.setOnChildClickListener(this);
    mListView.setOnGroupExpandListener(this);
}
 
Example 6
Source File: RecentTabsPage.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor returns an instance of RecentTabsPage.
 *
 * @param activity The activity this view belongs to.
 * @param recentTabsManager The RecentTabsManager which provides the model data.
 */
public RecentTabsPage(ChromeActivity activity, RecentTabsManager recentTabsManager) {
    mActivity = activity;
    mRecentTabsManager = recentTabsManager;

    mTitle = activity.getResources().getString(R.string.recent_tabs);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);
    mRecentTabsManager.setUpdatedCallback(this);
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = (ViewGroup) inflater.inflate(R.layout.recent_tabs_page, null);
    mListView = (ExpandableListView) mView.findViewById(R.id.odp_listview);
    mAdapter = new RecentTabsRowAdapter(activity, recentTabsManager);
    mListView.setAdapter(mAdapter);
    mListView.setOnChildClickListener(this);
    mListView.setGroupIndicator(null);
    mListView.setOnGroupCollapseListener(this);
    mListView.setOnGroupExpandListener(this);
    mListView.setOnCreateContextMenuListener(this);

    mView.addOnAttachStateChangeListener(this);
    ApplicationStatus.registerStateListenerForActivity(this, activity);
    // {@link #mInForeground} will be updated once the view is attached to the window.

    if (activity.getBottomSheet() != null) {
        View recentTabsRoot = mView.findViewById(R.id.recent_tabs_root);
        ApiCompatibilityUtils.setPaddingRelative(recentTabsRoot,
                ApiCompatibilityUtils.getPaddingStart(recentTabsRoot), 0,
                ApiCompatibilityUtils.getPaddingEnd(recentTabsRoot),
                activity.getResources().getDimensionPixelSize(
                        R.dimen.bottom_control_container_height));
    }

    onUpdated();
}