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
|
@Override
|
||||||
public void onArticleSelected(Article article, boolean open) {
|
public void onArticleSelected(final Article article, boolean open) {
|
||||||
|
|
||||||
if (article == null) return;
|
if (article == null) return;
|
||||||
|
|
||||||
@ -229,19 +229,17 @@ public class DetailActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
if (!getSupportActionBar().isShowing()) getSupportActionBar().show();
|
if (!getSupportActionBar().isShowing()) getSupportActionBar().show();
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
|
|
||||||
final Article fArticle = article;
|
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
|
||||||
|
|
||||||
if (af != null) {
|
if (af != null) {
|
||||||
af.setActiveArticle(fArticle);
|
af.setActiveArticle(article);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 250);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
HeadlinesFragment hf = (HeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
|
||||||
|
@ -9,6 +9,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
@ -240,7 +241,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
onFeedSelected(feed, true);
|
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);
|
FeedsFragment ff = (FeedsFragment) getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
|
||||||
|
|
||||||
@ -248,22 +249,28 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
|||||||
ff.setSelectedfeed(feed);
|
ff.setSelectedfeed(feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
FragmentTransaction ft = getSupportFragmentManager()
|
if (m_drawerLayout != null) {
|
||||||
.beginTransaction();
|
m_drawerLayout.closeDrawers();
|
||||||
|
}
|
||||||
|
|
||||||
HeadlinesFragment hf = new HeadlinesFragment();
|
new Handler().postDelayed(new Runnable() {
|
||||||
hf.initialize(feed);
|
@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;
|
ft.commit();
|
||||||
m_userFeedSelected = selectedByUser;
|
|
||||||
|
|
||||||
if (m_drawerLayout != null) {
|
m_feedIsSelected = true;
|
||||||
m_drawerLayout.closeDrawers();
|
m_userFeedSelected = selectedByUser;
|
||||||
}
|
|
||||||
|
}
|
||||||
|
}, 250);
|
||||||
|
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user