From 9b186f36d84ed89f301857af1f86f7d5f3c4735a Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Wed, 12 Sep 2012 12:31:44 +0100 Subject: [PATCH] Bug 787877 - History list doesn't update after you remove the last history item using context menu (r=wesj) --- .../android/base/awesomebar/HistoryTab.java | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/mobile/android/base/awesomebar/HistoryTab.java b/mobile/android/base/awesomebar/HistoryTab.java index f628ddadc43..1fd39c7bf1c 100644 --- a/mobile/android/base/awesomebar/HistoryTab.java +++ b/mobile/android/base/awesomebar/HistoryTab.java @@ -205,7 +205,6 @@ public class HistoryTab extends AwesomeBarTab { private static final long MS_PER_WEEK = MS_PER_DAY * 7; protected Pair> doInBackground(Void... arg0) { - Pair> result = null; Cursor cursor = BrowserDB.getRecentHistory(getContentResolver(), MAX_RESULTS); Date now = new Date(); @@ -217,9 +216,9 @@ public class HistoryTab extends AwesomeBarTab { // Split the list of urls into separate date range groups // and show it in an expandable list view. - List childrenLists = null; + List childrenLists = new LinkedList(); ChildrenList children = null; - GroupList groups = null; + GroupList groups = new GroupList(); HistorySection section = null; // Move cursor before the first row in preparation @@ -234,12 +233,6 @@ public class HistoryTab extends AwesomeBarTab { long time = cursor.getLong(cursor.getColumnIndexOrThrow(URLColumns.DATE_LAST_VISITED)); HistorySection itemSection = getSectionForTime(time, today); - if (groups == null) - groups = new GroupList(); - - if (childrenLists == null) - childrenLists = new LinkedList(); - if (section != itemSection) { if (section != null) { groups.add(createGroupItem(section)); @@ -263,11 +256,8 @@ public class HistoryTab extends AwesomeBarTab { // Close the query cursor as we won't use it anymore cursor.close(); - if (groups != null && childrenLists != null) { - result = Pair.>create(groups, childrenLists); - } - - return result; + // groups and childrenLists will be empty lists if there's no history + return Pair.>create(groups, childrenLists); } public Map createHistoryItem(Cursor cursor) { @@ -350,10 +340,6 @@ public class HistoryTab extends AwesomeBarTab { } protected void onPostExecute(Pair> result) { - // FIXME: display some sort of message when there's no history - if (result == null) - return; - mCursorAdapter = new HistoryListAdapter( mContext, result.first,