From 1dc05242e12f3b0f767f06696d58769ffb7c3caf Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Fri, 13 Dec 2013 16:35:46 +0100 Subject: [PATCH 1/3] fix #448: reader - change the empty view message when fetching articles --- res/values/strings.xml | 8 ++-- .../reader_native/ReaderPostListFragment.java | 41 ++++++++++--------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index a2c2ec1d507f..b3f2b4d330d2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -723,10 +723,10 @@ Freshly Pressed - No articles with this tag - No articles with this tag yet - You don\'t follow any tags - No popular tags + No articles in this topic. + Fetching articles… + You don\'t follow any tags. + No popular tags. You\'re not following any blogs yet. But don\'t worry, just tap the tag icon to start exploring! You have not liked any posts. diff --git a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java index 4c4c63c80e27..b5cf930712ed 100644 --- a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java +++ b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java @@ -238,29 +238,30 @@ private void startBoxAndPagesAnimation() { } private void setEmptyTitleAndDecriptionForCurrentTag() { - boolean hasTagEverUpdated = ReaderTagTable.hasEverUpdatedTag(mCurrentTag); + if (!isPostAdapterEmpty()) { + return ; + } int title, description = -1; - int tagIndex = mActionBarAdapter.getIndexOfTagName(mCurrentTag); - - final String tagId; - if (tagIndex > -1) { - ReaderTag tag = (ReaderTag) getActionBarAdapter().getItem(tagIndex); - tagId = tag.getStringIdFromEndpoint(); + if (isUpdating()) { + title = R.string.reader_empty_posts_in_topic_updating; } else { - tagId = ""; - } + int tagIndex = mActionBarAdapter.getIndexOfTagName(mCurrentTag); - 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; + final String tagId; + if (tagIndex > -1) { + ReaderTag tag = (ReaderTag) getActionBarAdapter().getItem(tagIndex); + tagId = tag.getStringIdFromEndpoint(); } else { - if (hasTagEverUpdated) { - title = R.string.reader_empty_posts_in_tag; + tagId = ""; + } + 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 { - title = R.string.reader_empty_posts_in_tag_never_updated; + title = R.string.reader_empty_posts_in_topic; } } } @@ -451,12 +452,12 @@ public void onUpdateResult(ReaderActions.UpdateResult result, int numNewPosts) { protected boolean isUpdating() { return mIsUpdating; } + protected void setIsUpdating(boolean isUpdating, ReaderActions.RequestDataAction updateAction) { if (mIsUpdating==isUpdating) return; if (!hasActivity()) return; - mIsUpdating = isUpdating; switch (updateAction) { case LOAD_NEWER: @@ -473,6 +474,8 @@ protected void setIsUpdating(boolean isUpdating, ReaderActions.RequestDataAction } break; } + // update empty view title and description if the the post list is empty + setEmptyTitleAndDecriptionForCurrentTag(); } private void showNewPostsBar(int numNewPosts) { From 6ce8e786595c1886317e14041ef7f8fd3e5b725c Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Mon, 16 Dec 2013 11:18:26 +0100 Subject: [PATCH 2/3] s/article/post/ in strings.xml (this word was only used in the reader) --- res/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index b3f2b4d330d2..1b756b2adb36 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -689,8 +689,8 @@ Optional comment - One new article - %d new articles + One new post + %d new posts Added %s Removed %s Reblog this post to @@ -723,8 +723,8 @@ Freshly Pressed - No articles in this topic. - Fetching articles… + No post in this topic. + Fetching posts… You don\'t follow any tags. No popular tags. You\'re not following any blogs yet. From ed7bf8fdfa07e768ae594c0bc6d0f371a98d39d6 Mon Sep 17 00:00:00 2001 From: Maxime Biais Date: Mon, 16 Dec 2013 14:18:43 +0100 Subject: [PATCH 3/3] update empty view only when no new article fetched --- .../android/ui/reader_native/ReaderPostListFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java index b5cf930712ed..47eb4d8ab4f3 100644 --- a/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java +++ b/src/org/wordpress/android/ui/reader_native/ReaderPostListFragment.java @@ -424,6 +424,8 @@ private void updatePostsWithTag(final String tagName, final ReaderActions.Reques } setIsUpdating(true, updateAction); + // update empty view title and description if the the post list is empty + setEmptyTitleAndDecriptionForCurrentTag(); ReaderPostActions.updatePostsWithTag(tagName, updateAction, new ReaderActions.UpdateResultAndCountListener() { @Override @@ -441,6 +443,9 @@ public void onUpdateResult(ReaderActions.UpdateResult result, int numNewPosts) { } else { refreshPosts(); } + } else { + // update empty view title and description if the the post list is empty + setEmptyTitleAndDecriptionForCurrentTag(); } // schedule the next update in this tag if (result != ReaderActions.UpdateResult.FAILED) @@ -474,8 +479,6 @@ protected void setIsUpdating(boolean isUpdating, ReaderActions.RequestDataAction } break; } - // update empty view title and description if the the post list is empty - setEmptyTitleAndDecriptionForCurrentTag(); } private void showNewPostsBar(int numNewPosts) {