Skip to content

Repository files navigation

PaginationManualJava


vm.getNotification().observe(this, resource -> {
switch (resource.status) {
caseSTATUS_1_SUCCESS:
swipe(binding.swipeRefreshLayout, false);
list = resource.data;
emptyState(list != null ? list.size() : 0, binding.rv, binding.imgEmpty);
params.setTotalData(resource.total);
adapter.addNewItem(resource.data);
break;
caseSTATUS_2_ERROR:
swipe(binding.swipeRefreshLayout, false);
emptyState(list != null ? list.size() : 0, binding.rv, binding.imgEmpty);
break;
caseSTATUS_6_LOADING:
swipe(binding.swipeRefreshLayout, true);
emptyState(list != null ? list.size() : 0, binding.rv, binding.imgEmpty);
break;
}
});
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"style="@style/swipeRefreshLayoutV1">
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"style="@style/LLEmptyStateRV"android:visibility="gone"tools:itemCount="3"tools:listitem="@layout/item_notifikasi"tools:visibility="visible" />
<LinearLayoutandroid:id="@+id/imgEmpty"style="@style/LLEmptyState"android:visibility="gone"tools:visibility="visible">
<ImageViewstyle="@style/LLEmptyStateImage"android:src="@drawable/img_no_data_v3" />
</LinearLayout>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<stylename="swipeRefreshLayoutV1">
<itemname="android:layout_width">match_parent</item>
<itemname="android:layout_height">0dp</item>
<itemname="android:layout_weight">1</item>
</style>
<stylename="LLEmptyStateRV">
<itemname="android:layout_width">match_parent</item>
<itemname="android:layout_height">0dp</item>
<itemname="android:layout_weight">1</item>
<itemname="android:overScrollMode">never</item>
</style>
<stylename="LLEmptyState">
<itemname="android:layout_width">match_parent</item>
<itemname="android:layout_height">0dp</item>
<itemname="android:layout_weight">1</item>
<itemname="android:gravity">center</item>
<itemname="android:orientation">vertical</item>
</style>
<stylename="LLEmptyStateImage">
<itemname="android:layout_width">300dp</item>
<itemname="android:layout_height">wrap_content</item>
<itemname="android:adjustViewBounds">true</item>
<itemname="android:scaleType">fitCenter</item>
<itemname="android:src">@drawable/img_no_data_v3</item>
</style>

Copyright 2021 M. Fadli Zein

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages