本文整理汇总了Java中com.facebook.widget.WebDialog.OnCompleteListener类的典型用法代码示例。如果您正苦于以下问题:Java OnCompleteListener类的具体用法?Java OnCompleteListener怎么用?Java OnCompleteListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OnCompleteListener类属于com.facebook.widget.WebDialog包,在下文中一共展示了OnCompleteListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendRequestDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
private void sendRequestDialog() {
Bundle params = new Bundle();
params.putString("title", "Solicitação de Aplicativo");
params.putString("message", "Experimente o IPRJapp");
params.putString("link","https://play.google.com/store/apps/details?id=com.wb.goog.batman.brawler2013");
params.putString("data",
"{\"badge_of_awesomeness\":\"1\"," +
"\"social_karma\":\"5\"}");
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(this.getActivity(), Session.getActiveSession(), params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
}
})
.build();
requestsDialog.show();
}
示例2: publishFeedDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
public void publishFeedDialog(String name, String caption, String description, String linkUrl, String pictureUrl, OnCompleteListener onPostCompleteListener) {
if(facebook.isSessionValid()) {
Bundle params = new Bundle();
params.putString("name", name);
params.putString("caption", caption);
params.putString("description", description);
params.putString("link", linkUrl);
params.putString("picture", pictureUrl);
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(activity,
facebook.getSession(),
params))
.setOnCompleteListener(onPostCompleteListener)
.build();
feedDialog.show();
}
}
示例3: share
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
private void share( Intent intent ) {
Entry entry = (Entry) intent.getSerializableExtra( EXTRAS_SHARED_ENTRY );
switch( intent.getIntExtra( EXTRAS_TYPE, TYPE_NORMAL ) ) {
case TYPE_FACEBOOK:
Bundle postParams = new Bundle();
final WebDialog fbDlg = new WebDialog.FeedDialogBuilder(
NotificationShareService.this, getString( R.string.applicationId ), postParams ).setCaption( entry.getTitle() )
.setDescription( entry.getKwic() ).setLink( mSharedEntryUrl ).build();
fbDlg.setOnCompleteListener( new OnCompleteListener() {
@Override
public void onComplete( Bundle bundle, FacebookException e ) {
fbDlg.dismiss();
ActivityCompat.finishAfterTransition( NotificationShareService.this );
}
} );
fbDlg.show();
break;
default:
String subject = getString( R.string.lbl_share_entry_title, getString( R.string.application_name ), entry.getTitle() );
String text = getString( R.string.lbl_share_entry_content, entry.getKwic(), mSharedEntryUrl,
Prefs.getInstance().getAppDownloadInfo()
);
Intent i = com.chopping.utils.Utils.getShareInformation( subject, text );
i.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT );
startActivity( i );
ActivityCompat.finishAfterTransition( NotificationShareService.this );
break;
}
}
示例4: sendRequestDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
private void sendRequestDialog(String paramString, final Ὶ paramῚ)
{
Bundle localBundle = new Bundle();
localBundle.putString("message", ċ.ˊ(2131165775));
localBundle.putString("to", "[" + paramString + "]");
((WebDialog.RequestsDialogBuilder)new WebDialog.RequestsDialogBuilder(getActivity(), Session.getActiveSession(), localBundle).setOnCompleteListener(new WebDialog.OnCompleteListener()
{
public void onComplete(Bundle paramAnonymousBundle, FacebookException paramAnonymousFacebookException)
{
if (paramAnonymousFacebookException != null)
{
if (!(paramAnonymousFacebookException instanceof FacebookOperationCanceledException))
Toast.makeText(FacebookFriendsFragment.this.getActivity().getApplicationContext(), "Network Error", 0).show();
}
else if (paramAnonymousBundle.getString("request") != null)
{
paramῚ.ˎ = true;
FacebookFriendsFragment.this.adapter.notifyDataSetChanged();
〵.ˊ("Viral", new HashMap()
{
});
ᓑ.ˎ();
return;
}
Toast.makeText(FacebookFriendsFragment.this.getActivity().getApplicationContext(), "Request cancelled", 0).show();
}
})).build().show();
}
示例5: tryAuthorize
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
boolean tryAuthorize(final AuthorizationClient.AuthorizationRequest paramAuthorizationRequest)
{
this.applicationId = paramAuthorizationRequest.getApplicationId();
Bundle localBundle = new Bundle();
if (!Utility.isNullOrEmpty(paramAuthorizationRequest.getPermissions()))
{
String str2 = TextUtils.join(",", paramAuthorizationRequest.getPermissions());
localBundle.putString("scope", str2);
addLoggingExtra("scope", str2);
}
String str1 = paramAuthorizationRequest.getPreviousAccessToken();
if ((!Utility.isNullOrEmpty(str1)) && (str1.equals(loadCookieToken())))
{
localBundle.putString("access_token", str1);
addLoggingExtra("access_token", "1");
}
else
{
Utility.clearFacebookCookies(AuthorizationClient.this.context);
addLoggingExtra("access_token", "0");
}
WebDialog.OnCompleteListener local1 = new WebDialog.OnCompleteListener()
{
public void onComplete(Bundle paramAnonymousBundle, FacebookException paramAnonymousFacebookException)
{
AuthorizationClient.WebViewAuthHandler.this.onWebDialogComplete(paramAuthorizationRequest, paramAnonymousBundle, paramAnonymousFacebookException);
}
};
this.e2e = AuthorizationClient.access$100();
addLoggingExtra("e2e", this.e2e);
this.loginDialog = ((WebDialog.Builder)new AuthorizationClient.AuthDialogBuilder(AuthorizationClient.this.getStartActivityDelegate().getActivityContext(), this.applicationId, localBundle).setE2E(this.e2e).setIsRerequest(paramAuthorizationRequest.isRerequest()).setOnCompleteListener(local1)).build();
this.loginDialog.show();
return true;
}
示例6: setDialogListener
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
private void setDialogListener(Facebook.DialogListener paramDialogListener)
{
this.mListener = paramDialogListener;
setOnCompleteListener(new WebDialog.OnCompleteListener()
{
public void onComplete(Bundle paramAnonymousBundle, FacebookException paramAnonymousFacebookException)
{
FbDialog.this.callDialogListener(paramAnonymousBundle, paramAnonymousFacebookException);
}
});
}
示例7: showAppRequestsDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
public static void showAppRequestsDialog(String message, Activity activity, final Context applicationContext)
{
Bundle params = new Bundle();
params.putString("message", message);
if(!isFBSessionOpen())
return;
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(activity,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
// request cancelled
} else {
Toast.makeText(applicationContext,
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
// request sent
} else {
//Request cancelled
}
}
}
})
.build();
requestsDialog.show();
}
示例8: facebookFeedDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
/**
* Publish a facebook story.
*
* @param activity
* @param title
* @param caption
* @param description
* @param link
* @param picture
*/
public void facebookFeedDialog( final Activity activity,
String title,
String caption,
String description,
String link,
String picture)
{
// Set the dialog parameters
Bundle params = new Bundle();
params.putString("name", title);
params.putString("caption", caption);
params.putString("description", description);
params.putString("link", link);
params.putString("picture", picture);
// Invoke the dialog
WebDialog feedDialog =
(new WebDialog.FeedDialogBuilder( activity,
Session.getActiveSession(),
params))
.setOnCompleteListener(
new OnCompleteListener()
{
@Override
public void onComplete( Bundle values,
FacebookException error)
{
if (error == null)
{
// When the story is posted, echo
// the success
// and the post Id.
final String postId =
values.getString("post_id");
if (postId != null)
{
Toast.makeText(
activity,
"Story published: "
+ postId,
Toast.LENGTH_SHORT)
.show();
}
}
}
}).build();
feedDialog.show();
}
示例9: AppRequest
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
@UnityCallable
public static void AppRequest(String params_str) {
Log.v(TAG, "sendRequestDialog(" + params_str + ")");
final UnityMessage response = new UnityMessage("OnAppRequestsComplete");
if (!isLoggedIn()) {
response.sendNotLoggedInError();
return;
}
UnityParams unity_params = UnityParams.parse(params_str);
if (unity_params.hasString("callback_id")) {
response.put("callback_id", unity_params.getString("callback_id"));
}
final Bundle params = unity_params.getStringParams();
if (params.containsKey("callback_id")) {
params.remove("callback_id");
}
if (frictionlessRequests) {
params.putString("frictionless", "true");
}
getUnityActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
WebDialog requestsDialog = (
new WebDialog.RequestsDialogBuilder(getUnityActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if(error.toString().equals("com.facebook.FacebookOperationCanceledException")) {
response.putCancelled();
response.send();
} else {
response.sendError(error.toString());
}
} else {
if(values != null) {
final String requestId = values.getString("request");
if(requestId == null) {
response.putCancelled();
}
}
for (String key : values.keySet()) {
response.put(key, values.getString(key));
}
response.send();
}
}
})
.build();
requestsDialog.show();
}
});
}
示例10: GameGroupCreate
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
@UnityCallable
public static void GameGroupCreate(String params_str) {
final UnityParams unity_params = UnityParams.parse(params_str);
final UnityMessage response = new UnityMessage("OnGroupCreateComplete");
if (unity_params.hasString("callback_id")) {
response.put("callback_id", unity_params.getString("callback_id"));
}
if (!isLoggedIn()) {
response.sendNotLoggedInError();
return;
}
final Bundle params = unity_params.getStringParams();
if(params.containsKey("callback_id")) {
params.remove("callback_id");
}
getUnityActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
WebDialog feedDialog = (
new WebDialog.Builder(getUnityActivity(),
Session.getActiveSession(),
"game_group_create",
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
// response
if (error == null) {
final String postID = values.getString("id");
if (postID != null) {
response.putID(postID);
} else {
response.putCancelled();
}
response.send();
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
response.putCancelled();
response.send();
} else {
// Generic, ex: network error
response.sendError(error.toString());
}
}
})
.build();
feedDialog.show();
}
});
}
示例11: GameGroupJoin
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
@UnityCallable
public static void GameGroupJoin(String params_str) {
final UnityParams unity_params = UnityParams.parse(params_str);
final UnityMessage response = new UnityMessage("OnGroupCreateComplete");
if (unity_params.hasString("callback_id")) {
response.put("callback_id", unity_params.getString("callback_id"));
}
if (!isLoggedIn()) {
response.sendNotLoggedInError();
return;
}
final Bundle params = unity_params.getStringParams();
if(params.containsKey("callback_id")) {
params.remove("callback_id");
}
getUnityActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
WebDialog feedDialog = (
new WebDialog.Builder(getUnityActivity(),
Session.getActiveSession(),
"game_group_join",
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
// response
if (error == null) {
final String postID = values.getString("id");
if (postID != null) {
response.putID(postID);
} else {
response.putCancelled();
}
response.send();
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
response.putCancelled();
response.send();
} else {
// Generic, ex: network error
response.sendError(error.toString());
}
}
})
.build();
feedDialog.show();
}
});
}
示例12: FeedRequest
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
@UnityCallable
public static void FeedRequest(String params_str) {
Log.v(TAG, "FeedRequest(" + params_str + ")");
final UnityMessage response = new UnityMessage("OnFeedRequestComplete");
UnityParams unity_params = UnityParams.parse(params_str);
if (unity_params.hasString("callback_id")){
response.put("callback_id", unity_params.getString("callback_id"));
}
if (!isLoggedIn()) {
response.sendNotLoggedInError();
return;
}
final Bundle params = unity_params.getStringParams();
if (!FacebookDialog.canPresentShareDialog(getUnityActivity()) ||
FBDialogUtils.hasUnsupportedParams(FBDialogUtils.DialogType.SHARE_DIALOG, params)) {
if (params.containsKey("callback_id")) {
params.remove("callback_id");
}
getUnityActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(getUnityActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
// response
if (error == null) {
final String postID = values.getString("post_id");
if (postID != null) {
response.putID(postID);
} else {
response.putCancelled();
}
response.send();
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
response.putCancelled();
response.send();
} else {
// Generic, ex: network error
response.sendError(error.toString());
}
}
})
.build();
feedDialog.show();
}
});
} else {
Intent intent = new Intent(getUnityActivity(), FBUnityDialogsActivity.class);
intent.putExtra(FBUnityDialogsActivity.DIALOG_TYPE, FBDialogUtils.DialogType.SHARE_DIALOG);
intent.putExtra(FBUnityDialogsActivity.DIALOG_PARAMS, params);
getUnityActivity().startActivity(intent);
}
}
示例13: sendRequestDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
public void sendRequestDialog(final Activity activity, final String pToUserId) {
activity.runOnUiThread(new Runnable(){
@Override
public void run() {
Bundle params = new Bundle();
params.putString("to", pToUserId);
RequestsDialogBuilder dialog = new RequestsDialogBuilder(activity,
Session.getActiveSession(),
params);
/*dialog.setLink("https://play.google.com/store/apps/details?id=com.yoero.puzzle.arukone.flow.free");
dialog.setDescription("descriptie");
dialog.setCaption("captie");
dialog.setName("Bingo Free name");
*/
dialog.setTitle("Bingo Run Free");
//dialog.setData("Bogdan tirca");
dialog.setMessage("Join me on Bingo Free! I'm having a great time playing it!");
WebDialog requestsDialog = dialog.build();
requestsDialog.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(final Bundle values, final FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Toast.makeText(activity.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity.getApplicationContext(),
"Network Error",
Toast.LENGTH_SHORT).show();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Toast.makeText(activity.getApplicationContext(),
"Request sent",
Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(activity.getApplicationContext(),
"Request cancelled",
Toast.LENGTH_SHORT).show();
}
}
}
});
requestsDialog.show();
}
});
}
示例14: createSendRequestDialog
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
/**
* Creates a Facebook application request dialog.<br><br>
*
* More info at <a href="https://developers.facebook.com/docs/android/send-requests/">Facebook request</a>
*
* @param message The message of the request.
* @param extraParams You can pass arbitrary data as an additional parameter when making the
* dialog request call. This could be data to make a gift, for example, to
* the user if he opens the app.
* @param onSuccessCallback What to do if the request is successfully done. See {@link OnAppRequestSuccessActionCallback}
* @param onFailCallback What to do if the request fails. See {@link OnAppRequestFailActionCallback}
* @param onCancelCallback What to do if the request is cancelled. See {@link OnAppRequestCancelledActionCallback}
*/
public static void createSendRequestDialog(Session session, Context context, String message, Map<String, String> extraParams,
final OnAppRequestSuccessActionCallback onSuccessCallback,
final OnAppRequestFailActionCallback onFailCallback,
final OnAppRequestCancelledActionCallback onCancelCallback) throws FBSessionException {
if(Session.getActiveSession()!=null && Session.getActiveSession().isOpened()) {
//Prepare the request
Bundle params = new Bundle();
params.putString("message", message);
//Set extra parameters if there are. This can be used to
//send a gift to the user receiving the request.
if(extraParams!=null && extraParams.size()>0){
params.putString("data", gson.toJson(extraParams));
}
//make the application request.
WebDialog requestsDialog = (
new WebDialog
.RequestsDialogBuilder(context, session, params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error != null) {
if (error instanceof FacebookOperationCanceledException) {
Log.i(ToolBox.TAG, "Facebook request cancelled.");
if(onCancelCallback!=null)
onCancelCallback.start();
} else {
Log.i(ToolBox.TAG, "Facebook request error.");
if(onFailCallback!=null)
onFailCallback.start();
}
} else {
final String requestId = values.getString("request");
if (requestId != null) {
Log.i(ToolBox.TAG, "Facebook request sent.");
if(onSuccessCallback!=null)
onSuccessCallback.start();
} else {
Log.i(ToolBox.TAG, "Facebook request cancelled.");
if(onCancelCallback!=null)
onCancelCallback.start();
}
}
}
})
.build();
requestsDialog.show();
}else{
Log.i(ToolBox.TAG, "No current Facebook active session or not logged in.");
throw new FBSessionException("No current Facebook active session or not logged in.");
}
}
示例15: facebookShareWebShare
import com.facebook.widget.WebDialog.OnCompleteListener; //导入依赖的package包/类
/**
* Post to Facebook using the web feed dialog.
*
* This is used when no native Facebook application
* is found.
*/
private void facebookShareWebShare() {
Bundle params = new Bundle();
params.putString("name", applicationName);
params.putString("caption", caption);
params.putString("description", description);
params.putString("link", link);
params.putString("picture", pictureURL);
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(getActivity(),
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error == null) {
// When the story is posted, echo the success and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Log.i(ToolBox.TAG, "user successfully posted in Facebook. Post Id: " + postId);
if(onShareSuccessCallback!=null)
onShareSuccessCallback.start();
} else {
// User clicked the Cancel button
Log.i(ToolBox.TAG, "user cancelled posting story.");
if(onShareCancelledCallback!=null)
onShareCancelledCallback.start();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Log.i(ToolBox.TAG, "user cancelled posting story ('X' button pressed).");
if(onShareCancelledCallback!=null)
onShareCancelledCallback.start();
} else {
// Generic, example: network error
Log.i(ToolBox.TAG, "Error posting story (" + error.getMessage() + ")", error);
if(onShareFailCallback!=null)
onShareFailCallback.start();
}
}
})
.build();
feedDialog.show();
}