Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

Bookends

A UI widget for adding headers and footers to RecyclerView

Subscribe to updates I use Bookends


Statistics on Bookends

Number of watchers on Github 551
Number of open issues 5
Average time to close an issue 6 days
Main language Java
Open pull requests 1+
Closed pull requests 0+
Last commit over 5 years ago
Repo Created over 5 years ago
Repo Last Updated over 2 years ago
Size 261 KB
Organization / Authortumblr
Latest Releasev1.0
Page Updated
Do you use Bookends? Leave a review!
View open issues (5)
View Bookends activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating Bookends for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

Bookends

A UI widget that allows for headers and footers on lists backed by RecyclerView, for Android.

Download

Grab the artifact via JCenter. Include JCenter as a repository in your build.gradle file:

repositories {
    jcenter()
}

And add Bookends to your dependencies:

dependencies {
    compile (group: 'com.tumblr', name: 'bookends', version: '1.0.0', ext: 'aar')
}

Usage

Bookends wraps an adapter that you give it.

It works by creating extra view items types that are returned in getItemViewType(), and mapping these to the header and footer views provided via addHeader() and addFooter().

There are some restrictions when using this class:

  1. Bookends only works for single-column lists. (ie, those that use LinearLayoutManager).

  2. The base adapter can't use negative view types, since Bookends uses negative view types to keep track of header and footer views.

  3. You can't add more than 1000 headers or footers.

Example:

// Create your views, whatever they may be
View myHeader = LayoutInflater.from(getContext()).inflate(R.layout.my_header, null);
View anotherHeader = LayoutInflater.from(getContext()).inflate(R.layout.another_header, null);
View myFooter = LayoutInflater.from(getContext()).inflate(R.layout.my_footer, null);

// Add them as headers / footers
Bookends<MyAdapter> adapter = new Bookends<MyAdapter>(myAdapter);
adapter.addHeader(myHeader);
adapter.addHeader(anotherHeader);
adapter.addFooter(myFooter);

Sample app

Clone and build this repo in Android Studio to see an example of a sample app. The app makes a list with RecyclerView and uses Bookends to add header and footer views.

Contact

Michael Lapadula: mlapadula@gmail.com

License

Copyright 2015 Tumblr, Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Bookends open issues Ask a question     (View All Issues)
  • over 4 years Adapter attached window notifiy not called
  • about 5 years Issue when using coordinator layout.
  • about 5 years Issue when there is a header and footer without having any data in recyclerview
  • over 5 years How do remove the footer?
  • over 5 years Add support for GridLayoutManager
Bookends open pull requests (View All Pulls)
  • Fixes #3 - Support GridLayoutManager
Bookends questions on Stackoverflow (View All Questions)
  • regular expression: r05c75 -- extracting numbers between bookends
Bookends list of languages used
Bookends latest release notes
v1.0 v1.0

1.0 release of Bookends.

Other projects in Java
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark