Set a new adapter to provide child views on demand.

@param adapter The new adapter to set, or null to set no adapter.
549177
public void setAdapter(Adapter adapter) {
        if (mAdapter != null) {
            mAdapter.unregisterAdapterDataObserver(mObserver);
        }
        // end all running animations
        if (mItemAnimator != null) {
            mItemAnimator.endAnimations();
        }
        // Since animations are ended, mLayout.children should be equal to recyclerView.children.
        // This may not be true if item animator's end does not work as expected. (e.g. not release
        // children instantly). It is safer to use mLayout's child count.
        if (mLayout != null) {
            mLayout.removeAndRecycleAllViews(mRecycler);
            mLayout.removeAndRecycleScrapInt(mRecycler, true);
        }

        final Adapter oldAdapter = mAdapter;
        mAdapter = adapter;
        if (adapter != null) {
            adapter.registerAdapterDataObserver(mObserver);
        }
        if (mLayout != null) {
            mLayout.onAdapterChanged(oldAdapter, mAdapter);
        }
        mRecycler.onAdapterChanged(oldAdapter, mAdapter);
        mState.mStructureChanged = true;
        markKnownViewsInvalid();
        requestLayout();
    }
284404
public void setViewPager(@Nullable ViewPager view) {
        if (mViewPager == view)
            return;

        if (mViewPager != null){
            mViewPager.removeOnPageChangeListener(this);
            PagerAdapter adapter = mViewPager.getAdapter();
            if(adapter != null)
            	adapter.unregisterDataSetObserver(mObserver);
        }

        mViewPager = view;

        if(mViewPager != null) {
            PagerAdapter adapter = mViewPager.getAdapter();
            if (adapter == null)
                throw new IllegalStateException("ViewPager does not have adapter instance.");

            adapter.registerDataSetObserver(mObserver);

            mViewPager.addOnPageChangeListener(this);

            notifyDataSetChanged();
            onPageSelected(mViewPager.getCurrentItem());
        }
        else
            mTabContainer.removeAllViews();
    }
291258
public void addAdapters(int position, @Nullable List<Adapter> adapters) {
        if (adapters == null || adapters.size() == 0) {
            return;
        }
        if (position < 0) {
            position = 0;
        }

        if (position > mAdapters.size()) {
            position = mAdapters.size();
        }

        List<Adapter> newAdapter = new ArrayList<>();
        Iterator<Pair<AdapterDataObserver, Adapter>> itr = mAdapters.iterator();
        while (itr.hasNext()) {
            Pair<AdapterDataObserver, Adapter> pair = itr.next();
            Adapter theOrigin = pair.second;
            newAdapter.add(theOrigin);
        }
        for (Adapter adapter : adapters) {
            newAdapter.add(position, adapter);
            position++;
        }
        setAdapters(newAdapter);
    }
990078
public static <Item extends IItem, A extends IAdapter> FastAdapter<Item> with(@Nullable Collection<A> adapters) {
        return with(adapters, null);
    }
787938
public function setAdapter($adapter)
    {
        switch (strtolower($adapter)) {
            case 'sodium':
                $adapterSet = '\Zest\Encryption\Adapter\SodiumEncryption';
                break;
            case 'openssl':
                $adapterSet = '\Zest\Encryption\Adapter\OpenSslEncryption';
                break;
            default:
                $adapterSet = '\Zest\Encryption\Adapter\OpenSslEncryption';
                break;
        }
        $key = __config()->encryption->key;
        $this->adapter = new $adapterSet($key);

        return $this;
    }
765488
public function setDefaultAdapter(
        \Zend\Http\Client\Adapter\AdapterInterface $adapter
    ) {
        $this->defaultAdapter = $adapter;
    }
162888
private void adaptItemTypeface() {
        if (adapter != null && itemTypeface != null) {
            RecyclerView.Adapter<?> wrappedAdapter = adapter.getWrappedAdapter();

            if (wrappedAdapter instanceof ArrayRecyclerViewAdapter) {
                ((ArrayRecyclerViewAdapter) wrappedAdapter).setItemTypeface(itemTypeface);
            }
        }
    }
344849
private static Adapter tryAdapter( Class adapterClass, Object externalContext )
    {
        try
        {
            Adapter sa = ( Adapter ) adapterClass.newInstance();

            try
            {
                AdapterContext context = new AdapterContext( externalContext );
                
                if ( sa.accept( context ) )
                {
                    _log.info( "Adapter " + adapterClass.getName() + " accepted." );
                    sa.setContext( context );
                    return sa;
                }
                else
                {
                    _log.info( "Adapter " + adapterClass.getName() + " is present but did not accept." );
                }
            }
            catch ( Exception e )
            {
                _log.error( adapterClass.getName() + ".accept() threw an exception.", e );
            }
            catch ( LinkageError e )
            {
                _log.error( adapterClass.getName() + ".accept() caused a linkage error and may be out of date.", e );
            }
        }
        catch ( InstantiationException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( IllegalAccessException e )
        {
            _log.error( "Could not create instance of Adapter class " + adapterClass.getName(), e );
        }
        catch ( Exception e )
        {
            _log.error( "Error creating instance of Adapter class " + adapterClass.getName(), e );
        }

        return null;
    }
419571
public void setSecondaryDistanceUnitAdapter(DistanceUnitAdapter distanceUnitAdapter) {
        if (distanceUnitAdapter == null) {
            throw new IllegalArgumentException("adapter must not be null");
        }
        this.secondaryDistanceUnitAdapter = distanceUnitAdapter;
        this.redrawNeeded = true;
    }
640232
public function setAdapter(AdapterInterface $adapter)
    {
        $adapter->setClient($this);

        $this->adapter = $adapter;

        return $this;
    }
1169607
public void setAdapter(final BaseCircularViewAdapter adapter) {
        mAdapter = adapter;
        if (mAdapter != null) {
            mAdapter.registerDataSetObserver(mAdapterDataSetObserver);
        }
        postInvalidate();
    }
333833
protected void setUpAdapter() {
        if (mAdapter == null) {
            mAdapter = new SimpleMonthAdapter(getContext(), mController);
        } else {
            mAdapter.setSelectedDay(mSelectedDay);
            mAdapter.notifyDataSetChanged();
        }
        // refresh the view with the new parameters
        mAdapter.notifyDataSetChanged();
    }
1087652
public void setAppender(final Appender appender) {
        if (this.appender != null) {
            close();
        }
        checkAccess(this);
        if (applyLayout && appender != null) {
            final Formatter formatter = getFormatter();
            appender.setLayout(formatter == null ? null : new FormatterLayout(formatter));
        }
        appenderUpdater.set(this, appender);
    }
1038780
@Deprecated
    @SuppressWarnings("unchecked")
    public static void deselect(final FastAdapter adapter) {
        adapter.recursive(new AdapterPredicate() {
            @Override
            public boolean apply(@NonNull IAdapter lastParentAdapter, int lastParentPosition, @NonNull IItem item, int position) {
                if (position != -1) {
                    SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
                    if (extension != null) {
                        extension.deselect(position);
                    }
                } else {
                    item.withSetSelected(false);
                }
                return true;
            }
        }, false);
    }
1031511
function use(adapter) {
  if (~adapters.indexOf(adapter)) return false;

  adapters.push(adapter);
  return true;
}
103910
public function setAdapter($adapter)
    {
        if ($adapter == null) {
            $this->adapter = $adapter;
        } else {
              parent::setAdapter($adapter);
        }
    }
601868
public <A extends IAdapter<Item>> FastAdapter<Item> addAdapter(int index, A adapter) {
        mAdapters.add(index, adapter);
        adapter.withFastAdapter(this);
        adapter.mapPossibleTypes(adapter.getAdapterItems());
        for (int i = 0; i < mAdapters.size(); i++) {
            mAdapters.get(i).setOrder(i);
        }
        cacheSizes();
        return this;
    }