RecyclerNotifier


Source link: https://github.com/julioz/recyclernotifier

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.


Usage

There are two ways of using the library: dynamically via Java code or statically through XML layouts (there is sample code for each one of the possibilites). After that, you're all set! Just call show() and hide() whenever you want to change the RecyclerNotifier visibility. The library brings a smooth animation built-in.

Via Java

Initialize a RecyclerNotifier like so:

RecyclerNotifier recyclerNotifier = new RecyclerNotifier(getContext());

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-->

/>

Attributes

You can set a regular OnClickListener on it through setOnClickListener(...), and all the other properties through your instance of RecyclerNotifier.

Anchoring

If needed, you can set the anchor of your RecyclerNotifier to TOP or BOTTOM by using the following call:

RecyclerNotifierAttacher.attach(recyclerNotifier, mRecyclerView, RecyclerNotifierAttacher.ANCHOR_BOTTOM);

You can even have two RecyclerNotifiers, one attached to TOP and another to BOTTOM!

Scroll listener

There is also a built-in OnScrollListener: the RecyclerNotifier will hide automatically if you scroll your RecyclerView downwards and reapper if you scroll it up. To use it, you must simply call:

mRecyclerView.addOnScrollListener(mRecyclerNotifier.getOnScrollListener());

Suppose you have a background thread fetching new data for your RecyclerView, and you want to show the RecyclerNotifier after the new data is fetched. When the user sees the data, the RecyclerNotifier will be hidden and won't show up until another fetch is started. To do that, you can simply set the Notifier's ScrollListener to your RecyclerView, and after your fetch is done you must call:

mRecyclerNotifier.show();

When your user sees the new data, simply set the Notifier to ignore new scroll events by using

mRecyclerNotifier.setChangeVisibilityWithScrollListener(false);

As soon as you have new data you can reset that flag to true in order for the Notifier to be shown as soon as the user scrolls.


Download

Right now the library is not yet available through gradle, but this is in the roadmap. For now, just checkout the directory folder and add it as a module to your project, or download the aar from the repository adding it to the libs directory in your project.

Then, add this to your build.gradle dependencies:

compile 'br.com.zynger.recyclernotifier:recyclernotifier:1.0@aar'

And this to your repositories node in the top-level build.gradle:

allprojects {

  repositories {

jcenter()

flatDir {

  dirs 'libs'

}

  
}
 
}

License

Copyright 2015 Julio Zynger, 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
  http://www.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. 

Resources

A powerful image picker which support multi mode and huge image.

Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live blurring and animations. It uses RenderScript internally (although different implementations can be chosen) and is heavily cached to be fast and keeps small memory footprint. It features a lot of additional image filters and may be easily extended and pretty every configuration can be changed.

Under the Hood is a flexible and powerful Android debug view library. It uses a modular template system that can be easily extended to your needs, although coming with many useful elements built-in.

There is a lot of "default" debug data that can be easily embedded (e.g. current runtime-permission status, app version and device info). There are 2 basic themes (dark and light) which can be customized to your needs.

Sticky header view or suspending view for RecyclerView. RecyclerStickyHeaderView is an Android library that makes it easy to integrate section headers stick to the top in RecyclerView.

Official Google Actions SDK is written in Node.js. But in many situations voice interfaces like Google Home or Google Assistant will extend or replace mobile apps. If you are old fashioned Android engineer and the most of your code is already written in Java, why not reuse it and build voice extension to app on your own? And this is the main reason to build Google Actions Java SDK - enabling as much developers as possible to build their brilliant ideas for Google Assistant and Home.

Currently this is just working proof of concept of Google Actions Java SDK. It means that there is no documentation, fixed interface, (not much) unit tests and many, many others.

Google Actions Java SDK is build based on official Node.js library, but it's not a mirror copy of it. The goal is to make it fully compatible with Conversational Protocol of Assistant Platform.

Applozic Android Video Calling SDK lets you integrate video call, audio call, real time chat and in-app messaging in just few lines of code.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes