Java Code Examples for android.widget.ExpandableListAdapter

The following are top voted examples for showing how to use android.widget.ExpandableListAdapter. 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: yyox   File: ExpandedListUtils.java   View source code 7 votes vote down vote up
public static void setExpandedListViewHeightBasedOnChildren(ExpandableListView listView, int groupPosition) {
    ExpandableListAdapter listAdapter = listView.getExpandableListAdapter();
    if (listAdapter == null) {
        return;
    }
    View listItem = listAdapter.getChildView(groupPosition, 0, true, null,
            listView);
    listItem.measure(0, 0);
    int appendHeight = 0;
    for (int i = 0; i < listAdapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height += appendHeight;
    listView.setLayoutParams(params);
}
 
Example 2
Project: yyox   File: ExpandedListUtils.java   View source code 6 votes vote down vote up
public static void setCollapseListViewHeightBasedOnChildren(ExpandableListView listView, int groupPosition) {
    ExpandableListAdapter listAdapter = listView.getExpandableListAdapter();
    if (listAdapter == null) {
        return;
    }
    View listItem = listAdapter.getChildView(groupPosition, 0, true, null,
            listView);
    listItem.measure(0, 0);
    int appendHeight = 0;
    for (int i = 0; i < listAdapter.getChildrenCount(groupPosition); i++) {
        appendHeight += listItem.getMeasuredHeight();
    }
    ViewGroup.LayoutParams params = listView.getLayoutParams();
    params.height -= appendHeight;
    listView.setLayoutParams(params);
}
 
Example 3
Project: easyfilemanager   File: RootsFragment.java   View source code 6 votes vote down vote up
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
Example 4
Project: exciting-app   File: ExpandableHListView.java   View source code 6 votes vote down vote up
/**
 * Sets the adapter that provides data to this view.
 *
 * @param adapter The adapter that provides data to this view.
 */
public void setAdapter( ExpandableListAdapter adapter ) {
	// Set member variable
	mAdapter = adapter;

	if( adapter != null ) {
		// Create the connector
		mConnector = new ExpandableHListConnector( adapter );
	}
	else {
		mConnector = null;
	}

	// Link the ListView (superclass) to the expandable list data through the connector
	super.setAdapter( mConnector );
}
 
Example 5
Project: FireFiles   File: RootsFragment.java   View source code 6 votes vote down vote up
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
Example 6
Project: simple-share-android   File: RootsFragment.java   View source code 6 votes vote down vote up
private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for(int i=0; i < length; i++) {
            if(list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
 
Example 7
Project: StickyAnimatedExpandableGridView   File: StickyHeaderExpandableGridView.java   View source code 6 votes vote down vote up
@Override
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);
    mAdapter = adapter;
    mHeaderView = adapter.getGroupView(0, false, null, this);
    boolean isBaseAdapter = adapter instanceof BaseExpandableListAdapter;
    if (cacheHeaderViews == null) {
        if (isBaseAdapter) {
            int typeCount = ((BaseExpandableListAdapter) adapter).getGroupTypeCount();
            cacheHeaderViews = new SparseArray<>(typeCount);
        }
        cacheHeaderViews = new SparseArray<>(1);
    }
    if (mHeaderView != null) {
        int groupType = 0;
        if (isBaseAdapter) {
            groupType = ((BaseExpandableListAdapter) adapter).getGroupType(0);
            cacheHeaderViews.put(groupType, mHeaderView);
        }
        cacheHeaderViews.put(groupType, mHeaderView);
    }
}
 
Example 8
Project: connectedteam-android   File: ListOrExpandableListFragment.java   View source code 6 votes vote down vote up
public void setExpandableListAdapter(ExpandableListAdapter adapter){
	mAdapter=null;
	boolean hadAdapter = mExpandableListAdapter != null;
	mExpandableListAdapter = adapter;
	if (mList!=null && !(mList instanceof ExpandableListView)){
		changeListView(true);
		
	}
	if (mList instanceof ExpandableListView) {
        ((ExpandableListView)mList).setAdapter(adapter);
        if (!mListShown && !hadAdapter) {
            // The list was hidden, and previously didn't have an
            // adapter.  It is now time to show it.
            setListShown(true, getView().getWindowToken() != null);
        }
    }
   
}
 
Example 9
Project: ActivityLauncher   File: AllTasksListFragment.java   View source code 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 10
Project: IntentsLab   File: BrowseComponentsFragment.java   View source code 6 votes vote down vote up
private void clearDataAndShowLoadingIndicator() {
    if (mProgressIndicator != null) {
        mNonExpandableListView.setEmptyView(null);
        mNonExpandableListView.setVisibility(View.GONE);
        mNonExpandableListView.setOnItemClickListener(null);
        mNonExpandableListView.setAdapter(null);

        mExpandableListView.setEmptyView(null);
        mExpandableListView.setVisibility(View.GONE);
        mExpandableListView.setOnChildClickListener(null);
        mExpandableListView.setAdapter((ExpandableListAdapter) null);

        mEmptyMessage.setVisibility(View.GONE);
        mCustomErrorText.setVisibility(View.GONE);
        mProgressIndicator.setVisibility(View.VISIBLE);
    }

    mLoadedData = null;
}
 
Example 11
Project: MultiChoiceExpandableList   File: MultiChoiceExpandableListView.java   View source code 6 votes vote down vote up
@Override
public void setAdapter(final ExpandableListAdapter adapter){

	if (adapter == null)
		throw new NullPointerException("The adapter you passed was null");


	if (adapter instanceof MultiChoiceExpandableAdapter)
		this.mAdapterWrapper = (MultiChoiceExpandableAdapter) adapter;

	else if (mAdapterWrapper == null)
		mAdapterWrapper = new MultiChoiceExpandableAdapter(	adapter,
															this);
	else
		mAdapterWrapper.setWrappedAdapter(adapter);

	super.setAdapter(mAdapterWrapper);

	mCheckStore = new CheckStateStore(this); // Must do this to ensure
												// hasStableIds stays
												// current
}
 
Example 12
Project: opentasks   File: RetainExpandableListView.java   View source code 6 votes vote down vote up
public void expandGroups(long[] groupsToExpand)
{
    // this.expandedIds = expandedIds;
    if (groupsToExpand != null && groupsToExpand.length > 0)
    {
        ExpandableListAdapter adapter = getExpandableListAdapter();
        if (adapter != null)
        {
            for (int i = 0; i < adapter.getGroupCount(); i++)
            {
                long id = adapter.getGroupId(i);
                if (inArray(groupsToExpand, id))
                {
                    expandGroup(i);
                }
            }
        }
    }
}
 
Example 13
Project: opentasks   File: TaskListFragment.java   View source code 6 votes vote down vote up
private void selectChildView(ExpandableListView expandLV, int groupPosition, int childPosition, boolean force)
{
    if (groupPosition < mAdapter.getGroupCount() && childPosition < mAdapter.getChildrenCount(groupPosition))
    {
        // a task instance element has been clicked, get it's instance id and notify the activity
        ExpandableListAdapter listAdapter = expandLV.getExpandableListAdapter();
        Cursor cursor = (Cursor) listAdapter.getChild(groupPosition, childPosition);

        if (cursor == null)
        {
            return;
        }
        // TODO: for now we get the id of the task, not the instance, once we support recurrence we'll have to change that
        Long selectTaskId = cursor.getLong(cursor.getColumnIndex(Instances.TASK_ID));

        if (selectTaskId != null)
        {
            // Notify the active callbacks interface (the activity, if the fragment is attached to one) that an item has been selected.

            // TODO: use the instance URI one we support recurrence
            Uri taskUri = ContentUris.withAppendedId(Tasks.getContentUri(mAuthority), selectTaskId);

            mCallbacks.onItemSelected(taskUri, force, mInstancePosition);
        }
    }
}
 
Example 14
Project: easyfilemanager   File: RootsFragment.java   View source code 5 votes vote down vote up
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
 
Example 15
Project: Phial   File: KeyValueView.java   View source code 5 votes vote down vote up
public KeyValueView(Context context, KVSaver kvSaver) {
    super(context);
    this.kvSaver = kvSaver;

    inflate(context, R.layout.view_keyvalue, this);
    listView = findViewById(R.id.list_keyvalue);
    adapter = new KeyValueAdapter(LayoutInflater.from(context));
    listView.setAdapter((ExpandableListAdapter) adapter);

    updateData();
    kvSaver.addObserver(this);
}
 
Example 16
Project: Android-DFU-App   File: ExpandableListActivity.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(ExpandableListAdapter adapter) {
	synchronized (this) {
		ensureList();
		mAdapter = adapter;
		mList.setAdapter(adapter);
	}
}
 
Example 17
Project: MyFlightbookAndroid   File: FixedExpandableListActivity.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
void setListAdapter(ExpandableListAdapter adapter) {
    synchronized (this) {
        ensureList();
        mAdapter = adapter;
        mList.setAdapter(adapter);
    }
}
 
Example 18
Project: MyFlightbookAndroid   File: ExpandableListFragment.java   View source code 5 votes vote down vote up
/**
* Provide the cursor for the list view.
*/
    void setListAdapter(ExpandableListAdapter adapter) {
        boolean hadAdapter = mAdapter != null;
        mAdapter = adapter;
        if (mExpandableList != null) {
            mExpandableList.setAdapter(adapter);
            if (!mExpandableListShown && !hadAdapter) {
                // The list was hidden, and previously didn't have an
                // adapter. It is now time to show it.
                View v = getView();
                if (v != null)
                    setListShown(true, getView().getWindowToken() != null);
            }
        }
    }
 
Example 19
Project: Paper-Melody   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);

    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 20
Project: FireFiles   File: RootsFragment.java   View source code 5 votes vote down vote up
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
 
Example 21
Project: simple-share-android   File: RootsFragment.java   View source code 5 votes vote down vote up
private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i=0; i<adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id)) list.expandGroup(i);
            }
        }
    }
}
 
Example 22
Project: Veggietizer   File: Popup.java   View source code 5 votes vote down vote up
/**
 * Shows the popup that is opened when the user clicks on the info action button of a details page.
 * An {@link ExpandableListView} is used as a layout.
 *
 * @param context The context to show the popup in.
 * @param title The popup's title.
 * @param groups The expandable categories.
 * @param entries Each category in <code>groups</code> shows one entry when expanded.
 * @return The dialog.
 */
private static AlertDialog showDetailsInfo(Context context, String title,
                                           String[] groups, String[] entries,
                                           DialogInterface.OnClickListener onSubmitListener) {
    if (groups.length != entries.length) {
        throw new IllegalArgumentException();
    }

    // Custom title
    TextView customTitle = (TextView) LayoutInflater.from(context).inflate(R.layout.popup_title, null);
    customTitle.setText(title);

    View popupDetailsInfo = LayoutInflater.from(context)
            .inflate(R.layout.popup_details_info, null);
    ExpandableListView listViewDetailsInfo = (ExpandableListView)
            popupDetailsInfo.findViewById(R.id.expandablelistview_popup_details_info);
    ExpandableListAdapter adapter = createDetailsInfoAdapter(context, groups, entries);
    listViewDetailsInfo.setAdapter(adapter);

    AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context);
    popupBuilder.setView(popupDetailsInfo)
            .setNeutralButton(R.string.ok, onSubmitListener)
            .setCustomTitle(customTitle);

    AlertDialog dialog = popupBuilder.create();
    dialog.show();

    Utility.setFont(FontManager.Font.ROBOTO_LIGHT, new TextView[]{
            customTitle
    });

    return dialog;
}
 
Example 23
Project: Veggietizer   File: Popup.java   View source code 5 votes vote down vote up
private static ExpandableListAdapter createDetailsInfoAdapter(Context context, String[] groups, String[] entries) {
    // Creates the upper list level
    List<Map<String, String>> groupData = new LinkedList<>();
    String groupName = "GroupName";
    String[] groupFrom = new String[] {groupName};
    int[] groupTo = new int[] {R.id.component_details_info_group};

    for (String g : groups) {
        Map<String, String> group = new HashMap<>(1);
        group.put(groupName, g);
        groupData.add(group);
    }

    // Creates the lower list level
    List<List<Map<String, String>>> childData = new LinkedList<>();
    String groupContent = "Content";
    String[] childFrom = new String[] {groupContent};
    int[] childTo = new int[] {R.id.component_details_info_entry};

    for (String e : entries) {
        List<Map<String, String>> content = new LinkedList<>();
        Map<String, String> entry = new HashMap<>(1);

        entry.put(groupContent, e);
        content.add(entry);
        childData.add(content);
    }

    return new DetailsInfoAdapter(context, groupData,
            groupFrom, groupTo, childData, childFrom, childTo);
}
 
Example 24
Project: ScribaNotesApp   File: ExpandableListActivity.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(ExpandableListAdapter adapter) {
	synchronized (this) {
		ensureList();
		mAdapter = adapter;
		mList.setAdapter(adapter);
	}
}
 
Example 25
Project: m-dan   File: Utils.java   View source code 5 votes vote down vote up
/**
 * Sets ExpandableListView height dynamically based on the height of the items.
 *
 * @param expandablelistView to be resized
 * @return true if the expandablelistView is successfully resized, false otherwise
 */
public static boolean setListViewHeightBasedOnItems(ExpandableListView expandablelistView) {

    ExpandableListAdapter expandableListAdapter = expandablelistView.getExpandableListAdapter();
    if (expandableListAdapter != null) {

        int numberOfGroups = expandableListAdapter.getGroupCount();
        int numberOfDividers = numberOfGroups;

        // Get total height of all items of all group expanded
        int totalItemsHeight = 0;

        for (int groupPos = 0; groupPos < numberOfGroups; groupPos++) {

            View item = expandableListAdapter.getGroupView(groupPos, expandablelistView.isGroupExpanded(groupPos), null, expandablelistView);
            item.measure(0, 0);
            totalItemsHeight += item.getMeasuredHeight();

            if(expandablelistView.isGroupExpanded(groupPos)) {
                totalItemsHeight += calculateHeightOfOneGroup(groupPos, expandableListAdapter, expandablelistView);
                numberOfDividers += expandableListAdapter.getChildrenCount(groupPos);
            }
        }

        // Get total height of all item dividers.
        int totalDividersHeight = expandablelistView.getDividerHeight() * numberOfDividers;

        // Set list height.
        ViewGroup.LayoutParams params = expandablelistView.getLayoutParams();
        params.height = totalItemsHeight + totalDividersHeight + 5;
        expandablelistView.setLayoutParams(params);
        expandablelistView.requestLayout();

        return true;
    } else {
        return false;
    }
}
 
Example 26
Project: m-dan   File: Utils.java   View source code 5 votes vote down vote up
/**
 * Calculate the height of an expanded group dynamically based on the height of the items.
 *
 * @param groupPos position of the current group
 * @param expandableListAdapter adapter of the expandableList
 * @param parent the parent that this view will eventually be attached to
 * @return true if the listView is successfully resized, false otherwise
 */
public static int calculateHeightOfOneGroup(int groupPos, ExpandableListAdapter expandableListAdapter, ViewGroup parent) {

    int numberOfItems = expandableListAdapter.getChildrenCount(groupPos);

    // Get total height of all items in the group
    int totalItemsHeight = 0;

    for (int itemPos = 0; itemPos < numberOfItems; itemPos++) {

        boolean lastItem = false;
        if(itemPos == numberOfItems-1){
            lastItem = true;
        }

        // Supprimer le if si on veut garder un truc générique. Ici, le if sert à gérer la cutom expandable en plus des expandables classiques
        View item;
        if(expandableListAdapter instanceof com.orange.ease.idunnololz.widgets.AnimatedExpandableListView.AnimatedExpandableListAdapter){
            item = ((AnimatedExpandableListView.AnimatedExpandableListAdapter) expandableListAdapter).getRealChildView(groupPos, itemPos, lastItem, null, parent);
        }else{
            item = expandableListAdapter.getChildView(groupPos, itemPos, lastItem, null, parent);
        }


        item.measure(0, 0);
        totalItemsHeight += item.getMeasuredHeight();
    }

    return totalItemsHeight;
}
 
Example 27
Project: m-dan   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);

    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 28
Project: lr_dialer   File: Common.java   View source code 5 votes vote down vote up
private void onScrollStateChanged(ExpandableListView elv, int scrollState)
{
	elv.setTag(AQuery.TAG_NUM, scrollState);
	if (scrollState == SCROLL_STATE_IDLE)
	{
		int first = elv.getFirstVisiblePosition();
		int last = elv.getLastVisiblePosition();
		int count = last - first;
		ExpandableListAdapter ela = elv.getExpandableListAdapter();
		for (int i = 0; i <= count; i++)
		{
			long packed = elv.getExpandableListPosition(i + first);
			int group = ExpandableListView.getPackedPositionGroup(packed);
			int child = ExpandableListView.getPackedPositionChild(packed);
			if (group >= 0)
			{
				View convertView = elv.getChildAt(i);
				Long targetPacked = (Long) convertView.getTag(AQuery.TAG_NUM);
				if (targetPacked != null && targetPacked.longValue() == packed)
				{
					if (child == -1)
					{
						ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
					}
					else
					{
						ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);
					}
					convertView.setTag(AQuery.TAG_NUM, null);
				}
				else
				{
					//AQUtility.debug("skip!");
				}
			}
		}
	}
}
 
Example 29
Project: newbee   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);

    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if (adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 30
Project: StickyAnimatedExpandableGridView   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);
    
    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 31
Project: AndroidAgent   File: OCSShowInventory.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.actvity_show_inventory);

    // Get the listview
    ExpandableListView maListView = (ExpandableListView) findViewById(R.id.myListView);

    // Set datas
    ExpandableListAdapter monListAdapter = new ExpandableSectionAdapter(this, Inventory.getInstance(this).getAllSections());

    // Set list adapter
    maListView.setAdapter(monListAdapter);
}
 
Example 32
Project: AeonDroid   File: TriggersActivity.java   View source code 5 votes vote down vote up
@Override
protected void onPostExecute(Cursor cursor) {
    ExpandableListAdapter ela = getExpandableListAdapter();
    if (ela == null) {
        setListAdapter(new AlertTriggerCursorAdapter(cursor, context, false, mEditButtonListener));
    }
    else {
        AlertTriggerCursorAdapter atca = (AlertTriggerCursorAdapter)getExpandableListAdapter();
        atca.changeCursor(cursor);
    }
}
 
Example 33
Project: Android-ExpandableListFragment   File: ExpandableListFragment.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(final ExpandableListAdapter adapter){
    final boolean hadAdapter = this.adapter != null;
    this.adapter = adapter;
    if(list != null){
        list.setAdapter(adapter);
        if(!isListShown && !hadAdapter){
            // The list was hidden, and previously didn't have an
            // adapter.  It is now time to show it.
            setListShown(true, getView().getWindowToken() != null);
        }
    }
}
 
Example 34
Project: mobile-android-studio   File: GDExpandableListActivity.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(ExpandableListAdapter adapter) {
    synchronized (this) {
        ensureLayout();
        mAdapter = adapter;
        mList.setAdapter(adapter);
    }
}
 
Example 35
Project: Android-SlideSupport-ListLayouts   File: SlideSupportExpandableListView.java   View source code 5 votes vote down vote up
@Override
public void setAdapter(ExpandableListAdapter adapter) {
    if (adapter instanceof SlideAdapter) {
        SlideAdapter slideAdapter = (SlideAdapter) adapter;
        slideAdapter.setSlideSupporter(mActionHandler);
    }

    super.setAdapter(adapter);
}
 
Example 36
Project: Subreddit_Reader   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);

    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 37
Project: iGuide   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);

    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 38
Project: XiaomiOrder   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);
    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 39
Project: XiaomiOrder   File: AnimatedExpandableListView.java   View source code 5 votes vote down vote up
/**
 * @see ExpandableListView#setAdapter(ExpandableListAdapter)
 */
public void setAdapter(ExpandableListAdapter adapter) {
    super.setAdapter(adapter);
    // Make sure that the adapter extends AnimatedExpandableListAdapter
    if(adapter instanceof AnimatedExpandableListAdapter) {
        this.adapter = (AnimatedExpandableListAdapter) adapter;
        this.adapter.setParent(this);
    } else {
        throw new ClassCastException(adapter.toString() + " must implement AnimatedExpandableListAdapter");
    }
}
 
Example 40
Project: Android-nRF-Toolbox   File: ExpandableListActivity.java   View source code 5 votes vote down vote up
/**
 * Provide the adapter for the expandable list.
 */
public void setListAdapter(ExpandableListAdapter adapter) {
	synchronized (this) {
		ensureList();
		mAdapter = adapter;
		mList.setAdapter(adapter);
	}
}