Skip to content

Instantly share code, notes, and snippets.

View siifii's full-sized avatar
🐿️
Focusing

Kareem Alsaifi siifii

🐿️
Focusing
View GitHub Profile
@siifii
siifii / RecyclerActivity.kt
Created February 25, 2020 13:17
Filterable & Searchable Recyclerview.
searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
adapter.filter.filter(newText)
return false
}
override fun onQueryTextSubmit(query: String): Boolean {
return false
}
})
@siifii
siifii / recyclerview_layout.xml
Last active February 23, 2020 13:16
Adding padding for recycerview's last item.
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
------
android:layout_marginBottom="40dp"
android:clipToPadding="false"
------
android:paddingBottom="56dp"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
@siifii
siifii / MyRecyclerActivity.kt
Last active February 23, 2020 13:16
Recyclerview's gridlayout/straggedgridlayout with flexible and dynamic width and height
val layoutManager = FlexboxLayoutManager(this)
layoutManager.flexDirection = FlexDirection.ROW
layoutManager.justifyContent = JustifyContent.FLEX_START
recyclerview.layoutManager = layoutManager
//TODO TO KNOW MORE ABOUT FLEXBOX CHECK https://github.com/google/flexbox-layout