fix revertdepth not decreasing properly on backpressed

This commit is contained in:
Andrew Dolgov 2013-05-28 10:38:59 +04:00
parent 4e412ef05b
commit 339f37e5b0

View File

@ -297,7 +297,14 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override
public void onBackPressed() {
if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
if (m_actionbarRevertDepth > 0) {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
onBackPressed();
} else if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
super.onBackPressed();
@ -308,18 +315,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
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 if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
finish();
}
onBackPressed();
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());