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


Java Task.isSuccessful方法代码示例

本文整理汇总了Java中com.google.android.gms.tasks.Task.isSuccessful方法的典型用法代码示例。如果您正苦于以下问题:Java Task.isSuccessful方法的具体用法?Java Task.isSuccessful怎么用?Java Task.isSuccessful使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.tasks.Task的用法示例。


在下文中一共展示了Task.isSuccessful方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onComplete

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<Void> task) {
    if (isDisposed()) return;
    if (!task.isSuccessful()) {
        Exception exception = task.getException();
        if (terminated) {
            RxJavaPlugins.onError(exception);
        } else {
            try {
                terminated = true;
                observer.onError(exception);
            } catch (Throwable t) {
                Exceptions.throwIfFatal(t);
                RxJavaPlugins.onError(new CompositeException(task.getException(), t));
            }
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:19,代码来源:ObservableTaskCallback.java

示例2: changePassword

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public Promise<Void, BError, Void> changePassword(String email, String oldPassword, String newPassword){
    
    final Deferred<Void, BError, Void> deferred = new DeferredObject<>();

    FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

    OnCompleteListener<Void> resultHandler = new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {
            if (task.isSuccessful()) {
                deferred.resolve(null);
            } else {
                deferred.reject(getFirebaseError(DatabaseError.fromException(task.getException())));

            }
        }
    };

    user.updatePassword(newPassword).addOnCompleteListener(resultHandler);

    return deferred.promise();
}
 
开发者ID:MobileDev418,项目名称:chat-sdk-android-push-firebase,代码行数:24,代码来源:BChatcatNetworkAdapter.java

示例3: then

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public Task<Void> then(@NonNull Task<Void> task) throws Exception {
    if (!task.isSuccessful()) {
        try {
            throw task.getException();
        } catch (FirebaseWebRequestException e) {
            if (e.getHttpStatusCode() == 400 || e.getHttpStatusCode() == 403) {
                Log.d(TAG, "Digits session deemed invalid by server");
                Log.d(TAG, "Clearing legacy session");
                // Permanent errors should clear the persistence key.
                storageHelpers.clearDigitsSession();
            }
            return task;
        }
    }
    storageHelpers.clearDigitsSession();
    return task;
}
 
开发者ID:firebase,项目名称:digits-migration-helper-android,代码行数:19,代码来源:ClearSessionContinuation.java

示例4: subscribe

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
    final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {

            if (!emitter.isDisposed()) {
                if (!task.isSuccessful()) {
                    emitter.onError(task.getException());
                } else {
                    emitter.onComplete();
                }
            }

        }
    };

    reference.update(updates).addOnCompleteListener(listener);

}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:21,代码来源:UpdateOnSubscribe.java

示例5: onComplete

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
    if (task.isSuccessful()) {
        FirebaseAuth firebaseAuth = SessionManager.getFirebaseAuth();
        FirebaseUser currentUser = SessionManager.getFirebaseUser();

        boolean isEmailVerified = currentUser.isEmailVerified();
        // TODO zmienić z powrotem
        if (true) {
            updateLoginConfigInSharedPrefs();

            SessionManager.initializeCurrentUserFirebaseListeners();
            SessionManager.initializeFamilyMembersFirebaseListener();

            Intent intent = new Intent(context, MainActivity.class);
            context.startActivity(intent);
        } else {
            firebaseAuth.signOut();
            Toast.makeText(context, R.string.email_not_verified, Toast.LENGTH_LONG).show();
        }
    } else {
        logger.logWarn("Sign In Failure: " + task.getException());
        Toast.makeText(context, R.string.invalid_email_or_password, Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:lmnpWmi,项目名称:wirtualnaApteczka,代码行数:26,代码来源:LogInOnCompleteListener.java

示例6: listener

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
public static OnCompleteListener<Void> listener(@NonNull final CompletableEmitter emitter) {
  return new OnCompleteListener<Void>() {
    @Override public void onComplete(@NonNull Task<Void> task) {
      if (!task.isSuccessful()) {
        if (!emitter.isDisposed()) {
          emitter.onError(task.getException());
        }
        return;
      }

      if (!emitter.isDisposed()) {
        emitter.onComplete();
      }
    }
  };
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:17,代码来源:GmsTaskListeners.java

示例7: onSignInFinished

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
private void onSignInFinished(Task task) {

        if (!isViewActive(view)) {
            return;
        }

        if (task.isSuccessful()) {

            //noinspection ConstantConditions
            view.continueIntoApp();
        } else {

            Timber.w(task.getException(), "signInAnonymously:failure");

            //noinspection ConstantConditions
            viewModel.setShowErrorMessage(true);
            viewModel.setShowContinueButton(true);
            viewModel.setShowLoadingIndicator(false);
        }
    }
 
开发者ID:Frank1234,项目名称:FireBaseTest,代码行数:21,代码来源:SignInPresenter.java

示例8: onComplete

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<T> task) {
    if (isDisposed()) return;
    if (task.isSuccessful()) {
        T result = task.getResult();
        if (result == null) {
            observer.onComplete();
        } else {
            observer.onSuccess(result);
        }
    } else {
        try {
            observer.onError(task.getException());
        } catch (Throwable t) {
            Exceptions.throwIfFatal(t);
            RxJavaPlugins.onError(new CompositeException(task.getException(), t));
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:20,代码来源:MaybeTaskCallback.java

示例9: subscribe

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override public void subscribe(final SingleEmitter<FirebaseUser> emitter) {
  final OnCompleteListener<AuthResult> listener = new OnCompleteListener<AuthResult>() {
    @Override public void onComplete(@NonNull Task<AuthResult> task) {
      if (!task.isSuccessful()) {
        if (!emitter.isDisposed()) {
          emitter.onError(task.getException());
        }
        return;
      }

      if (!emitter.isDisposed()) {
        emitter.onSuccess(task.getResult().getUser());
      }
    }
  };
  createAuthTask(instance).addOnCompleteListener(listener);
}
 
开发者ID:b3er,项目名称:RxFirebase2,代码行数:18,代码来源:BaseAuthOnSubscribe.java

示例10: subscribe

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void subscribe(final SingleEmitter<QuerySnapshot> emitter) throws Exception {
    OnCompleteListener<QuerySnapshot> listener = new OnCompleteListener<QuerySnapshot>() {
        @Override
        public void onComplete(@NonNull Task<QuerySnapshot> task) {
            if (!emitter.isDisposed()) {
                if (task.isSuccessful()) {
                    emitter.onSuccess(task.getResult());

                } else {
                    emitter.onError(task.getException());

                }
            }

        }
    };

    collectionReference.get()
            .addOnCompleteListener(listener);
}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:22,代码来源:GetCollectionOnSubscribe.java

示例11: listener

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
/**
 * @param emit
 * @param <R>
 * @return
 */
@NonNull
@CheckReturnValue
public static <R> OnCompleteListener<R> listener(@NonNull final CompletableEmitter emit) {
    return new OnCompleteListener<R>() {
        @Override
        public void onComplete(@NonNull final Task<R> task) {
            if (!emit.isDisposed()) {
                if (task.isSuccessful()) {
                    emit.onComplete();
                } else {
                    Exception e = task.getException();
                    emit.onError(e != null ? e : new RuntimeException());
                }
            }
        }
    };
}
 
开发者ID:yongjhih,项目名称:rxtasks,代码行数:23,代码来源:RxTask.java

示例12: subscribe

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
    final OnCompleteListener<Void> listener = new OnCompleteListener<Void>() {
        @Override
        public void onComplete(@NonNull Task<Void> task) {

            if (!emitter.isDisposed()) {
                if (!task.isSuccessful()) {
                    emitter.onError(task.getException());
                } else {
                    emitter.onComplete();
                }
            }

        }
    };

    reference.delete().addOnCompleteListener(listener);
}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:20,代码来源:DeleteOnSubscribe.java

示例13: subscribe

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void subscribe(final CompletableEmitter emitter) throws Exception {
    final OnCompleteListener<DocumentReference> listener =
            new OnCompleteListener<DocumentReference>() {
                @Override
                public void onComplete(@NonNull Task<DocumentReference> task) {

                    if (!emitter.isDisposed()) {
                        if (!task.isSuccessful()) {
                            emitter.onError(task.getException());
                        } else {
                            emitter.onComplete();
                        }
                    }

                }
            };

    reference.add(value).addOnCompleteListener(listener);
}
 
开发者ID:btrautmann,项目名称:RxFirestore,代码行数:21,代码来源:AddOnSubscribe.java

示例14: onComplete

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
@Override
public void onComplete(@NonNull Task<Void> task) {
    if (isDisposed()) return;
    if (task.isSuccessful()) {
        observer.onComplete();
    } else {
        try {
            observer.onError(task.getException());
        } catch (Throwable t) {
            Exceptions.throwIfFatal(t);
            RxJavaPlugins.onError(new CompositeException(task.getException(), t));
        }
    }
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:15,代码来源:CompletableTaskCallback.java

示例15: onComplete

import com.google.android.gms.tasks.Task; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onComplete(@NonNull Task<AuthResult> task)
{
    if (task.isSuccessful()) {
        callback.onSuccess(getCurrentUser());
    } else {
        callback.onFail(task.getException());
    }
}
 
开发者ID:mk-5,项目名称:gdx-fireapp,代码行数:13,代码来源:Auth.java


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