summaryrefslogtreecommitdiff
path: root/src/org/fox/ttrss/FeedsActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/fox/ttrss/FeedsActivity.java')
-rw-r--r--src/org/fox/ttrss/FeedsActivity.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/org/fox/ttrss/FeedsActivity.java b/src/org/fox/ttrss/FeedsActivity.java
index 3682ba08..914d5461 100644
--- a/src/org/fox/ttrss/FeedsActivity.java
+++ b/src/org/fox/ttrss/FeedsActivity.java
@@ -34,6 +34,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
protected long m_lastRefresh = 0;
private boolean m_actionbarUpEnabled = false;
+ private int m_actionbarRevertDepth = 0;
@SuppressLint("NewApi")
@Override
@@ -118,6 +119,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
} else { // savedInstanceState != null
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
+ m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
if (!isSmallScreen()) {
// temporary hack because FeedsActivity doesn't track whether active feed is open
@@ -235,7 +237,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
}
public void onCatSelected(FeedCategory cat, boolean openAsFeed) {
-
+ FeedCategoriesFragment fc = (FeedCategoriesFragment) getSupportFragmentManager().findFragmentByTag(FRAG_CATS);
+
if (!openAsFeed) {
if (isSmallScreen()) {
@@ -246,6 +249,10 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
startActivityForResult(intent, 0);
} else {
+ if (fc != null) {
+ fc.setSelectedCategory(null);
+ }
+
FragmentTransaction ft = getSupportFragmentManager()
.beginTransaction();
@@ -255,8 +262,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.addToBackStack(null);
ft.commit();
+
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ m_actionbarUpEnabled = true;
+ m_actionbarRevertDepth = m_actionbarRevertDepth + 1;
}
} else {
+
+ if (fc != null) {
+ fc.setSelectedCategory(cat);
+ }
+
Feed feed = new Feed(cat.id, cat.title, true);
onFeedSelected(feed);
}
@@ -269,6 +285,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
+ case android.R.id.home:
+ if (m_actionbarRevertDepth > 0) {
+
+ m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
+ m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
+ getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
+
+ onBackPressed();
+ } else {
+ finish();
+ }
+ return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());
initMenu();
@@ -297,6 +325,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onSaveInstanceState(out);
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
+ out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
GlobalState.getInstance().save(out);
}