diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-03-11 06:37:36 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:05:41 +0200 |
commit | bf0c38302498d93083fc243a6334c20e28f31ccc (patch) | |
tree | 31ca112e2841434c39bc1e0a0cea028f79348fa5 /src/android/app | |
parent | android: Convert ForegroundService to Kotlin (diff) | |
download | yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.gz yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.bz2 yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.lz yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.xz yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.zst yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.zip |
Diffstat (limited to 'src/android/app')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.java | 29 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.kt | 22 |
2 files changed, 22 insertions, 29 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.java b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.java deleted file mode 100644 index fd43575de..000000000 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.yuzu.yuzu_emu.utils; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -import com.squareup.picasso.Picasso; -import com.squareup.picasso.Request; -import com.squareup.picasso.RequestHandler; - -import org.yuzu.yuzu_emu.NativeLibrary; - -import java.nio.IntBuffer; - -public class GameIconRequestHandler extends RequestHandler { - @Override - public boolean canHandleRequest(Request data) { - return "content".equals(data.uri.getScheme()); - } - - @Override - public Result load(Request request, int networkPolicy) { - String gamePath = request.uri.toString(); - byte[] data = NativeLibrary.GetIcon(gamePath); - BitmapFactory.Options options = new BitmapFactory.Options(); - options.inMutable = true; - Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options); - return new Result(bitmap, Picasso.LoadedFrom.DISK); - } -} diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.kt new file mode 100644 index 000000000..f5a535327 --- /dev/null +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/GameIconRequestHandler.kt @@ -0,0 +1,22 @@ +package org.yuzu.yuzu_emu.utils + +import android.graphics.BitmapFactory +import com.squareup.picasso.Picasso +import com.squareup.picasso.Request +import com.squareup.picasso.RequestHandler +import org.yuzu.yuzu_emu.NativeLibrary + +class GameIconRequestHandler : RequestHandler() { + override fun canHandleRequest(data: Request): Boolean { + return "content" == data.uri.scheme + } + + override fun load(request: Request, networkPolicy: Int): Result { + val gamePath = request.uri.toString() + val data = NativeLibrary.GetIcon(gamePath) + val options = BitmapFactory.Options() + options.inMutable = true + val bitmap = BitmapFactory.decodeByteArray(data, 0, data.size, options) + return Result(bitmap, Picasso.LoadedFrom.DISK) + } +} |