本文整理汇总了Java中com.facebook.internal.CallbackManagerImpl类的典型用法代码示例。如果您正苦于以下问题:Java CallbackManagerImpl类的具体用法?Java CallbackManagerImpl怎么用?Java CallbackManagerImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CallbackManagerImpl类属于com.facebook.internal包,在下文中一共展示了CallbackManagerImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerStaticShareCallback
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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));
}
}
);
}
示例2: registerSharerCallback
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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));
}
});
}
示例3: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@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);
}
示例4: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@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);
}
示例5: registerCallback
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
/**
* 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);
}
}
);
}
示例6: onActivityResult
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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);
}
}
示例7: performFirstInitialize
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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;
}
示例8: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@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);
}
示例9: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@Override
protected void registerCallbackImpl(
final CallbackManagerImpl callbackManager,
final FacebookCallback<Result> callback) {
ShareInternalUtility.registerSharerCallback(
getRequestCode(), callbackManager, callback);
}
示例10: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@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);
}
});
}
示例11: startLogin
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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;
}
}
示例12: onActivityResult
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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);
}
}
示例13: onActivityResult
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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);
}
}
示例14: registerCallbackImpl
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
@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);
}
});
}
示例15: startLogin
import com.facebook.internal.CallbackManagerImpl; //导入依赖的package包/类
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;
}
}