RecyclerNotifier

Additional

Language
Java
Version
N/A
Created
Nov 3, 2015
Updated
Nov 7, 2015 (Retired)
Owner
Júlio Zynger (julioz)
Contributor
Júlio Zynger (julioz)
1
Activity
Badge
Generate
Download
Source code
APK file

Commercial

RecyclerNotifier

Inform your app's users of update in data presented in RecyclerViews.

You can attach the notifier anchored on top (default) or bottom of your RecyclerView (or both top and bottom). The API also allows you to set various properties of the notifier, including drawable, visibility of image and text, textColor and so on.

The text will be limited to one singleLine and will add ellipsis (...) to the end of the text if needed.


Then attach it to your RecyclerView using:

// supposing mRecyclerView is the instance of your Recycler View:
RecyclerNotifierAttacher.attach(recyclerNotifier, mRecyclerView);

Via XML

Add the following node to the same ViewGroup where your RecyclerView is located:

<br.com.zynger.recyclernotifier.RecyclerNotifier
  android:id="@+id/recycler_notifier"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  library:rn_attachTo="@id/recycler_view"/>

Notice the rn_attachTo attribute: you must pass in the id reference of the RecyclerView you want to attach the notifier to.

After adding it to your XML layout, you have to grab that reference through something like

mRecyclerNotifier = (RecyclerNotifier) view.findViewById(R.id.recycler_notifier);

and call onParentInflated() after your view is inflated so all the attributes take effect. I recommend doing it in onViewCreated() of your Fragment:

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerNotifier.onParentInflated();
}

That's it! There are also plenty of attributes you can set in your XML node, like

<br.com.zynger.recyclernotifier.RecyclerNotifier
  android:id="@+id/recycler_notifier"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  library:rn_attachTo="@id/recycler_view"
  library:rn_imageSrc="..." <!-- drawable resource for the icon -->
  library:rn_text="..." <!-- text that the notifier will show -->
  library:rn_textColor="<#hex_value>"
  library:rn_textVisibility="..." <!-- one of gone, invisible or visible -->
  library:rn_imageVisibility="..." <!-- same as textVisibility but for the icon -->
  library:rn_anchor="..." <!-- one of top or bottom -->
  library:rn_scrollListenerEnabled="boolean" <!-- if the scroll listener must be attached automatically to the RecyclerView-->
        />