From 7bf9e771c2d89d9d7ccb052e7ed93d13076109e2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 16 Apr 2013 13:48:44 +0400 Subject: properly toggle unread/marked/published icons on the actionbar --- res/drawable-hdpi/ic_menu_publish_light.png | Bin 1219 -> 0 bytes res/drawable-hdpi/ic_menu_published_light.png | Bin 0 -> 977 bytes res/drawable-hdpi/ic_menu_unpublished_light.png | Bin 0 -> 1169 bytes res/drawable-hdpi/ic_read_light.png | Bin 0 -> 1636 bytes res/drawable-hdpi/ic_unread_light.png | Bin 0 -> 1599 bytes res/drawable-xhdpi/ic_menu_publish_light.png | Bin 1760 -> 0 bytes res/drawable-xhdpi/ic_menu_published_light.png | Bin 0 -> 1266 bytes res/drawable-xhdpi/ic_menu_unpublished_light.png | Bin 0 -> 1546 bytes res/drawable-xhdpi/ic_read_light.png | Bin 0 -> 1923 bytes res/drawable-xhdpi/ic_unread_light.png | Bin 0 -> 1809 bytes res/drawable/s_menu_publish_light.svg | 113 -------------- res/drawable/s_menu_published_light.svg | 189 +++++++++++++++++++++++ res/drawable/s_menu_unpublished_light.svg | 113 ++++++++++++++ res/menu/headlines_action_menu.xml | 2 +- res/menu/main_menu.xml | 6 +- res/menu/offline_menu.xml | 6 +- src/org/fox/ttrss/OnlineActivity.java | 35 ++++- 17 files changed, 340 insertions(+), 124 deletions(-) delete mode 100644 res/drawable-hdpi/ic_menu_publish_light.png create mode 100644 res/drawable-hdpi/ic_menu_published_light.png create mode 100644 res/drawable-hdpi/ic_menu_unpublished_light.png create mode 100644 res/drawable-hdpi/ic_read_light.png create mode 100644 res/drawable-hdpi/ic_unread_light.png delete mode 100644 res/drawable-xhdpi/ic_menu_publish_light.png create mode 100644 res/drawable-xhdpi/ic_menu_published_light.png create mode 100644 res/drawable-xhdpi/ic_menu_unpublished_light.png create mode 100644 res/drawable-xhdpi/ic_read_light.png create mode 100644 res/drawable-xhdpi/ic_unread_light.png delete mode 100644 res/drawable/s_menu_publish_light.svg create mode 100644 res/drawable/s_menu_published_light.svg create mode 100644 res/drawable/s_menu_unpublished_light.svg diff --git a/res/drawable-hdpi/ic_menu_publish_light.png b/res/drawable-hdpi/ic_menu_publish_light.png deleted file mode 100644 index 72acf3dc..00000000 Binary files a/res/drawable-hdpi/ic_menu_publish_light.png and /dev/null differ diff --git a/res/drawable-hdpi/ic_menu_published_light.png b/res/drawable-hdpi/ic_menu_published_light.png new file mode 100644 index 00000000..599ca764 Binary files /dev/null and b/res/drawable-hdpi/ic_menu_published_light.png differ diff --git a/res/drawable-hdpi/ic_menu_unpublished_light.png b/res/drawable-hdpi/ic_menu_unpublished_light.png new file mode 100644 index 00000000..6d10cb92 Binary files /dev/null and b/res/drawable-hdpi/ic_menu_unpublished_light.png differ diff --git a/res/drawable-hdpi/ic_read_light.png b/res/drawable-hdpi/ic_read_light.png new file mode 100644 index 00000000..9ef52959 Binary files /dev/null and b/res/drawable-hdpi/ic_read_light.png differ diff --git a/res/drawable-hdpi/ic_unread_light.png b/res/drawable-hdpi/ic_unread_light.png new file mode 100644 index 00000000..d516f770 Binary files /dev/null and b/res/drawable-hdpi/ic_unread_light.png differ diff --git a/res/drawable-xhdpi/ic_menu_publish_light.png b/res/drawable-xhdpi/ic_menu_publish_light.png deleted file mode 100644 index 8c82c450..00000000 Binary files a/res/drawable-xhdpi/ic_menu_publish_light.png and /dev/null differ diff --git a/res/drawable-xhdpi/ic_menu_published_light.png b/res/drawable-xhdpi/ic_menu_published_light.png new file mode 100644 index 00000000..938ec3e3 Binary files /dev/null and b/res/drawable-xhdpi/ic_menu_published_light.png differ diff --git a/res/drawable-xhdpi/ic_menu_unpublished_light.png b/res/drawable-xhdpi/ic_menu_unpublished_light.png new file mode 100644 index 00000000..7b32106b Binary files /dev/null and b/res/drawable-xhdpi/ic_menu_unpublished_light.png differ diff --git a/res/drawable-xhdpi/ic_read_light.png b/res/drawable-xhdpi/ic_read_light.png new file mode 100644 index 00000000..62e3d1ad Binary files /dev/null and b/res/drawable-xhdpi/ic_read_light.png differ diff --git a/res/drawable-xhdpi/ic_unread_light.png b/res/drawable-xhdpi/ic_unread_light.png new file mode 100644 index 00000000..606c902c Binary files /dev/null and b/res/drawable-xhdpi/ic_unread_light.png differ diff --git a/res/drawable/s_menu_publish_light.svg b/res/drawable/s_menu_publish_light.svg deleted file mode 100644 index a0d818e2..00000000 --- a/res/drawable/s_menu_publish_light.svg +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/res/drawable/s_menu_published_light.svg b/res/drawable/s_menu_published_light.svg new file mode 100644 index 00000000..752fe0f6 --- /dev/null +++ b/res/drawable/s_menu_published_light.svg @@ -0,0 +1,189 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/s_menu_unpublished_light.svg b/res/drawable/s_menu_unpublished_light.svg new file mode 100644 index 00000000..6981beaf --- /dev/null +++ b/res/drawable/s_menu_unpublished_light.svg @@ -0,0 +1,113 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/menu/headlines_action_menu.xml b/res/menu/headlines_action_menu.xml index 5764e179..c4e6d3c4 100644 --- a/res/menu/headlines_action_menu.xml +++ b/res/menu/headlines_action_menu.xml @@ -14,7 +14,7 @@ diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index 7d41f16f..d7d5389e 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -87,7 +87,7 @@ android:title="@string/selection_toggle_marked"/> diff --git a/res/menu/offline_menu.xml b/res/menu/offline_menu.xml index a4dbd0f1..5a952e08 100644 --- a/res/menu/offline_menu.xml +++ b/res/menu/offline_menu.xml @@ -41,7 +41,7 @@ android:title="@string/selection_toggle_marked"/> 0) { toggleArticlesUnread(tmp); hf.notifyUpdated(); + initMenu(); } } } @@ -960,10 +964,13 @@ public class OnlineActivity extends CommonActivity { case R.id.set_unread: if (ap != null && ap.getSelectedArticle() != null) { Article a = ap.getSelectedArticle(); - a.unread = true; - saveArticleUnread(a); + + if (a != null) { + a.unread = !a.unread; + saveArticleUnread(a); + } + if (hf != null) hf.notifyUpdated(); - //if (ap != null) ap.notifyUpdated(); } return true; case R.id.set_labels: @@ -1188,7 +1195,8 @@ public class OnlineActivity extends CommonActivity { public void saveArticleUnread(final Article article) { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { - toast(R.string.article_set_unread); + //toast(R.string.article_set_unread); + initMenu(); } }; @@ -1210,6 +1218,7 @@ public class OnlineActivity extends CommonActivity { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { toast(article.marked ? R.string.notify_article_marked : R.string.notify_article_unmarked); + initMenu(); } }; @@ -1232,6 +1241,7 @@ public class OnlineActivity extends CommonActivity { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { toast(article.published ? R.string.notify_article_published : R.string.notify_article_unpublished); + initMenu(); } }; @@ -1446,6 +1456,23 @@ public class OnlineActivity extends CommonActivity { MenuItem search = m_menu.findItem(R.id.search); search.setEnabled(getApiLevel() >= 2); + ArticlePager ap = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); + + if (ap != null) { + Article article = ap.getSelectedArticle(); + + if (article != null) { + m_menu.findItem(R.id.toggle_marked).setIcon(article.marked ? R.drawable.ic_important_light : + R.drawable.ic_unimportant_light); + + m_menu.findItem(R.id.toggle_published).setIcon(article.published ? R.drawable.ic_menu_published_light : + R.drawable.ic_menu_unpublished_light); + + m_menu.findItem(R.id.set_unread).setIcon(article.unread ? R.drawable.ic_unread_light : + R.drawable.ic_read_light); + } + } + /* if (android.os.Build.VERSION.SDK_INT >= 14) { ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider(); -- cgit v1.2.3-54-g00ecf