diff options
| author | 2023-03-11 00:37:36 -0500 | |
|---|---|---|
| committer | 2023-06-03 00:05:41 -0700 | |
| commit | bf0c38302498d93083fc243a6334c20e28f31ccc (patch) | |
| tree | 31ca112e2841434c39bc1e0a0cea028f79348fa5 /src/android/app | |
| parent | android: Convert ForegroundService to Kotlin (diff) | |
| download | yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.gz yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.tar.xz yuzu-bf0c38302498d93083fc243a6334c20e28f31ccc.zip | |
android: Convert GameIconRequestHandler to Kotlin
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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils; | ||
| 2 | |||
| 3 | import android.graphics.Bitmap; | ||
| 4 | import android.graphics.BitmapFactory; | ||
| 5 | |||
| 6 | import com.squareup.picasso.Picasso; | ||
| 7 | import com.squareup.picasso.Request; | ||
| 8 | import com.squareup.picasso.RequestHandler; | ||
| 9 | |||
| 10 | import org.yuzu.yuzu_emu.NativeLibrary; | ||
| 11 | |||
| 12 | import java.nio.IntBuffer; | ||
| 13 | |||
| 14 | public class GameIconRequestHandler extends RequestHandler { | ||
| 15 | @Override | ||
| 16 | public boolean canHandleRequest(Request data) { | ||
| 17 | return "content".equals(data.uri.getScheme()); | ||
| 18 | } | ||
| 19 | |||
| 20 | @Override | ||
| 21 | public Result load(Request request, int networkPolicy) { | ||
| 22 | String gamePath = request.uri.toString(); | ||
| 23 | byte[] data = NativeLibrary.GetIcon(gamePath); | ||
| 24 | BitmapFactory.Options options = new BitmapFactory.Options(); | ||
| 25 | options.inMutable = true; | ||
| 26 | Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options); | ||
| 27 | return new Result(bitmap, Picasso.LoadedFrom.DISK); | ||
| 28 | } | ||
| 29 | } | ||
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 @@ | |||
| 1 | package org.yuzu.yuzu_emu.utils | ||
| 2 | |||
| 3 | import android.graphics.BitmapFactory | ||
| 4 | import com.squareup.picasso.Picasso | ||
| 5 | import com.squareup.picasso.Request | ||
| 6 | import com.squareup.picasso.RequestHandler | ||
| 7 | import org.yuzu.yuzu_emu.NativeLibrary | ||
| 8 | |||
| 9 | class GameIconRequestHandler : RequestHandler() { | ||
| 10 | override fun canHandleRequest(data: Request): Boolean { | ||
| 11 | return "content" == data.uri.scheme | ||
| 12 | } | ||
| 13 | |||
| 14 | override fun load(request: Request, networkPolicy: Int): Result { | ||
| 15 | val gamePath = request.uri.toString() | ||
| 16 | val data = NativeLibrary.GetIcon(gamePath) | ||
| 17 | val options = BitmapFactory.Options() | ||
| 18 | options.inMutable = true | ||
| 19 | val bitmap = BitmapFactory.decodeByteArray(data, 0, data.size, options) | ||
| 20 | return Result(bitmap, Picasso.LoadedFrom.DISK) | ||
| 21 | } | ||
| 22 | } | ||