use of android.support.v4.view.ViewPager in project Meizhi by drakeet.
the class SmoothAppBarLayout method initViews.
protected void initViews() {
if (mViewPagerId > 0) {
vViewPager = (ViewPager) getRootView().findViewById(mViewPagerId);
} else {
int i = 0;
ViewGroup parent = (ViewGroup) getParent();
View child;
for (int z = parent.getChildCount(); i < z; i++) {
child = parent.getChildAt(i);
if (child instanceof ViewPager) {
vViewPager = (ViewPager) child;
break;
}
}
}
}
use of android.support.v4.view.ViewPager in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ViewPager pager = (ViewPager) findViewById(R.id.pager);
final MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
observable = (Observable<PermissionRoster>) getLastNonConfigurationInstance();
if (observable == null) {
observable = Observable.create(new PermissionSource(this)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).cache();
}
sub = observable.subscribe(new Consumer<PermissionRoster>() {
@Override
public void accept(PermissionRoster roster) throws Exception {
pager.setAdapter(new PermissionTabAdapter(MainActivity.this, getFragmentManager(), roster));
tabs.setViewPager(pager);
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable error) throws Exception {
Toast.makeText(MainActivity.this, error.getMessage(), Toast.LENGTH_LONG).show();
Log.e(getClass().getSimpleName(), "Exception processing request", error);
}
});
}
use of android.support.v4.view.ViewPager in project UltimateAndroid by cymcsg.
the class ViewPagerTabListViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.observable_scroll_view_activity_viewpagertabscrollview);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
mHeaderView = findViewById(R.id.header);
ViewCompat.setElevation(mHeaderView, getResources().getDimension(R.dimen.toolbar_elevation));
mToolbarView = findViewById(R.id.toolbar);
mPagerAdapter = new NavigationAdapter(getSupportFragmentManager());
mPager = (ViewPager) findViewById(R.id.pager);
mPager.setAdapter(mPagerAdapter);
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tabs);
slidingTabLayout.setCustomTabView(R.layout.observable_scroll_view_tab_indicator, android.R.id.text1);
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.accent));
slidingTabLayout.setDistributeEvenly(true);
slidingTabLayout.setViewPager(mPager);
// When the page is selected, other fragments' scrollY should be adjusted
// according to the toolbar status(shown/hidden)
slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i2) {
}
@Override
public void onPageSelected(int i) {
propagateToolbarState(toolbarIsShown());
}
@Override
public void onPageScrollStateChanged(int i) {
}
});
propagateToolbarState(toolbarIsShown());
}
use of android.support.v4.view.ViewPager in project cw-omnibus by commonsguy.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(buildAdapter());
}
use of android.support.v4.view.ViewPager in project cw-omnibus by commonsguy.
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();
}
Aggregations