android.widget.WrapperListAdapter Java Examples

The following examples show how to use android.widget.WrapperListAdapter. 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: AsyncNavigationAdapter.java    From rss with GNU General Public License v3.0 7 votes vote down vote up
@Override
protected
void onPostExecute(String[][] result)
{
    // Set the titles & counts arrays in this file and notify the adapter.
    ListView navigationList = (ListView) m_activity.findViewById(R.id.fragment_navigation_drawer);
    WrapperListAdapter wrapperAdapter = (WrapperListAdapter) navigationList.getAdapter();
    ArrayAdapter<String[]> adapter = (ArrayAdapter<String[]>) wrapperAdapter.getWrappedAdapter();

    // Update the data in the adapter.
    adapter.clear();
    adapter.addAll(result);

    // Update the subtitle.
    if(Constants.s_fragmentFeeds.isVisible())
    {
        Utilities.setTitlesAndDrawerAndPage(null, -10);
    }
}
 
Example #2
Source File: DragAndDropHandler.java    From ListViewAnimations with Apache License 2.0 6 votes vote down vote up
/**
 * @throws java.lang.IllegalStateException    if the adapter does not have stable ids.
 * @throws java.lang.IllegalArgumentException if the adapter does not implement {@link com.nhaarman.listviewanimations.util.Swappable}.
 */
private void setAdapterInternal(@NonNull final ListAdapter adapter) {
    ListAdapter actualAdapter = adapter;
    if (actualAdapter instanceof WrapperListAdapter) {
        actualAdapter = ((WrapperListAdapter) actualAdapter).getWrappedAdapter();
    }

    if (!actualAdapter.hasStableIds()) {
        throw new IllegalStateException("Adapter doesn't have stable ids! Make sure your adapter has stable ids, and override hasStableIds() to return true.");
    }

    if (!(actualAdapter instanceof Swappable)) {
        throw new IllegalArgumentException("Adapter should implement Swappable!");
    }

    mAdapter = actualAdapter;
}
 
Example #3
Source File: ScrollingPauseLoadManager.java    From sketch with Apache License 2.0 6 votes vote down vote up
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if (AppConfig.INSTANCE.getBoolean(view.getContext(), AppConfig.Key.SCROLLING_PAUSE_LOAD) && view.getAdapter() != null) {
        ListAdapter listAdapter = view.getAdapter();
        if (listAdapter instanceof WrapperListAdapter) {
            listAdapter = ((WrapperListAdapter) listAdapter).getWrappedAdapter();
        }
        if (listAdapter instanceof BaseAdapter) {
            if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
                if (!sketch.getConfiguration().isPauseLoadEnabled()) {
                    sketch.getConfiguration().setPauseLoadEnabled(true);
                }
            } else if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
                if (sketch.getConfiguration().isPauseLoadEnabled()) {
                    sketch.getConfiguration().setPauseLoadEnabled(false);
                    ((BaseAdapter) listAdapter).notifyDataSetChanged();
                }
            }
        }
    }

    if (absListScrollListener != null) {
        absListScrollListener.onScrollStateChanged(view, scrollState);
    }
}
 
Example #4
Source File: PXHierarchyListener.java    From pixate-freestyle-android with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void setAdapterProxy(final AdapterView adapterView) {
    Adapter adapter = adapterView.getAdapter();
    if (adapter == null || Proxy.isProxyClass(adapter.getClass())) {
        // Thou shalt not Proxy a Proxy!
        return;
    }
    if (adapterView instanceof ExpandableListView) {
        // FIXME - Right now, skip the support for ExpandableListView.
        // This class throws exceptions on setAdapter(Adapter), and requires
        // a special adapter that only works with it.... Lame API break!
        return;
    }
    // Collect the Adapter sub-interfaces that we
    // would like to proxy.
    List<Class<?>> interfaces = new ArrayList<Class<?>>(4);
    interfaces.add(Adapter.class);
    if (adapter instanceof ListAdapter) {
        interfaces.add(ListAdapter.class);
    }
    if (adapter instanceof WrapperListAdapter) {
        interfaces.add(WrapperListAdapter.class);
    }
    if (adapter instanceof SpinnerAdapter) {
        interfaces.add(SpinnerAdapter.class);
    }

    // Create a proxy for the adapter to intercept
    // the 'getView'
    Adapter newAdapter = (Adapter) PXAdapterInvocationHandler.newInstance(adapterView,
            interfaces.toArray(new Class<?>[interfaces.size()]));

    // Set the proxy as the adapter
    adapterView.setAdapter(newAdapter);
}
 
Example #5
Source File: AbsListViewScrollTarget.java    From QuickReturn with MIT License 5 votes vote down vote up
private QuickReturnAdapter getAdapter() {
  ListAdapter adapter = listView.getAdapter();

  if (adapter instanceof WrapperListAdapter) {
    adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
  }

  if (!(adapter instanceof QuickReturnAdapter)) {
    throw new UnsupportedOperationException(
        "Your QuickReturn ListView adapter must be an instance of QuickReturnAdapter.");
  }

  return (QuickReturnAdapter) adapter;
}
 
Example #6
Source File: AnimatedHeaderGridView.java    From AnimatedGridView with Apache License 2.0 5 votes vote down vote up
public BaseAdapter getBaseAdapter() {
    Adapter adapter = getAdapter();
    if (adapter != null) {
        if (adapter instanceof WrapperListAdapter) {
            adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
        }

        if (adapter instanceof BaseAdapter) {
            return (BaseAdapter) adapter;
        }
    }
    return null;
}
 
Example #7
Source File: AnimatedGridView.java    From AnimatedGridView with Apache License 2.0 5 votes vote down vote up
public BaseAdapter getBaseAdapter() {
    Adapter adapter = getAdapter();
    if (adapter != null) {
        if (adapter instanceof WrapperListAdapter) {
            adapter = ((WrapperListAdapter) adapter).getWrappedAdapter();
        }

        if (adapter instanceof BaseAdapter) {
            return (BaseAdapter) adapter;
        }
    }
    return null;
}
 
Example #8
Source File: WrapperListAdapterAssert.java    From assertj-android with Apache License 2.0 4 votes vote down vote up
public WrapperListAdapterAssert(WrapperListAdapter actual) {
  super(actual, WrapperListAdapterAssert.class);
}