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;
}
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();
}
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();
}
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);
}
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);
}
Aggregations