Search in sources :

Example 21 with Adapter

use of android.widget.Adapter in project androidquery by androidquery.

the class Common method onItemSelected.

@Override
public void onItemSelected(AdapterView<?> parent, View v, int pos, long id) {
    invoke(parent, v, pos, id);
    if (galleryListener != null) {
        galleryListener.onItemSelected(parent, v, pos, id);
    }
    if (galleryListen) {
        Integer selected = (Integer) parent.getTag(AQuery.TAG_NUM);
        if (selected != pos) {
            Adapter adapter = parent.getAdapter();
            parent.setTag(AQuery.TAG_NUM, pos);
            int count = parent.getChildCount();
            //AQUtility.debug("redrawing", count);
            int first = parent.getFirstVisiblePosition();
            for (int i = 0; i < count; i++) {
                View convertView = parent.getChildAt(i);
                int drawPos = first + i;
                Integer lastDrawn = (Integer) convertView.getTag(AQuery.TAG_NUM);
                if (lastDrawn != null && lastDrawn.intValue() == drawPos) {
                //AQUtility.debug("skip", drawPos);
                } else {
                    //AQUtility.debug("redraw", drawPos);
                    adapter.getView(drawPos, convertView, parent);
                }
            }
        }
    }
}
Also used : Adapter(android.widget.Adapter) ExpandableListAdapter(android.widget.ExpandableListAdapter) ListAdapter(android.widget.ListAdapter) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView)

Example 22 with Adapter

use of android.widget.Adapter in project material-design-data by Luosunce.

the class MainActivity method setupViewPager.

private void setupViewPager(ViewPager viewPager) {
    Adapter adapter = new Adapter(getSupportFragmentManager());
    adapter.addFragment(new ListFragment(), "Category 1");
    adapter.addFragment(new ListFragment(), "Category 2");
    adapter.addFragment(new ListFragment(), "Category 3");
    viewPager.setAdapter(adapter);
}
Also used : Adapter(android.widget.Adapter) FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Example 23 with Adapter

use of android.widget.Adapter in project SuperRecyclerView by Malinskiy.

the class SwipeLayout method isDisabledInAdapterView.

/**
     * if working in {@link android.widget.AdapterView}, we should response {@link android.widget.Adapter}
     * isEnable(int position).
     *
     * @return true when item is enabled, else disabled.
     */
private boolean isDisabledInAdapterView() {
    AdapterView adapterView = getAdapterView();
    boolean enable = true;
    if (adapterView != null) {
        Adapter adapter = adapterView.getAdapter();
        if (adapter != null) {
            int p = adapterView.getPositionForView(SwipeLayout.this);
            if (adapter instanceof BaseAdapter) {
                enable = ((BaseAdapter) adapter).isEnabled(p);
            } else if (adapter instanceof ListAdapter) {
                enable = ((ListAdapter) adapter).isEnabled(p);
            }
        }
    }
    return !enable;
}
Also used : AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Example 24 with Adapter

use of android.widget.Adapter in project robolectric by robolectric.

the class ShadowAlertDialog method getItems.

/**
   * Non-Android accessor.
   *
   * @return the items that are available to be clicked on
   */
public CharSequence[] getItems() {
    Adapter adapter = getShadowAlertController().getAdapter();
    int count = adapter.getCount();
    CharSequence[] items = new CharSequence[count];
    for (int i = 0; i < items.length; i++) {
        items[i] = (CharSequence) adapter.getItem(i);
    }
    return items;
}
Also used : Adapter(android.widget.Adapter)

Example 25 with Adapter

use of android.widget.Adapter in project platform_frameworks_base by android.

the class AppWidgetHostView method viewDataChanged.

/**
     * Process data-changed notifications for the specified view in the specified
     * set of {@link RemoteViews} views.
     */
void viewDataChanged(int viewId) {
    View v = findViewById(viewId);
    if ((v != null) && (v instanceof AdapterView<?>)) {
        AdapterView<?> adapterView = (AdapterView<?>) v;
        Adapter adapter = adapterView.getAdapter();
        if (adapter instanceof BaseAdapter) {
            BaseAdapter baseAdapter = (BaseAdapter) adapter;
            baseAdapter.notifyDataSetChanged();
        } else if (adapter == null && adapterView instanceof RemoteAdapterConnectionCallback) {
            // If the adapter is null, it may mean that the RemoteViewsAapter has not yet
            // connected to its associated service, and hence the adapter hasn't been set.
            // In this case, we need to defer the notify call until it has been set.
            ((RemoteAdapterConnectionCallback) adapterView).deferNotifyDataSetChanged();
        }
    }
}
Also used : RemoteAdapterConnectionCallback(android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback) AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter)

Aggregations

Adapter (android.widget.Adapter)36 AdapterView (android.widget.AdapterView)23 View (android.view.View)18 BaseAdapter (android.widget.BaseAdapter)15 ListAdapter (android.widget.ListAdapter)12 AbsListView (android.widget.AbsListView)10 RemoteAdapterConnectionCallback (android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback)7 TextView (android.widget.TextView)7 Intent (android.content.Intent)4 ExpandableListAdapter (android.widget.ExpandableListAdapter)4 HeaderViewListAdapter (android.widget.HeaderViewListAdapter)3 SuppressLint (android.annotation.SuppressLint)2 ExpandableListView (android.widget.ExpandableListView)2 SectionIndexer (android.widget.SectionIndexer)2 DataSetObserver (android.database.DataSetObserver)1 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)1 CursorAdapter (android.support.v4.widget.CursorAdapter)1 ViewGroup (android.view.ViewGroup)1 ArrayAdapter (android.widget.ArrayAdapter)1 ListView (android.widget.ListView)1