use of org.thoughtcrime.securesms.scribbles.ImageEditorFragment in project Signal-Android by WhisperSystems.
the class AvatarSelectionActivity method handleSave.
private void handleSave() {
ImageEditorFragment fragment = (ImageEditorFragment) getSupportFragmentManager().findFragmentByTag(IMAGE_EDITOR);
if (fragment == null) {
throw new AssertionError();
}
ImageEditorFragment.Data data = (ImageEditorFragment.Data) fragment.saveState();
EditorModel model = data.readModel();
if (model == null) {
throw new AssertionError();
}
MediaRepository.transformMedia(this, Collections.singletonList(currentMedia), Collections.singletonMap(currentMedia, new ImageEditorModelRenderMediaTransform(model, AVATAR_DIMENSIONS)), output -> {
Media transformed = output.get(currentMedia);
Intent result = new Intent();
result.putExtra(EXTRA_MEDIA, transformed);
setResult(RESULT_OK, result);
finish();
});
}
use of org.thoughtcrime.securesms.scribbles.ImageEditorFragment in project Signal-Android by signalapp.
the class AvatarSelectionActivity method handleSave.
private void handleSave() {
ImageEditorFragment fragment = (ImageEditorFragment) getSupportFragmentManager().findFragmentByTag(IMAGE_EDITOR);
if (fragment == null) {
throw new AssertionError();
}
ImageEditorFragment.Data data = (ImageEditorFragment.Data) fragment.saveState();
EditorModel model = data.readModel();
if (model == null) {
throw new AssertionError();
}
MediaRepository.transformMedia(this, Collections.singletonList(currentMedia), Collections.singletonMap(currentMedia, new ImageEditorModelRenderMediaTransform(model, AVATAR_DIMENSIONS)), output -> {
Media transformed = output.get(currentMedia);
Intent result = new Intent();
result.putExtra(EXTRA_MEDIA, transformed);
setResult(RESULT_OK, result);
finish();
});
}
Aggregations