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)
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();
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);
}
/* if (!isSmallScreen()) {
ft.replace(R.id.headlines_fragment, new HeadlinesFragment(new Feed(-3, "Fresh articles", false)));
} */
ft.commit();
AppRater.appLaunched(this);
checkTrial(true);
//}
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
@ -154,7 +123,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (m_menu != null && getSessionId() != null) {
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
//ArticlePager af = (ArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
HeadlinesFragment hf = (HeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
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());
} else {
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.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);
if (getUnreadOnly()) {
@ -253,14 +200,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (!openAsFeed) {
if (false && isSmallScreen()) {
Intent intent = new Intent(FeedsActivity.this, FeedsActivity.class);
intent.putExtra("category", cat);
startActivityForResult(intent, 0);
} else {
if (fc != null) {
fc.setSelectedCategory(null);
}
@ -278,7 +217,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
}
} else {
if (fc != null) {
@ -364,16 +303,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
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();
Intent intent = new Intent(FeedsActivity.this, HeadlinesActivity.class);
@ -383,7 +312,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, HEADLINES_REQUEST);
overridePendingTransition(R.anim.right_slide_in, 0);
//}
}
public void onArticleSelected(Article article, boolean open) {
@ -395,19 +323,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (open) {
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.putExtra("feed", hf.getFeed());
intent.putExtra("article", article);
@ -415,7 +330,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, HEADLINES_REQUEST);
overridePendingTransition(R.anim.right_slide_in, 0);
//}
} else {
initMenu();
}

View File

@ -89,15 +89,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
}
setLoadingStatus(R.string.blank, false);
//findViewById(R.id.loading_container).setVisibility(View.GONE);
initMenu();
/* if (!isSmallScreen()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
container.setWeightSum(3f);
} */
if (!isCompatMode() && !isSmallScreen()) {
((ViewGroup)findViewById(R.id.headlines_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) {
Fragment ff = getSupportFragmentManager().findFragmentByTag(FRAG_FEEDS);
Fragment cf = getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
//OfflineArticlePager af = (OfflineArticlePager) getSupportFragmentManager().findFragmentByTag(FRAG_ARTICLE);
OfflineHeadlinesFragment hf = (OfflineHeadlinesFragment)getSupportFragmentManager().findFragmentByTag(FRAG_HEADLINES);
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());
} else {
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_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);
if (getUnreadOnly()) {
@ -208,12 +192,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
onFeedSelected(catId, true, true);
} else {
/* if (isSmallScreen()) {
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineFeedsActivity.class);
intent.putExtra("category", catId);
startActivityForResult(intent, 0);
} else { */
if (fc != null) {
fc.setSelectedFeedId(-1);
}
@ -232,7 +210,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
ft.commit();
//}
}
}
@ -243,27 +220,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
public void onFeedSelected(final int feedId, final boolean isCat, boolean 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()) {
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
container.setWeightSum(3f);
@ -289,8 +245,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
}
}, 10);
//}
}
}
@ -326,19 +280,6 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
initMenu();
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);
Intent intent = new Intent(OfflineFeedsActivity.this, OfflineHeadlinesActivity.class);
@ -349,7 +290,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
startActivityForResult(intent, 0);
overridePendingTransition(R.anim.right_slide_in, 0);
//}
} else {
refresh();
}

View File

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