AdaptiveRecyclerView

Additional

Language
Kotlin
Version
0.1.2 (Feb 15, 2020)
Created
Dec 24, 2019
Updated
Mar 28, 2020
Owner
Artem Fomchenkov (fartem)
Contributor
Artem Fomchenkov (fartem)
1
Activity
Badge
Generate
Download
Source code
APK file

Commercial

Adaptive Recycler View

About

Library for creating RecyclerView with warning message of data availability.

Screenshots

First screenshot - example of app state with an empty list of data. Second screenshot - example of app state with loaded items in RecyclerView.



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.
  • message_text_at_center - set message TextView gravity at Gravity.CENTER.

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_text_padding - message padding, 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.

Demo

How to contribute

Read Commit Convention. Make sure your build is green before you contribute your pull request. Then:

gradlew clean
gradlew build

If you don't see any error messages, submit your pull request.

Contributors