remove obsolete code

This commit is contained in:
Andrew Dolgov 2013-05-28 13:17:02 +04:00
parent 882824190c
commit 1d82edfc0b
3 changed files with 92 additions and 239 deletions

View File

@ -78,33 +78,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (m_slidingMenu != null) if (m_slidingMenu != null)
m_slidingMenu.showMenu(); m_slidingMenu.showMenu();
/* if (intent.getParcelableExtra("article") != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
Feed feed = (Feed) intent.getParcelableExtra("feed");
FeedCategory cat = (FeedCategory) intent.getParcelableExtra("category");
Article article = (Article) intent.getParcelableExtra("article");
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
if (article != null) {
Article original = GlobalState.getInstance().m_loadedArticles.findById(article.id);
ArticlePager ap = new ArticlePager();
ap.initialize(original != null ? original : article, feed);
ft.replace(R.id.feeds_fragment, ap, FRAG_ARTICLE);
ap.setSearchQuery(intent.getStringExtra("searchQuery"));
setTitle(feed.title);
}
ft.commit();
} else { */
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
if (m_prefs.getBoolean("enable_cats", false)) { if (m_prefs.getBoolean("enable_cats", false)) {
@ -113,15 +86,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.replace(R.id.feeds_fragment, new FeedsFragment(), FRAG_FEEDS); ft.replace(R.id.feeds_fragment, new FeedsFragment(), FRAG_FEEDS);
} }
/* if (!isSmallScreen()) {
ft.replace(R.id.headlines_fragment, new HeadlinesFragment(new Feed(-3, "Fresh articles", false)));
} */
ft.commit(); ft.commit();
AppRater.appLaunched(this); AppRater.appLaunched(this);
checkTrial(true); checkTrial(true);
//}
} else { // savedInstanceState != null } else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
@ -154,7 +123,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (m_menu != null && getSessionId() != null) { if (m_menu != null && getSessionId() != null) {
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS); Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
//ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_slidingMenu != null) { if (m_slidingMenu != null) {
@ -162,32 +130,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing());
} else { } else {
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded())); m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
//m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
m_menu.findItem(R.id.update_headlines).setVisible(false); m_menu.findItem(R.id.update_headlines).setVisible(false);
} }
/* if (isSmallScreen()) {
m_menu.findItem(R.id.update_headlines).setVisible(hf != null && hf.isAdded());
} else {
m_menu.findItem(R.id.update_headlines).setVisible(false);
} */
/* if (af != null) {
if (af.getSelectedArticle() != null && af.getSelectedArticle().attachments != null && af.getSelectedArticle().attachments.size() > 0) {
if (!isCompatMode()) {
m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
m_menu.findItem(R.id.toggle_attachments).setVisible(true);
} else {
if (!isCompatMode()) {
m_menu.findItem(R.id.toggle_attachments).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}
m_menu.findItem(R.id.toggle_attachments).setVisible(false);
}
} */
MenuItem item = m_menu.findItem(R.id.show_feeds); MenuItem item = m_menu.findItem(R.id.show_feeds);
if (getUnreadOnly()) { if (getUnreadOnly()) {
@ -253,14 +200,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (!openAsFeed) { if (!openAsFeed) {
if (false && isSmallScreen()) {
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
intent.putExtra("category", cat);
startActivityForResult(intent, 0);
} else {
if (fc != null) { if (fc != null) {
fc.setSelectedCategory(null); fc.setSelectedCategory(null);
} }
@ -278,7 +217,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true; m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1; m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
}
} else { } else {
if (fc != null) { if (fc != null) {
@ -364,16 +303,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
} }
public void openFeedArticles(Feed feed) { public void openFeedArticles(Feed feed) {
/* if (isSmallScreen()) {
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
GlobalState.getInstance().m_activeFeed = feed;
GlobalState.getInstance().m_loadedArticles.clear();
intent.putExtra("feed", feed);
intent.putExtra("article", new Article());
startActivityForResult(intent, 0);
} else { */
GlobalState.getInstance().m_loadedArticles.clear(); GlobalState.getInstance().m_loadedArticles.clear();
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class); Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
@ -383,7 +312,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, HEADLINES_REQUEST); startActivityForResult(intent, HEADLINES_REQUEST);
overridePendingTransition(R.anim.right_slide_in, 0); overridePendingTransition(R.anim.right_slide_in, 0);
//}
} }
public void onArticleSelected(Article article, boolean open) { public void onArticleSelected(Article article, boolean open) {
@ -395,19 +323,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (open) { if (open) {
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
/* if (isSmallScreen()) {
//GlobalState.getInstance().m_loadedArticles.clear();
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
intent.putExtra("feed", hf.getFeed());
intent.putExtra("article", article);
intent.putExtra("searchQuery", hf.getSearchQuery());
startActivityForResult(intent, 0);
} else { */
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class); Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
intent.putExtra("feed", hf.getFeed()); intent.putExtra("feed", hf.getFeed());
intent.putExtra("article", article); intent.putExtra("article", article);
@ -415,7 +330,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, HEADLINES_REQUEST); startActivityForResult(intent, HEADLINES_REQUEST);
overridePendingTransition(R.anim.right_slide_in, 0); overridePendingTransition(R.anim.right_slide_in, 0);
//}
} else { } else {
initMenu(); initMenu();
} }

View File

@ -89,15 +89,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
} }
setLoadingStatus(R.string.blank, false); setLoadingStatus(R.string.blank, false);
//findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu(); initMenu();
/* if (!isSmallScreen()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
container.setWeightSum(3f);
} */
if (!isCompatMode() && !isSmallScreen()) { if (!isCompatMode() && !isSmallScreen()) {
((ViewGroup)findViewById(R.id.headlines_fragment)).setLayoutTransition(new LayoutTransition()); ((ViewGroup)findViewById(R.id.headlines_fragment)).setLayoutTransition(new LayoutTransition());
((ViewGroup)findViewById(R.id.feeds_fragment)).setLayoutTransition(new LayoutTransition()); ((ViewGroup)findViewById(R.id.feeds_fragment)).setLayoutTransition(new LayoutTransition());
@ -164,7 +158,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (m_menu != null) { if (m_menu != null) {
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS); Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS); Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
//OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
if (m_slidingMenu != null) { if (m_slidingMenu != null) {
@ -172,18 +165,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && !m_slidingMenu.isMenuShowing());
} else { } else {
m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded())); m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
//m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded());
} }
/* m_menu.setGroupVisible(R.id.menu_group_feeds, (ff != null && ff.isAdded()) || (cf != null && cf.isAdded()));
m_menu.setGroupVisible(R.id.menu_group_article, af != null && af.isAdded());
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); */
//m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && getSelectedArticleCount() == 0);
//m_menu.setGroupVisible(R.id.menu_group_headlines_selection, hf != null && hf.isAdded() && getSelectedArticleCount() != 0);
MenuItem item = m_menu.findItem(R.id.show_feeds); MenuItem item = m_menu.findItem(R.id.show_feeds);
if (getUnreadOnly()) { if (getUnreadOnly()) {
@ -208,12 +192,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
onFeedSelected(catId, true, true); onFeedSelected(catId, true, true);
} else { } else {
/* if (isSmallScreen()) {
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineFeedsActivity.class);
intent.putExtra("category", catId);
startActivityForResult(intent, 0);
} else { */
if (fc != null) { if (fc != null) {
fc.setSelectedFeedId(-1); fc.setSelectedFeedId(-1);
} }
@ -232,7 +210,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_actionbarRevertDepth = m_actionbarRevertDepth + 1; m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
ft.commit(); ft.commit();
//}
} }
} }
@ -243,27 +220,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
public void onFeedSelected(final int feedId, final boolean isCat, boolean open) { public void onFeedSelected(final int feedId, final boolean isCat, boolean open) {
if (open) { if (open) {
/* if (isSmallScreen()) {
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineFeedsActivity.class);
intent.putExtra("feed", feedId);
intent.putExtra("isCat", isCat);
startActivityForResult(intent, 0);
} else { */
/* if (!isCompatMode()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
float wSum = container.getWeightSum();
if (wSum <= 2.0f) {
ObjectAnimator anim = ObjectAnimator.ofFloat(container, "weightSum", wSum, 3.0f);
anim.setDuration(200);
anim.start();
}
} */
// ^ no idea why the animation hangs half the time :(
if (!isSmallScreen()) { if (!isSmallScreen()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container); LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
container.setWeightSum(3f); container.setWeightSum(3f);
@ -289,8 +245,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
} }
}, 10); }, 10);
//}
} }
} }
@ -326,19 +280,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
initMenu(); initMenu();
if (open) { if (open) {
/* if (isSmallScreen()) {
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineFeedsActivity.class);
intent.putExtra("feed", hf.getFeedId());
intent.putExtra("isCat", hf.getFeedIsCat());
intent.putExtra("article", articleId);
startActivityForResult(intent, 0);
} else { */
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class); Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class);
@ -349,7 +290,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
startActivityForResult(intent, 0); startActivityForResult(intent, 0);
overridePendingTransition(R.anim.right_slide_in, 0); overridePendingTransition(R.anim.right_slide_in, 0);
//}
} else { } else {
refresh(); refresh();
} }

View File

@ -141,10 +141,7 @@ public class OfflineHeadlinesActivity extends OfflineActivity implements Offline
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES); OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded()); m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.isAdded() && hf.isVisible());
//m_menu.setGroupVisible(R.id.menu_group_headlines, hf != null && hf.getSelectedArticleCount() == 0);
//m_menu.setGroupVisible(R.id.menu_group_headlines_selection, hf != null && hf.getSelectedArticleCount() != 0);
Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE); Fragment af = getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);