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.activity_main);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new SampleAdapter());
}
use of android.support.v4.view.ViewPager in project KitKatEmoji by chathudan.
the class EmojiconsFragment method onCreateView.
// TODO for Recent Emoji
// private void getRecentEmoji() {
// ArrayList<Emojicon> emojicons = YourApplication.getInstance().mEmojicons;
// if(emojicons.size()>0){
// RECENT_DATA = new Emojicon[emojicons.size()];
// for (int i=0;i<emojicons.size();i++) {
// RECENT_DATA[i] = emojicons.get(i);
// }
// }
//
// }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// getRecentEmoji();
View view = inflater.inflate(R.layout.emojicons, container, false);
final ViewPager emojisPager = (ViewPager) view.findViewById(R.id.emojis_pager);
emojisPager.setOnPageChangeListener(this);
EmojisPagerAdapter emojisAdapter = new EmojisPagerAdapter(getFragmentManager(), Arrays.asList(EmojiconGridFragment.newInstance(RECENT_DATA), EmojiconGridFragment.newInstance(People.DATA), EmojiconGridFragment.newInstance(Nature.DATA), EmojiconGridFragment.newInstance(Objects.DATA), EmojiconGridFragment.newInstance(Places.DATA), EmojiconGridFragment.newInstance(Symbols.DATA)));
emojisPager.setAdapter(emojisAdapter);
mEmojiTabs = new View[6];
mEmojiTabs[0] = view.findViewById(R.id.emojis_tab_00_recent);
mEmojiTabs[1] = view.findViewById(R.id.emojis_tab_0_people);
mEmojiTabs[2] = view.findViewById(R.id.emojis_tab_1_nature);
mEmojiTabs[3] = view.findViewById(R.id.emojis_tab_2_objects);
mEmojiTabs[4] = view.findViewById(R.id.emojis_tab_3_cars);
mEmojiTabs[5] = view.findViewById(R.id.emojis_tab_4_punctuation);
for (int i = 0; i < mEmojiTabs.length; i++) {
final int position = i;
mEmojiTabs[i].setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
emojisPager.setCurrentItem(position);
}
});
}
view.findViewById(R.id.emojis_backspace).setOnTouchListener(new RepeatListener(1000, 50, new View.OnClickListener() {
// R.id.emojis_backspace
@Override
public void onClick(View v) {
if (mOnEmojiconBackspaceClickedListener != null) {
mOnEmojiconBackspaceClickedListener.onEmojiconBackspaceClicked(v);
}
}
}));
onPageSelected(0);
return view;
}
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 ActionBar-PullToRefresh by chrisbanes.
the class FragmentTabsViewPagerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment_tabs_vp);
ViewPager vp = (ViewPager) findViewById(R.id.ptr_viewpager);
mFragmentTabPager = new FragmentTabPager(this, vp);
// Add 3 tabs which will switch fragments
ActionBar ab = getSupportActionBar();
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Bundle b = new Bundle();
b.putString(EXTRA_TITLE, "Tab 1");
mFragmentTabPager.addTab(ab.newTab().setText("Tab 1"), SampleFragment.class, b);
b = new Bundle();
b.putString(EXTRA_TITLE, "Tab 2");
mFragmentTabPager.addTab(ab.newTab().setText("Tab 2"), SampleFragment.class, b);
b = new Bundle();
b.putString(EXTRA_TITLE, "Tab 3");
mFragmentTabPager.addTab(ab.newTab().setText("Tab 3"), SampleFragment.class, b);
}
use of android.support.v4.view.ViewPager 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;
}
Aggregations