mjolnirrecyclerview

One RecyclerView to rule them all.

License

License

GroupId

GroupId

co.infinum
ArtifactId

ArtifactId

mjolnirrecyclerview
Last Version

Last Version

2.3.0
Release Date

Release Date

Type

Type

aar
Description

Description

mjolnirrecyclerview
One RecyclerView to rule them all.
Project URL

Project URL

https://github.com/infinum/MjolnirRecyclerView
Source Code Management

Source Code Management

https://github.com/infinum/MjolnirRecyclerView

Download mjolnirrecyclerview

How to add to project

<!-- https://jarcasting.com/artifacts/co.infinum/mjolnirrecyclerview/ -->
<dependency>
    <groupId>co.infinum</groupId>
    <artifactId>mjolnirrecyclerview</artifactId>
    <version>2.3.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/co.infinum/mjolnirrecyclerview/
implementation 'co.infinum:mjolnirrecyclerview:2.3.0'
// https://jarcasting.com/artifacts/co.infinum/mjolnirrecyclerview/
implementation ("co.infinum:mjolnirrecyclerview:2.3.0")
'co.infinum:mjolnirrecyclerview:aar:2.3.0'
<dependency org="co.infinum" name="mjolnirrecyclerview" rev="2.3.0">
  <artifact name="mjolnirrecyclerview" type="aar" />
</dependency>
@Grapes(
@Grab(group='co.infinum', module='mjolnirrecyclerview', version='2.3.0')
)
libraryDependencies += "co.infinum" % "mjolnirrecyclerview" % "2.3.0"
[co.infinum/mjolnirrecyclerview "2.3.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.android.support » recyclerview-v7 jar 27.0.2

Project Modules

There are no modules declared in this project.

[DEPRECATED] MjolnirRecyclerView - This library is no longer maintained and it will not receive any more updates.

==========

CircleCI JCenter Method count Android Arsenal

Provides a simple way to extend the default RecyclerView behaviour with support for headers, footers, empty view, DiffUtil and ArrayAdapter like methods.

Usage

Add the library as a dependency to your build.gradle

compile 'co.infinum:mjolnirrecyclerview:version@aar'

Check the latest version here.

Features

1. Header & footer support

Add a custom number of headers and footers to MjolnirRecyclerView by using 2 simple methods from MjolnirRecyclerAdapter:

    adapter.setHeader(View view)
    adapter.setHeader(View view)

2. Empty view

Empty view support for MjolnirRecyclerView. View is automatically hidden when adapter is populated with some data, and is automatically shown once again when adapter becomes empty.

    recyclerView.setEmptyView(View view)

You can also show empty view while adapter is not set to the MjolnirRecyclerView, which is handy if you want to intialize adapter at some later point in the time.

    // show empty view if adapter is not set
    recyclerView.setEmptyView(View view, true)

3. DiffUtil

DiffUtil support for MjolnirRecyclerAdapter. Simply add DiffUtil.Callback in adapters update method:

    adapter.update(new ItemDiffUtilResult())

As DiffUtil is a blocking sync action, it's executed on the background thread inside the MjolnirRecyclerAdapter by using a AsyncTask. As a result of this approach, you need to call cancel() method on your adapter when your activity or fragment is about to be destroyed, so that the adapter is not updated if the screen has been destroyed.

    @Override
    protected void onDestroy() {
        super.onDestroy();
        adapter.cancel();
    }

4. ArrayAdapter like methods

MjolnirRecyclerAdapter has full support for ArrayAdapter methods, like add(), addAll(), reset(), remove(), set()...

Contributing

Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license.

Credits

Maintained and sponsored by Infinum.

co.infinum

Infinum

We're an independent design & development agency of 230 people, creating beautiful software for 14 years.

Versions

Version
2.3.0