use of org.thoughtcrime.securesms.scribbles.UriGlideRenderer in project Signal-Android by WhisperSystems.
the class WallpaperCropActivity method setupImageEditor.
private void setupImageEditor(@NonNull Uri imageUri) {
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
float ratio = width / (float) height;
EditorModel editorModel = EditorModel.createForWallpaperEditing(ratio);
EditorElement image = new EditorElement(new UriGlideRenderer(imageUri, true, width, height, UriGlideRenderer.WEAK_BLUR));
image.getFlags().setSelectable(false).persist();
editorModel.addElement(image);
imageEditor.setModel(editorModel);
imageEditor.setSizeChangedListener((newWidth, newHeight) -> {
float newRatio = newWidth / (float) newHeight;
Log.i(TAG, String.format(Locale.US, "Output size (%d, %d) (ratio %.2f)", newWidth, newHeight, newRatio));
editorModel.setFixedRatio(newRatio);
});
}
Aggregations