Skip to content

qs-lll/ExpandingPager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2a8847d · May 30, 2020

History

28 Commits
May 30, 2020
Jun 22, 2016
Sep 15, 2017
Jun 21, 2016
Jun 22, 2016
Sep 15, 2017
Jun 21, 2016
Jun 21, 2016
Aug 2, 2019
Jun 21, 2016
Jun 19, 2016
Jun 19, 2016
Jun 19, 2016
Jun 19, 2016

Repository files navigation

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();
    }
}

About

ExpandingPager is a card peek/pop controller

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages