diff options
| author | JosJuice <josjuice@gmail.com> | 2020-06-21 20:41:50 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-06-21 20:47:23 +0200 |
| commit | d494e0230c2ebfd580bb66b2a741d19ef830d658 (patch) | |
| tree | edd701dfdd98be00f0971dc747eea0dcbe5f7c71 /Source/Android/app/src/main/java/org | |
| parent | 99822518994d62def4e336f6746d6a2e2d108fb2 (diff) | |
Show file format details in game properties
Diffstat (limited to 'Source/Android/app/src/main/java/org')
3 files changed, 60 insertions, 0 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index f37169ddee..3751385be8 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -449,6 +449,8 @@ public final class NativeLibrary public static native boolean InstallWAD(String file); + public static native String FormatSize(long bytes, int decimals); + private static boolean alertResult = false; public static boolean displayAlertMsg(final String caption, final String text, diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java index 88120e3c42..a0597390e5 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java @@ -10,6 +10,7 @@ import android.widget.TextView; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; +import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.model.GameFile; import org.dolphinemu.dolphinemu.services.GameFileCacheService; @@ -50,8 +51,17 @@ public final class GameDetailsDialog extends DialogFragment TextView textGameId = contents.findViewById(R.id.text_game_id); TextView textRevision = contents.findViewById(R.id.text_revision); + TextView textFileFormat = contents.findViewById(R.id.text_file_format); + TextView textCompression = contents.findViewById(R.id.text_compression); + TextView textBlockSize = contents.findViewById(R.id.text_block_size); + + TextView labelFileFormat = contents.findViewById(R.id.label_file_format); + TextView labelCompression = contents.findViewById(R.id.label_compression); + TextView labelBlockSize = contents.findViewById(R.id.label_block_size); + String country = getResources().getStringArray(R.array.countryNames)[gameFile.getCountry()]; String description = gameFile.getDescription(); + String fileSize = NativeLibrary.FormatSize(gameFile.getFileSize(), 2); textTitle.setText(gameFile.getTitle()); textDescription.setText(gameFile.getDescription()); @@ -59,11 +69,49 @@ public final class GameDetailsDialog extends DialogFragment { textDescription.setVisibility(View.GONE); } + textCountry.setText(country); textCompany.setText(gameFile.getCompany()); textGameId.setText(gameFile.getGameId()); textRevision.setText(Integer.toString(gameFile.getRevision())); + if (!gameFile.shouldShowFileFormatDetails()) + { + labelFileFormat.setText(R.string.game_details_file_size); + textFileFormat.setText(fileSize); + + labelCompression.setVisibility(View.GONE); + textCompression.setVisibility(View.GONE); + labelBlockSize.setVisibility(View.GONE); + textBlockSize.setVisibility(View.GONE); + } + else + { + long blockSize = gameFile.getBlockSize(); + String compression = gameFile.getCompressionMethod(); + + textFileFormat.setText(String.format("%1$s (%2$s)", gameFile.getBlobTypeString(), fileSize)); + + if (compression.isEmpty()) + { + textCompression.setText(R.string.game_details_no_compression); + } + else + { + textCompression.setText(gameFile.getCompressionMethod()); + } + + if (blockSize > 0) + { + textBlockSize.setText(NativeLibrary.FormatSize(blockSize, 0)); + } + else + { + labelBlockSize.setVisibility(View.GONE); + textBlockSize.setVisibility(View.GONE); + } + } + PicassoUtils.loadGameBanner(banner, gameFile); builder.setView(contents); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java index dea006f24e..666103cf05 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GameFile.java @@ -38,6 +38,16 @@ public class GameFile public native int getRevision(); + public native String getBlobTypeString(); + + public native long getBlockSize(); + + public native String getCompressionMethod(); + + public native boolean shouldShowFileFormatDetails(); + + public native long getFileSize(); + public native int[] getBanner(); public native int getBannerWidth(); |
