You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-24Lines changed: 35 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,69 +4,80 @@ Handles multiple display states for data-centric views
4
4
- Content state; shows the inner content of the View (as defined in XML)
5
5
- Loading state; shows a Loading state (as specified either via the `loadingLayout` attribute, or the default layout (`res/layout/msv__loading.xml`)
6
6
7
+
The following shows examples (using default layouts) for **Loading**, **General Error**, **Network Error**, and the **Content** states (where we've made the "Hello World" the content) in respective order.
- For whatever `View` you want to switch out with `MultiStateView`, wrap the `View` in a `MultiStateView` node.
10
17
- In code, get your reference to the child of `MultiStateView` via `MultiStateView#getContentView()` and cast that value as needed. There's no good reason to put an `android:id` on the child `View`.
0.`android:id="@+id/list"` was moved from the `ListView` to the `MultiStateView`
52
-
0. It was also renamed to `list_container` to note that it now is the parent of the `ListView`
53
-
0. Any references in code should now use `MultiStateView#getContentView()` casted to `ListView` to reference the `ListView` child. There's no good reason to put an `id` on the `ListView`. See below.
62
+
0.`android:id="@+id/list"` was moved from the `ListView` to the `MultiStateView`
63
+
0. It was also renamed to `list_container` to note that it now is the parent of the `ListView`
64
+
0. Any references in code should now use `MultiStateView#getContentView()` casted to `ListView` to reference the `ListView` child. There's no good reason to put an `id` on the `ListView`. See below.
54
65
55
66
- In code,
56
-
67
+
57
68
ListView list = (ListView) findViewById(R.id.list);
ListView list = (ListView) container.getContentView();
63
-
74
+
64
75
- To control the state of the `MultiStateView`, use the `MultiStateView#setState(State)` method.
65
-
76
+
66
77
container.setState(State.LOADING);
67
-
78
+
68
79
- By default, "Loading" indication uses the loading layout provided in the library (`res/layout/msv__loading.xml`). To customize, you can add the custom attribute `msvLoadingLayout` to the `MultiStateView` in XML with a reference to the layout to inflate.
0 commit comments