fix for actionbar up button disappearing on rotate when switching

between slide and normal sidebar
This commit is contained in:
Andrew Dolgov 2013-05-28 19:50:08 +04:00
parent 5189150253
commit ee687410d8
2 changed files with 17 additions and 7 deletions

View File

@ -103,9 +103,18 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected"); m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
if (m_slidingMenu != null && m_feedIsSelected == false) if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu(); m_slidingMenu.showMenu();
} else if (m_slidingMenu != null) {
m_actionbarUpEnabled = true;
} else {
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
}
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
if (!isSmallScreen()) { if (!isSmallScreen()) {
// temporary hack because FeedsActivity doesn't track whether active feed is open // temporary hack because FeedsActivity doesn't track whether active feed is open
LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container); LinearLayout container = (LinearLayout) findViewById(R.id.fragment_container);
@ -113,10 +122,6 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (container != null) if (container != null)
container.setWeightSum(3f); container.setWeightSum(3f);
} }
if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
} }
/* if (!isCompatMode() && !isSmallScreen()) { /* if (!isCompatMode() && !isSmallScreen()) {

View File

@ -77,8 +77,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected"); m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
if (!m_feedIsSelected && m_slidingMenu != null) if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu(); m_slidingMenu.showMenu();
} else if (m_slidingMenu != null) {
m_actionbarUpEnabled = true;
} else {
m_actionbarUpEnabled = m_actionbarRevertDepth > 0;
}
if (m_actionbarUpEnabled) { if (m_actionbarUpEnabled) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);