diff options
author | Ben Murdoch <benm@google.com> | 2010-08-04 12:00:55 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-09 10:59:32 +0100 |
commit | 8262d8fb4005dde5347f5be3b0c77eb9052fbe2d (patch) | |
tree | 5af3728946eda5250118f797b474f8f73e45969a | |
parent | a2b2ba8da913f26c820e49d3e43158e2fe6ebeba (diff) | |
download | packages_apps_Browser-8262d8fb4005dde5347f5be3b0c77eb9052fbe2d.zip packages_apps_Browser-8262d8fb4005dde5347f5be3b0c77eb9052fbe2d.tar.gz packages_apps_Browser-8262d8fb4005dde5347f5be3b0c77eb9052fbe2d.tar.bz2 |
Do not write the Bookmarks Activity view mode preference unnecessarily.
Fix for issue 2891872
Change-Id: Ia42b70bebe99d88562bba0de87913beec16d648c
-rw-r--r-- | src/com/android/browser/BrowserBookmarksPage.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index cd2abd9..4d5c5fa 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -293,11 +293,13 @@ public class BrowserBookmarksPage extends Activity implements mViewMode = viewMode; // Update the preferences to make the new view mode sticky. - Editor ed = getPreferences(MODE_PRIVATE).edit(); - if (mMostVisited) { - ed.putInt(PREF_MOST_VISITED_VIEW_MODE, mViewMode.ordinal()); - } else { - ed.putInt(PREF_BOOKMARK_VIEW_MODE, mViewMode.ordinal()); + SharedPreferences preferences = getPreferences(MODE_PRIVATE); + Editor ed = preferences.edit(); + int pref = mViewMode.ordinal(); + if (mMostVisited && preferences.getInt(PREF_MOST_VISITED_VIEW_MODE, -1) != pref) { + ed.putInt(PREF_MOST_VISITED_VIEW_MODE, pref); + } else if (!mMostVisited && preferences.getInt(PREF_BOOKMARK_VIEW_MODE, -1) != pref) { + ed.putInt(PREF_BOOKMARK_VIEW_MODE, pref); } ed.commit(); |