Skip to content

Commit

Permalink
Merge pull request #208 from natsuk4ze/Refactor
Browse files Browse the repository at this point in the history
Format
  • Loading branch information
natsuk4ze authored Feb 5, 2024
2 parents 426ef08 + db13cc7 commit 13b1022
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions android/src/main/java/studio/midoridesign/gal/GalPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
case "putImageBytes": {
new Thread(() -> {
try {
putMediaBytes(call.argument("bytes"), call.argument("album"), call.argument("name"));
putMediaBytes(call.argument("bytes"), call.argument("album"),
call.argument("name"));
new Handler(Looper.getMainLooper()).post(() -> result.success(null));
} catch (Exception e) {
handleError(e, result);
Expand Down Expand Up @@ -125,7 +126,8 @@ private void putMedia(String path, String album, boolean isImage)
}
}

private void putMediaBytes(byte[] bytes, String album, String name) throws IOException, SecurityException {
private void putMediaBytes(byte[] bytes, String album, String name)
throws IOException, SecurityException {
ImageFormat imageFormat = Imaging.guessFormat(bytes);
String extension = "." + imageFormat.getDefaultExtension().toLowerCase();
try (InputStream in = new ByteArrayInputStream(bytes)) {
Expand Down

0 comments on commit 13b1022

Please sign in to comment.