Search in sources :

Example 1 with GlimmrPagerAdapter

use of com.bourke.glimmr.common.GlimmrPagerAdapter in project glimmr by brk3.

the class PhotoInfoFragment method initViewPager.

private void initViewPager() {
    ViewPager viewPager = (ViewPager) mLayout.findViewById(R.id.viewPager);
    /* http://stackoverflow.com/a/13684139/663370 */
    GlimmrPagerAdapter adapter = new GlimmrPagerAdapter(getChildFragmentManager(), viewPager, mActivity.getActionBar(), CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case OVERVIEW_PAGE:
                    return PhotoOverviewFragment.newInstance(PhotoInfoFragment.this.mPhoto);
                case MORE_PAGE:
                    return ExifInfoFragment.newInstance(PhotoInfoFragment.this.mPhoto);
            }
            return null;
        }
    };
    viewPager.setAdapter(adapter);
    PageIndicator indicator = (TabPageIndicator) mLayout.findViewById(R.id.indicator);
    indicator.setViewPager(viewPager);
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) TabPageIndicator(com.viewpagerindicator.TabPageIndicator) PageIndicator(com.viewpagerindicator.PageIndicator) TabPageIndicator(com.viewpagerindicator.TabPageIndicator) ViewPager(android.support.v4.view.ViewPager)

Example 2 with GlimmrPagerAdapter

use of com.bourke.glimmr.common.GlimmrPagerAdapter in project glimmr by brk3.

the class PhotosetViewerActivity method initViewPager.

@Override
protected void initViewPager() {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case PHOTOSET_PAGE:
                    return PhotosetGridFragment.newInstance(mPhotoset);
            }
            return null;
        }
    };
    super.initViewPager();
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) Fragment(android.support.v4.app.Fragment) PhotosetGridFragment(com.bourke.glimmr.fragments.photoset.PhotosetGridFragment)

Example 3 with GlimmrPagerAdapter

use of com.bourke.glimmr.common.GlimmrPagerAdapter in project glimmr by brk3.

the class ProfileViewerActivity method initViewPager.

@Override
protected void initViewPager() {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case PHOTO_STREAM_PAGE:
                    return PhotoStreamGridFragment.newInstance(mUser);
                case FAVORITES_STREAM_PAGE:
                    return FavoritesGridFragment.newInstance(mUser);
                case SETS_PAGE:
                    return PhotosetsFragment.newInstance(mUser);
                case CONTACTS_PAGE:
                    // TODO
                    return PhotoStreamGridFragment.newInstance(mUser);
            }
            return null;
        }
    };
    super.initViewPager();
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) FavoritesGridFragment(com.bourke.glimmr.fragments.home.FavoritesGridFragment) Fragment(android.support.v4.app.Fragment) PhotosetsFragment(com.bourke.glimmr.fragments.home.PhotosetsFragment) PhotoStreamGridFragment(com.bourke.glimmr.fragments.home.PhotoStreamGridFragment)

Example 4 with GlimmrPagerAdapter

use of com.bourke.glimmr.common.GlimmrPagerAdapter in project glimmr by brk3.

the class SearchActivity method initViewPager.

protected void initViewPager(final String searchQuery) {
    mViewPager = (ViewPager) findViewById(R.id.viewPager);
    mAdapter = new GlimmrPagerAdapter(getSupportFragmentManager(), mViewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case RESULT_PUBLIC_PHOTOS_PAGE:
                    return PublicPhotoSearchGridFragment.newInstance(searchQuery, AbstractPhotoSearchGridFragment.SORT_TYPE_RELAVANCE);
                case RESULT_PHOTOSTREAM_PAGE:
                    return PhotostreamSearchGridFragment.newInstance(searchQuery, AbstractPhotoSearchGridFragment.SORT_TYPE_RELAVANCE, mUser);
            }
            return null;
        }
    };
    super.initViewPager();
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) Fragment(android.support.v4.app.Fragment) AbstractPhotoSearchGridFragment(com.bourke.glimmr.fragments.search.AbstractPhotoSearchGridFragment) PublicPhotoSearchGridFragment(com.bourke.glimmr.fragments.search.PublicPhotoSearchGridFragment) PhotostreamSearchGridFragment(com.bourke.glimmr.fragments.search.PhotostreamSearchGridFragment)

Example 5 with GlimmrPagerAdapter

use of com.bourke.glimmr.common.GlimmrPagerAdapter in project glimmr by brk3.

the class ExploreActivity method initViewPager.

private void initViewPager() {
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
    GlimmrPagerAdapter adapter = new GlimmrPagerAdapter(getSupportFragmentManager(), viewPager, mActionBar, CONTENT) {

        @Override
        public Fragment getItemImpl(int position) {
            switch(position) {
                case INTERESTING_PAGE:
                    return RecentPublicPhotosFragment.newInstance();
            }
            return null;
        }
    };
    viewPager.setAdapter(adapter);
//TitlePageIndicator indicator =
//(TitlePageIndicator) findViewById(R.id.indicator);
//if (indicator != null) {
//indicator.setViewPager(viewPager);
//} else {
//mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
//viewPager.setOnPageChangeListener(adapter);
//for (String title : CONTENT) {
//ActionBar.Tab newTab = mActionBar.newTab().setText(title);
//newTab.setTabListener(adapter);
//mActionBar.addTab(newTab);
//}
//}
}
Also used : GlimmrPagerAdapter(com.bourke.glimmr.common.GlimmrPagerAdapter) ViewPager(android.support.v4.view.ViewPager)

Aggregations

GlimmrPagerAdapter (com.bourke.glimmr.common.GlimmrPagerAdapter)6 Fragment (android.support.v4.app.Fragment)4 ViewPager (android.support.v4.view.ViewPager)2 GroupAboutFragment (com.bourke.glimmr.fragments.group.GroupAboutFragment)1 GroupPoolGridFragment (com.bourke.glimmr.fragments.group.GroupPoolGridFragment)1 FavoritesGridFragment (com.bourke.glimmr.fragments.home.FavoritesGridFragment)1 PhotoStreamGridFragment (com.bourke.glimmr.fragments.home.PhotoStreamGridFragment)1 PhotosetsFragment (com.bourke.glimmr.fragments.home.PhotosetsFragment)1 PhotosetGridFragment (com.bourke.glimmr.fragments.photoset.PhotosetGridFragment)1 AbstractPhotoSearchGridFragment (com.bourke.glimmr.fragments.search.AbstractPhotoSearchGridFragment)1 PhotostreamSearchGridFragment (com.bourke.glimmr.fragments.search.PhotostreamSearchGridFragment)1 PublicPhotoSearchGridFragment (com.bourke.glimmr.fragments.search.PublicPhotoSearchGridFragment)1 PageIndicator (com.viewpagerindicator.PageIndicator)1 TabPageIndicator (com.viewpagerindicator.TabPageIndicator)1