An android ui library that provide useful classes to speed up the implementation.
Complete documentation Here.
1 Add the JitPack repository to your root build.gradle at the end of repositories
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}2 Add the dependency
dependencies {
implementation 'com.github.WINKgroup:winkit-android-ui:0.1'
}PaginatedRecyclerView docs
An helpful View that implement a RecyclerView with pullToRefresh and Loadmore feature. This recyclerView ask in a callback the pages and allow to implement the “no data” and “error” state.
Xml declaration:
<winkit.android.ui.PaginatedRecyclerView
android:id="@+id/paginatedRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:empty_title="Empty data"
app:empty_subtitle="Subtitle"
app:empty_icon="@mipmap/ic_launcher"
app:error_icon="@mipmap/ic_launcher"/>Kotlin implemention:
paginatedRecycler.adapter = adapter
paginatedRecycler.getPageListener = getPage@{ index: Int ->
getRandomData(index) { data ->
Log.d("DATA!", "${data?.size}")
if (data != null) {
adapter.append(data)
paginatedRecycler.haveMore = !data.isEmpty() && adapter.getRowsCount() < 40
adapter.notifyDataSetChanged()
} else {
if(index == 0)
adapter.showError("Errore di connessione")
else {
paginatedRecycler.haveMore = false
Toast.makeText(this, "Errore di connessione", Toast.LENGTH_SHORT).show()
}
}
}
}
paginatedRecycler.requestFirstPage()


