use of android.support.v4.view.ViewPager in project chuck by jgilfelt.
the class TransactionActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chuck_activity_transaction);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
title = (TextView) findViewById(R.id.toolbar_title);
final ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
transactionId = getIntent().getLongExtra(ARG_TRANSACTION_ID, 0);
getSupportLoaderManager().initLoader(0, null, this);
}
use of android.support.v4.view.ViewPager in project FastDev4Android by jiangqqlmj.
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.ViewPager in project SlidingMenu by jfeinstein10.
the class ViewPagerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ViewPager vp = new ViewPager(this);
vp.setId("VP".hashCode());
vp.setAdapter(new ColorPagerAdapter(getSupportFragmentManager()));
setContentView(vp);
vp.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageScrollStateChanged(int arg0) {
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageSelected(int position) {
switch(position) {
case 0:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
break;
default:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
break;
}
}
});
vp.setCurrentItem(0);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
use of android.support.v4.view.ViewPager in project Android-Developers-Samples by johnjohndoe.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set content view (which contains a CheeseListFragment)
setContentView(R.layout.sample_main);
// Retrieve the ViewPager from the content view
ViewPager vp = (ViewPager) findViewById(R.id.viewpager);
// Set an OnPageChangeListener so we are notified when a new item is selected
vp.setOnPageChangeListener(mOnPageChangeListener);
// Finally set the adapter so the ViewPager can display items
vp.setAdapter(mPagerAdapter);
}
use of android.support.v4.view.ViewPager in project ZhihuDailyPurify by izzyleung.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
layoutResID = R.layout.activity_main;
super.onCreate(savedInstanceState);
TabLayout tabs = (TabLayout) findViewById(R.id.main_pager_tabs);
ViewPager viewPager = (ViewPager) findViewById(R.id.main_pager);
assert tabs != null;
assert viewPager != null;
viewPager.setOffscreenPageLimit(PAGE_COUNT);
MainPagerAdapter adapter = new MainPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
tabs.setupWithViewPager(viewPager);
FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_pick_date);
assert floatingActionButton != null;
floatingActionButton.setOnClickListener(v -> prepareIntent(PickDateActivity.class));
}
Aggregations