From a5ee43a4e61cf756b8f66985ecbadddc0ca29b80 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 16 Sep 2012 21:00:09 +0400 Subject: [PATCH] further tweaks for tablets --- src/org/fox/ttrss/FeedsActivity.java | 12 ------------ src/org/fox/ttrss/HeadlinesActivity.java | 15 +++++++-------- src/org/fox/ttrss/OnlineActivity.java | 16 ++++++++++++++++ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java index 39b45490..7869f76c 100644 --- a/src/org/fox/ttrss/FeedsActivity.java +++ b/src/org/fox/ttrss/FeedsActivity.java @@ -93,18 +93,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe item.setTitle(R.string.menu_unread_feeds); } - if (android.os.Build.VERSION.SDK_INT >= 14) { - ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider(); - - if (af != null && af.getSelectedArticle() != null) { - Log.d(TAG, "setting up share provider"); - shareProvider.setShareIntent(getShareIntent(af.getSelectedArticle())); - - if (!isSmallScreen()) { - m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - } - } - } } } diff --git a/src/org/fox/ttrss/HeadlinesActivity.java b/src/org/fox/ttrss/HeadlinesActivity.java index 1b9ead10..59234d21 100644 --- a/src/org/fox/ttrss/HeadlinesActivity.java +++ b/src/org/fox/ttrss/HeadlinesActivity.java @@ -45,8 +45,6 @@ private final String TAG = this.getClass().getSimpleName(); setSmallScreen(findViewById(R.id.headlines_fragment) == null); if (savedInstanceState == null) { - FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - Intent i = getIntent(); if (i.getExtras() != null) { @@ -59,17 +57,18 @@ private final String TAG = this.getClass().getSimpleName(); for (Article a : alist) articles.add(a); - + HeadlinesFragment hf = new HeadlinesFragment(feed, activeArticle, articles); + ArticlePager af = new ArticlePager(hf.getArticleById(article.id), hf.getAllArticles()); + + FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES); - - ArticlePager af = new ArticlePager(article, hf.getAllArticles()); - ft.replace(R.id.article_fragment, af, FRAG_ARTICLE); + + ft.commit(); + } - - ft.commit(); } } diff --git a/src/org/fox/ttrss/OnlineActivity.java b/src/org/fox/ttrss/OnlineActivity.java index e2d3ba4d..f97c07d7 100644 --- a/src/org/fox/ttrss/OnlineActivity.java +++ b/src/org/fox/ttrss/OnlineActivity.java @@ -33,6 +33,7 @@ import android.view.View; import android.view.Window; import android.widget.EditText; import android.widget.SearchView; +import android.widget.ShareActionProvider; public class OnlineActivity extends CommonActivity { private final String TAG = this.getClass().getSimpleName(); @@ -759,6 +760,21 @@ public class OnlineActivity extends CommonActivity { MenuItem search = m_menu.findItem(R.id.search); search.setEnabled(m_apiLevel >= 2); + if (android.os.Build.VERSION.SDK_INT >= 14) { + ShareActionProvider shareProvider = (ShareActionProvider) m_menu.findItem(R.id.share_article).getActionProvider(); + + ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); + + if (af != null && af.getSelectedArticle() != null) { + Log.d(TAG, "setting up share provider"); + shareProvider.setShareIntent(getShareIntent(af.getSelectedArticle())); + + if (!isSmallScreen()) { + m_menu.findItem(R.id.share_article).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + } + } + } + if (!isCompatMode()) { SearchView searchView = (SearchView) search.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {