Browse Source

Correctly handle logic affected by swapped drawers

master
Anthony Restaino 8 years ago
parent
commit
9c8281f56c
  1. 20
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

20
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -1164,9 +1164,9 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
@Override @Override
public synchronized void onBackPressed() { public synchronized void onBackPressed() {
final LightningView currentTab = mTabsManager.getCurrentTab(); final LightningView currentTab = mTabsManager.getCurrentTab();
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { if (mDrawerLayout.isDrawerOpen(getTabDrawer())) {
mDrawerLayout.closeDrawer(mDrawerLeft); mDrawerLayout.closeDrawer(getTabDrawer());
} else if (mDrawerLayout.isDrawerOpen(mDrawerRight)) { } else if (mDrawerLayout.isDrawerOpen(getBookmarkDrawer())) {
mEventBus.post(new BrowserEvents.UserPressedBack()); mEventBus.post(new BrowserEvents.UserPressedBack());
} else { } else {
if (currentTab != null) { if (currentTab != null) {
@ -1494,14 +1494,22 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
new HistoryPage(mTabsManager.getCurrentTab(), getApplication(), mHistoryDatabase).load(); new HistoryPage(mTabsManager.getCurrentTab(), getApplication(), mHistoryDatabase).load();
} }
private View getBookmarkDrawer() {
return mSwapBookmarksAndTabs ? mDrawerLeft : mDrawerRight;
}
private View getTabDrawer() {
return mSwapBookmarksAndTabs ? mDrawerRight : mDrawerLeft;
}
/** /**
* helper function that opens the bookmark drawer * helper function that opens the bookmark drawer
*/ */
private void openBookmarks() { private void openBookmarks() {
if (mDrawerLayout.isDrawerOpen(mDrawerLeft)) { if (mDrawerLayout.isDrawerOpen(getTabDrawer())) {
mDrawerLayout.closeDrawers(); mDrawerLayout.closeDrawers();
} }
mDrawerLayout.openDrawer(mDrawerRight); mDrawerLayout.openDrawer(getBookmarkDrawer());
} }
/** /**
@ -2022,7 +2030,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
if (mSearch != null && mSearch.hasFocus()) { if (mSearch != null && mSearch.hasFocus()) {
currentTab.requestFocus(); currentTab.requestFocus();
} else if (mShowTabsInDrawer) { } else if (mShowTabsInDrawer) {
mDrawerLayout.openDrawer(mDrawerLeft); mDrawerLayout.openDrawer(getTabDrawer());
} else { } else {
currentTab.loadHomepage(); currentTab.loadHomepage();
} }

Loading…
Cancel
Save