Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qs-lll/ExpandingPager
ExpandingPager is a card peek/pop controller
https://github.com/qs-lll/ExpandingPager
card-peek fragments viewpager
Last synced: 2 months ago
JSON representation
ExpandingPager is a card peek/pop controller
- Host: GitHub
- URL: https://github.com/qs-lll/ExpandingPager
- Owner: qs-lll
- Created: 2016-06-19T21:03:06.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-30T06:14:39.000Z (over 4 years ago)
- Last Synced: 2024-11-05T03:51:28.837Z (3 months ago)
- Topics: card-peek, fragments, viewpager
- Language: Java
- Size: 20.8 MB
- Stars: 1,899
- Watchers: 43
- Forks: 269
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-github-android-ui - ExpandingPager - 卡片peek及pop控件 (ViewPager)
README
# ExpandingPager
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ExpandingPager-green.svg?style=true)](https://android-arsenal.com/details/1/3747)##only support system 5.0/latest!!!😭who can solve before 5.0 support!!!
ExpandingPager is a card peek/pop controller
[![gif](img/ExpandingPager.gif)]()
####SIZE & FRAGMENT AREA
![](img/size1.png)#Setup
Just extends `ExpandingViewPagerAdapter` in your Fragment Adapter and setup the ExpandingViewPager
```java
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`
```java
public class CustomViewPagerAdapter extends ExpandingViewPagerAdapter {@Override
public Fragment getItem(int position) {
return CustomExpandingFragment.newInstance();
}}
```Your `ExpandingFragment` must returns a FragmentTop and a FragmentBottom
```java
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.
```java
public class CustomFragmentTop extends Fragment {
}
```##Bottom
Create your top fragment implementing `ExpandingFragment.ChildTop`
```java
public class CustomFragmentBottom extends Fragment {
}
```##BackPress
```java
@Override
public void onBackPressed() {
if(!expandingViewPager.onBackPressed(viewPager)){
super.onBackPressed();
}
}
```