diff options
author | Andrew Dolgov <[email protected]> | 2017-06-05 14:16:00 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2017-06-05 14:16:00 +0300 |
commit | 213c21190b6cac493e11e855564586e97ee351d9 (patch) | |
tree | ff8960ee56e60c2876ae1c12b5a4a8439b41c905 /org.fox.ttrss/src | |
parent | 5c437de607da94cda73a29049a35909f3b518a7e (diff) |
when selecting feed in a drawer use runnable
Diffstat (limited to 'org.fox.ttrss/src')
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java | 10 | ||||
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java | 31 |
2 files changed, 23 insertions, 18 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java index 6345f28c..6386c5fc 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/DetailActivity.java @@ -211,7 +211,7 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList } @Override - public void onArticleSelected(Article article, boolean open) { + public void onArticleSelected(final Article article, boolean open) { if (article == null) return; @@ -229,19 +229,17 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList if (!getSupportActionBar().isShowing()) getSupportActionBar().show(); if (open) { - - final Article fArticle = article; - + new Handler().postDelayed(new Runnable() { @Override public void run() { ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); if (af != null) { - af.setActiveArticle(fArticle); + af.setActiveArticle(article); } } - }, 10); + }, 250); } else { HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java index 0799274a..5d46460d 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/MasterActivity.java @@ -9,6 +9,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; +import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; @@ -240,7 +241,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList onFeedSelected(feed, true); } - public void onFeedSelected(Feed feed, final boolean selectedByUser) { + public void onFeedSelected(final Feed feed, final boolean selectedByUser) { FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); @@ -248,22 +249,28 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList ff.setSelectedfeed(feed); } - FragmentTransaction ft = getSupportFragmentManager() - .beginTransaction(); + if (m_drawerLayout != null) { + m_drawerLayout.closeDrawers(); + } - HeadlinesFragment hf = new HeadlinesFragment(); - hf.initialize(feed); + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + FragmentTransaction ft = getSupportFragmentManager() + .beginTransaction(); - ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES); + HeadlinesFragment hf = new HeadlinesFragment(); + hf.initialize(feed); - ft.commit(); + ft.replace(R.id.headlines_fragment, hf, FRAG_HEADLINES); - m_feedIsSelected = true; - m_userFeedSelected = selectedByUser; + ft.commit(); - if (m_drawerLayout != null) { - m_drawerLayout.closeDrawers(); - } + m_feedIsSelected = true; + m_userFeedSelected = selectedByUser; + + } + }, 250); Date date = new Date(); |