<commit_before># HollyViewPager

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-HollyViewPager-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2388)

[![screen](https://raw.githubusercontent.com/florent37/HollyViewPager/master/screens/1024_small.png)](https://www.youtube.com/watch?v=4ZmjEde-Xho)

[![screen](http://j.gifs.com/vZ4D9G.gif)](https://www.youtube.com/watch?v=4ZmjEde-Xho)

<a href="https://play.google.com/store/apps/details?id=com.github.florent37.beautifulviewpager.sample">
  <img alt="Android app on Google Play" src="https://developer.android.com/images/brand/en_app_rgb_wo_45.png" />
</a>

#Usage

Add a HollyViewPager in your layout

```xml
<com.github.florent37.hollyviewpager.HollyViewPager
        android:id="@+id/hollyViewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:hvp_headerHeight="150dp" />
```
        
```java
HollyViewPager hollyViewPager = findViewById(R.id.hollyViewPager);
hollyViewPager.setAdapter(...);

hollyViewPager.setConfigurator(new HollyViewPagerConfigurator() {
           @Override
           public float getHeightPercentForPage(int page) {
               return PERCENT;
           }
       });
```

#Pages
You pages should contain a recyclerview or a ObservableScrollView
----------

#RecyclerView
```java	
HollyViewPagerBus.registerRecyclerView(getActivity(), recyclerView);
```

Adapter
```java
	protected static final int TYPE_HEADER = 0;
    protected static final int TYPE_CELL = 1;

    @Override
    public int getItemViewType(int position) {
        switch (position){
            case 0: return TYPE_HEADER;
            default: return TYPE_CELL;
        }
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {
        View view;
        switch (type){
            case TYPE_HEADER:
                new RecyclerView.ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.hvp_header_placeholder,viewGroup,false)) {};
                break;
            default:
                ...YOUR_VIEW...
                break;
        }
    }
```

#ScrollView

```java	
HollyViewPagerBus.registerScrollView(getActivity(), scrollView);
```

```xml	
<com.github.ksoichiro.android.observablescrollview.ObservableScrollView 
	xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/hvp_header_placeholder"/>

        ... YOUR CONTENT ...
```

#Download

In your module [![Download](https://api.bintray.com/packages/florent37/maven/HollyViewPager/images/download.svg)](https://bintray.com/florent37/maven/HollyViewPager/_latestVersion)
```groovy
compile 'com.github.florent37:hollyviewpager:1.0.1'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
```

#Credits

Author: <NAME> [http://www.florentchampigny.com/](http://www.florentchampigny.com/)

<a href="https://plus.google.com/+florentchampigny">
  <img alt="Follow me on Google+"
       src="https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/gplus.png" />
</a><commit_msg>Fix broken Markdown headings<commit_after># HollyViewPager

[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-HollyViewPager-brightgreen.svg?style=flat)](http://android-arsenal.com/details/1/2388)

[![screen](https://raw.githubusercontent.com/florent37/HollyViewPager/master/screens/1024_small.png)](https://www.youtube.com/watch?v=4ZmjEde-Xho)

[![screen](http://j.gifs.com/vZ4D9G.gif)](https://www.youtube.com/watch?v=4ZmjEde-Xho)

<a href="https://play.google.com/store/apps/details?id=com.github.florent37.beautifulviewpager.sample">
  <img alt="Android app on Google Play" src="https://developer.android.com/images/brand/en_app_rgb_wo_45.png" />
</a>

# Usage

Add a HollyViewPager in your layout

```xml
<com.github.florent37.hollyviewpager.HollyViewPager
        android:id="@+id/hollyViewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:hvp_headerHeight="150dp" />
```
        
```java
HollyViewPager hollyViewPager = findViewById(R.id.hollyViewPager);
hollyViewPager.setAdapter(...);

hollyViewPager.setConfigurator(new HollyViewPagerConfigurator() {
           @Override
           public float getHeightPercentForPage(int page) {
               return PERCENT;
           }
       });
```

# Pages
You pages should contain a recyclerview or a ObservableScrollView
----------

# RecyclerView
```java	
HollyViewPagerBus.registerRecyclerView(getActivity(), recyclerView);
```

Adapter
```java
	protected static final int TYPE_HEADER = 0;
    protected static final int TYPE_CELL = 1;

    @Override
    public int getItemViewType(int position) {
        switch (position){
            case 0: return TYPE_HEADER;
            default: return TYPE_CELL;
        }
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int type) {
        View view;
        switch (type){
            case TYPE_HEADER:
                new RecyclerView.ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.hvp_header_placeholder,viewGroup,false)) {};
                break;
            default:
                ...YOUR_VIEW...
                break;
        }
    }
```

# ScrollView

```java	
HollyViewPagerBus.registerScrollView(getActivity(), scrollView);
```

```xml	
<com.github.ksoichiro.android.observablescrollview.ObservableScrollView 
	xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="none">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <include layout="@layout/hvp_header_placeholder"/>

        ... YOUR CONTENT ...
```

# Download

In your module [![Download](https://api.bintray.com/packages/florent37/maven/HollyViewPager/images/download.svg)](https://bintray.com/florent37/maven/HollyViewPager/_latestVersion)
```groovy
compile 'com.github.florent37:hollyviewpager:1.0.1'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
```

# Credits

Author: <NAME> [http://www.florentchampigny.com/](http://www.florentchampigny.com/)

<a href="https://plus.google.com/+florentchampigny">
  <img alt="Follow me on Google+"
       src="https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/gplus.png" />
</a>
{'fraction_non_alphanumeric': 0.14042738770170082, 'fraction_numerical': 0.012501817124582062, 'mean_word_length': 3.667571234735414, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 20, 'lorem ipsum': 0, 'www.': 8, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1230836', 'n_tokens_mistral': 2391, 'n_tokens_neox': 2230, 'n_words': 294}