Java Code Examples for android.support.v4.app.FragmentActivity#setResult()

The following examples show how to use android.support.v4.app.FragmentActivity#setResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClanUtils.java    From BigApp_Discuz_Android with Apache License 2.0 6 votes vote down vote up
public static void logout(FragmentActivity activity, String msg) {
    ZogUtils.printError(ClanUtils.class, "logout_succeed");

    ToastUtils.mkLongTimeToast(activity, msg);

    PreferenceManager.getDefaultSharedPreferences(activity).edit().clear().commit();
    AppSPUtils.saveAvatarUrl(activity, "");
    MyFavUtils.deleteAllForum(activity);
    MyFavUtils.deleteAllThread(activity);
    MyFavUtils.deleteAllArticle(activity);

    AppSPUtils.setLoginInfo(activity, false, "0", "");

    activity.setResult(ResultCode.RESULT_CODE_EXIT);
    activity.finish();
}
 
Example 2
Source File: IgnoreTextDialogActivity.java    From oversec with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCancel(DialogInterface dialog) {
    super.onCancel(dialog);
    FragmentActivity a = getActivity();
    if (a != null) {
        a.setResult(RESULT_CANCELED);
    }
}
 
Example 3
Source File: FacebookDialogFragment.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void onCompleteWebDialog(Bundle values, FacebookException error) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = NativeProtocol.createProtocolResultIntent(
            fragmentActivity.getIntent(),
            values,
            error);

    int resultCode = error == null ? Activity.RESULT_OK : Activity.RESULT_CANCELED;

    fragmentActivity.setResult(resultCode, resultIntent);
    fragmentActivity.finish();
}
 
Example 4
Source File: FacebookDialogFragment.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
private void onCompleteWebFallbackDialog(Bundle values) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = new Intent();
    resultIntent.putExtras(values == null ? new Bundle() : values);

    fragmentActivity.setResult(Activity.RESULT_OK, resultIntent);
    fragmentActivity.finish();
}
 
Example 5
Source File: FacebookDialogFragment.java    From letv with Apache License 2.0 4 votes vote down vote up
private void onCompleteWebDialog(Bundle values, FacebookException error) {
    FragmentActivity fragmentActivity = getActivity();
    fragmentActivity.setResult(error == null ? -1 : 0, NativeProtocol.createProtocolResultIntent(fragmentActivity.getIntent(), values, error));
    fragmentActivity.finish();
}
 
Example 6
Source File: EasyPhotos.java    From imsdk-android with MIT License 2 votes vote down vote up
/**
 * 启动拼图(最多对9张图片进行拼图)
 *
 * @param act                  上下文
 * @param photos               图片集合(最多对9张图片进行拼图)
 * @param puzzleSaveDirPath    拼图完成保存的文件夹全路径
 * @param puzzleSaveNamePrefix 拼图完成保存的文件名前缀,最终格式:前缀+默认生成唯一数字标识+.png
 * @param replaceCustom        单击替换拼图中的某张图片时,是否以startForResult的方式启动你的自定义界面,该界面与传进来的act为同一界面。false则在EasyPhotos内部完成,正常需求直接写false即可。 true的情况适用于:用于拼图的图片集合中包含网络图片,是在你的act界面中获取并下载的(也可以直接用网络地址,不用下载后的本地地址,也就是可以不下载下来),而非单纯本地相册。举例:你的act中有两个按钮,一个指向本地相册,一个指向网络相册,用户在该界面任意选择,选择好图片后跳转到拼图界面,用户在拼图界面点击替换按钮,将会启动一个新的act界面,这时,act只让用户在网络相册和本地相册选择一张图片,选择好执行
 *                             Intent intent = new Intent();
 *                             intent.putParcelableArrayListExtra(AlbumBuilder.RESULT_PHOTOS , photos);
 *                             act.setResult(RESULT_OK,intent); 并关闭act,回到拼图界面,完成替换。
 * @param imageEngine          图片加载引擎的具体实现
 * @param callback             拼图回调
 */
public static void startPuzzleWithPhotos(FragmentActivity act, ArrayList<Photo> photos, String puzzleSaveDirPath, String puzzleSaveNamePrefix, boolean replaceCustom, @NonNull ImageEngine imageEngine, PuzzleCallback callback) {
    act.setResult(Activity.RESULT_OK);
    EasyResult.get(act).startPuzzleWithPhotos(photos, puzzleSaveDirPath, puzzleSaveNamePrefix, replaceCustom, imageEngine, callback);
}