Search in sources :

Example 1 with BaseAdapter

use of android.widget.BaseAdapter in project android_frameworks_base by ParanoidAndroid.

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)

Example 2 with BaseAdapter

use of android.widget.BaseAdapter in project SuperSaiyanScrollView by nolanlawson.

the class SuperSaiyanScrollView method getSections.

private void getSections() {
    Adapter adapter = mList.getAdapter();
    if (adapter instanceof HeaderViewListAdapter) {
        mListOffset = ((HeaderViewListAdapter) adapter).getHeadersCount();
        adapter = ((HeaderViewListAdapter) adapter).getWrappedAdapter();
    }
    if (adapter instanceof SectionIndexer) {
        mListAdapter = (BaseAdapter) adapter;
        mSections = ((SectionIndexer) mListAdapter).getSections();
    }
}
Also used : HeaderViewListAdapter(android.widget.HeaderViewListAdapter) Adapter(android.widget.Adapter) HeaderViewListAdapter(android.widget.HeaderViewListAdapter) BaseAdapter(android.widget.BaseAdapter) SectionIndexer(android.widget.SectionIndexer)

Example 3 with BaseAdapter

use of android.widget.BaseAdapter in project UltimateAndroid by cymcsg.

the class DynamicListView method handleCellSwitch.

/**
     * This method determines whether the hover cell has been shifted far enough
     * to invoke a cell swap. If so, then the respective cell swap candidate is
     * determined and the data set is changed. Upon posting a notification of the
     * data set change, a layout is invoked to place the cells in the right place.
     * Using a ViewTreeObserver and a corresponding OnPreDrawListener, we can
     * offset the cell being swapped to where it previously was and then animate it to
     * its new position.
     */
private void handleCellSwitch() {
    final int deltaY = mLastEventY - mDownY;
    int deltaYTotal = mHoverCellOriginalBounds.top + mTotalOffset + deltaY;
    View belowView = getViewForId(mBelowItemId);
    View mobileView = getViewForId(mMobileItemId);
    View aboveView = getViewForId(mAboveItemId);
    boolean isBelow = (belowView != null) && (deltaYTotal > belowView.getTop());
    boolean isAbove = (aboveView != null) && (deltaYTotal < aboveView.getTop());
    if (isBelow || isAbove) {
        final long switchItemId = isBelow ? mBelowItemId : mAboveItemId;
        View switchView = isBelow ? belowView : aboveView;
        final int originalItem = getPositionForView(mobileView);
        if (switchView == null) {
            updateNeighborViewsForId(mMobileItemId);
            return;
        }
        if (getPositionForView(switchView) < getHeaderViewsCount()) {
            return;
        }
        swapElements(originalItem, getPositionForView(switchView));
        BaseAdapter adapter;
        if (getAdapter() instanceof HeaderViewListAdapter) {
            adapter = (BaseAdapter) ((HeaderViewListAdapter) getAdapter()).getWrappedAdapter();
        } else {
            adapter = (BaseAdapter) getAdapter();
        }
        adapter.notifyDataSetChanged();
        mDownY = mLastEventY;
        mDownX = mLastEventX;
        final int switchViewStartTop = switchView.getTop();
        mobileView.setVisibility(View.VISIBLE);
        switchView.setVisibility(View.INVISIBLE);
        updateNeighborViewsForId(mMobileItemId);
        final ViewTreeObserver observer = getViewTreeObserver();
        observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

            public boolean onPreDraw() {
                observer.removeOnPreDrawListener(this);
                View switchView = getViewForId(switchItemId);
                mTotalOffset += deltaY;
                int switchViewNewTop = switchView.getTop();
                int delta = switchViewStartTop - switchViewNewTop;
                ViewHelper.setTranslationY(switchView, delta);
                ObjectAnimator animator = ObjectAnimator.ofFloat(switchView, "translationY", 0);
                animator.setDuration(MOVE_DURATION);
                animator.start();
                return true;
            }
        });
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) HeaderViewListAdapter(android.widget.HeaderViewListAdapter) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) BaseAdapter(android.widget.BaseAdapter) ViewTreeObserver(android.view.ViewTreeObserver)

Example 4 with BaseAdapter

use of android.widget.BaseAdapter in project UltimateAndroid by cymcsg.

the class SwipeLayout method isEnabledInAdapterView.

/**
     * 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 isEnabledInAdapterView() {
    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 5 with BaseAdapter

use of android.widget.BaseAdapter in project bee by orhanobut.

the class UiHandler method initSettingsContent.

void initSettingsContent(List<MethodInfo> list) {
    BaseAdapter adapter = SettingsAdapter.newInstance(context, list);
    listView.setAdapter(adapter);
}
Also used : BaseAdapter(android.widget.BaseAdapter)

Aggregations

BaseAdapter (android.widget.BaseAdapter)63 View (android.view.View)30 AdapterView (android.widget.AdapterView)26 ViewGroup (android.view.ViewGroup)22 TextView (android.widget.TextView)21 ListAdapter (android.widget.ListAdapter)16 Adapter (android.widget.Adapter)15 ListView (android.widget.ListView)11 PackageInfoData (dev.ukanth.ufirewall.Api.PackageInfoData)8 RemoteAdapterConnectionCallback (android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback)7 Intent (android.content.Intent)5 LayoutInflater (android.view.LayoutInflater)5 SuppressLint (android.annotation.SuppressLint)4 Context (android.content.Context)4 AbsListView (android.widget.AbsListView)4 GridView (android.widget.GridView)4 ImageView (android.widget.ImageView)4 RecyclerView (android.support.v7.widget.RecyclerView)3 MenuItem (android.view.MenuItem)3 HeaderViewListAdapter (android.widget.HeaderViewListAdapter)3