ExpandingPager
qs-lll
1865
Visit GitHub RepoView Pagers

ExpandingPager

Android Arsenal

##only support system 5.0/latest!!!????who can solve before 5.0 support!!!

ExpandingPager is a card peek/pop controller

gif

####SIZE & FRAGMENT AREA

#Setup

Just extends ExpandingViewPagerAdapter in your Fragment Adapter and setup the ExpandingViewPager

ViewPager viewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    viewPager = (ViewPager) findViewById(...);
     
    viewPager.setAdapter( new CustomViewPagerAdapter(getSupportFragmentManager()) );

    ExpandingFactory.setupViewPager(ViewPager viewPager);
}

##Adapter

Just extends ExpandingViewPagerAdapter in your Fragment Adapter, which returns ExpandingFragment`

public class CustomViewPagerAdapter extends ExpandingViewPagerAdapter {

    @Override
    public Fragment getItem(int position) {
        return CustomExpandingFragment.newInstance();
    }

}

Your ExpandingFragment must returns a FragmentTop and a FragmentBottom

public class CustomExpandingFragment extends ExpandingFragment {

    @Override
    public Fragment getFragmentFront() {
        return CustomFragmentTop.newInstance();
    }

    @Override
    public Fragment getFragmentBottom() {
        return CustomFragmentBottom.newInstance();
    }
}

##Fragments

###Top please do not set full screen click Event,it maybe can prevent the main click Event.

public class CustomFragmentTop extends Fragment  {
    
  
}

##Bottom

Create your top fragment implementing ExpandingFragment.ChildTop

public class CustomFragmentBottom extends Fragment  {
    

}

##BackPress

@Override
public void onBackPressed() {
    if(!expandingViewPager.onBackPressed(viewPager)){
        super.onBackPressed();
    }
}
Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer
Microsoft

Become Pro in Android by watching videos

OUR LEARNERS WORK AT