summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-01-19 17:36:15 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-19 17:36:15 -0800
commitf90ca690e640340527b972b55132c5c418b3cc4c (patch)
treed50e6570a743a6099636c81b68f2d776b3431416
parent4c1914c2132de46d0664001d23c90fd008a3d2c8 (diff)
parent85e3d6f2f852d43488f29124bbd9599161ac380a (diff)
downloadpackages_apps_browser-f90ca690e640340527b972b55132c5c418b3cc4c.zip
packages_apps_browser-f90ca690e640340527b972b55132c5c418b3cc4c.tar.gz
packages_apps_browser-f90ca690e640340527b972b55132c5c418b3cc4c.tar.bz2
Merge "Added checks to guard against illegal state" into honeycomb
-rw-r--r--src/com/android/browser/CombinedBookmarkHistoryView.java22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/browser/CombinedBookmarkHistoryView.java b/src/com/android/browser/CombinedBookmarkHistoryView.java
index 8b58d2e..6c03746 100644
--- a/src/com/android/browser/CombinedBookmarkHistoryView.java
+++ b/src/com/android/browser/CombinedBookmarkHistoryView.java
@@ -57,6 +57,7 @@ public class CombinedBookmarkHistoryView extends LinearLayout
final static String STARTING_FRAGMENT = "fragment";
+ final static int INVALID_ID = 0;
final static int FRAGMENT_ID_BOOKMARKS = 1;
final static int FRAGMENT_ID_HISTORY = 2;
@@ -66,7 +67,7 @@ public class CombinedBookmarkHistoryView extends LinearLayout
private Bundle mExtras;
- int mCurrentFragment;
+ int mCurrentFragment = INVALID_ID;
ActionBar.Tab mTabBookmarks;
ActionBar.Tab mTabHistory;
@@ -179,7 +180,7 @@ public class CombinedBookmarkHistoryView extends LinearLayout
// This is done because history uses orientation-specific padding
FragmentManager fm = mActivity.getFragmentManager();
mHistory = BrowserHistoryPage.newInstance(mUiController, mHistory.getArguments());
- fm.openTransaction().replace(R.id.fragment, mHistory).commit();
+ fm.beginTransaction().replace(R.id.fragment, mHistory).commit();
}
}
@@ -241,14 +242,17 @@ public class CombinedBookmarkHistoryView extends LinearLayout
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
- FragmentManager fm = mActivity.getFragmentManager();
- FragmentTransaction transaction = fm.beginTransaction();
- if (mCurrentFragment == FRAGMENT_ID_BOOKMARKS) {
- transaction.remove(mBookmarks);
- } else if (mCurrentFragment == FRAGMENT_ID_HISTORY) {
- transaction.remove(mHistory);
+ if (mCurrentFragment != INVALID_ID) {
+ FragmentManager fm = mActivity.getFragmentManager();
+ FragmentTransaction transaction = fm.beginTransaction();
+ if (mCurrentFragment == FRAGMENT_ID_BOOKMARKS) {
+ transaction.remove(mBookmarks);
+ } else if (mCurrentFragment == FRAGMENT_ID_HISTORY) {
+ transaction.remove(mHistory);
+ }
+ transaction.commit();
+ mCurrentFragment = INVALID_ID;
}
- transaction.commit();
mUiController.unregisterOptionsMenuHandler(this);
}