本文整理汇总了Java中com.facebook.FacebookOperationCanceledException类的典型用法代码示例。如果您正苦于以下问题:Java FacebookOperationCanceledException类的具体用法?Java FacebookOperationCanceledException怎么用?Java FacebookOperationCanceledException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FacebookOperationCanceledException类属于com.facebook包,在下文中一共展示了FacebookOperationCanceledException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExceptionFromErrorData
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static FacebookException getExceptionFromErrorData(Bundle errorData) {
if (errorData == null) {
return null;
}
String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE);
if (type == null) {
type = errorData.getString(STATUS_ERROR_TYPE);
}
String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION);
if (description == null) {
description = errorData.getString(STATUS_ERROR_DESCRIPTION);
}
if (type != null && type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
return new FacebookOperationCanceledException(description);
}
/* TODO parse error values and create appropriate exception class */
return new FacebookException(description);
}
示例2: getExceptionFromErrorData
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static FacebookException getExceptionFromErrorData(Bundle errorData) {
if (errorData == null) {
return null;
}
String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE);
if (type == null) {
type = errorData.getString(STATUS_ERROR_TYPE);
}
String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION);
if (description == null) {
description = errorData.getString(STATUS_ERROR_DESCRIPTION);
}
if (type == null || !type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
return new FacebookException(description);
}
return new FacebookOperationCanceledException(description);
}
示例3: callDialogListener
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
private void callDialogListener(Bundle values, FacebookException error) {
if (mListener == null) {
return;
}
if (values != null) {
mListener.onComplete(values);
} else {
if (error instanceof FacebookDialogException) {
FacebookDialogException facebookDialogException = (FacebookDialogException) error;
DialogError dialogError = new DialogError(facebookDialogException.getMessage(),
facebookDialogException.getErrorCode(), facebookDialogException.getFailingUrl());
mListener.onError(dialogError);
} else if (error instanceof FacebookOperationCanceledException) {
mListener.onCancel();
} else {
FacebookError facebookError = new FacebookError(error.getMessage());
mListener.onFacebookError(facebookError);
}
}
}
示例4: getExceptionFromErrorData
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static Exception getExceptionFromErrorData(Bundle errorData) {
if (errorData == null) {
return null;
}
String type = errorData.getString(BRIDGE_ARG_ERROR_TYPE);
if (type == null) {
type = errorData.getString(STATUS_ERROR_TYPE);
}
String description = errorData.getString(BRIDGE_ARG_ERROR_DESCRIPTION);
if (description == null) {
description = errorData.getString(STATUS_ERROR_DESCRIPTION);
}
if (type != null && type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
return new FacebookOperationCanceledException(description);
}
/* TODO parse error values and create appropriate exception class */
return new FacebookException(description);
}
示例5: callDialogListener
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
private void callDialogListener(Bundle paramBundle, FacebookException paramFacebookException)
{
if (this.mListener == null)
return;
if (paramBundle != null)
{
this.mListener.onComplete(paramBundle);
return;
}
if ((paramFacebookException instanceof FacebookDialogException))
{
FacebookDialogException localFacebookDialogException = (FacebookDialogException)paramFacebookException;
DialogError localDialogError = new DialogError(localFacebookDialogException.getMessage(), localFacebookDialogException.getErrorCode(), localFacebookDialogException.getFailingUrl());
this.mListener.onError(localDialogError);
return;
}
if ((paramFacebookException instanceof FacebookOperationCanceledException))
{
this.mListener.onCancel();
return;
}
FacebookError localFacebookError = new FacebookError(paramFacebookException.getMessage());
this.mListener.onFacebookError(localFacebookError);
}
示例6: onComplete
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public final void onComplete(Bundle paramBundle, FacebookException paramFacebookException)
{
if (paramFacebookException == null)
{
if (paramBundle.getString("post_id") != null)
{
ϳ.ˊ(this.ˊ.ͺ, true, false, false);
return;
}
ϳ.ˊ(this.ˊ.ͺ, false, false, true);
return;
}
if ((paramFacebookException instanceof FacebookOperationCanceledException))
{
ϳ.ˊ(this.ˊ.ͺ, false, false, true);
return;
}
ϳ.ˊ(this.ˊ.ͺ, false, true, false);
}
示例7: getExceptionFromErrorData
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static Exception getExceptionFromErrorData(Bundle errorData) {
if (errorData == null) {
return null;
}
// TODO This is not going to work for JS dialogs, where the keys are not STATUS_ERROR_TYPE etc.
// TODO However, it should keep existing dialogs functional
String type = errorData.getString(STATUS_ERROR_TYPE);
String description = errorData.getString(STATUS_ERROR_DESCRIPTION);
if (type != null && type.equalsIgnoreCase(ERROR_USER_CANCELED)) {
return new FacebookOperationCanceledException(description);
}
/* TODO parse error values and create appropriate exception class */
return new FacebookException(description);
}
示例8: handleActivityResult
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static boolean handleActivityResult(
int requestCode,
int resultCode,
Intent data,
ResultProcessor resultProcessor) {
AppCall appCall = getAppCallFromActivityResult(requestCode, resultCode, data);
if (appCall == null) {
return false;
}
NativeAppCallAttachmentStore.cleanupAttachmentsForCall(appCall.getCallId());
if (resultProcessor == null) {
return true;
}
FacebookException exception = NativeProtocol.getExceptionFromErrorData(
NativeProtocol.getErrorDataFromResultIntent(data));
if (exception != null) {
if (exception instanceof FacebookOperationCanceledException) {
resultProcessor.onCancel(appCall);
} else {
resultProcessor.onError(appCall, exception);
}
} else {
// If here, we did not find an error in the result.
Bundle results = NativeProtocol.getSuccessResultsFromIntent(data);
resultProcessor.onSuccess(appCall, results);
}
return true;
}
示例9: createBundleForException
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public static Bundle createBundleForException(FacebookException e) {
if (e == null) {
return null;
}
Bundle errorBundle = new Bundle();
errorBundle.putString(BRIDGE_ARG_ERROR_DESCRIPTION, e.toString());
if (e instanceof FacebookOperationCanceledException) {
errorBundle.putString(BRIDGE_ARG_ERROR_TYPE, ERROR_USER_CANCELED);
}
return errorBundle;
}
示例10: onSessionStateChange
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
/** Re authenticate after session state changed.*/
public static Promise<Object, BError, Void> onSessionStateChange(Session session, SessionState state, Exception exception) {
if (DEBUG) Timber.i("Session changed state");
// If we can start the login process with no errors this promise wont be used.
// The returned promise will be from the loginWithFacebook.
Deferred<Object, BError, Void> deferred = new DeferredObject<>();
if (exception != null)
{
exception.printStackTrace();
if (exception instanceof FacebookOperationCanceledException)
{
deferred.reject(new BError(BError.Code.EXCEPTION, exception));
return deferred.promise();
}
}
if (state.isOpened()) {
if (DEBUG) Timber.i("Session is open.");
// We will need this session later to make request.
userFacebookAccessToken = Session.getActiveSession().getAccessToken();
return loginWithFacebook();
} else if (state.isClosed()) {
// Logged out of Facebook
if (DEBUG) Timber.i("Session is closed.");
deferred.reject(new BError(BError.Code.SESSION_CLOSED, "Facebook session is closed."));
}
return deferred.promise();
}
示例11: setFacebookLogin
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
protected void setFacebookLogin(){
facebookLogin.setOnErrorListener(new LoginButton.OnErrorListener() {
@Override
public void onError(FacebookException error) {
if (error instanceof FacebookOperationCanceledException)
return;
else if (error.getMessage() != null && error.getMessage().equals("Log in attempt aborted."))
return;
showAlertToast("Facebook error: " + error.getMessage() + " " + error.getClass().getSimpleName());
}
});
facebookLogin.setReadPermissions(Arrays.asList("email", "user_friends"));
}
示例12: onSessionStateChange
import com.facebook.FacebookOperationCanceledException; //导入依赖的package包/类
public void onSessionStateChange(Session session, SessionState state, Exception exception){
if (!getNetworkAdapter().facebookEnabled())
{
return;
}
if (exception != null)
{
exception.printStackTrace();
if (exception instanceof FacebookOperationCanceledException)
{
return;
}
}else showOrUpdateProgDialog(getString(R.string.authenticating));
BFacebookManager.onSessionStateChange(session, state, exception).done(new DoneCallback<Object>() {
@Override
public void onDone(Object o) {
if (DEBUG) Timber.i("Connected to facebook");
afterLogin();
}
}).fail(new FailCallback<BError>() {
@Override
public void onFail(BError bError) {
if (DEBUG) Timber.i(TAG, "Error connecting to Facebook");
// Toast.makeText(LoginActivity.this, "Failed connect to facebook.", Toast.LENGTH_SHORT).show();
showAlertToast( getString(R.string.login_activity_facebook_connection_fail_toast) );
BFacebookManager.logout(ChatSDKAbstractLoginActivity.this);
dismissProgDialog();
}
});
}