Java 类com.facebook.widget.FacebookDialog 实例源码

项目:AndroidBackendlessChat    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:chat-sdk-android-push-firebase    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:Fortunes    文件:MainActivity.java   
private void shareOnFacebook(String link, String picUrl) {
    // Publish the post using the Share Dialog
    FacebookDialog.ShareDialogBuilder shareDialogBuilder = new FacebookDialog.ShareDialogBuilder(this)
            .setCaption(getString(R.string.app_name))
            .setName(getString(R.string.app_name))
            .setDescription(mFortune.toString())
            .setLink(link)
            .setPicture(picUrl);

    if (shareDialogBuilder.canPresent()) {
        uiHelper.trackPendingDialogCall(shareDialogBuilder.build().present());
    } else {
        Toast.makeText(this, getString(R.string.facebook_not_installed_or_outdated), Toast.LENGTH_SHORT).show();
        openGooglePlayIfPossible(getString(R.string.facebook_main_package));
    }
}
项目:Fortunes    文件:MainActivity.java   
private void shareOnFacebookMessenger(String link, String picUrl) {
    // Check if the Facebook app is installed and we can present the share dialog
    FacebookDialog.MessageDialogBuilder messageDialogBuilder = new FacebookDialog.MessageDialogBuilder(this)
            .setCaption(getString(R.string.app_name))
            .setName(getString(R.string.app_name))
            .setLink(link)
            .setPicture(picUrl)
            .setDescription(mFortune.toString());

    // If the Facebook app is installed and we can present the share dialog
    if (messageDialogBuilder.canPresent()) {
        uiHelper.trackPendingDialogCall(messageDialogBuilder.build().present());
    } else {
        Toast.makeText(this, getString(R.string.facebook_messenger_not_installed_or_outdated), Toast.LENGTH_SHORT).show();
        openGooglePlayIfPossible(getString(R.string.facebook_messenger_main_package));
    }
}
项目:yelo-android    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:BrillaMXAndroid    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:aquaplay    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:TP-Formation-Android    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:AutoTimeHelper    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:snake-game-aws    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:CallService-Facebook-sample    文件:UserHome.java   
public void inviteFriends(View view) {
    // If the Facebook Messenger app is installed and we can present
    // the share dialog
    if (builder.canPresent()) {
        FacebookDialog dialog = builder.build();
        dialog.present();
    } else {
        // show Sharing options
        Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent
                .putExtra(
                        Intent.EXTRA_TEXT,
                        "Hi, install this app to video call me for free : https://play.google.com/store/apps/details?id=com.threebytes.callservicesamplefb");
        sendIntent.putExtra(Intent.EXTRA_SUBJECT, "Video Call Me For FREE");
        sendIntent.setType("text/plain");
        startActivity(Intent.createChooser(sendIntent, "Invite a friend"));
    }
}
项目:BrainStudio    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            applicationContext,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:Nefete    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:Shorcial    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:HereAStory-Android    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:Team-Alice    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:barterli_android    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:Qtino.SharingKit    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:LostAndFound    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:ExerciseMe    文件:BadgeDialogFragment.java   
private void shareToFB(Context context, String badgeName) {
    String description = context.getResources().getText(context.getResources()
            .getIdentifier(badgeName + "FB", "string", context.getPackageName())).toString();

    String imgURL = context.getResources().getText(context.getResources()
            .getIdentifier(badgeName + "imgURL", "string", context.getPackageName())).toString();

    if (FacebookDialog.canPresentOpenGraphActionDialog(context.getApplicationContext(),
            FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
        OpenGraphObject badge = OpenGraphObject.Factory.createForPost
                (OpenGraphObject.class, "exercisemeapp:badge", "I earned a new badge!",
                        imgURL, null, description);
        OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
        action.setProperty("badge", badge);
        action.setType("exercisemeapp:earn");

        FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(), action, "badge")
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    } else {
        Toast.makeText(getActivity(), "Facebook not available", Toast.LENGTH_SHORT).show();
    }
}
项目:maven-multilib-sample-app    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:bladedroid    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:ShopAfter    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:MeNextAndroid    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:Klyph    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:openkit-android    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:StoryTeller    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:CanYouSinkMe    文件:UiLifecycleHelper.java   
private void cancelPendingAppCall(FacebookDialog.Callback facebookDialogCallback) {
    if (facebookDialogCallback != null) {
        Intent pendingIntent = pendingFacebookDialogCall.getRequestIntent();

        Intent cancelIntent = new Intent();
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION,
                pendingIntent.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_ACTION));
        cancelIntent.putExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION,
                pendingIntent.getIntExtra(NativeProtocol.EXTRA_PROTOCOL_VERSION, 0));
        cancelIntent.putExtra(NativeProtocol.STATUS_ERROR_TYPE, NativeProtocol.ERROR_UNKNOWN_ERROR);

        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall,
                pendingFacebookDialogCall.getRequestCode(), cancelIntent, facebookDialogCallback);
    }
    pendingFacebookDialogCall = null;
}
项目:ClassParticipation2    文件:LikeActionController.java   
private boolean onActivityResult(int requestCode, int resultCode, Intent data, UUID callId) {
    if (pendingCallId == null || !pendingCallId.equals(callId)) {
        return false;
    }

    // See if we were waiting for a dialog completion
    FacebookDialog.PendingCall pendingCall = PendingCallStore.getInstance().getPendingCallById(pendingCallId);
    if (pendingCall == null) {
        return false;
    }

    // Look for results
    FacebookDialog.handleActivityResult(
            context,
            pendingCall,
            requestCode,
            data,
            getFacebookDialogCallback(pendingCallAnalyticsBundle));

    // The handlers from above will run synchronously. So by the time we get here, it should be safe to
    // stop tracking this call and also serialize the controller to disk
    stopTrackingPendingCall();

    return true;
}
项目:AndroidBackendlessChat    文件:UiLifecycleHelper.java   
/**
 * To be called from an Activity or Fragment's onActivityResult method, when the results of a FacebookDialog
 * call are expected.
 *
 * @param requestCode the request code
 * @param resultCode the result code
 * @param data the result data
 * @param dialogCallback the callback for handling FacebookDialog results, can be null
 */
public void onActivityResult(int requestCode, int resultCode, Intent data,
            FacebookDialog.Callback facebookDialogCallback) {
    Session session = Session.getActiveSession();
    if (session != null) {
        session.onActivityResult(activity, requestCode, resultCode, data);
    }

    handleFacebookDialogActivityResult(requestCode, resultCode, data, facebookDialogCallback);
}
项目:AndroidBackendlessChat    文件:UiLifecycleHelper.java   
/**
 * Register that we are expecting results from a call to the Facebook application (e.g., from a native
 * dialog provided by the Facebook app). Activity results forwarded to onActivityResults will be parsed
 * and handled if they correspond to this call. Only a single pending FacebookDialog call can be tracked
 * at a time; attempting to track another one will cancel the first one.
 * @param appCall an PendingCall object containing the call ID
 */
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
    if (pendingFacebookDialogCall != null) {
        // If one is already pending, cancel it; we don't allow multiple pending calls.
        Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call.");
        cancelPendingAppCall(null);
    }
    pendingFacebookDialogCall = pendingCall;
}
项目:AndroidBackendlessChat    文件:UiLifecycleHelper.java   
private boolean handleFacebookDialogActivityResult(int requestCode, int resultCode, Intent data,
        FacebookDialog.Callback facebookDialogCallback) {
    if (pendingFacebookDialogCall == null || pendingFacebookDialogCall.getRequestCode() != requestCode) {
        return false;
    }

    if (data == null) {
        // We understand the request code, but have no Intent. This can happen if the called Activity crashes
        // before it can be started; we treat this as a cancellation because we have no other information.
        cancelPendingAppCall(facebookDialogCallback);
        return true;
    }

    String callIdString = data.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID);
    UUID callId = null;
    if (callIdString != null) {
        try {
            callId = UUID.fromString(callIdString);
        } catch (IllegalArgumentException exception) {
        }
    }

    // Was this result for the call we are waiting on?
    if (callId != null && pendingFacebookDialogCall.getCallId().equals(callId)) {
        // Yes, we can handle it normally.
        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall, requestCode, data,
                facebookDialogCallback);
    } else {
        // No, send a cancellation error to the pending call and ignore the result, because we
        // don't know what to do with it.
        cancelPendingAppCall(facebookDialogCallback);
    }

    pendingFacebookDialogCall = null;
    return true;
}
项目:chat-sdk-android-push-firebase    文件:UiLifecycleHelper.java   
/**
 * To be called from an Activity or Fragment's onActivityResult method, when the results of a FacebookDialog
 * call are expected.
 *
 * @param requestCode the request code
 * @param resultCode the result code
 * @param data the result data
 * @param dialogCallback the callback for handling FacebookDialog results, can be null
 */
public void onActivityResult(int requestCode, int resultCode, Intent data,
            FacebookDialog.Callback facebookDialogCallback) {
    Session session = Session.getActiveSession();
    if (session != null) {
        session.onActivityResult(activity, requestCode, resultCode, data);
    }

    handleFacebookDialogActivityResult(requestCode, resultCode, data, facebookDialogCallback);
}
项目:chat-sdk-android-push-firebase    文件:UiLifecycleHelper.java   
/**
 * Register that we are expecting results from a call to the Facebook application (e.g., from a native
 * dialog provided by the Facebook app). Activity results forwarded to onActivityResults will be parsed
 * and handled if they correspond to this call. Only a single pending FacebookDialog call can be tracked
 * at a time; attempting to track another one will cancel the first one.
 * @param appCall an PendingCall object containing the call ID
 */
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
    if (pendingFacebookDialogCall != null) {
        // If one is already pending, cancel it; we don't allow multiple pending calls.
        Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call.");
        cancelPendingAppCall(null);
    }
    pendingFacebookDialogCall = pendingCall;
}
项目:chat-sdk-android-push-firebase    文件:UiLifecycleHelper.java   
private boolean handleFacebookDialogActivityResult(int requestCode, int resultCode, Intent data,
        FacebookDialog.Callback facebookDialogCallback) {
    if (pendingFacebookDialogCall == null || pendingFacebookDialogCall.getRequestCode() != requestCode) {
        return false;
    }

    if (data == null) {
        // We understand the request code, but have no Intent. This can happen if the called Activity crashes
        // before it can be started; we treat this as a cancellation because we have no other information.
        cancelPendingAppCall(facebookDialogCallback);
        return true;
    }

    String callIdString = data.getStringExtra(NativeProtocol.EXTRA_PROTOCOL_CALL_ID);
    UUID callId = null;
    if (callIdString != null) {
        try {
            callId = UUID.fromString(callIdString);
        } catch (IllegalArgumentException exception) {
        }
    }

    // Was this result for the call we are waiting on?
    if (callId != null && pendingFacebookDialogCall.getCallId().equals(callId)) {
        // Yes, we can handle it normally.
        FacebookDialog.handleActivityResult(activity, pendingFacebookDialogCall, requestCode, data,
                facebookDialogCallback);
    } else {
        // No, send a cancellation error to the pending call and ignore the result, because we
        // don't know what to do with it.
        cancelPendingAppCall(facebookDialogCallback);
    }

    pendingFacebookDialogCall = null;
    return true;
}
项目:Chatois    文件:MainActivity.java   
@Override
    public void share(String tag)
    {
        switch(tag) {
            case "facebook":
                ArrayList<Bitmap> pic = new ArrayList<>();
                pic.add(screenShot());
                if (FacebookDialog.canPresentShareDialog (getApplicationContext(),
                        FacebookDialog.ShareDialogFeature.PHOTOS)) {
                    // Publish the post using the Photo Share Dialog
                    FacebookDialog shareDialog = new FacebookDialog.PhotoShareDialogBuilder(this)
                            .addPhotos(pic)
                            .setApplicationName("Chatois")
                            .build();
                    uiHelper.trackPendingDialogCall(shareDialog.present());
                } else {
                    // The user doesn't have the Facebook for Android app installed.
                    // You may be able to use a fallback.
                }

//                FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
//                        .setLink("https://play.google.com/store/apps/details?id=com.chatois.app")
//                        .setDescription("Description")
//                        .setName("name")
//                        .setApplicationName("Chatois!")
//                        .setCaption("Caption")
//                        .build();
//                uiHelper.trackPendingDialogCall(shareDialog.present());
                break;
            case "whatsapp":
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TEXT, "Can you help me guess this word?");
                sendIntent.putExtra(Intent.EXTRA_STREAM, getImageUri(screenShot()));
                sendIntent.setType("image/*");
                sendIntent.setPackage("com.whatsapp");
                startActivity(sendIntent);
                break;
        }
    }
项目:RetroFacebook    文件:Facebook.java   
public Observable<Bundle> share(Photo photo) {
    Log.d("RetroFacebook", "share");
    //if (FacebookDialog.canPresentShareDialog(activity, ShareDialogFeature.PHOTOS)) {
    //}
    FacebookDialog shareDialog = new FacebookDialog.PhotoShareDialogBuilder(activity)
        .addPhotos(Arrays.asList(photo.pictureBitmap()))
        //.setPlace(photo.placeId())
        .build();

    return trackPendingDialogCall(shareDialog);
}
项目:RetroFacebook    文件:Facebook.java   
private Observable<Bundle> trackPendingDialogCall(FacebookDialog shareDialog) {
    Log.d("RetroFacebook", "trackPendingDialogCall");
    //Subject<Bundle, Bundle> sub = BehaviorSubject.create();
    //dialogSubject = BehaviorSubject.create();
    PendingCall pendingCall = shareDialog.present();
    //dialogSubs.put(pendingCall.getCallId(), sub);
    uiLifecycleHelper.trackPendingDialogCall(pendingCall);

    //return sub.asObservable();
    return dialogSubject.asObservable().take(1);
}
项目:geopin    文件:MainMapActivity.java   
protected void shareOnFacebook(Marker marker){
    Log.d("App name: ",getString(R.string.app_name));
    if (FacebookDialog.canPresentShareDialog(getApplicationContext(),
            FacebookDialog.ShareDialogFeature.SHARE_DIALOG)) {
        // Publish the post using the Share Dialog
        FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(MainMapActivity.this)
                .setLink("http://maps.google.com/maps?z=15&t=m&q=loc:" + marker.getPosition().latitude + "+" + marker.getPosition().longitude)
                .setName(marker.getTitle())
                .setCaption("via Geopin App")
                .setDescription(marker.getSnippet())
                .setApplicationName(getString(R.string.app_name))
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());
    }
}
项目:yelo-android    文件:UiLifecycleHelper.java   
/**
 * To be called from an Activity or Fragment's onActivityResult method, when the results of a FacebookDialog
 * call are expected.
 *
 * @param requestCode the request code
 * @param resultCode the result code
 * @param data the result data
 * @param dialogCallback the callback for handling FacebookDialog results, can be null
 */
public void onActivityResult(int requestCode, int resultCode, Intent data,
            FacebookDialog.Callback facebookDialogCallback) {
    Session session = Session.getActiveSession();
    if (session != null) {
        session.onActivityResult(activity, requestCode, resultCode, data);
    }

    handleFacebookDialogActivityResult(requestCode, resultCode, data, facebookDialogCallback);
}