Bug 882715 - Allow fragments to handle back button (r=bnicholson)
authorLucas Rocha <lucasr@mozilla.com>
Mon, 08 Jul 2013 23:05:27 +0100
changeset 151372 81c3af05d10a
parent 151371 950e12ef1eb8
child 151373 6c702f748e20
push idunknown
push userunknown
push dateunknown
reviewersbnicholson
bugs882715
milestone25.0a1
Bug 882715 - Allow fragments to handle back button (r=bnicholson) * * * more
mobile/android/base/BrowserApp.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -535,16 +535,21 @@ abstract public class BrowserApp extends
                 // without restarting.
                 return true;
             }
         });
     }
 
     @Override
     public void onBackPressed() {
+        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
+            super.onBackPressed();
+            return;
+        }
+
         if (dismissEditingMode()) {
             return;
         }
 
         if (mSiteIdentityPopup != null && mSiteIdentityPopup.isShowing()) {
             mSiteIdentityPopup.dismiss();
             return;
         }
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -2230,16 +2230,21 @@ abstract public class GeckoApp
     }
 
     public void showReadingList() {
         // FIXME: bug 862798 (also, this probably belong in BrowserApp)
     }
 
     @Override
     public void onBackPressed() {
+        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
+            super.onBackPressed();
+            return;
+        }
+
         if (autoHideTabs()) {
             return;
         }
 
         if (mDoorHangerPopup != null && mDoorHangerPopup.isShowing()) {
             mDoorHangerPopup.dismiss();
             return;
         }