Skip to content

gzeinnumer/EasyEmptyListState

Repository files navigation

  

EasyEmptyListState


Easy Recyclerview Empty State View.


Content List


Download

Add maven jitpack.io and dependencies in build.gradle (Project) :

// build.gradle project
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

// build.gradle app/module
dependencies {
  ...
  implementation 'com.github.gzeinnumer:EasyEmptyListState:version'
}

Feature List

No Nested

DummyAdapterV2 adapter = new DummyAdapterV2();
EasyEmptyList easyEmptyList = findViewById(R.id.easy_empty_list);
easyEmptyList.rv.setAdapter(adapter);
easyEmptyList.rv.hasFixedSize();
easyEmptyList.rv.setLayoutManager(new LinearLayoutManager(this));

//use list.size();
//if size == 0 , R.drawable.no_data_custom will SHOW RecyclerView will HIDE
//if size > 0, R.drawable.no_data_custom will HIDE RecyclerView will SHOW
easyEmptyList.setSize(1);
easyEmptyList.setImageEmpty(R.drawable.no_data_custom);
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    ...
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.gzeinnumer.eels.EasyEmptyList
        android:id="@+id/easy_empty_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

Nested

DummyAdapterV2 adapter = new DummyAdapterV2();
EasyEmptyList easyEmptyList = findViewById(R.id.easy_empty_list);
easyEmptyList.rv.setAdapter(adapter);
easyEmptyList.rv.hasFixedSize();
easyEmptyList.rv.setLayoutManager(new LinearLayoutManager(this));

//use list.size();
//if size == 0 , R.drawable.no_data_custom will SHOW RecyclerView will HIDE
//if size > 0, R.drawable.no_data_custom will HIDE RecyclerView will SHOW
easyEmptyList.setSize(1);
easyEmptyList.setImageEmpty(R.drawable.no_data_custom);
easyEmptyList.rv.setNestedScrollingEnabled(true); // enable nested
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView
    ...
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <com.gzeinnumer.eels.EasyEmptyList
            android:id="@+id/easy_empty_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1" />
    </LinearLayout>
</androidx.core.widget.NestedScrollView>

Example Code/App


Version

  • 1.0.0
    • First Release
  • 1.0.1
    • SDK 16
  • 1.0.3
    • Bug Fixing

Contribution

You can sent your constribution to branch open-pull.

Fore More All My Library


Copyright 2021 M. Fadli Zein

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages