attempt at better reverse navigation

This commit is contained in:
Andrew Dolgov 2013-05-28 19:59:33 +04:00
parent ee687410d8
commit 8c923e309f
2 changed files with 23 additions and 12 deletions

View File

@ -73,10 +73,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void onOpened() {
if (m_actionbarRevertDepth == 0) {
m_actionbarUpEnabled = false;
m_feedIsSelected = false;
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
initMenu();
}
m_feedIsSelected = false;
initMenu();
}
});
}
@ -256,11 +257,15 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public void onBackPressed() {
if (m_actionbarRevertDepth > 0) {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
if (m_feedIsSelected && m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
onBackPressed();
onBackPressed();
}
} else if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
@ -272,7 +277,8 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
if (m_actionbarUpEnabled)
onBackPressed();
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());

View File

@ -129,11 +129,15 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
public void onBackPressed() {
if (m_actionbarRevertDepth > 0) {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
if (m_feedIsSelected && m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
m_actionbarRevertDepth = m_actionbarRevertDepth - 1;
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
getSupportActionBar().setDisplayHomeAsUpEnabled(m_actionbarUpEnabled);
onBackPressed();
onBackPressed();
}
} else if (m_slidingMenu != null && !m_slidingMenu.isMenuShowing()) {
m_slidingMenu.showMenu();
} else {
@ -145,7 +149,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
if (m_actionbarUpEnabled)
onBackPressed();
return true;
case R.id.show_feeds:
setUnreadOnly(!getUnreadOnly());