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();
}
}
}
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();
}
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();
}
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;
}
}
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);
}
}
Aggregations