public static void registerStaticShareCallback( final int requestCode) { CallbackManagerImpl.registerStaticCallback( requestCode, new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return handleActivityResult( requestCode, resultCode, data, getShareResultProcessor(null)); } } ); }
public static void registerSharerCallback( final int requestCode, final CallbackManager callbackManager, final FacebookCallback<Sharer.Result> callback) { if (!(callbackManager instanceof CallbackManagerImpl)) { throw new FacebookException("Unexpected CallbackManager, " + "please use the provided Factory."); } ((CallbackManagerImpl) callbackManager).registerCallback( requestCode, new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return handleActivityResult( requestCode, resultCode, data, getShareResultProcessor(callback)); } }); }
@Override protected void registerCallbackImpl ( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { final ResultProcessor resultProcessor = (callback == null) ? null : new ResultProcessor(callback) { @Override public void onSuccess(AppCall appCall, Bundle results) { callback.onSuccess(new Result(results)); } }; CallbackManagerImpl.Callback callbackManagerCallback = new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return ShareInternalUtility.handleActivityResult( getRequestCode(), resultCode, data, resultProcessor); } }; callbackManager.registerCallback(getRequestCode(), callbackManagerCallback); }
@Override protected void registerCallbackImpl( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { final ResultProcessor resultProcessor = (callback == null) ? null : new ResultProcessor(callback) { @Override public void onSuccess(AppCall appCall, Bundle results) { callback.onSuccess(new Result(results.getString("id"))); } }; CallbackManagerImpl.Callback callbackManagerCallback = new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return ShareInternalUtility.handleActivityResult( getRequestCode(), resultCode, data, resultProcessor); } }; callbackManager.registerCallback(getRequestCode(), callbackManagerCallback); }
/** * Registers a login callback to the given callback manager. * @param callbackManager The callback manager that will encapsulate the callback. * @param callback The login callback that will be called on login completion. */ public void registerCallback( final CallbackManager callbackManager, final FacebookCallback<LoginResult> callback) { if (!(callbackManager instanceof CallbackManagerImpl)) { throw new FacebookException("Unexpected CallbackManager, " + "please use the provided Factory."); } ((CallbackManagerImpl) callbackManager).registerCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult( resultCode, data, callback); } } ); }
protected void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); if (resultCode == -1 && requestCode == PickImageActivity.PICKER_REQUEST_CODE) { //가지고 온 이미지들을 이용하여 CardNews 객체 생성. CardNewsItem item = new CardNewsItem(this.getIntent().getStringExtra("from"), intent.getExtras().getStringArrayList(PickImageActivity.KEY_DATA_RESULT),headLine); cardNewsList.add(item); adapter.notifyDataSetChanged(); } if (requestCode == CallbackManagerImpl.RequestCodeOffset.Share.toRequestCode()) { callbackManager.onActivityResult(requestCode, resultCode, intent); } }
private synchronized static void performFirstInitialize() { if (isInitialized) { return; } handler = new Handler(Looper.getMainLooper()); Context appContext = FacebookSdk.getApplicationContext(); SharedPreferences sharedPreferences = appContext.getSharedPreferences( LIKE_ACTION_CONTROLLER_STORE, Context.MODE_PRIVATE); objectSuffix = sharedPreferences.getInt(LIKE_ACTION_CONTROLLER_STORE_OBJECT_SUFFIX_KEY, 1); controllerDiskCache = new FileLruCache(TAG, new FileLruCache.Limits()); registerAccessTokenTracker(); CallbackManagerImpl.registerStaticCallback( CallbackManagerImpl.RequestCodeOffset.Like.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return handleOnActivityResult( CallbackManagerImpl.RequestCodeOffset.Like.toRequestCode(), resultCode, data); } }); isInitialized = true; }
@Override protected void registerCallbackImpl ( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { final ResultProcessor resultProcessor = (callback == null) ? null : new ResultProcessor(callback) { @Override public void onSuccess(AppCall appCall, Bundle results) { callback.onSuccess(new Result(results)); } }; CallbackManagerImpl.Callback callbackManagerCallback = new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return ShareInternalUtility.handleActivityResult( getRequestCode(), resultCode, data, resultProcessor); } }; callbackManager.registerCallback( getRequestCode(), callbackManagerCallback); }
@Override protected void registerCallbackImpl( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { ShareInternalUtility.registerSharerCallback( getRequestCode(), callbackManager, callback); }
@Override protected void registerCallbackImpl( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { final ResultProcessor resultProcessor = (callback == null) ? null : new ResultProcessor(callback) { @Override public void onSuccess(AppCall appCall, Bundle results) { if (results != null) { callback.onSuccess(new Result(results)); } else { onCancel(appCall); } } }; callbackManager.registerCallback( getRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return ShareInternalUtility.handleActivityResult( getRequestCode(), resultCode, data, resultProcessor); } }); }
private void startLogin( StartActivityDelegate startActivityDelegate, LoginClient.Request request ) throws FacebookException { logStartLogin(startActivityDelegate.getActivityContext(), request); // Make sure the static handler for login is registered if there isn't an explicit callback CallbackManagerImpl.registerStaticCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult(resultCode, data); } } ); boolean started = tryFacebookActivity(startActivityDelegate, request); if (!started) { FacebookException exception = new FacebookException( "Log in attempt failed: FacebookActivity could not be started." + " Please make sure you added FacebookActivity to the AndroidManifest."); boolean wasLoginActivityTried = false; logCompleteLogin( startActivityDelegate.getActivityContext(), LoginClient.Result.Code.ERROR, null, exception, wasLoginActivityTried, request); throw exception; } }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode()) { Log.d("ResultCode", "페이스북 로그인"); callbackManager.onActivityResult(requestCode, resultCode, data); }else{ Log.d("ResultCode", "트위터 로그인"); twitterLoginButton.onActivityResult(requestCode, resultCode, data); } }
@Override protected void registerCallbackImpl( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { final ResultProcessor resultProcessor = (callback == null) ? null : new ResultProcessor(callback) { @Override public void onSuccess(AppCall appCall, Bundle results) { if (results != null) { callback.onSuccess(new Result(results.getString( ShareConstants.WEB_DIALOG_RESULT_PARAM_REQUEST_ID))); } else { onCancel(appCall); } } }; callbackManager.registerCallback( getRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return ShareInternalUtility.handleActivityResult( getRequestCode(), resultCode, data, resultProcessor); } }); }
private void startLogin( StartActivityDelegate startActivityDelegate, LoginClient.Request request ) throws FacebookException { this.pendingLoginRequest = request; this.pendingLoggingExtras = new HashMap<>(); this.context = startActivityDelegate.getActivityContext(); logStartLogin(); // Make sure the static handler for login is registered if there isn't an explicit callback CallbackManagerImpl.registerStaticCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult(resultCode, data); } } ); boolean started = tryLoginActivity(startActivityDelegate, request); pendingLoggingExtras.put( LoginLogger.EVENT_EXTRAS_TRY_LOGIN_ACTIVITY, started ? AppEventsConstants.EVENT_PARAM_VALUE_YES : AppEventsConstants.EVENT_PARAM_VALUE_NO ); if (!started) { FacebookException exception = new FacebookException( "Log in attempt failed: LoginActivity could not be started"); logCompleteLogin(LoginClient.Result.Code.ERROR, null, exception); this.pendingLoginRequest = null; throw exception; } }
private void startLogin( StartActivityDelegate startActivityDelegate, LoginClient.Request request ) throws FacebookException { this.pendingLoginRequest = request; this.pendingLoggingExtras = new HashMap<>(); this.context = startActivityDelegate.getActivityContext(); logStartLogin(); // Make sure the static handler for login is registered if there isn't an explicit callback CallbackManagerImpl.registerStaticCallback( CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(), new CallbackManagerImpl.Callback() { @Override public boolean onActivityResult(int resultCode, Intent data) { return LoginManager.this.onActivityResult(resultCode, data); } } ); boolean started = tryFacebookActivity(startActivityDelegate, request); pendingLoggingExtras.put( LoginLogger.EVENT_EXTRAS_TRY_LOGIN_ACTIVITY, started ? AppEventsConstants.EVENT_PARAM_VALUE_YES : AppEventsConstants.EVENT_PARAM_VALUE_NO ); if (!started) { FacebookException exception = new FacebookException( "Log in attempt failed: FacebookActivity could not be started." + " Please make sure you added FacebookActivity to the AndroidManifest."); logCompleteLogin(LoginClient.Result.Code.ERROR, null, exception); this.pendingLoginRequest = null; throw exception; } }
@Override protected void registerCallbackImpl( final CallbackManagerImpl callbackManager, final FacebookCallback<Result> callback) { ShareInternalUtility.registerSharerCallback(getRequestCode(), callbackManager, callback); }
@Override protected int getDefaultRequestCode() { return CallbackManagerImpl.RequestCodeOffset.Share.toRequestCode(); }
@Override protected int getDefaultRequestCode() { return CallbackManagerImpl.RequestCodeOffset.Message.toRequestCode(); }
public static int getLoginRequestCode() { return CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(); }
@Override protected int getDefaultRequestCode() { return CallbackManagerImpl.RequestCodeOffset.Login.toRequestCode(); }
public static CallbackManager create() { return new CallbackManagerImpl(); }