зеркало из https://github.com/mozilla/gecko-dev.git
Bug 772908 - Remove race condition adding touch listeners in the Awesomescreen. r=mbrubeck
This commit is contained in:
Родитель
4c482a881d
Коммит
7352ef0629
|
@ -53,7 +53,6 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
|||
private ArrayList<SearchEngine> mSearchEngines;
|
||||
private SuggestClient mSuggestClient;
|
||||
private AsyncTask<String, Void, ArrayList<String>> mSuggestTask;
|
||||
private ListView mView = null;
|
||||
private AwesomeBarCursorAdapter mCursorAdapter = null;
|
||||
|
||||
private class SearchEntryViewHolder {
|
||||
|
@ -103,10 +102,10 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
|||
((Activity)mContext).registerForContextMenu(mView);
|
||||
mView.setTag(TAG);
|
||||
AwesomeBarCursorAdapter adapter = getCursorAdapter();
|
||||
mView.setAdapter(adapter);
|
||||
((ListView)mView).setAdapter(adapter);
|
||||
mView.setOnTouchListener(mListListener);
|
||||
}
|
||||
return mView;
|
||||
return (ListView)mView;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
|
|
@ -33,6 +33,7 @@ abstract public class AwesomeBarTab {
|
|||
abstract public boolean onBackPressed();
|
||||
abstract public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo);
|
||||
|
||||
protected View mView = null;
|
||||
protected View.OnTouchListener mListListener;
|
||||
private AwesomeBarTabs.OnUrlOpenListener mListener;
|
||||
private LayoutInflater mInflater = null;
|
||||
|
@ -48,6 +49,8 @@ abstract public class AwesomeBarTab {
|
|||
|
||||
public void setListTouchListener(View.OnTouchListener listener) {
|
||||
mListListener = listener;
|
||||
if (mView != null)
|
||||
mView.setOnTouchListener(mListListener);
|
||||
}
|
||||
|
||||
protected class AwesomeEntryViewHolder {
|
||||
|
|
|
@ -37,7 +37,6 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
private boolean mInReadingList = false;
|
||||
private int mFolderId;
|
||||
private String mFolderTitle;
|
||||
private ListView mView = null;
|
||||
private BookmarksListAdapter mCursorAdapter = null;
|
||||
private BookmarksQueryTask mQueryTask = null;
|
||||
|
||||
|
@ -75,13 +74,14 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
mView.setOnTouchListener(mListListener);
|
||||
|
||||
// We need to add the header before we set the adapter, hence make it null
|
||||
mView.setAdapter(null);
|
||||
mView.setAdapter(getCursorAdapter());
|
||||
ListView list = (ListView)mView;
|
||||
list.setAdapter(null);
|
||||
list.setAdapter(getCursorAdapter());
|
||||
|
||||
BookmarksQueryTask task = getQueryTask();
|
||||
task.execute();
|
||||
}
|
||||
return mView;
|
||||
return (ListView)mView;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
@ -128,13 +128,14 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
|
||||
// Add/Remove header based on the root folder
|
||||
if (mView != null) {
|
||||
ListView list = (ListView)mView;
|
||||
if (mFolderId == Bookmarks.FIXED_ROOT_ID) {
|
||||
if (mView.getHeaderViewsCount() == 1) {
|
||||
mView.removeHeaderView(headerView);
|
||||
if (list.getHeaderViewsCount() == 1) {
|
||||
list.removeHeaderView(headerView);
|
||||
}
|
||||
} else {
|
||||
if (mView.getHeaderViewsCount() == 0) {
|
||||
mView.addHeaderView(headerView, null, true);
|
||||
if (list.getHeaderViewsCount() == 0) {
|
||||
list.addHeaderView(headerView, null, true);
|
||||
}
|
||||
headerView.setText(mFolderTitle);
|
||||
}
|
||||
|
@ -360,8 +361,9 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||
public void run() {
|
||||
// this will update the cursorAdapter to use the new one if it already exists
|
||||
// We need to add the header before we set the adapter, hence make it null
|
||||
mView.setAdapter(null);
|
||||
mView.setAdapter(getCursorAdapter(cursor));
|
||||
ListView list = (ListView)mView;
|
||||
list.setAdapter(null);
|
||||
list.setAdapter(getCursorAdapter(cursor));
|
||||
}
|
||||
});
|
||||
mQueryTask = null;
|
||||
|
|
|
@ -48,7 +48,6 @@ public class HistoryTab extends AwesomeBarTab {
|
|||
private ContentObserver mContentObserver;
|
||||
private ContentResolver mContentResolver;
|
||||
private HistoryQueryTask mQueryTask = null;
|
||||
private ExpandableListView mView = null;
|
||||
private HistoryListAdapter mCursorAdapter = null;
|
||||
|
||||
public HistoryTab(Context context) {
|
||||
|
@ -96,11 +95,11 @@ public class HistoryTab extends AwesomeBarTab {
|
|||
mView.setOnTouchListener(mListListener);
|
||||
|
||||
// We need to add the header before we set the adapter, hence make it null
|
||||
mView.setAdapter(getCursorAdapter());
|
||||
((ExpandableListView)mView).setAdapter(getCursorAdapter());
|
||||
HistoryQueryTask task = new HistoryQueryTask();
|
||||
task.execute();
|
||||
}
|
||||
return mView;
|
||||
return (ListView)mView;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче