зеркало из https://github.com/mozilla/pjs.git
Bug 727482 - Remove custom bookmark observer. r=bnicholson
This commit is contained in:
Родитель
dfb386299f
Коммит
d9a94d3b2b
|
@ -40,7 +40,6 @@ package org.mozilla.gecko;
|
|||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -72,7 +71,6 @@ import android.widget.TextView;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
@ -102,7 +100,6 @@ public class AwesomeBarTabs extends TabHost {
|
|||
private View.OnTouchListener mListTouchListener;
|
||||
private JSONArray mSearchEngines;
|
||||
private ContentResolver mContentResolver;
|
||||
private ContentObserver mContentObserver;
|
||||
|
||||
private AwesomeBarCursorAdapter mAllPagesCursorAdapter;
|
||||
private BookmarksListAdapter mBookmarksAdapter;
|
||||
|
@ -282,32 +279,6 @@ public class AwesomeBarTabs extends TabHost {
|
|||
new int[] { R.id.title, R.id.url, R.id.favicon }
|
||||
);
|
||||
|
||||
try {
|
||||
// use reflection to disable auto-requery
|
||||
Class<?> cls = Class.forName("android.widget.CursorTreeAdapter");
|
||||
Field field = cls.getDeclaredField("mAutoRequery");
|
||||
field.setAccessible(true);
|
||||
field.set(mBookmarksAdapter, false);
|
||||
|
||||
// register an asynchronous custom observer to replace the synchronous auto-requery
|
||||
mContentObserver = new ContentObserver(GeckoAppShell.getHandler()) {
|
||||
public void onChange(boolean selfChange) {
|
||||
// The group cursor doesn't ever need to change because it just holds the
|
||||
// mobile/desktop folders, but we do need to update the children cursors.
|
||||
Cursor groupCursor = mBookmarksAdapter.getCursor();
|
||||
groupCursor.moveToPosition(-1);
|
||||
while (groupCursor.moveToNext()) {
|
||||
String guid = groupCursor.getString(groupCursor.getColumnIndexOrThrow(Bookmarks.GUID));
|
||||
// We need to do this in a AsyncTask because we're on the main thread
|
||||
new RefreshChildrenCursorTask(groupCursor.getPosition()).execute(guid);
|
||||
}
|
||||
}
|
||||
};
|
||||
BrowserDB.registerBookmarkObserver(mContentResolver, mContentObserver);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "could not disable auto-requery for BookmarksListAdapter");
|
||||
}
|
||||
|
||||
mBookmarksAdapter.setViewBinder(new AwesomeCursorViewBinder());
|
||||
|
||||
final ExpandableListView bookmarksList = (ExpandableListView) findViewById(R.id.bookmarks_list);
|
||||
|
@ -635,7 +606,6 @@ public class AwesomeBarTabs extends TabHost {
|
|||
mInflated = false;
|
||||
mSearchEngines = new JSONArray();
|
||||
mContentResolver = context.getContentResolver();
|
||||
mContentObserver = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -845,9 +815,6 @@ public class AwesomeBarTabs extends TabHost {
|
|||
if (bookmarksCursor != null)
|
||||
bookmarksCursor.close();
|
||||
}
|
||||
|
||||
if (mContentObserver != null)
|
||||
BrowserDB.unregisterBookmarkObserver(mContentResolver, mContentObserver);
|
||||
}
|
||||
|
||||
public void filter(String searchTerm) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче