diff --git a/res/anim/box_with_pages_slide_up_page1.xml b/res/anim/box_with_pages_slide_up_page1.xml new file mode 100644 index 000000000000..a85fc5429e96 --- /dev/null +++ b/res/anim/box_with_pages_slide_up_page1.xml @@ -0,0 +1,8 @@ + + + diff --git a/res/anim/box_with_pages_slide_up_page2.xml b/res/anim/box_with_pages_slide_up_page2.xml new file mode 100644 index 000000000000..782df4db5f27 --- /dev/null +++ b/res/anim/box_with_pages_slide_up_page2.xml @@ -0,0 +1,8 @@ + + + diff --git a/res/anim/box_with_pages_slide_up_page3.xml b/res/anim/box_with_pages_slide_up_page3.xml new file mode 100644 index 000000000000..bb4f315d8983 --- /dev/null +++ b/res/anim/box_with_pages_slide_up_page3.xml @@ -0,0 +1,8 @@ + + + diff --git a/res/drawable-hdpi/box_with_pages_bottom.png b/res/drawable-hdpi/box_with_pages_bottom.png new file mode 100644 index 000000000000..6c00746b5cce Binary files /dev/null and b/res/drawable-hdpi/box_with_pages_bottom.png differ diff --git a/res/drawable-hdpi/box_with_pages_page1.png b/res/drawable-hdpi/box_with_pages_page1.png new file mode 100644 index 000000000000..c237a01e9d64 Binary files /dev/null and b/res/drawable-hdpi/box_with_pages_page1.png differ diff --git a/res/drawable-hdpi/box_with_pages_page2.png b/res/drawable-hdpi/box_with_pages_page2.png new file mode 100644 index 000000000000..6f936c0bc406 Binary files /dev/null and b/res/drawable-hdpi/box_with_pages_page2.png differ diff --git a/res/drawable-hdpi/box_with_pages_page3.png b/res/drawable-hdpi/box_with_pages_page3.png new file mode 100644 index 000000000000..0129bde787e1 Binary files /dev/null and b/res/drawable-hdpi/box_with_pages_page3.png differ diff --git a/res/drawable-hdpi/box_with_pages_top.png b/res/drawable-hdpi/box_with_pages_top.png new file mode 100644 index 000000000000..bd843e23deac Binary files /dev/null and b/res/drawable-hdpi/box_with_pages_top.png differ diff --git a/res/drawable-mdpi/box_with_pages_bottom.png b/res/drawable-mdpi/box_with_pages_bottom.png new file mode 100644 index 000000000000..2e685cb30597 Binary files /dev/null and b/res/drawable-mdpi/box_with_pages_bottom.png differ diff --git a/res/drawable-mdpi/box_with_pages_page1.png b/res/drawable-mdpi/box_with_pages_page1.png new file mode 100644 index 000000000000..fb7b3315b06d Binary files /dev/null and b/res/drawable-mdpi/box_with_pages_page1.png differ diff --git a/res/drawable-mdpi/box_with_pages_page2.png b/res/drawable-mdpi/box_with_pages_page2.png new file mode 100644 index 000000000000..0e61552067c6 Binary files /dev/null and b/res/drawable-mdpi/box_with_pages_page2.png differ diff --git a/res/drawable-mdpi/box_with_pages_page3.png b/res/drawable-mdpi/box_with_pages_page3.png new file mode 100644 index 000000000000..fb3181f32af8 Binary files /dev/null and b/res/drawable-mdpi/box_with_pages_page3.png differ diff --git a/res/drawable-mdpi/box_with_pages_top.png b/res/drawable-mdpi/box_with_pages_top.png new file mode 100644 index 000000000000..df37ace6a146 Binary files /dev/null and b/res/drawable-mdpi/box_with_pages_top.png differ diff --git a/res/drawable-xhdpi/box_with_pages_bottom.png b/res/drawable-xhdpi/box_with_pages_bottom.png new file mode 100644 index 000000000000..ec010b34f01e Binary files /dev/null and b/res/drawable-xhdpi/box_with_pages_bottom.png differ diff --git a/res/drawable-xhdpi/box_with_pages_page1.png b/res/drawable-xhdpi/box_with_pages_page1.png new file mode 100644 index 000000000000..d691dcd8d3dc Binary files /dev/null and b/res/drawable-xhdpi/box_with_pages_page1.png differ diff --git a/res/drawable-xhdpi/box_with_pages_page2.png b/res/drawable-xhdpi/box_with_pages_page2.png new file mode 100644 index 000000000000..cf50edec8111 Binary files /dev/null and b/res/drawable-xhdpi/box_with_pages_page2.png differ diff --git a/res/drawable-xhdpi/box_with_pages_page3.png b/res/drawable-xhdpi/box_with_pages_page3.png new file mode 100644 index 000000000000..1e1bbfd04080 Binary files /dev/null and b/res/drawable-xhdpi/box_with_pages_page3.png differ diff --git a/res/drawable-xhdpi/box_with_pages_top.png b/res/drawable-xhdpi/box_with_pages_top.png new file mode 100644 index 000000000000..b284f25d1f27 Binary files /dev/null and b/res/drawable-xhdpi/box_with_pages_top.png differ diff --git a/res/drawable-xxhdpi/box_with_pages_bottom.png b/res/drawable-xxhdpi/box_with_pages_bottom.png new file mode 100644 index 000000000000..c46ce05ea14a Binary files /dev/null and b/res/drawable-xxhdpi/box_with_pages_bottom.png differ diff --git a/res/drawable-xxhdpi/box_with_pages_page1.png b/res/drawable-xxhdpi/box_with_pages_page1.png new file mode 100644 index 000000000000..24456dbd2c15 Binary files /dev/null and b/res/drawable-xxhdpi/box_with_pages_page1.png differ diff --git a/res/drawable-xxhdpi/box_with_pages_page2.png b/res/drawable-xxhdpi/box_with_pages_page2.png new file mode 100644 index 000000000000..d09de9d1e9e6 Binary files /dev/null and b/res/drawable-xxhdpi/box_with_pages_page2.png differ diff --git a/res/drawable-xxhdpi/box_with_pages_page3.png b/res/drawable-xxhdpi/box_with_pages_page3.png new file mode 100644 index 000000000000..3b550df86c08 Binary files /dev/null and b/res/drawable-xxhdpi/box_with_pages_page3.png differ diff --git a/res/drawable-xxhdpi/box_with_pages_top.png b/res/drawable-xxhdpi/box_with_pages_top.png new file mode 100644 index 000000000000..b5ff7db2121d Binary files /dev/null and b/res/drawable-xxhdpi/box_with_pages_top.png differ diff --git a/res/layout/reader_empty_view.xml b/res/layout/reader_empty_view.xml new file mode 100644 index 000000000000..fca829244bc8 --- /dev/null +++ b/res/layout/reader_empty_view.xml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/reader_fragment_post_grid.xml b/res/layout/reader_fragment_post_grid.xml index 75c22a28849a..95eff736bee6 100644 --- a/res/layout/reader_fragment_post_grid.xml +++ b/res/layout/reader_fragment_post_grid.xml @@ -33,4 +33,7 @@ android:text="@string/reader_empty_posts_in_tag" android:visibility="gone" /> + + \ No newline at end of file diff --git a/res/layout/reader_fragment_post_list.xml b/res/layout/reader_fragment_post_list.xml index 5835ce35c13e..a3422975e6ad 100644 --- a/res/layout/reader_fragment_post_list.xml +++ b/res/layout/reader_fragment_post_list.xml @@ -16,13 +16,8 @@ android:text="@string/reader_label_new_posts_one" android:visibility="gone" /> - + \ No newline at end of file diff --git a/res/values/colors.xml b/res/values/colors.xml index 5a6444c68faf..108ffe0e5960 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -69,6 +69,7 @@ #eeeeee #dddddd #999999 + #777777 #333333 #222222 diff --git a/res/values/dimens.xml b/res/values/dimens.xml index fd45e9131a92..25d38ab8e609 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -61,6 +61,10 @@ 96dp + 24sp + 18sp + 36dp + 12dp 4dp 4dp diff --git a/res/values/reader_styles.xml b/res/values/reader_styles.xml index 72781b79c708..db9101377164 100644 --- a/res/values/reader_styles.xml +++ b/res/values/reader_styles.xml @@ -137,8 +137,9 @@ wrap_content @dimen/reader_text_sz_large center - @color/grey_medium + @color/grey_dark + + + + + + + \ No newline at end of file diff --git a/src/org/wordpress/android/models/ReaderTag.java b/src/org/wordpress/android/models/ReaderTag.java index c1a447f98a17..32da4b25b8fd 100644 --- a/src/org/wordpress/android/models/ReaderTag.java +++ b/src/org/wordpress/android/models/ReaderTag.java @@ -50,6 +50,22 @@ public void setEndpoint(String endpoint) { this.endpoint = StringUtils.notNullStr(endpoint); } + /** + * Extract tag Id from endpoint, only works for ReaderTagType.DEFAULT + * + * @return a string Id if tagType is ReaderTagType.DEFAULT, empty string else + */ + public String getStringIdFromEndpoint() { + if (tagType != ReaderTagType.DEFAULT) { + return ""; + } + String[] splitted = endpoint.split("/"); + if (splitted != null && splitted.length > 0) { + return splitted[splitted.length - 1]; + } + return ""; + } + public String getTagName() { return StringUtils.notNullStr(tagName); } diff --git a/src/org/wordpress/android/ui/reader/ReaderActivity.java b/src/org/wordpress/android/ui/reader/ReaderActivity.java index b8524556b437..f46c1195a42e 100644 --- a/src/org/wordpress/android/ui/reader/ReaderActivity.java +++ b/src/org/wordpress/android/ui/reader/ReaderActivity.java @@ -3,11 +3,9 @@ import android.app.Dialog; import android.content.Context; import android.content.Intent; -import android.content.SharedPreferences; import android.content.res.Configuration; import android.net.Uri; import android.os.Bundle; -import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; @@ -28,7 +26,6 @@ import org.wordpress.android.R; import org.wordpress.android.WordPress; import org.wordpress.android.ui.WPActionBarActivity; -import org.wordpress.android.ui.posts.PostsActivity; import org.wordpress.android.ui.reader.ReaderBaseFragment.ChangeTopicListener; import org.wordpress.android.ui.reader.ReaderBaseFragment.GetLastSelectedItemListener; import org.wordpress.android.ui.reader.ReaderBaseFragment.GetLoadedItemsListener; diff --git a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java index 41191f2175fe..9686f29cf42b 100644 --- a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java +++ b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java @@ -13,8 +13,10 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.AbsListView; import android.widget.AdapterView; +import android.widget.ImageView; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; @@ -49,7 +51,7 @@ public class ReaderPostListFragment extends Fragment implements AbsListView.OnSc private ReaderActionBarTagAdapter mActionBarAdapter; private TextView mNewPostsBar; - private TextView mEmptyMessage; + private View mEmptyView; private View mFooterProgress; private String mCurrentTag; @@ -213,13 +215,15 @@ public void onClick(View view) { }); // textView that appears when current tag has no posts - mEmptyMessage = (TextView) view.findViewById(R.id.text_empty); + mEmptyView = view.findViewById(R.id.empty_view); // move the "new posts" bar and "empty" textView down when the translucent ActionBar is enabled if (isTranslucentActionBarEnabled) { RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mNewPostsBar.getLayoutParams(); - params.setMargins(0, actionbarHeight, 0, 0); - mEmptyMessage.setPadding(0, actionbarHeight, 0, 0); + if (params != null) { + params.setMargins(0, actionbarHeight, 0, 0); + } + mEmptyView.setPadding(0, actionbarHeight, 0, 0); } if (useGridView) { @@ -289,6 +293,54 @@ public void onItemClick(AdapterView adapterView, View view, int position, lon return view; } + private void startBoxAndPagesAnimation() { + Animation animPage1 = AnimationUtils.loadAnimation(getActivity(), + R.anim.box_with_pages_slide_up_page1); + ImageView page1 = (ImageView) getActivity().findViewById(R.id.empty_tags_box_page1); + page1.startAnimation(animPage1); + + Animation animPage2 = AnimationUtils.loadAnimation(getActivity(), + R.anim.box_with_pages_slide_up_page2); + ImageView page2 = (ImageView) getActivity().findViewById(R.id.empty_tags_box_page2); + page2.startAnimation(animPage2); + + Animation animPage3 = AnimationUtils.loadAnimation(getActivity(), + R.anim.box_with_pages_slide_up_page3); + ImageView page3 = (ImageView) getActivity().findViewById(R.id.empty_tags_box_page3); + page3.startAnimation(animPage3); + } + + private void setEmptyTitleAndDecriptionForCurrentTag() { + boolean hasTagEverUpdated = ReaderTagTable.hasEverUpdatedTag(mCurrentTag); + int title, description = -1; + int tagIndex = mActionBarAdapter.getIndexOfTagName(mCurrentTag); + ReaderTag tag = (ReaderTag) getActionBarAdapter().getItem(tagIndex); + String tagId = tag.getStringIdFromEndpoint(); + if (tagId.equals("following")) { + title = R.string.reader_empty_followed_blogs_title; + description = R.string.reader_empty_followed_blogs_description; + } else { + if (tagId.equals("liked")) { + title = R.string.reader_empty_posts_liked; + } else { + if (hasTagEverUpdated) { + title = R.string.reader_empty_posts_in_tag; + } else { + title = R.string.reader_empty_posts_in_tag_never_updated; + } + } + } + TextView titleView = (TextView) getActivity().findViewById(R.id.title_empty); + TextView descriptionView = (TextView) getActivity().findViewById(R.id.description_empty); + titleView.setText(getString(title)); + if (description == -1) { + descriptionView.setVisibility(View.INVISIBLE); + } else { + descriptionView.setText(getString(description)); + descriptionView.setVisibility(View.VISIBLE); + } + } + /* * called by post adapter when data has been loaded */ @@ -296,12 +348,11 @@ public void onItemClick(AdapterView adapterView, View view, int position, lon @Override public void onDataLoaded(boolean isEmpty) { if (isEmpty) { - // different empty text depending on whether this tag has ever been updated - boolean hasTagEverUpdated = ReaderTagTable.hasEverUpdatedTag(mCurrentTag); - mEmptyMessage.setText(hasTagEverUpdated ? R.string.reader_empty_posts_in_tag : R.string.reader_empty_posts_in_tag_never_updated); - mEmptyMessage.setVisibility(View.VISIBLE); + startBoxAndPagesAnimation(); + setEmptyTitleAndDecriptionForCurrentTag(); + mEmptyView.setVisibility(View.VISIBLE); } else { - mEmptyMessage.setVisibility(View.GONE); + mEmptyView.setVisibility(View.GONE); // restore previous scroll position if (mScrollToIndex > 0) { final ListView listView = (ListView) getActivity().findViewById(android.R.id.list);