mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 772908 - Remove race condition adding touch listeners in the Awesomescreen. r=mbrubeck
This commit is contained in:
parent
6cd88db097
commit
7cbf7cb2f8
@ -53,7 +53,6 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
|||||||
private ArrayList<SearchEngine> mSearchEngines;
|
private ArrayList<SearchEngine> mSearchEngines;
|
||||||
private SuggestClient mSuggestClient;
|
private SuggestClient mSuggestClient;
|
||||||
private AsyncTask<String, Void, ArrayList<String>> mSuggestTask;
|
private AsyncTask<String, Void, ArrayList<String>> mSuggestTask;
|
||||||
private ListView mView = null;
|
|
||||||
private AwesomeBarCursorAdapter mCursorAdapter = null;
|
private AwesomeBarCursorAdapter mCursorAdapter = null;
|
||||||
|
|
||||||
private class SearchEntryViewHolder {
|
private class SearchEntryViewHolder {
|
||||||
@ -103,10 +102,10 @@ public class AllPagesTab extends AwesomeBarTab implements GeckoEventListener {
|
|||||||
((Activity)mContext).registerForContextMenu(mView);
|
((Activity)mContext).registerForContextMenu(mView);
|
||||||
mView.setTag(TAG);
|
mView.setTag(TAG);
|
||||||
AwesomeBarCursorAdapter adapter = getCursorAdapter();
|
AwesomeBarCursorAdapter adapter = getCursorAdapter();
|
||||||
mView.setAdapter(adapter);
|
((ListView)mView).setAdapter(adapter);
|
||||||
mView.setOnTouchListener(mListListener);
|
mView.setOnTouchListener(mListListener);
|
||||||
}
|
}
|
||||||
return mView;
|
return (ListView)mView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
@ -33,6 +33,7 @@ abstract public class AwesomeBarTab {
|
|||||||
abstract public boolean onBackPressed();
|
abstract public boolean onBackPressed();
|
||||||
abstract public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo);
|
abstract public ContextMenuSubject getSubject(ContextMenu menu, View view, ContextMenuInfo menuInfo);
|
||||||
|
|
||||||
|
protected View mView = null;
|
||||||
protected View.OnTouchListener mListListener;
|
protected View.OnTouchListener mListListener;
|
||||||
private AwesomeBarTabs.OnUrlOpenListener mListener;
|
private AwesomeBarTabs.OnUrlOpenListener mListener;
|
||||||
private LayoutInflater mInflater = null;
|
private LayoutInflater mInflater = null;
|
||||||
@ -48,6 +49,8 @@ abstract public class AwesomeBarTab {
|
|||||||
|
|
||||||
public void setListTouchListener(View.OnTouchListener listener) {
|
public void setListTouchListener(View.OnTouchListener listener) {
|
||||||
mListListener = listener;
|
mListListener = listener;
|
||||||
|
if (mView != null)
|
||||||
|
mView.setOnTouchListener(mListListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class AwesomeEntryViewHolder {
|
protected class AwesomeEntryViewHolder {
|
||||||
|
@ -37,7 +37,6 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||||||
private boolean mInReadingList = false;
|
private boolean mInReadingList = false;
|
||||||
private int mFolderId;
|
private int mFolderId;
|
||||||
private String mFolderTitle;
|
private String mFolderTitle;
|
||||||
private ListView mView = null;
|
|
||||||
private BookmarksListAdapter mCursorAdapter = null;
|
private BookmarksListAdapter mCursorAdapter = null;
|
||||||
private BookmarksQueryTask mQueryTask = null;
|
private BookmarksQueryTask mQueryTask = null;
|
||||||
|
|
||||||
@ -75,13 +74,14 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||||||
mView.setOnTouchListener(mListListener);
|
mView.setOnTouchListener(mListListener);
|
||||||
|
|
||||||
// We need to add the header before we set the adapter, hence make it null
|
// We need to add the header before we set the adapter, hence make it null
|
||||||
mView.setAdapter(null);
|
ListView list = (ListView)mView;
|
||||||
mView.setAdapter(getCursorAdapter());
|
list.setAdapter(null);
|
||||||
|
list.setAdapter(getCursorAdapter());
|
||||||
|
|
||||||
BookmarksQueryTask task = getQueryTask();
|
BookmarksQueryTask task = getQueryTask();
|
||||||
task.execute();
|
task.execute();
|
||||||
}
|
}
|
||||||
return mView;
|
return (ListView)mView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
@ -128,13 +128,14 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||||||
|
|
||||||
// Add/Remove header based on the root folder
|
// Add/Remove header based on the root folder
|
||||||
if (mView != null) {
|
if (mView != null) {
|
||||||
|
ListView list = (ListView)mView;
|
||||||
if (mFolderId == Bookmarks.FIXED_ROOT_ID) {
|
if (mFolderId == Bookmarks.FIXED_ROOT_ID) {
|
||||||
if (mView.getHeaderViewsCount() == 1) {
|
if (list.getHeaderViewsCount() == 1) {
|
||||||
mView.removeHeaderView(headerView);
|
list.removeHeaderView(headerView);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mView.getHeaderViewsCount() == 0) {
|
if (list.getHeaderViewsCount() == 0) {
|
||||||
mView.addHeaderView(headerView, null, true);
|
list.addHeaderView(headerView, null, true);
|
||||||
}
|
}
|
||||||
headerView.setText(mFolderTitle);
|
headerView.setText(mFolderTitle);
|
||||||
}
|
}
|
||||||
@ -360,8 +361,9 @@ public class BookmarksTab extends AwesomeBarTab {
|
|||||||
public void run() {
|
public void run() {
|
||||||
// this will update the cursorAdapter to use the new one if it already exists
|
// 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
|
// We need to add the header before we set the adapter, hence make it null
|
||||||
mView.setAdapter(null);
|
ListView list = (ListView)mView;
|
||||||
mView.setAdapter(getCursorAdapter(cursor));
|
list.setAdapter(null);
|
||||||
|
list.setAdapter(getCursorAdapter(cursor));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mQueryTask = null;
|
mQueryTask = null;
|
||||||
|
@ -48,7 +48,6 @@ public class HistoryTab extends AwesomeBarTab {
|
|||||||
private ContentObserver mContentObserver;
|
private ContentObserver mContentObserver;
|
||||||
private ContentResolver mContentResolver;
|
private ContentResolver mContentResolver;
|
||||||
private HistoryQueryTask mQueryTask = null;
|
private HistoryQueryTask mQueryTask = null;
|
||||||
private ExpandableListView mView = null;
|
|
||||||
private HistoryListAdapter mCursorAdapter = null;
|
private HistoryListAdapter mCursorAdapter = null;
|
||||||
|
|
||||||
public HistoryTab(Context context) {
|
public HistoryTab(Context context) {
|
||||||
@ -96,11 +95,11 @@ public class HistoryTab extends AwesomeBarTab {
|
|||||||
mView.setOnTouchListener(mListListener);
|
mView.setOnTouchListener(mListListener);
|
||||||
|
|
||||||
// We need to add the header before we set the adapter, hence make it null
|
// 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();
|
HistoryQueryTask task = new HistoryQueryTask();
|
||||||
task.execute();
|
task.execute();
|
||||||
}
|
}
|
||||||
return mView;
|
return (ListView)mView;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
|
Loading…
Reference in New Issue
Block a user