/adaptive-recycler-view

Library that allows you to create RecyclerView with warning message of data availability

Primary LanguageKotlinMIT LicenseMIT

AdaptiveRecyclerView

GitHubActions Codebeat Codecov JitPack Android Arsenal

About

Library that allows you to create RecyclerView with warning message of data availability.

Screenshots

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


Usage

Gradle dependency

In root build.gradle:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

In project level build.gradle:

implementation 'com.github.fartem:adaptive-recycler-view:1.1.1'

AdaptiveRecyclerView

XML

<com.smlnskgmail.jaman.adaptiverecyclerview.AdaptiveRecyclerView
        android:id="@+id/adaptive_recycler_view"
        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

Method Arguments Description
setMessageView messageView: View Set message view

AdaptiveMessageView

XML

Must be declared in layout with AdaptiveRecyclerView.

<com.smlnskgmail.jaman.adaptiverecyclerview.AdaptiveMessageView
        android:id="@+id/adaptive_message_view"
        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

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

Dimension

Dimension Description
adaptive_message_view_text_margin_top Distance between image and message
adaptive_message_view_text_padding Message padding
adaptive_message_view_image_size Image size
adaptive_message_view_text_size Message text size

Strings keys

String key Description
adaptive_message_view_text Message text
adaptive_message_view_content_description Image content description

Who using AdaptiveRecyclerView

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