when selecting feed in a drawer use runnable
This commit is contained in:
parent
5c437de607
commit
213c21190b
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user