Search in sources :

Example 76 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project SmartAndroidSource by jaychou2012.

the class IconPageIndicator method setViewPager.

@Override
public void setViewPager(ViewPager view) {
    if (mViewPager == view) {
        return;
    }
    if (mViewPager != null) {
        mViewPager.setOnPageChangeListener(null);
    }
    PagerAdapter adapter = view.getAdapter();
    if (adapter == null) {
        throw new IllegalStateException("ViewPager does not have adapter instance.");
    }
    mViewPager = view;
    view.setOnPageChangeListener(this);
    notifyDataSetChanged();
}
Also used : PagerAdapter(android.support.v4.view.PagerAdapter)

Example 77 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project SmartAndroidSource by jaychou2012.

the class TabPageIndicator method setViewPager.

@Override
public void setViewPager(ViewPager view) {
    if (mViewPager == view) {
        return;
    }
    if (mViewPager != null) {
        mViewPager.setOnPageChangeListener(null);
    }
    final PagerAdapter adapter = view.getAdapter();
    if (adapter == null) {
        throw new IllegalStateException("ViewPager does not have adapter instance.");
    }
    mViewPager = view;
    view.setOnPageChangeListener(this);
    notifyDataSetChanged();
}
Also used : PagerAdapter(android.support.v4.view.PagerAdapter)

Example 78 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project FastDev4Android by jiangqqlmj.

the class TabPageIndicator method notifyDataSetChanged.

public void notifyDataSetChanged() {
    mTabLayout.removeAllViews();
    PagerAdapter adapter = mViewPager.getAdapter();
    IconPagerAdapter iconAdapter = null;
    if (adapter instanceof IconPagerAdapter) {
        iconAdapter = (IconPagerAdapter) adapter;
    }
    final int count = adapter.getCount();
    for (int i = 0; i < count; i++) {
        CharSequence title = adapter.getPageTitle(i);
        if (title == null) {
            title = EMPTY_TITLE;
        }
        int iconResId = 0;
        if (iconAdapter != null) {
            iconResId = iconAdapter.getIconResId(i);
        }
        addTab(i, title, iconResId);
    }
    if (mSelectedTabIndex > count) {
        mSelectedTabIndex = count - 1;
    }
    setCurrentItem(mSelectedTabIndex);
    requestLayout();
}
Also used : PagerAdapter(android.support.v4.view.PagerAdapter)

Example 79 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project FastDev4Android by jiangqqlmj.

the class IconPageIndicator method setViewPager.

@Override
public void setViewPager(ViewPager view) {
    if (mViewPager == view) {
        return;
    }
    if (mViewPager != null) {
        mViewPager.setOnPageChangeListener(null);
    }
    PagerAdapter adapter = view.getAdapter();
    if (adapter == null) {
        throw new IllegalStateException("ViewPager does not have adapter instance.");
    }
    mViewPager = view;
    view.setOnPageChangeListener(this);
    notifyDataSetChanged();
}
Also used : PagerAdapter(android.support.v4.view.PagerAdapter)

Example 80 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project JazzyViewPager by jfeinstein10.

the class JazzyViewPager method findViewFromObject.

public View findViewFromObject(int position) {
    Object o = mObjs.get(Integer.valueOf(position));
    if (o == null) {
        return null;
    }
    PagerAdapter a = getAdapter();
    View v;
    for (int i = 0; i < getChildCount(); i++) {
        v = getChildAt(i);
        if (a.isViewFromObject(v, o))
            return v;
    }
    return null;
}
Also used : View(android.view.View) PagerAdapter(android.support.v4.view.PagerAdapter)

Aggregations

PagerAdapter (android.support.v4.view.PagerAdapter)111 View (android.view.View)47 ViewPager (android.support.v4.view.ViewPager)39 TextView (android.widget.TextView)33 HorizontalScrollView (android.widget.HorizontalScrollView)19 ViewGroup (android.view.ViewGroup)18 LinearLayout (android.widget.LinearLayout)13 Toolbar (android.support.v7.widget.Toolbar)11 ImageView (android.widget.ImageView)11 TabLayout (android.support.design.widget.TabLayout)8 RecyclerView (android.support.v7.widget.RecyclerView)8 ArrayList (java.util.ArrayList)8 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)6 AppBarLayout (android.support.design.widget.AppBarLayout)5 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)5 FragmentStatePagerAdapter (android.support.v4.app.FragmentStatePagerAdapter)5 ImageButton (android.widget.ImageButton)5 LargeTest (android.support.test.filters.LargeTest)4 MediumTest (android.support.test.filters.MediumTest)4 SmallTest (android.support.test.filters.SmallTest)4