зеркало из https://github.com/mozilla/gecko-dev.git
Bug 898501: HomeCursorLoaderCallbacks should be a separate class. [r=lucasr]
This commit is contained in:
Родитель
40c1c7dedf
Коммит
286581b265
|
@ -222,6 +222,7 @@ FENNEC_JAVA_FILES = \
|
||||||
home/BookmarkThumbnailView.java \
|
home/BookmarkThumbnailView.java \
|
||||||
home/BrowserSearch.java \
|
home/BrowserSearch.java \
|
||||||
home/HistoryPage.java \
|
home/HistoryPage.java \
|
||||||
|
home/HomeCursorLoaderCallbacks.java \
|
||||||
home/HomeFragment.java \
|
home/HomeFragment.java \
|
||||||
home/HomeListView.java \
|
home/HomeListView.java \
|
||||||
home/HomePager.java \
|
home/HomePager.java \
|
||||||
|
|
|
@ -129,12 +129,14 @@ public class BookmarksPage extends HomeFragment {
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
// Setup the top bookmarks adapter.
|
// Setup the top bookmarks adapter.
|
||||||
mTopBookmarksAdapter = new TopBookmarksAdapter(getActivity(), null);
|
mTopBookmarksAdapter = new TopBookmarksAdapter(activity, null);
|
||||||
mTopBookmarks.setAdapter(mTopBookmarksAdapter);
|
mTopBookmarks.setAdapter(mTopBookmarksAdapter);
|
||||||
|
|
||||||
// Setup the list adapter.
|
// Setup the list adapter.
|
||||||
mListAdapter = new BookmarksListAdapter(getActivity(), null);
|
mListAdapter = new BookmarksListAdapter(activity, null);
|
||||||
mListAdapter.setOnRefreshFolderListener(new OnRefreshFolderListener() {
|
mListAdapter.setOnRefreshFolderListener(new OnRefreshFolderListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefreshFolder(int folderId) {
|
public void onRefreshFolder(int folderId) {
|
||||||
|
@ -147,7 +149,7 @@ public class BookmarksPage extends HomeFragment {
|
||||||
mList.setAdapter(mListAdapter);
|
mList.setAdapter(mListAdapter);
|
||||||
|
|
||||||
// Create callbacks before the initial loader is started.
|
// Create callbacks before the initial loader is started.
|
||||||
mLoaderCallbacks = new CursorLoaderCallbacks();
|
mLoaderCallbacks = new CursorLoaderCallbacks(activity, getLoaderManager());
|
||||||
mThumbnailsLoaderCallbacks = new ThumbnailsLoaderCallbacks();
|
mThumbnailsLoaderCallbacks = new ThumbnailsLoaderCallbacks();
|
||||||
loadIfVisible();
|
loadIfVisible();
|
||||||
}
|
}
|
||||||
|
@ -369,6 +371,10 @@ public class BookmarksPage extends HomeFragment {
|
||||||
* Loader callbacks for the LoaderManager of this fragment.
|
* Loader callbacks for the LoaderManager of this fragment.
|
||||||
*/
|
*/
|
||||||
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
||||||
|
public CursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
super(context, loaderManager);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
switch(id) {
|
switch(id) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.database.Cursor;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.support.v4.content.AsyncTaskLoader;
|
import android.support.v4.content.AsyncTaskLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
|
@ -262,15 +263,17 @@ public class BrowserSearch extends HomeFragment
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
// Intialize the search adapter
|
// Intialize the search adapter
|
||||||
mAdapter = new SearchAdapter(getActivity());
|
mAdapter = new SearchAdapter(activity);
|
||||||
mList.setAdapter(mAdapter);
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
// Only create an instance when we need it
|
// Only create an instance when we need it
|
||||||
mSuggestionLoaderCallbacks = null;
|
mSuggestionLoaderCallbacks = null;
|
||||||
|
|
||||||
// Create callbacks before the initial loader is started
|
// Create callbacks before the initial loader is started
|
||||||
mCursorLoaderCallbacks = new CursorLoaderCallbacks();
|
mCursorLoaderCallbacks = new CursorLoaderCallbacks(activity, getLoaderManager());
|
||||||
loadIfVisible();
|
loadIfVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -760,6 +763,10 @@ public class BrowserSearch extends HomeFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
||||||
|
public CursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
super(context, loaderManager);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
if (id == LOADER_ID_SEARCH) {
|
if (id == LOADER_ID_SEARCH) {
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.gecko.home;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
|
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
|
import android.support.v4.content.Loader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cursor loader callbacks that takes care loading favicons into memory.
|
||||||
|
*/
|
||||||
|
abstract class HomeCursorLoaderCallbacks implements LoaderCallbacks<Cursor> {
|
||||||
|
|
||||||
|
// Cursor loader ID for favicons query
|
||||||
|
private static final int LOADER_ID_FAVICONS = 100;
|
||||||
|
|
||||||
|
private final Context mContext;
|
||||||
|
private final LoaderManager mLoaderManager;
|
||||||
|
|
||||||
|
public HomeCursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
mContext = context;
|
||||||
|
mLoaderManager = loaderManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadFavicons(Cursor cursor) {
|
||||||
|
FaviconsLoader.restartFromCursor(mLoaderManager, LOADER_ID_FAVICONS, this, cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
|
if (id == LOADER_ID_FAVICONS) {
|
||||||
|
return FaviconsLoader.createInstance(mContext, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
|
||||||
|
if (loader.getId() == LOADER_ID_FAVICONS) {
|
||||||
|
onFaviconsLoaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoaderReset(Loader<Cursor> loader) {
|
||||||
|
// Do nothing by default.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback for favicons loaded in memory.
|
||||||
|
public abstract void onFaviconsLoaded();
|
||||||
|
}
|
|
@ -15,19 +15,14 @@ import org.mozilla.gecko.db.BrowserContract.Combined;
|
||||||
import org.mozilla.gecko.db.BrowserDB;
|
import org.mozilla.gecko.db.BrowserDB;
|
||||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||||
import org.mozilla.gecko.home.HomeListView.HomeContextMenuInfo;
|
import org.mozilla.gecko.home.HomeListView.HomeContextMenuInfo;
|
||||||
import org.mozilla.gecko.ReaderModeUtils;
|
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.mozilla.gecko.util.UiAsyncTask;
|
import org.mozilla.gecko.util.UiAsyncTask;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
|
||||||
import android.support.v4.content.Loader;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -51,9 +46,6 @@ abstract class HomeFragment extends Fragment {
|
||||||
// URL to Title replacement regex.
|
// URL to Title replacement regex.
|
||||||
private static final String REGEX_URL_TO_TITLE = "^([a-z]+://)?(www\\.)?";
|
private static final String REGEX_URL_TO_TITLE = "^([a-z]+://)?(www\\.)?";
|
||||||
|
|
||||||
// Cursor loader ID for favicons query
|
|
||||||
private static final int LOADER_ID_FAVICONS = 100;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
|
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
|
||||||
if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
|
if (menuInfo == null || !(menuInfo instanceof HomeContextMenuInfo)) {
|
||||||
|
@ -252,38 +244,4 @@ abstract class HomeFragment extends Fragment {
|
||||||
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Cursor loader callbacks that takes care loading favicons into memory.
|
|
||||||
*/
|
|
||||||
abstract class HomeCursorLoaderCallbacks implements LoaderCallbacks<Cursor> {
|
|
||||||
|
|
||||||
// Callback for favicons loaded in memory.
|
|
||||||
public abstract void onFaviconsLoaded();
|
|
||||||
|
|
||||||
public void loadFavicons(Cursor cursor) {
|
|
||||||
FaviconsLoader.restartFromCursor(getLoaderManager(), LOADER_ID_FAVICONS, this, cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
|
||||||
if (id == LOADER_ID_FAVICONS) {
|
|
||||||
return FaviconsLoader.createInstance(getActivity(), args);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
|
|
||||||
if (loader.getId() == LOADER_ID_FAVICONS) {
|
|
||||||
onFaviconsLoaded();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoaderReset(Loader<Cursor> loader) {
|
|
||||||
// Do nothing by default.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.widget.SimpleCursorAdapter;
|
import android.support.v4.widget.SimpleCursorAdapter;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
|
@ -140,15 +141,17 @@ public class MostRecentPage extends HomeFragment {
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
// Initialize map of history sections
|
// Initialize map of history sections
|
||||||
mMostRecentSections = new SparseArray<MostRecentSection>();
|
mMostRecentSections = new SparseArray<MostRecentSection>();
|
||||||
|
|
||||||
// Intialize adapter
|
// Intialize adapter
|
||||||
mAdapter = new MostRecentAdapter(getActivity());
|
mAdapter = new MostRecentAdapter(activity);
|
||||||
mList.setAdapter(mAdapter);
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
// Create callbacks before the initial loader is started
|
// Create callbacks before the initial loader is started
|
||||||
mCursorLoaderCallbacks = new CursorLoaderCallbacks();
|
mCursorLoaderCallbacks = new CursorLoaderCallbacks(activity, getLoaderManager());
|
||||||
loadIfVisible();
|
loadIfVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,6 +348,10 @@ public class MostRecentPage extends HomeFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
||||||
|
public CursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
super(context, loaderManager);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
if (id == LOADER_ID_HISTORY) {
|
if (id == LOADER_ID_HISTORY) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.widget.CursorAdapter;
|
import android.support.v4.widget.CursorAdapter;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -116,12 +117,14 @@ public class MostVisitedPage extends HomeFragment {
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
|
||||||
// Intialize the search adapter
|
// Intialize the search adapter
|
||||||
mAdapter = new VisitedAdapter(getActivity(), null);
|
mAdapter = new VisitedAdapter(activity, null);
|
||||||
mList.setAdapter(mAdapter);
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
// Create callbacks before the initial loader is started
|
// Create callbacks before the initial loader is started
|
||||||
mCursorLoaderCallbacks = new CursorLoaderCallbacks();
|
mCursorLoaderCallbacks = new CursorLoaderCallbacks(activity, getLoaderManager());
|
||||||
loadIfVisible();
|
loadIfVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +166,10 @@ public class MostVisitedPage extends HomeFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
||||||
|
public CursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
super(context, loaderManager);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
if (id == LOADER_ID_FRECENCY) {
|
if (id == LOADER_ID_FRECENCY) {
|
||||||
|
|
|
@ -8,11 +8,12 @@ package org.mozilla.gecko.home;
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.widget.CursorAdapter;
|
import android.support.v4.widget.CursorAdapter;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
@ -124,15 +125,18 @@ class PinBookmarkDialog extends DialogFragment {
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
|
final Activity activity = getActivity();
|
||||||
|
final LoaderManager manager = getLoaderManager();
|
||||||
|
|
||||||
// Initialize the search adapter
|
// Initialize the search adapter
|
||||||
mAdapter = new SearchAdapter(getActivity());
|
mAdapter = new SearchAdapter(activity);
|
||||||
mList.setAdapter(mAdapter);
|
mList.setAdapter(mAdapter);
|
||||||
|
|
||||||
// Create callbacks before the initial loader is started
|
// Create callbacks before the initial loader is started
|
||||||
mLoaderCallbacks = new CursorLoaderCallbacks();
|
mLoaderCallbacks = new CursorLoaderCallbacks(activity, manager);
|
||||||
|
|
||||||
// Reconnect to the loader only if present
|
// Reconnect to the loader only if present
|
||||||
getLoaderManager().initLoader(LOADER_ID_SEARCH, null, mLoaderCallbacks);
|
manager.initLoader(LOADER_ID_SEARCH, null, mLoaderCallbacks);
|
||||||
|
|
||||||
// Default filter.
|
// Default filter.
|
||||||
filter("");
|
filter("");
|
||||||
|
@ -175,50 +179,42 @@ class PinBookmarkDialog extends DialogFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CursorLoaderCallbacks implements LoaderCallbacks<Cursor> {
|
private class CursorLoaderCallbacks extends HomeCursorLoaderCallbacks {
|
||||||
|
public CursorLoaderCallbacks(Context context, LoaderManager loaderManager) {
|
||||||
|
super(context, loaderManager);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||||
switch(id) {
|
if (id == LOADER_ID_SEARCH) {
|
||||||
case LOADER_ID_SEARCH:
|
|
||||||
return SearchLoader.createInstance(getActivity(), args);
|
return SearchLoader.createInstance(getActivity(), args);
|
||||||
|
} else {
|
||||||
case LOADER_ID_FAVICONS:
|
return super.onCreateLoader(id, args);
|
||||||
return FaviconsLoader.createInstance(getActivity(), args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
|
public void onLoadFinished(Loader<Cursor> loader, Cursor c) {
|
||||||
final int loaderId = loader.getId();
|
if (loader.getId() == LOADER_ID_SEARCH) {
|
||||||
switch(loaderId) {
|
|
||||||
case LOADER_ID_SEARCH:
|
|
||||||
mAdapter.swapCursor(c);
|
mAdapter.swapCursor(c);
|
||||||
|
loadFavicons(c);
|
||||||
FaviconsLoader.restartFromCursor(getLoaderManager(), LOADER_ID_FAVICONS,
|
} else {
|
||||||
mLoaderCallbacks, c);
|
super.onLoadFinished(loader, c);
|
||||||
break;
|
|
||||||
|
|
||||||
case LOADER_ID_FAVICONS:
|
|
||||||
// Force the list to use the in-memory favicons.
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoaderReset(Loader<Cursor> loader) {
|
public void onLoaderReset(Loader<Cursor> loader) {
|
||||||
final int loaderId = loader.getId();
|
if (loader.getId() == LOADER_ID_SEARCH) {
|
||||||
switch(loaderId) {
|
|
||||||
case LOADER_ID_SEARCH:
|
|
||||||
mAdapter.swapCursor(null);
|
mAdapter.swapCursor(null);
|
||||||
break;
|
} else {
|
||||||
|
super.onLoaderReset(loader);
|
||||||
case LOADER_ID_FAVICONS:
|
|
||||||
// Do nothing
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFaviconsLoaded() {
|
||||||
|
mAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче