当前位置: 首页>>代码示例>>Java>>正文


Java LoaderManager.restartLoader方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:20,代码来源:SMSConversationsListFragment.java

示例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);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:JournalFragment.java

示例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);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:19,代码来源:SMSConversationFragment.java

示例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);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:ContactsFragment.java

示例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);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:RequestSearchFragment.java

示例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);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:22,代码来源:UserSearchFragment.java

示例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);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:TorrentSearchFragment.java

示例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);
    }
}
 
开发者ID:ediTLJ,项目名称:novelty,代码行数:27,代码来源:BookmarksFragment.java

示例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);
    }
}
 
开发者ID:ediTLJ,项目名称:novelty,代码行数:26,代码来源:FeedFragment.java

示例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;
}
 
开发者ID:IstiN,项目名称:android_xcore,代码行数:18,代码来源:CursorLoaderFragmentHelper.java

示例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);
}
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:19,代码来源:RecentSearchesFragment.java

示例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);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:22,代码来源:SessionDetailFragment.java

示例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);
}
 
开发者ID:TheDeltaProgram,项目名称:iosched2013,代码行数:26,代码来源:SessionFeedbackFragment.java

示例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);
    }
}
 
开发者ID:joshvocal,项目名称:TransLinkMe-App,代码行数:28,代码来源:LocationFragment.java

示例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();
}
 
开发者ID:active-citizen,项目名称:android.java,代码行数:36,代码来源:MyPointsFragment.java


注:本文中的android.support.v4.app.LoaderManager.restartLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。