Skip to content
This repository was archived by the owner on Jan 6, 2020. It is now read-only.

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
Bartosz Lipinski committed Apr 7, 2016
2 parents c6684cd + f31ea61 commit 3f8dc1d
Show file tree
Hide file tree
Showing 28 changed files with 774 additions and 616 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
Version 2.0.0 *(2016-04-06)*
----------------------------
RecyclerViewHeader 2 is a major release that focuses on fixing all of the previously reported issues.

* Attaching `RecyclerViewHeader` simplified. There's only one approach left (previously named `Header-already-aligned approach`).
* New: Horizontal `RecyclerViews` support added
* Fix: Header in wrong position after reusing fragment with `RecyclerView`
* Fix: Removing an item misplacing header.

`StaggeredGridLayoutManager` support has been temporarily disabled. This is planned to be re-enabled in a future release.

*Important*:
1. `RecyclerViewHeader` 2 uses a different package (`com.bartoszlipinski.recyclerviewheader2`)
2. Maven `group` and `artifact` has been changed.

Version 1.2.1 *(2016-02-04)*
----------------------------

Expand Down
116 changes: 43 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ RecyclerViewHeader

[![License](https://img.shields.io/github/license/blipinsk/RecyclerViewHeader.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-RecyclerViewHeader-green.svg?style=flat)](http://android-arsenal.com/details/1/1853)
[![Maven Central](https://img.shields.io/maven-central/v/com.bartoszlipinski.recyclerviewheader/library.svg)](http://gradleplease.appspot.com/#recyclerviewheader)
[![Maven Central](https://img.shields.io/maven-central/v/com.bartoszlipinski/recyclerviewheader2.svg)](http://gradleplease.appspot.com/#recyclerviewheader2)

Super fast and easy way to create header for Android `RecyclerView`.

Lets you create header `View` for any `RecyclerView` that uses `LinearLayoutManager`, `GridLayoutManager` or `StaggeredGridLayoutManager` with just a simple method call.
Lets you create header `View` for any `RecyclerView` that uses `LinearLayoutManager` or `GridLayoutManager` with just a simple method call.

![ ](/RecyclerViewHeader.png)

Expand All @@ -22,99 +22,69 @@ You need to bare in mind that the library is created to be used with relatively
E.g. if your header uses a complex layout (with multiple scrolls and focusable elements) or a complicated `Touch` management system I advice you not to use `RecyclerViewHeader`, but a proper `RecyclerView` `Adapter` that incorporates inflating multiple types of views.
There are other libraries on github (for example [HeaderRecyclerView by Karumi][1]) that might seem a bit more complicated to use, but are implementing mentioned approach and will fit your needs better.

Usage
=====
*For a working implementation of this library see the `sample/` folder.*

Basically, there are two ways of using `RecyclerViewHeader`.

**Regular approach** (super easy to use, but it uses additional `Layouts` so it's a bit less efficient than the second approach):

1. Create an xml layout file for your header (file can contain any type of `View` or `ViewGroup`)

```xml
<FrameLayout
android:layout_width="match_parent"
android:layout_height="100dp">
On version 2
------------
I created this library back in the day when I thought `RecyclerView` was all new and difficult. Writing an adapter that could inflate multiple types of `Views` seemed like a difficult job to do.
Not long after I released `RecyclerViewHeader` I found out that's an incredibly easy task to perform especially if you have tools like [`HeaderRecyclerView` by Karumi][1].
Using a specialized adapter was fixing all the flaws that `RecyclerViewHeader` was suffering from.

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="header"/>
The aim of the second version was to fix all the issues users were facing. The problem is, while I was developing the second version, I was thinking about killing this library multiple times.
I was finding multiple aspects of the approach it presents, to be problematic for someone who doesn't understand the concept of the library thoroughly (usage with simple headers).

</FrameLayout>
```
I decided to finish the second version as a token of gratitude, for all your support. Thank you!

2. Create `RecyclerViewHeader` from `xml` using static initializer.
Nonetheless, **as of today (06/04/2016) I'm beginning the process of retiring of the `RecyclerViewHeader` library.**
Version `2.0.0` will be the last *major* release. The only new development will contain fixes for critical bugs (with the exception of re-enabling `StaggeredGridLayoutManager` support).

```java
RecyclerViewHeader header = RecyclerViewHeader.fromXml(context, R.layout.header);
```

3. Attach `RecyclerViewHeader` to your `RecyclerView` and you're done!

```java
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// set LayoutManager for your RecyclerView
header.attachTo(recyclerView);
```

**Header-already-aligned approach** (does not introduce any additional `Layouts`):
Usage
=====
*For a working implementation of this library see the `sample/` folder.*

1. Place `RecyclerViewHeader`layout above your `RecyclerView` at the top part of it.
1. Place `RecyclerViewHeader` layout above (z-order-wise) your `RecyclerView` at the top part of it.

```xml
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top" />
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top" />

<com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal|top">
<com.bartoszlipinski.recyclerviewheader2.RecyclerViewHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="center_horizontal|top">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="header"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="header"/>

</com.bartoszlipinski.recyclerviewheader.RecyclerViewHeader>
</com.bartoszlipinski.recyclerviewheader2.RecyclerViewHeader>

</FrameLayout>
```
</FrameLayout>

2. Get the `RecyclerViewHeader` view object with:

```java
RecyclerViewHeader header = (RecyclerViewHeader) findViewById(R.id.header);
```
RecyclerViewHeader header = (RecyclerViewHeader) findViewById(R.id.header);

3. Attach `RecyclerViewHeader` to your `RecyclerView` (with `attachTo(RecyclerView recycler, boolean headerAlreadyAligned)`) and that's it.
3. Attach `RecyclerViewHeader` to your `RecyclerView`:

```java
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// set LayoutManager for your RecyclerView
header.attachTo(recyclerView, true);
```
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// set LayoutManager for your RecyclerView
header.attachTo(recyclerView);


Important notes
---------------

`RecyclerViewHeader` needs to be called after you've set the `LayoutManager` for your `RecyclerView`.

Current implementation of the library can be used with `RecyclerViews` that use `LinearLayoutManager`, `GridLayoutManager` or `StaggeredGridLayoutManager`.

Currently only `vertical` implementations of `LayoutManagers` are supported.
Current implementation of the library can be used with `RecyclerViews` that use `LinearLayoutManager` or `GridLayoutManager`.


Including In Your Project
Expand All @@ -123,7 +93,7 @@ You can grab the library via Maven Central. Just add a proper dependency inside

```xml
dependencies {
compile 'com.bartoszlipinski.recyclerviewheader:library:1.2.1'
compile 'com.bartoszlipinski:recyclerviewheader2:2.0.0'
}
```

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
ext {
configuration = [
package : "com.bartoszlipinski.recyclerviewheader.sample",
package : "com.bartoszlipinski.recyclerviewheader2.sample",
compileVersion : 23,
buildToolsVersion: "23.0.2",
minSdk : 11,
targetSdk : 23,
versionCode : 5,
versionName : "1.2.1"
versionCode : 6,
versionName : "2.0.0"
]

libraries = [
support: "23.1.1",
support: "23.2.1",
]
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION_NAME=1.2.1
VERSION_CODE=5
GROUP=com.bartoszlipinski.recyclerviewheader
VERSION_NAME=2.0.0
VERSION_CODE=6
GROUP=com.bartoszlipinski

POM_DESCRIPTION=Super fast and easy way to create header for Android RecyclerView
POM_URL=https://github.com/blipinsk/RecyclerViewHeader
Expand Down
3 changes: 3 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion library/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
POM_NAME=RecyclerViewHeader Library
POM_ARTIFACT_ID=library
POM_ARTIFACT_ID=recyclerviewheader2
POM_PACKAGING=aar
2 changes: 1 addition & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bartoszlipinski.recyclerviewheader">
package="com.bartoszlipinski.recyclerviewheader2">

</manifest>
Loading

0 comments on commit 3f8dc1d

Please sign in to comment.