further tweaks for tablets

This commit is contained in:
Andrew Dolgov 2012-09-16 21:00:09 +04:00
parent 3cbae613a5
commit a5ee43a4e6
3 changed files with 23 additions and 20 deletions

View File

@ -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);
}
}
}
}
}

View File

@ -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();
}
}

View File

@ -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() {