another attempt at fixing the shortcut-mode drawer strangeness while retaining overall back navigation

This commit is contained in:
Andrew Dolgov 2014-11-08 04:18:47 +04:00
parent b171b64d51
commit 61f6713645
5 changed files with 17 additions and 9 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="274" android:versionCode="276"
android:versionName="1.67" > android:versionName="1.68" >
<uses-sdk <uses-sdk
android:minSdkVersion="9" android:minSdkVersion="9"

View File

@ -39,6 +39,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
protected long m_lastRefresh = 0; protected long m_lastRefresh = 0;
private boolean m_feedIsSelected = false; private boolean m_feedIsSelected = false;
private boolean m_userFeedSelected = false;
private ActionBarDrawerToggle m_drawerToggle; private ActionBarDrawerToggle m_drawerToggle;
private DrawerLayout m_drawerLayout; private DrawerLayout m_drawerLayout;
@ -114,7 +115,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
Feed tmpFeed = new Feed(feedId, feedTitle, isCat); Feed tmpFeed = new Feed(feedId, feedTitle, isCat);
onFeedSelected(tmpFeed); onFeedSelected(tmpFeed, false);
} }
@Override @Override
@ -160,6 +161,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
//m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled"); //m_actionbarUpEnabled = savedInstanceState.getBoolean("actionbarUpEnabled");
//m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth"); //m_actionbarRevertDepth = savedInstanceState.getInt("actionbarRevertDepth");
m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected"); m_feedIsSelected = savedInstanceState.getBoolean("feedIsSelected");
m_userFeedSelected = savedInstanceState.getBoolean("userFeedSelected");
//m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected"); //m_feedWasSelected = savedInstanceState.getBoolean("feedWasSelected");
/* if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) { /* if (findViewById(R.id.sw600dp_port_anchor) != null && m_feedWasSelected && m_slidingMenu != null) {
@ -213,7 +215,11 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
} }
} }
public void onFeedSelected(Feed feed) { public void onFeedSelected(Feed feed) {
onFeedSelected(feed, true);
}
public void onFeedSelected(Feed feed, final boolean selectedByUser) {
GlobalState.getInstance().m_loadedArticles.clear(); GlobalState.getInstance().m_loadedArticles.clear();
//m_pullToRefreshAttacher.setRefreshing(true); //m_pullToRefreshAttacher.setRefreshing(true);
@ -238,6 +244,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
ft.commit(); ft.commit();
m_feedIsSelected = true; m_feedIsSelected = true;
m_userFeedSelected = selectedByUser;
//m_feedWasSelected = true; //m_feedWasSelected = true;
if (m_drawerLayout != null) { if (m_drawerLayout != null) {
@ -379,7 +386,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (m_drawerLayout != null && !m_drawerLayout.isDrawerOpen(Gravity.START) && if (m_drawerLayout != null && !m_drawerLayout.isDrawerOpen(Gravity.START) &&
getSupportFragmentManager().getBackStackEntryCount() > 0) { (getSupportFragmentManager().getBackStackEntryCount() > 0 || m_userFeedSelected)) {
m_drawerLayout.openDrawer(Gravity.START); m_drawerLayout.openDrawer(Gravity.START);
} else { } else {
@ -399,6 +406,7 @@ public class FeedsActivity extends OnlineActivity implements HeadlinesEventListe
super.onSaveInstanceState(out); super.onSaveInstanceState(out);
out.putBoolean("feedIsSelected", m_feedIsSelected); out.putBoolean("feedIsSelected", m_feedIsSelected);
out.putBoolean("userFeedSelected", m_userFeedSelected);
GlobalState.getInstance().save(out); GlobalState.getInstance().save(out);
} }

View File

@ -265,7 +265,7 @@ public class OfflineFeedsActivity extends OfflineActivity implements OfflineHead
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (m_drawerLayout != null && !m_drawerLayout.isDrawerOpen(Gravity.START) && if (m_drawerLayout != null && !m_drawerLayout.isDrawerOpen(Gravity.START) &&
getSupportFragmentManager().getBackStackEntryCount() > 0) { (getSupportFragmentManager().getBackStackEntryCount() > 0 || m_feedIsSelected)) {
m_drawerLayout.openDrawer(Gravity.START); m_drawerLayout.openDrawer(Gravity.START);
} else { } else {