本文整理汇总了Java中android.support.v4.app.LoaderManager.restartLoader方法的典型用法代码示例。如果您正苦于以下问题:Java LoaderManager.restartLoader方法的具体用法?Java LoaderManager.restartLoader怎么用?Java LoaderManager.restartLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.LoaderManager
的用法示例。
在下文中一共展示了LoaderManager.restartLoader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadListViewItems
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int listPosition, boolean markSeen, boolean showProgress) {
if (!isAdded()) {
return;
}
int loaderId = 0;
ConversationsLoaderCallbacks callbacks =
new ConversationsLoaderCallbacks(getContext(), listView,
listPosition, cursorAdapter, markSeen, showProgress);
LoaderManager manager = getLoaderManager();
Loader<?> loader = manager.getLoader(loaderId);
if (loader == null) {
// init and run the items loader
manager.initLoader(loaderId, null, callbacks);
} else {
// restart loader
manager.restartLoader(loaderId, null, callbacks);
}
}
示例2: loadListViewItems
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
if (!isAdded()) {
return;
}
int loaderId = 0;
JournalItemsLoaderCallbacks callbacks =
new JournalItemsLoaderCallbacks(getContext(), cursorAdapter,
itemsFilter, deleteItems, listView, listPosition);
LoaderManager manager = getLoaderManager();
if (manager.getLoader(loaderId) == null) {
// init and run the items loader
manager.initLoader(loaderId, null, callbacks);
} else {
// restart loader
manager.restartLoader(loaderId, null, callbacks);
}
}
示例3: loadListViewItems
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int threadId, int unreadCount, int listPosition) {
if (!isAdded()) {
return;
}
int loaderId = 0;
ConversationLoaderCallbacks callbacks =
new ConversationLoaderCallbacks(getContext(),
threadId, unreadCount, listView, listPosition, cursorAdapter);
LoaderManager manager = getLoaderManager();
if (manager.getLoader(loaderId) == null) {
// init and run the items loader
manager.initLoader(loaderId, null, callbacks);
} else {
// restart loader
manager.restartLoader(loaderId, null, callbacks);
}
}
示例4: loadListViewItems
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
if (!isAdded()) {
return;
}
int loaderId = 0;
ContactsLoaderCallbacks callbacks =
new ContactsLoaderCallbacks(getContext(), contactType, cursorAdapter,
itemsFilter, deleteItems, listView, listPosition);
LoaderManager manager = getLoaderManager();
if (manager.getLoader(loaderId) == null) {
// init and run the items loader
manager.initLoader(loaderId, null, callbacks);
} else {
// restart loader
manager.restartLoader(loaderId, null, callbacks);
}
}
示例5: startSearch
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
noResults.setVisibility(View.GONE);
Bundle args = new Bundle();
args.putString(SearchActivity.TERMS, terms);
args.putString(SearchActivity.TAGS, tags);
args.putInt(SearchActivity.PAGE, page);
LoaderManager lm = getLoaderManager();
Loader l = lm.getLoader(page);
if (l == null){
lm.initLoader(page, args, this);
}
//Check if the terms and tags are different from what the loader has and restart if they're different
else {
RequestSearchAsyncLoader s = (RequestSearchAsyncLoader)l;
if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
lm.restartLoader(page, args, this);
}
else {
lm.initLoader(page, args, this);
}
}
}
示例6: startSearch
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, int page){
noResults.setVisibility(View.GONE);
Bundle args = new Bundle();
args.putString(SearchActivity.TERMS, terms);
args.putInt(SearchActivity.PAGE, page);
LoaderManager lm = getLoaderManager();
Loader l = lm.getLoader(page);
if (l == null){
lm.initLoader(page, args, this);
}
//Check if the terms and tags are different from what the loader has and restart if they're different
else {
UserSearchAsyncLoader s = (UserSearchAsyncLoader)l;
if (!s.getTerms().equalsIgnoreCase(searchTerms)){
lm.restartLoader(page, args, this);
}
else {
lm.initLoader(page, args, this);
}
}
}
示例7: startSearch
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
noResults.setVisibility(View.GONE);
Bundle args = new Bundle();
args.putString(SearchActivity.TERMS, terms);
args.putString(SearchActivity.TAGS, tags);
args.putInt(SearchActivity.PAGE, page);
LoaderManager lm = getLoaderManager();
Loader l = lm.getLoader(page);
if (l == null){
lm.initLoader(page, args, this);
}
//Check if the terms and tags are different from what the loader has and restart if they're different
else {
TorrentSearchAsyncLoader s = (TorrentSearchAsyncLoader)l;
if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
lm.restartLoader(page, args, this);
}
else {
lm.initLoader(page, args, this);
}
}
}
示例8: onListItemClick
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Cursor c = mAdapter.getCursor();
Intent iNewsInfo = new Intent(getActivity(), NewsInfoActivity.class);
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_ID, c.getString(c.getColumnIndex(DB.MyNews.ID)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_FEED_ID, c.getString(c.getColumnIndex(DB.MyNews.FEED_ID)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_AUTHOR, c.getString(c.getColumnIndex(DB.News.AUTHOR)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_TITLE, c.getString(c.getColumnIndex(DB.News.TITLE)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_DATE, c.getLong(c.getColumnIndex(DB.News.PUBLISHED_DATE)));
iNewsInfo
.putExtra(NewsInfoActivity.EXTRA_CONTENT_VALUES, c.getString(c.getColumnIndex(DB.News.CONTENT_VALUES)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_URL, c.getString(c.getColumnIndex(DB.News.URL)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_IS_BOOKMARK, c.getInt(c.getColumnIndex(DB.MyNews.IS_BOOKMARK)) > 0);
startActivity(iNewsInfo);
if (c.getInt(c.getColumnIndex(DB.MyNews.IS_READ)) == 0) {
LoaderManager lm = getLoaderManager();
Bundle b = new Bundle();
b.putString("newsId", c.getString(c.getColumnIndex(DB.MyNews.ID)));
b.putString("feedId", c.getString(c.getColumnIndex(DB.MyNews.FEED_ID)));
lm.restartLoader(LoaderIds.ASYNC_UPDATE_READ, b, loaderCallbacks);
}
}
示例9: onListItemClick
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Cursor c = mAdapter.getCursor();
Intent iNewsInfo = new Intent(getActivity(), NewsInfoActivity.class);
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_ID, c.getString(c.getColumnIndex(DB.MyNews.ID)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_FEED_ID, getArguments().getString("feedId"));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_AUTHOR, c.getString(c.getColumnIndex(DB.News.AUTHOR)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_TITLE, c.getString(c.getColumnIndex(DB.News.TITLE)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_DATE, c.getLong(c.getColumnIndex(DB.News.PUBLISHED_DATE)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_CONTENT_VALUES,
c.getString(c.getColumnIndex(DB.News.CONTENT_VALUES)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_URL, c.getString(c.getColumnIndex(DB.News.URL)));
iNewsInfo.putExtra(NewsInfoActivity.EXTRA_IS_BOOKMARK, c.getInt(c.getColumnIndex(DB.MyNews.IS_BOOKMARK)) > 0);
startActivity(iNewsInfo);
if (c.getInt(c.getColumnIndex(DB.MyNews.IS_READ)) == 0) {
LoaderManager lm = getLoaderManager();
Bundle b = new Bundle();
b.putString("newsId", c.getString(c.getColumnIndex(DB.MyNews.ID)));
lm.restartLoader(LoaderIds.ASYNC_UPDATE_READ, b, loaderCallbacks);
}
}
示例10: onActivityCreated
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public static boolean onActivityCreated(ICursorLoaderFragmentHelper cursorLoaderFragment, Bundle savedInstanceState) {
Activity activity = cursorLoaderFragment.getActivity();
if (activity instanceof FragmentActivity) {
if (cursorLoaderFragment.getUri() != null) {
LoaderManager lm;
if (cursorLoaderFragment instanceof Fragment) {
lm = ((Fragment) cursorLoaderFragment).getLoaderManager();
} else {
lm = ((FragmentActivity) activity).getSupportLoaderManager();
}
Log.xd("lm", lm);
lm.restartLoader(cursorLoaderFragment.getLoaderId(), null, cursorLoaderFragment);
return true;
}
}
return false;
}
示例11: onActivityCreated
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
adapter = new RecentSearchesAdapter(getContext(), null, true);
recentSearchesList.setAdapter(adapter);
recentSearchesList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RecentSearch entry = (RecentSearch) view.getTag();
parentFragment.switchToSearch(entry.getText());
}
});
LoaderManager supportLoaderManager = getLoaderManager();
supportLoaderManager.initLoader(RECENT_SEARCHES_FRAGMENT_LOADER_ID, null, this);
supportLoaderManager.restartLoader(RECENT_SEARCHES_FRAGMENT_LOADER_ID, null, this);
}
示例12: onCreate
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSessionUri = intent.getData();
if (mSessionUri == null) {
return;
}
mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);
mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);
LoaderManager manager = getLoaderManager();
manager.restartLoader(SessionsQuery._TOKEN, null, this);
manager.restartLoader(SpeakersQuery._TOKEN, null, this);
setHasOptionsMenu(true);
}
示例13: onCreate
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String chosenAccountName = AccountUtils.getChosenAccountName(getActivity());
mPlusClient = new PlusClient.Builder(getActivity(), this, this)
.clearScopes()
.setAccountName(chosenAccountName)
.build();
final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
mSessionUri = intent.getData();
if (mSessionUri == null) {
return;
}
mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);
mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);
LoaderManager manager = getLoaderManager();
manager.restartLoader(0, null, this);
setHasOptionsMenu(true);
}
示例14: onOptionsItemSelected
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_locate:
if (!checkPermissions()) {
requestPermissions();
} else {
getLastLocation();
if (mLastLocation != null) {
Toast.makeText(getContext(), Double.toString(mLastLocation.getLongitude()), Toast.LENGTH_SHORT).show();
LoaderManager loaderManager = getLoaderManager();
loaderManager.restartLoader(BUS_STOP_LOCATION_LOADER_ID, null, this);
} else {
Toast.makeText(getContext(), "Unable to determine location.", Toast.LENGTH_SHORT).show();
}
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例15: onViewCreated
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final FragmentActivity activity = getActivity();
AbsListView list = ButterKnife.findById(view,android.R.id.list);
list.setEmptyView(view.findViewById(android.R.id.empty));
adapter = new MyPointsAdapter(activity, null);
(list).setAdapter(adapter);
LoaderManager loaderManager = activity.getSupportLoaderManager();
if (loaderManager.getLoader(POINT_HISTORY_ID) == null) {
loaderManager.initLoader(POINT_HISTORY_ID, null, this);
} else {
loaderManager.restartLoader(POINT_HISTORY_ID, null, this);
}
/**
* убрал условие запроса не чаще, чем раз в PointsManger.isExpired(context)
* пользователь не всегда догадыватеся сам обновить историю
* полагает, что баллы не начислены и пишет в техподдержку
*/
PointsManager.refreshPointHistory((BaseActivity) activity, new Response.Listener<Object>() {
@Override
public void onResponse(Object o) {
processTitleBalance();
processStatus();
processPoints();
processPointUnits();
}
}, null);
processTitleBalance();
processStatus();
processPoints();
processPointUnits();
}