/ RecyclerView

Library for creating RecyclerView with warning message of data availability

Library for creating RecyclerView with warning message of data availability

Adaptive Recycler View

Library for creating RecyclerView with warning message of data availability.

Usage

Gradle dependency

In root build.gradle:

allprojects {
    repositories {
        ...
        maven {
            url 'https://dl.bintray.com/fartem/android'
        }
    }
}

In project level build file:

implementation 'com.smlnskgmail.jaman:adaptiverecyclerview:version'

AdaptiveRecyclerView

XML

Declaring as an AndroidX RecyclerView (Layout manager can be set up from code).

<com.smlnskgmail.jaman.adaptiverecyclerview.AdaptiveRecyclerView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />

Code

Java

adaptiveRecyclerView.setMessageView(adaptiveMessageView);

Kotlin

adaptive_recycler_view.messageView = adaptive_message_view

Methods:

  • setMessageView(messageView: View) - set message view.

AdaptiveMessageView

XML

Must be declared in layout with AdaptiveRecyclerView. It can be customized with parameters (all available parameters contains in example with arv).

<com.smlnskgmail.jaman.adaptiverecyclerview.AdaptiveMessageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        arv:message_image="@drawable/ic_error"
        arv:message_image_tint="@color/colorPrimary"
        arv:message_text="@string/text_message_list"
        arv:message_text_size="@dimen/medium_text"
        arv:message_text_color="@color/colorPrimary" />

Parameters:

  • message_image - set custom image;
  • message_image_tint - set tint for image (default or custom);
  • message_text - set message text;
  • message_text_size - set message size;
  • message_text_color - set message text color.

If you want to use default image or text, you can override dimension from the library:

  • adaptive_message_view_text_margin_top - distance between image and message, in dp;
  • adaptive_message_view_image_size - image size, in dp;
  • adaptive_message_view_text_size - message text size, in sp.

Default strings keys for elements:

  • adaptive_message_view_text - message text;
  • adaptive_message_view_content_description - image content description.

GitHub