diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 21b7d7d8..c44333c1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -51,6 +51,7 @@ @@ -62,14 +65,13 @@ android:title="@string/article_toggle_published"/> = 14) { - ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider(); - - OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); - - if (af != null && af.getSelectedArticleId() > 0) { - shareProvider.setShareIntent(getShareIntent(getArticleById(af.getSelectedArticleId()))); - - if (!isSmallScreen()) { - m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - } - } - if (!isCompatMode()) { MenuItem search = m_menu.findItem(R.id.search); @@ -435,6 +420,31 @@ public class OfflineActivity extends CommonActivity { } } + OfflineArticlePager ap = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); + + if (ap != null) { + int articleId = ap.getSelectedArticleId(); + + Cursor article = getArticleById(articleId); + + if (article != null) { + boolean unread = article.getInt(article.getColumnIndex("unread")) == 1; + boolean marked = article.getInt(article.getColumnIndex("marked")) == 1; + boolean published = article.getInt(article.getColumnIndex("published")) == 1; + + m_menu.findItem(R.id.toggle_marked).setIcon(marked ? R.drawable.ic_important_light : + R.drawable.ic_unimportant_light); + + m_menu.findItem(R.id.toggle_published).setIcon(published ? R.drawable.ic_menu_published_light : + R.drawable.ic_menu_unpublished_light); + + m_menu.findItem(R.id.set_unread).setIcon(unread ? R.drawable.ic_unread_light : + R.drawable.ic_read_light); + + article.close(); + } + } + SearchView searchView = (SearchView) search.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { private String query = ""; @@ -618,8 +628,10 @@ public class OfflineActivity extends CommonActivity { .findFragmentByTag(FRAG_HEADLINES); if (ohf != null) { - ohf.refresh(); - } + ohf.refresh(); + } + + initMenu(); } } diff --git a/src/org/fox/ttrss/offline/OfflineArticlePager.java b/src/org/fox/ttrss/offline/OfflineArticlePager.java index 69829115..48742c12 100644 --- a/src/org/fox/ttrss/offline/OfflineArticlePager.java +++ b/src/org/fox/ttrss/offline/OfflineArticlePager.java @@ -192,11 +192,9 @@ public class OfflineArticlePager extends Fragment { public void onPageSelected(int position) { if (m_cursor.moveToPosition(position)) { int articleId = m_cursor.getInt(m_cursor.getColumnIndex(BaseColumns._ID)); - - m_listener.onArticleSelected(articleId, false); m_articleId = articleId; - + m_listener.onArticleSelected(articleId, false); } } }); diff --git a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java index 7d301161..920d2865 100644 --- a/src/org/fox/ttrss/offline/OfflineFeedsActivity.java +++ b/src/org/fox/ttrss/offline/OfflineFeedsActivity.java @@ -272,6 +272,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead stmt.execute(); stmt.close(); + initMenu(); + if (open) { if (isSmallScreen()) {