Search in sources :

Example 11 with ViewPager

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());
}
Also used : ViewPager(android.support.v4.view.ViewPager)

Example 12 with ViewPager

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;
}
Also used : View(android.view.View) ViewPager(android.support.v4.view.ViewPager)

Example 13 with ViewPager

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());
}
Also used : ViewPager(android.support.v4.view.ViewPager)

Example 14 with ViewPager

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);
}
Also used : Bundle(android.os.Bundle) ViewPager(android.support.v4.view.ViewPager) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 15 with ViewPager

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;
}
Also used : ViewPager(android.support.v4.view.ViewPager) PagerAdapter(android.support.v4.view.PagerAdapter)

Aggregations

ViewPager (android.support.v4.view.ViewPager)235 View (android.view.View)94 PagerAdapter (android.support.v4.view.PagerAdapter)55 Fragment (android.support.v4.app.Fragment)40 TabLayout (android.support.design.widget.TabLayout)34 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)34 TextView (android.widget.TextView)34 Toolbar (android.support.v7.widget.Toolbar)30 Bundle (android.os.Bundle)27 ViewGroup (android.view.ViewGroup)27 FragmentStatePagerAdapter (android.support.v4.app.FragmentStatePagerAdapter)20 ImageView (android.widget.ImageView)20 ArrayList (java.util.ArrayList)19 Intent (android.content.Intent)14 ActionBar (android.support.v7.app.ActionBar)13 RecyclerView (android.support.v7.widget.RecyclerView)10 ViewTreeObserver (android.view.ViewTreeObserver)10 AdapterView (android.widget.AdapterView)9 LinearLayout (android.widget.LinearLayout)9 UiController (android.support.test.espresso.UiController)8