Search in sources :

Example 56 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project PhotoPicker by donglua.

the class PhotoPickerFragment method onActivityResult.

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == ImageCaptureManager.REQUEST_TAKE_PHOTO && resultCode == RESULT_OK) {
        if (captureManager == null) {
            FragmentActivity activity = getActivity();
            captureManager = new ImageCaptureManager(activity);
        }
        captureManager.galleryAddPic();
        if (directories.size() > 0) {
            String path = captureManager.getCurrentPhotoPath();
            PhotoDirectory directory = directories.get(INDEX_ALL_PHOTOS);
            directory.getPhotos().add(INDEX_ALL_PHOTOS, new Photo(path.hashCode(), path));
            directory.setCoverPath(path);
            photoGridAdapter.notifyDataSetChanged();
        }
    }
}
Also used : PhotoDirectory(me.iwf.photopicker.entity.PhotoDirectory) FragmentActivity(android.support.v4.app.FragmentActivity) Photo(me.iwf.photopicker.entity.Photo) ImageCaptureManager(me.iwf.photopicker.utils.ImageCaptureManager)

Example 57 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project facebook-android-sdk by facebook.

the class FacebookDialogFragment method onCompleteWebDialog.

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();
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Intent(android.content.Intent)

Example 58 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project facebook-android-sdk by facebook.

the class FacebookDialogFragment method onCompleteWebFallbackDialog.

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();
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Bundle(android.os.Bundle) Intent(android.content.Intent)

Example 59 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project facebook-android-sdk by facebook.

the class FacebookDialogFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (this.dialog == null) {
        final FragmentActivity activity = getActivity();
        Intent intent = activity.getIntent();
        Bundle params = NativeProtocol.getMethodArgumentsFromIntent(intent);
        boolean isWebFallback = params.getBoolean(NativeProtocol.WEB_DIALOG_IS_FALLBACK, false);
        WebDialog webDialog;
        if (!isWebFallback) {
            String actionName = params.getString(NativeProtocol.WEB_DIALOG_ACTION);
            Bundle webParams = params.getBundle(NativeProtocol.WEB_DIALOG_PARAMS);
            if (Utility.isNullOrEmpty(actionName)) {
                Utility.logd(TAG, "Cannot start a WebDialog with an empty/missing 'actionName'");
                activity.finish();
                return;
            }
            webDialog = new WebDialog.Builder(activity, actionName, webParams).setOnCompleteListener(new WebDialog.OnCompleteListener() {

                @Override
                public void onComplete(Bundle values, FacebookException error) {
                    onCompleteWebDialog(values, error);
                }
            }).build();
        } else {
            String url = params.getString(NativeProtocol.WEB_DIALOG_URL);
            if (Utility.isNullOrEmpty(url)) {
                Utility.logd(TAG, "Cannot start a fallback WebDialog with an empty/missing 'url'");
                activity.finish();
                return;
            }
            String redirectUrl = String.format("fb%s://bridge/", FacebookSdk.getApplicationId());
            webDialog = new FacebookWebFallbackDialog(activity, url, redirectUrl);
            webDialog.setOnCompleteListener(new WebDialog.OnCompleteListener() {

                @Override
                public void onComplete(Bundle values, FacebookException error) {
                    // Error data is nested in the values since this is in the form of a
                    // Native protocol response
                    onCompleteWebFallbackDialog(values);
                }
            });
        }
        this.dialog = webDialog;
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Bundle(android.os.Bundle) FacebookException(com.facebook.FacebookException) Intent(android.content.Intent)

Example 60 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project Notes by lguipeng.

the class EvernoteLoginFragment method onResult.

@SuppressWarnings("unused")
@TaskResult
public final synchronized void onResult(Boolean result, EvernoteLoginTask task) {
    if (mResultPosted || (task != null && task.getKey() != mTaskKey)) {
        return;
    }
    mResultPosted = true;
    dismiss();
    FragmentActivity activity = getActivity();
    if (activity instanceof ResultCallback) {
        ((ResultCallback) activity).onLoginFinished(result);
    } else {
        onLoginFinished(result);
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) TaskResult(net.vrallev.android.task.TaskResult)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)84 FragmentTransaction (android.app.FragmentTransaction)16 FragmentManager (android.support.v4.app.FragmentManager)16 FragmentTransaction (android.support.v4.app.FragmentTransaction)16 Fragment (android.support.v4.app.Fragment)11 Intent (android.content.Intent)6 Bundle (android.os.Bundle)5 View (android.view.View)4 DialogFragment (android.support.v4.app.DialogFragment)3 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)3 SearchView (android.widget.SearchView)3 TextView (android.widget.TextView)3 Fragment (android.app.Fragment)2 ActionBar (android.support.v7.app.ActionBar)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)2 MediaRouteDialogFactory (android.support.v7.app.MediaRouteDialogFactory)2 RecyclerView (android.support.v7.widget.RecyclerView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2 FacebookException (com.facebook.FacebookException)2