Mesith / android-binding

Automatically exported from code.google.com/p/android-binding
0 stars 0 forks source link

list binding doesn't provide empty template #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you have a look at the notepad sample from the SDK, the listactivity enables 
to handle a specific template whem the list is empty :
http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html  , 
step 4

I'm thinking it should be good to have it.

Original issue reported on code.google.com by ffor...@linuxmail.org on 10 Sep 2011 at 2:48

GoogleCodeExporter commented 9 years ago
it is actually odd to have that.. as it is actually not anything provided by 
the listview but a combo of a few widgets. I agree sdk listactivity providing 
this is very convenient.. but, I think we can do this by doing it manually or 
simply create a custom widget for this.. 

Original comment by gueei....@gmail.com on 11 Sep 2011 at 2:13

GoogleCodeExporter commented 9 years ago
We decided not to implement emptyView on the AdapterView, but provide a 
work-around implementation. Since letting a ViewAttribute holding the other 
instance's View isn't a too good idea for MVVM and the usage scenario is not 
generic enough, in this case a new Read-only View Attribute called `itemCount` 
is added to the AdapterView which returns the number of items the view is 
holding. 

Using also the newest in-xml referencing syntax, following would achieve what 
you suggested, purely in xml:

{{{
<TextView binding:visibility="NOT(EQUAL(=id/list1.itemCount, 0))"
android:text="There's nothing in the list yet".../>
<ListView android:id="@+id/list1" 
binding:visibility="EQUAL(=id/list1.itemCount, 0)" .../>
}}}

The above solution also demonstrated in the Markup Demo, in the 
ArrayListAsListViewSource.

Original comment by gueei....@gmail.com on 16 Sep 2011 at 1:28