Search in sources :

Example 56 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project Android-PullToRefresh by chrisbanes.

the class PullToRefreshViewPager method isReadyForPullEnd.

@Override
protected boolean isReadyForPullEnd() {
    ViewPager refreshableView = getRefreshableView();
    PagerAdapter adapter = refreshableView.getAdapter();
    if (null != adapter) {
        return refreshableView.getCurrentItem() == adapter.getCount() - 1;
    }
    return false;
}
Also used : ViewPager(android.support.v4.view.ViewPager) PagerAdapter(android.support.v4.view.PagerAdapter)

Example 57 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project ABPlayer by winkstu.

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 58 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project ABPlayer by winkstu.

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 59 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project Ushahidi_Android by ushahidi.

the class ViewReportSlideActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReports = new ListReportModel();
    this.mCategoryId = getIntent().getExtras().getInt("category", 0);
    int pos = getIntent().getExtras().getInt("id", 0);
    if (mCategoryId > 0) {
        mReports.loadReportByCategory(mCategoryId);
    } else {
        mReports.load();
    }
    NUM_PAGES = mReports.getReports().size();
    // Instantiate a ViewPager and a PagerAdapter.
    mPager = (MapPager) findViewById(R.id.report_pager);
    mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            // When changing pages, reset the action bar actions since they
            // are dependent
            // on which page is currently active. An alternative approach is
            // to have each
            // fragment expose actions itself (rather than the activity
            // exposing actions),
            // but for simplicity, the activity provides the actions in this one
            supportInvalidateOptionsMenu();
        }
    });
    mPager.setCurrentItem(pos, true);
}
Also used : ListReportModel(com.ushahidi.android.app.models.ListReportModel) ViewPager(android.support.v4.view.ViewPager)

Example 60 with PagerAdapter

use of android.support.v4.view.PagerAdapter in project android-shape-imageview by siyamed.

the class SampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    getSupportActionBar().hide();
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    pager.setAdapter(new PagerAdapter(getSupportFragmentManager()));
    PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    tabStrip.setViewPager(pager);
}
Also used : PagerSlidingTabStrip(com.astuetz.PagerSlidingTabStrip) ViewPager(android.support.v4.view.ViewPager) FragmentPagerAdapter(android.support.v4.app.FragmentPagerAdapter)

Aggregations

PagerAdapter (android.support.v4.view.PagerAdapter)111 View (android.view.View)49 ViewPager (android.support.v4.view.ViewPager)44 TextView (android.widget.TextView)33 ViewGroup (android.view.ViewGroup)19 HorizontalScrollView (android.widget.HorizontalScrollView)19 LinearLayout (android.widget.LinearLayout)13 Toolbar (android.support.v7.widget.Toolbar)12 ImageView (android.widget.ImageView)11 TabLayout (android.support.design.widget.TabLayout)10 ArrayList (java.util.ArrayList)9 RecyclerView (android.support.v7.widget.RecyclerView)8 FragmentStatePagerAdapter (android.support.v4.app.FragmentStatePagerAdapter)7 AppBarLayout (android.support.design.widget.AppBarLayout)6 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)6 MenuItem (android.view.MenuItem)5 ImageButton (android.widget.ImageButton)5 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)4 LargeTest (android.support.test.filters.LargeTest)4 MediumTest (android.support.test.filters.MediumTest)4