Skip to content

Commit d57baeb

Browse files
Adding screenshots to README.md for example look-and-feel
1 parent e19b05f commit d57baeb

5 files changed

Lines changed: 35 additions & 24 deletions

File tree

README.md

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,80 @@ Handles multiple display states for data-centric views
44
- Content state; shows the inner content of the View (as defined in XML)
55
- Loading state; shows a Loading state (as specified either via the `loadingLayout` attribute, or the default layout (`res/layout/msv__loading.xml`)
66

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.
8+
9+
![Loading state](screenshots/sample_loading.png)
10+
![General error state](screenshots/sample_general_error.png)
11+
![Network error state](screenshots/sample_network_error.png)
12+
![Content state](screenshots/sample_content.png)
13+
714
## Usage
815

916
- For whatever `View` you want to switch out with `MultiStateView`, wrap the `View` in a `MultiStateView` node.
1017
- 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`.
11-
12-
Example:
18+
19+
**Example**
1320

1421
- Assuming you're starting with:
1522

23+
````xml
1624
<LinearLayout
1725
xmlns:android="http://schemas.android.com/apk/res/android"
1826
android:layout_width="fill_parent"
1927
android:layout_height="fill_parent"
2028
android:orientation="vertical" >
21-
29+
2230
<ListView
2331
android:id="@+id/list"
2432
android:layout_width="fill_parent"
2533
android:layout_height="match_parent" />
26-
34+
2735
</LinearLayout>
36+
````
2837

2938
- You should end up with something like:
3039

40+
````xml
3141
<LinearLayout
3242
xmlns:android="http://schemas.android.com/apk/res/android"
3343
android:layout_width="fill_parent"
3444
android:layout_height="fill_parent"
3545
android:orientation="vertical" >
36-
46+
3747
<com.meetme.android.multistateview.MultiStateView
3848
android:id="@+id/list_container"
3949
android:layout_width="match_parent"
4050
android:layout_height="match_parent">
41-
51+
4252
<ListView
4353
android:layout_width="fill_parent"
4454
android:layout_height="match_parent" />
45-
55+
4656
</com.meetme.android.multistateview.MultiStateView>
47-
57+
4858
</LinearLayout>
49-
59+
````
60+
5061
**Example Notes**
51-
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.
5465

5566
- In code,
56-
67+
5768
ListView list = (ListView) findViewById(R.id.list);
58-
69+
5970
- Becomes
60-
71+
6172
MultiStateView container = (MultiStateView) findViewById(R.id.list_container);
6273
ListView list = (ListView) container.getContentView();
63-
74+
6475
- To control the state of the `MultiStateView`, use the `MultiStateView#setState(State)` method.
65-
76+
6677
container.setState(State.LOADING);
67-
78+
6879
- 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.
69-
80+
7081
## Contributors
7182
- [Dallas Gutauckis](http://github.com/dallasgutauckis)
7283

@@ -75,19 +86,19 @@ Example:
7586
Apache 2.0
7687

7788
Copyright 2013 MeetMe, Inc.
78-
89+
7990
Licensed under the Apache License, Version 2.0 (the "License");
8091
you may not use this file except in compliance with the License.
8192
You may obtain a copy of the License at
82-
93+
8394
http://www.apache.org/licenses/LICENSE-2.0
84-
95+
8596
Unless required by applicable law or agreed to in writing, software
8697
distributed under the License is distributed on an "AS IS" BASIS,
8798
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8899
See the License for the specific language governing permissions and
89100
limitations under the License.
90-
101+
91102
## Contributing
92103

93-
To make contributions, fork this repository, commit your changes, and submit a pull request.
104+
To make contributions, fork this repository, commit your changes, and submit a pull request.

screenshots/sample_content.png

25.5 KB
Loading
28.7 KB
Loading

screenshots/sample_loading.png

24.1 KB
Loading
28.8 KB
Loading

0 commit comments

Comments
 (0)