Java 类com.facebook.share.model.GameRequestContent 实例源码

项目:kognitivo    文件:GameRequestValidation.java   
public static void validate(GameRequestContent content) {
    Validate.notNull(content.getMessage(), "message");
    if (content.getObjectId() != null ^
            (content.getActionType() == GameRequestContent.ActionType.ASKFOR
            || content.getActionType() == GameRequestContent.ActionType.SEND)) {
        throw new IllegalArgumentException(
                "Object id should be provided if and only if action type is send or askfor");
    }

    // parameters to, filters, suggestions are mutually exclusive
    int mutex = 0;
    if (content.getTo() != null) {
        mutex++;
    }
    if (content.getSuggestions() != null) {
        mutex++;
    }
    if (content.getFilters() != null) {
        mutex++;
    }
    if (mutex > 1) {
        throw new IllegalArgumentException(
                "Parameters to, filters and suggestions are mutually exclusive");
    }
}
项目:Move-Alarm_ORCA    文件:GameRequestValidation.java   
public static void validate(GameRequestContent content) {
    Validate.notNull(content.getMessage(), "message");
    if (content.getObjectId() != null ^
            (content.getActionType() == GameRequestContent.ActionType.ASKFOR
            || content.getActionType() == GameRequestContent.ActionType.SEND)) {
        throw new IllegalArgumentException(
                "Object id should be provided if and only if action type is send or askfor");
    }

    // parameters to, filters, suggestions are mutually exclusive
    int mutex = 0;
    if (content.getTo() != null) {
        mutex++;
    }
    if (content.getSuggestions() != null) {
        mutex++;
    }
    if (content.getFilters() != null) {
        mutex++;
    }
    if (mutex > 1) {
        throw new IllegalArgumentException(
                "Parameters to, filters and suggestions are mutually exclusive");
    }
}
项目:SocioBlood    文件:GameRequestValidation.java   
public static void validate(GameRequestContent content) {
    Validate.notNull(content.getMessage(), "message");
    if (content.getObjectId() != null ^
            (content.getActionType() == GameRequestContent.ActionType.ASKFOR
            || content.getActionType() == GameRequestContent.ActionType.SEND)) {
        throw new IllegalArgumentException(
                "Object id should be provided if and only if action type is send or askfor");
    }

    // parameters to, filters, suggestions are mutually exclusive
    int mutex = 0;
    if (content.getTo() != null) {
        mutex++;
    }
    if (content.getSuggestions() != null) {
        mutex++;
    }
    if (content.getFilters() != null) {
        mutex++;
    }
    if (mutex > 1) {
        throw new IllegalArgumentException(
                "Parameters to, filters and suggestions are mutually exclusive");
    }
}
项目:kognitivo    文件:GameRequestDialog.java   
@Override
public AppCall createAppCall(final GameRequestContent content) {
    GameRequestValidation.validate(content);
    AppCall appCall = createBaseAppCall();
    DialogPresenter.setupAppCallForWebDialog(
            appCall,
            GAME_REQUEST_DIALOG,
            WebDialogParameters.create(content));

    return appCall;
}
项目:GDFacebook    文件:FacebookSDK.java   
public void showDialogForInvites(String title, String message) {
    GameRequestContent content = new GameRequestContent.Builder()
    .setTitle(title)
    .setMessage(message)
    .setFilters(GameRequestContent.Filters.APP_NON_USERS)
    .build();

    requestDialog.show(content);
}
项目:GDFacebook    文件:FacebookSDK.java   
public void showDialogForRequests (String title, String message) {
    GameRequestContent content = new GameRequestContent.Builder()
    .setTitle(title)
    .setMessage(message)
    .setFilters(GameRequestContent.Filters.APP_USERS)
    .build();

    requestDialog.show(content);
}
项目:GDFacebook    文件:FacebookSDK.java   
public void showDirectRequests (String title, String message, List<String> recip) {
    GameRequestContent content = new GameRequestContent.Builder()
    .setTitle(title)
    .setMessage(message)
    .setRecipients(recip)
    .build();

    requestDialog.show(content);
}
项目:Move-Alarm_ORCA    文件:GameRequestDialog.java   
@Override
public AppCall createAppCall(final GameRequestContent content) {
    GameRequestValidation.validate(content);
    AppCall appCall = createBaseAppCall();
    DialogPresenter.setupAppCallForWebDialog(
            appCall,
            GAME_REQUEST_DIALOG,
            WebDialogParameters.create(content));

    return appCall;
}
项目:SocioBlood    文件:GameRequestDialog.java   
@Override
public AppCall createAppCall(final GameRequestContent content) {
    GameRequestValidation.validate(content);
    AppCall appCall = createBaseAppCall();
    DialogPresenter.setupAppCallForWebDialog(
            appCall,
            GAME_REQUEST_DIALOG,
            WebDialogParameters.create(content));

    return appCall;
}
项目:kognitivo    文件:WebDialogParameters.java   
public static Bundle create(GameRequestContent gameRequestContent) {
    Bundle webParams = new Bundle();

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_MESSAGE,
            gameRequestContent.getMessage());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TO,
            gameRequestContent.getTo());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TITLE,
            gameRequestContent.getTitle());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_DATA,
            gameRequestContent.getData());
    if (gameRequestContent.getActionType() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_ACTION_TYPE,
                gameRequestContent.getActionType().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_OBJECT_ID,
            gameRequestContent.getObjectId());
    if (gameRequestContent.getFilters() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_FILTERS,
                gameRequestContent.getFilters().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putCommaSeparatedStringList(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_SUGGESTIONS,
            gameRequestContent.getSuggestions());
    return webParams;
}
项目:kognitivo    文件:GameRequestDialog.java   
@Override
public boolean canShow(final GameRequestContent content) {
    return true;
}
项目:Move-Alarm_ORCA    文件:WebDialogParameters.java   
public static Bundle create(GameRequestContent gameRequestContent) {
    Bundle webParams = new Bundle();

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_MESSAGE,
            gameRequestContent.getMessage());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TO,
            gameRequestContent.getTo());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TITLE,
            gameRequestContent.getTitle());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_DATA,
            gameRequestContent.getData());
    if (gameRequestContent.getActionType() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_ACTION_TYPE,
                gameRequestContent.getActionType().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_OBJECT_ID,
            gameRequestContent.getObjectId());
    if (gameRequestContent.getFilters() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_FILTERS,
                gameRequestContent.getFilters().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putCommaSeparatedStringList(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_SUGGESTIONS,
            gameRequestContent.getSuggestions());
    return webParams;
}
项目:Move-Alarm_ORCA    文件:GameRequestDialog.java   
@Override
public boolean canShow(final GameRequestContent content) {
    return true;
}
项目:SocioBlood    文件:WebDialogParameters.java   
public static Bundle create(GameRequestContent gameRequestContent) {
    Bundle webParams = new Bundle();

    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_MESSAGE,
            gameRequestContent.getMessage());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TO,
            gameRequestContent.getTo());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_TITLE,
            gameRequestContent.getTitle());
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_DATA,
            gameRequestContent.getData());
    if (gameRequestContent.getActionType() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_ACTION_TYPE,
                gameRequestContent.getActionType().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putNonEmptyString(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_OBJECT_ID,
            gameRequestContent.getObjectId());
    if (gameRequestContent.getFilters() != null) {
        Utility.putNonEmptyString(
                webParams,
                ShareConstants.WEB_DIALOG_PARAM_FILTERS,
                gameRequestContent.getFilters().toString().toLowerCase(Locale.ENGLISH));
    }
    Utility.putCommaSeparatedStringList(
            webParams,
            ShareConstants.WEB_DIALOG_PARAM_SUGGESTIONS,
            gameRequestContent.getSuggestions());
    return webParams;
}
项目:SocioBlood    文件:GameRequestDialog.java   
@Override
public boolean canShow(final GameRequestContent content) {
    return true;
}
项目:kognitivo    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param activity Activity hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Activity activity, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(activity).show(gameRequestContent);
}
项目:kognitivo    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param fragment Fragment hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Fragment fragment, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(fragment).show(gameRequestContent);
}
项目:Move-Alarm_ORCA    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param activity Activity hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Activity activity, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(activity).show(gameRequestContent);
}
项目:Move-Alarm_ORCA    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param fragment Fragment hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Fragment fragment, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(fragment).show(gameRequestContent);
}
项目:SocioBlood    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param activity Activity hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Activity activity, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(activity).show(gameRequestContent);
}
项目:SocioBlood    文件:GameRequestDialog.java   
/**
 * Shows a {@link GameRequestDialog} to send a request, using
 * the passed in activity. No callback will be invoked.
 *
 * @param fragment Fragment hosting the dialog.
 * @param gameRequestContent Content of the request.
 */
public static void show(final Fragment fragment, final GameRequestContent gameRequestContent) {
    new GameRequestDialog(fragment).show(gameRequestContent);
}