本文整理汇总了Java中android.app.LoaderManager.restartLoader方法的典型用法代码示例。如果您正苦于以下问题:Java LoaderManager.restartLoader方法的具体用法?Java LoaderManager.restartLoader怎么用?Java LoaderManager.restartLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.LoaderManager
的用法示例。
在下文中一共展示了LoaderManager.restartLoader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String chosenAccountName = AccountUtils.getActiveAccountName(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);
}
示例2: onActivityCreated
import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Activity activity = getActivity();
if (!activity.isFinishing()) {
// Start loading data
LoaderManager loaderManager = getLoaderManager();
loaderManager.restartLoader(PeopleIveMetQuery.TOKEN, null, this);
loaderManager.restartLoader(PeopleIveMetSubQuery.TOKEN, null, this);
// Set up the API client
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(activity, this, this)
.addApi(Plus.API)
.addScope(Plus.SCOPE_PLUS_LOGIN);
if (AccountUtils.hasActiveAccount(activity)) {
builder.setAccountName(AccountUtils.getActiveAccountName(activity));
}
mApiClient = builder.build();
}
}
示例3: onFeedbackQueryComplete
import android.app.LoaderManager; //导入方法依赖的package包/类
private void onFeedbackQueryComplete(Cursor cursor) {
// Views have not been set up yet -- continue loading the rest of data
if (mSubmitFeedbackView == null) {
LoaderManager manager = getLoaderManager();
manager.restartLoader(SessionsQuery._TOKEN, null, this);
manager.restartLoader(SpeakersQuery._TOKEN, null, this);
manager.restartLoader(TAG_METADATA_TOKEN, null, this);
}
// Is there existing feedback for this session?
mAlreadyGaveFeedback = cursor.getCount() > 0;
if (mAlreadyGaveFeedback) {
final MessageCardView giveFeedbackCardView = (MessageCardView) mRootView.findViewById(
R.id.give_feedback_card);
if (giveFeedbackCardView != null) {
giveFeedbackCardView.setVisibility(View.GONE);
}
if (mSubmitFeedbackView != null) {
mSubmitFeedbackView.setVisibility(View.GONE);
}
}
LOGD(TAG, "User " + (mAlreadyGaveFeedback ? "already gave" : "has not given") + " feedback for session.");
cursor.close();
}
示例4: restartLoader
import android.app.LoaderManager; //导入方法依赖的package包/类
private void restartLoader() {
if (cursorValid == null) {
return;
}
// Refresh the message list
LoaderManager loaderManager = getLoaderManager();
for (int i = 0; i < accountUuids.length; i++) {
loaderManager.restartLoader(i, null, this);
cursorValid[i] = false;
}
}
示例5: reSort
import android.app.LoaderManager; //导入方法依赖的package包/类
private void reSort() {
int toastString = sortType.getToast(sortAscending);
Toast toast = Toast.makeText(getActivity(), toastString, Toast.LENGTH_SHORT);
toast.show();
LoaderManager loaderManager = getLoaderManager();
for (int i = 0, len = accountUuids.length; i < len; i++) {
loaderManager.restartLoader(i, null, this);
}
}
示例6: loadSessions
import android.app.LoaderManager; //导入方法依赖的package包/类
/**
* Prepares and starts a SessionLoader for the specified query token.
*/
private void loadSessions(String roomId, String roomTitle, int roomType, int queryToken){
setHeader(MapUtils.getRoomIcon(roomType), roomTitle, null);
onSessionListLoading(roomId, roomTitle);
// Load the following sessions for this room
LoaderManager lm = getLoaderManager();
Bundle args = new Bundle();
args.putString(QUERY_ARG_ROOMID, roomId);
args.putString(QUERY_ARG_ROOMTITLE, roomTitle);
args.putInt(QUERY_ARG_ROOMTYPE, roomType);
lm.restartLoader(queryToken, args, this);
}
示例7: onUserAction
import android.app.LoaderManager; //导入方法依赖的package包/类
/**
* Called when the user has performed an {@code action}, with data to be passed
* as a {@link android.os.Bundle} in {@code args}.
* <p/>
* Add the constants used to store values in the bundle to the Model implementation class
* as final static protected strings.
* <p/>
* If the {@code action} should trigger a new data query, specify the query ID by storing the
* associated Integer in the {@code args} using {@link #KEY_RUN_QUERY_ID}. The {@code args} will
* be passed on to the cursor loader so you can pass in extra arguments for your query.
*/
@Override
public void onUserAction(UserActionEnum action, @Nullable Bundle args) {
boolean isValid = false;
if (mValidUserActions != null && mValidUserActions.length > 0 && action != null) {
for (int i = 0; i < mValidUserActions.length; i++) {
if (mValidUserActions[i].getId() == action.getId()) {
isValid = true;
}
}
}
if (isValid) {
if (args != null && args.containsKey(KEY_RUN_QUERY_ID)) {
Object queryId = args.get(KEY_RUN_QUERY_ID);
if (queryId instanceof Integer) {
LoaderManager manager = getLoaderManager();
manager.restartLoader((Integer) queryId, args, this);
} else {
// Query id should be an integer!
LOGE(TAG, "onUserAction called with a bundle containing KEY_RUN_QUERY_ID but"
+ "the value is not an Integer so it's not a valid query id!");
}
}
boolean success = mModel.requestModelUpdate(action, args);
if (!success) {
// User action not understood by model, even though the presenter understands it.
LOGE(TAG, "Model doesn't implement user action " + action.getId() + ". Have you "
+ "forgotten to implement this UserActionEnum in your model, or have you "
+ "called setValidUserActions on your presenter with a UserActionEnum that "
+ "it shouldn't support?");
}
} else {
// User action not understood.
LOGE(TAG, "Invalid user action " + action.getId() + ". Have you called "
+ "setValidUserActions on your presenter, with all the UserActionEnum you want "
+ "to support?");
}
}
示例8: restart
import android.app.LoaderManager; //导入方法依赖的package包/类
public void restart(@NonNull Observer<T> observer) {
final LoaderManager lm = mLmRef.get();
if (lm != null) {
synchronized (LoaderManager.class) {
lm.restartLoader(mLoaderId, Bundle.EMPTY, new RxLcImpl<>(mContext, mObservable, observer));
}
}
}
示例9: restartLoader
import android.app.LoaderManager; //导入方法依赖的package包/类
private void restartLoader() {
if (mCursorValid == null) {
return;
}
// Refresh the message list
LoaderManager loaderManager = getLoaderManager();
for (int i = 0; i < mAccountUuids.length; i++) {
loaderManager.restartLoader(i, null, this);
mCursorValid[i] = false;
}
}
示例10: reSort
import android.app.LoaderManager; //导入方法依赖的package包/类
private void reSort() {
int toastString = mSortType.getToast(mSortAscending);
Toast toast = Toast.makeText(getActivity(), toastString, Toast.LENGTH_SHORT);
toast.show();
LoaderManager loaderManager = getLoaderManager();
for (int i = 0, len = mAccountUuids.length; i < len; i++) {
loaderManager.restartLoader(i, null, this);
}
}
示例11: onNavigationItemSelected
import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
LoaderManager lm = getLoaderManager();
Bundle b = new Bundle();
b.putInt("storedType", itemPosition);
lm.restartLoader(2, b, ShowsStoredFragment.this);
stored_type = (itemPosition == ShowsStoredAsyncTaskLoader.STORED_RECENT_SHOWS ?
ScrollingShowAdapter.MENU_RECENT : ScrollingShowAdapter.MENU_BOOKMARK);
return true;
}
示例12: executeRefresh
import android.app.LoaderManager; //导入方法依赖的package包/类
private void executeRefresh(){
if(voteType==-1){
return;
}
LoaderManager lm = getLoaderManager();
Bundle b = new Bundle();
b.putIntArray("queryArray", new int[] {voteType, voteResultType, numResults, offset, artistId});
lm.restartLoader(2, b, VotesFragment.this);
}
示例13: executeSearch
import android.app.LoaderManager; //导入方法依赖的package包/类
private void executeSearch(String query) {
dateChanged = false;
Bundle b = new Bundle();
b.putString("query", query);
LoaderManager lm = this.getLoaderManager();
if(lm.getLoader(0)!=null){
// We already have a loader.
Logging.Log(LOG_TAG, "RESTART.");
lm.restartLoader(0, b, this);
} else{
// We need a new loader.
lm.initLoader(0, b, this);
}
}
示例14: retrieveAccessToken
import android.app.LoaderManager; //导入方法依赖的package包/类
public void retrieveAccessToken(String code)
{
LoaderManager lm = getLoaderManager();
Bundle b = new Bundle();
b.putString(OAuthAccessTokenLoader.PARAM_CODE, "code");
b.putString(OAuthAccessTokenLoader.PARAM_APIKEY, apiKey);
b.putString(OAuthAccessTokenLoader.PARAM_APISECRET, apiSecret);
b.putString(OAuthAccessTokenLoader.PARAM_CALLBACK_URL, callback);
b.putString(OAuthAccessTokenLoader.PARAM_BASEURL, baseOAuthUrl);
b.putInt(OAuthAccessTokenLoader.PARAM_OPERATION, OAuthAccessTokenLoader.OPERATION_ACCESS_TOKEN);
b.putString(OAuthAccessTokenLoader.PARAM_CODE, code);
lm.restartLoader(OAuthAccessTokenLoader.ID, b, this);
}
示例15: initOrRestartLoader
import android.app.LoaderManager; //导入方法依赖的package包/类
public static void initOrRestartLoader(LoaderManager loaderManager, int id, Bundle bundle, LoaderManager.LoaderCallbacks callbacks) {
Loader loader = loaderManager.getLoader(id);
if (loader == null) {
loaderManager.initLoader(id, bundle, callbacks);
} else {
loaderManager.restartLoader(id, bundle, callbacks);
}
}