<@U6ECJCVAL> Thanks for your reply and suggestions...
# android
t
@rkeazor Thanks for your reply and suggestions! I thought about implementing what you propose first but with databinding: - the list_fragment.xml RecyclerView layout with
android:visibility="@{adapter.itemCount > 0}
- a list_empty.xml layout with
android:visibility="@{adapter.itemCount == 0}
The issue is that I have trouble linking the
adapter
variable to the xmls 😕
a
I think you should keep all logic out of xml
what I’ve done in the past when experimenting with
RecyclerView
and data binding, is keep a bindable collection in a view-model
then create an abstract adapter, what I aimed for was
something that can bind a
List
,
ObservableList
,
ObservableArrayMap
, and
SortedList
. The solution was very complex under the hood, I never managed to get it out there, fully tested with example code, but plan to
current repo, not updated it in ages, but working on unit tests just now: https://github.com/Aidanvii7/Toolbox/
also changed a lot and not pushed… so not final
it’s mostly Java, with a think kotlin layer over certain parts
anyway, that aside, in xml, I aimed for syntax like this:
app:bind_collection="@{viewModel.observableList}"
t
I just saw your replies, thanks a lot for sharing this! I'll look into it tomorrow K