本文整理匯總了Java中com.facebook.widget.WebDialog.show方法的典型用法代碼示例。如果您正苦於以下問題:Java WebDialog.show方法的具體用法?Java WebDialog.show怎麽用?Java WebDialog.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.widget.WebDialog
的用法示例。
在下文中一共展示了WebDialog.show方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sendRequestDialog
import com.facebook.widget.WebDialog; //導入方法依賴的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; //導入方法依賴的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; //導入方法依賴的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: publishFeedDialog
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
public static void publishFeedDialog(final Activity activity) {
Bundle params = new Bundle();
String description = activity.getString(R.string.temp_fail);
if ((ValidacionPlaya.temperatura != null) && (ValidacionPlaya.temperatura > 0))
description = activity.getString(R.string.content_share_0) + " " + Utilities.getTemperatureC(activity, ValidacionPlaya.temperatura) + " " + activity.getString(R.string.content_share_1);
params.putString("name", activity.getString(R.string.title_share)+ " " + ValidacionPlaya.playa.nombre);
params.putString("caption", activity.getString(R.string.subtitle_share));
params.putString("description", description);
params.putString("link", activity.getString(R.string.url_share));
if ((ValidacionPlaya.imagenes != null) && (ValidacionPlaya.imagenes.size()>0))
params.putString("picture", ValidacionPlaya.imagenes.get(0).link);
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(activity, Session.getActiveSession(),params)).setOnCompleteListener(new WebDialog.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) {
Crouton.makeText(activity, activity.getString(R.string.share_fb), Style.CONFIRM).show();
} else {
// User clicked the Cancel button
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
} else {
// Generic, ex: network error
}
}
})
.build();
feedDialog.show();
}
示例5: showAppRequestsDialog
import com.facebook.widget.WebDialog; //導入方法依賴的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();
}
示例6: post
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
public void post(String description, String link, String urlImage) {
if (FacebookDialog.canPresentShareDialog(activity.getApplicationContext(),
FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(activity)
.setLink(link == "" ? "http://www.facebook.com/craboxgame" : link)
.setDescription(description)
.setPicture(urlImage)
.build();
uiHelper.trackPendingDialogCall(shareDialog.present());
} else {
Bundle params = new Bundle();
params.putString("name", "Crabox");
params.putString("caption", "pene");
params.putString("description", description);
params.putString("link", link == "" ? "http://www.facebook.com/craboxgame" : link);
params.putString("picture", urlImage);
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(activity,
Session.getActiveSession(),
params))
.build();
feedDialog.show();
}
}
示例7: facebookFeedDialog
import com.facebook.widget.WebDialog; //導入方法依賴的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();
}
示例8: publishFeedDialog
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
private void publishFeedDialog()
{
Bundle params = new Bundle();
params.putString("from", KlyphSession.getSessionUserId());
params.putString("to", getElementId());
WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(getActivity(), Session.getActiveSession(), params)).setOnCompleteListener(
new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error)
{
if (error == null)
{
final String postId = values.getString("post_id");
if (postId != null)
{
Toast.makeText(getActivity(), R.string.message_successfully_published, Toast.LENGTH_SHORT).show();
loadNewest();
}
else
{
// User clicked the Cancel button
Toast.makeText(getActivity().getApplicationContext(), "Publish cancelled", Toast.LENGTH_SHORT).show();
}
}
else if (error instanceof FacebookOperationCanceledException)
{
// User clicked the "x" button
// Toast.makeText(getActivity().getApplicationContext(),
// "Publish cancelled",
// Toast.LENGTH_SHORT).show();
}
else
{
AlertUtil.showAlert(getActivity(), R.string.error, R.string.publish_message_unknown_error, R.string.ok);
}
}
}).build();
feedDialog.show();
}
示例9: requestShareStory
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
@Override
public void requestShareStory(Story story) {
Log.v(TAG, "Request to share the story " + story);
// It uses the web version of the sharing dialog because there are
// problems with the native share dialog
Bundle params = new Bundle();
params.putString("name", story.getTitle());
params.putString("description", story.getContent());
params.putString("link", "https://play.google.com/store/apps/details?id=com.jiahaoliuliu.storyteller");
params.putString("picture", "https://raw.githubusercontent.com/jiahaoliuliu/StoryTeller/master/app/src/main/res/drawable-xxhdpi/ic_launcher.png");
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(this,
Session.getActiveSession(),
params))
.setOnCompleteListener(new WebDialog.OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error == null) {
// Show the publish status
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(BaseSessionActivity.this,
R.string.publish_success, Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(BaseSessionActivity.this,
R.string.publish_cancelled, Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(BaseSessionActivity.this,
R.string.publish_cancelled, Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(BaseSessionActivity.this,
R.string.publish_error, Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}
示例10: createSendRequestDialog
import com.facebook.widget.WebDialog; //導入方法依賴的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.");
}
}
示例11: facebookShareWebShare
import com.facebook.widget.WebDialog; //導入方法依賴的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();
}
示例12: publishFeedDialog
import com.facebook.widget.WebDialog; //導入方法依賴的package包/類
private void publishFeedDialog(long score) {
Bundle params = new Bundle();
params.putString("picture", "https://raw.github.com/damhonglinh/fruitybang/master/ic_launcher.png");
params.putString("name", getString(R.string.title));
params.putString("caption", getString(R.string.caption));
params.putString("description", getString(R.string.description) + " - "
+ score + getString(R.string.description1));
params.putString("link", getString(R.string.websiteUrl));
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) {
Toast.makeText(getActivity(),
getString(R.string.shareSuccessfully),
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(getActivity(),
getString(R.string.shareCancelled),
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(
getActivity().getApplicationContext(),
getString(R.string.shareCancelled),
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(
getActivity().getApplicationContext(),
getString(R.string.shareFail),
Toast.LENGTH_SHORT).show();
}
}
}).build();
feedDialog.show();
}