for sw600dp track whether feed was previously selected to restore

slidingmenu to a proper width, set to full screen width as default
(closes #804)
This commit is contained in:
Andrew Dolgov 2013-11-15 15:38:23 +04:00
parent d7c69cf591
commit 50aa77ebb3
2 changed files with 33 additions and 6 deletions

View File

@ -39,6 +39,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
private boolean m_feedIsSelected = false;
private boolean m_feedWasSelected = false;
@SuppressLint("NewApi")
@Override
@ -59,9 +60,9 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
if (findViewById(R.id.sw600dp_port_anchor) != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
} */
m_slidingMenu.setMode(SlidingMenu.LEFT);
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
@ -133,6 +134,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu();
@ -153,6 +159,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
if (container != null)
container.setWeightSum(3f);
}
}
/* if (!isCompatMode() && !isSmallScreen()) {
@ -228,11 +235,17 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.commit();
m_feedIsSelected = true;
m_feedWasSelected = true;
if (m_slidingMenu != null) {
if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
m_slidingMenu.showContent();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;
}
}
}, 10);
@ -344,6 +357,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
out.putBoolean("feedIsSelected", m_feedIsSelected);
out.putBoolean("feedWasSelected", m_feedWasSelected);
//if (m_slidingMenu != null )
// out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());

View File

@ -27,6 +27,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
private int m_actionbarRevertDepth = 0;
private SlidingMenu m_slidingMenu;
private boolean m_feedIsSelected = false;
private boolean m_feedWasSelected = false;
@SuppressLint("NewApi")
@Override
@ -47,9 +48,9 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
if (isSmallScreen() || findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu = new SlidingMenu(this);
if (findViewById(R.id.sw600dp_port_anchor) != null) {
/* if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
} */
m_slidingMenu.setMode(SlidingMenu.LEFT);
m_slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
@ -77,6 +78,11 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
if (m_slidingMenu != null && m_feedIsSelected == false) {
m_slidingMenu.showMenu();
@ -171,6 +177,8 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
out.putBoolean("actionbarUpEnabled", m_actionbarUpEnabled);
out.putInt("actionbarRevertDepth", m_actionbarRevertDepth);
out.putBoolean("feedIsSelected", m_feedIsSelected);
out.putBoolean("feedWasSelected", m_feedWasSelected);
//if (m_slidingMenu != null )
// out.putBoolean("slidingMenuVisible", m_slidingMenu.isMenuShowing());
@ -266,8 +274,13 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
ft.commit();
m_feedIsSelected = true;
m_feedWasSelected = true;
if (m_slidingMenu != null) {
if (findViewById(R.id.sw600dp_port_anchor) != null) {
m_slidingMenu.setBehindWidth(getScreenWidthInPixel() * 2/3);
}
m_slidingMenu.showContent();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
m_actionbarUpEnabled = true;