Skip to content

Commit ca46511

Browse files
committed
Merge pull request #354 from wordpress-mobile/issue/353-improve-post-empty-view
fix #353: new post/page empty view
2 parents 587d382 + 476e176 commit ca46511

File tree

6 files changed

+51
-9
lines changed

6 files changed

+51
-9
lines changed

res/drawable-hdpi/penandink.png

2.92 KB
Loading

res/drawable-mdpi/penandink.png

1.24 KB
Loading

res/drawable-xhdpi/penandink.png

2.61 KB
Loading

res/drawable-xxhdpi/penandink.png

7.05 KB
Loading

res/layout/post_listview.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:orientation="vertical"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent">
7+
8+
<LinearLayout
9+
android:id="@id/android:empty"
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"
12+
android:orientation="vertical"
13+
android:gravity="center">
14+
15+
<ImageView
16+
android:id="@+id/empty_tags_box_top"
17+
android:layout_width="112dp"
18+
android:layout_height="86dp"
19+
android:src="@drawable/penandink"
20+
android:layout_marginBottom="8dp" />
21+
22+
<org.wordpress.android.widgets.WPTextView
23+
android:id="@+id/title_empty"
24+
style="@style/WordPress.EmptyList.Title"
25+
android:layout_width="wrap_content"
26+
android:layout_height="wrap_content"
27+
android:layout_marginBottom="8dp"
28+
android:layout_marginLeft="32dp"
29+
android:layout_marginRight="32dp"
30+
android:text="@string/empty_list_default" />
31+
32+
<org.wordpress.android.widgets.WPTextView
33+
android:id="@+id/description_empty"
34+
style="@style/WordPress.EmptyList.Description"
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:layout_marginBottom="8dp"
38+
android:layout_marginLeft="48dp"
39+
android:layout_marginRight="48dp" />
40+
</LinearLayout>
41+
42+
<ListView
43+
android:id="@id/android:list"
44+
android:layout_width="match_parent"
45+
android:layout_height="0dp"
46+
android:layout_weight="1"
47+
android:drawSelectorOnTop="false" />
48+
</LinearLayout>
49+

src/org/wordpress/android/ui/posts/PostsListFragment.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,19 @@ public void onCreate(Bundle icicle) {
8282

8383
@Override
8484
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
85-
View v = inflater.inflate(R.layout.empty_listview, container, false);
86-
return v;
85+
return inflater.inflate(R.layout.post_listview, container, false);
8786
}
8887

8988
@Override
9089
public void onActivityCreated(Bundle bundle) {
9190
super.onActivityCreated(bundle);
92-
TextView textview = (TextView) getListView().getEmptyView();
91+
TextView textview = (TextView) getActivity().findViewById(R.id.title_empty);
9392
if (textview != null) {
9493
if (isPage) {
9594
textview.setText(getText(R.string.pages_empty_list));
9695
} else {
9796
textview.setText(getText(R.string.posts_empty_list));
9897
}
99-
textview.setOnClickListener(new View.OnClickListener() {
100-
@Override
101-
public void onClick(View v) {
102-
mParentActivity.newPost();
103-
}
104-
});
10598
}
10699
createSwitcher();
107100
mListScrollPositionManager = new ListScrollPositionManager(getListView(), true);

0 commit comments

Comments
 (0)