From c0816caf85e5c39386204d182033532deca73b50 Mon Sep 17 00:00:00 2001 From: Sean Maas Date: Thu, 8 Aug 2024 00:29:43 -0400 Subject: [PATCH] Android: fix a crash and pad the FPS counter --- src/android/java/com/hydra/noods/FileBrowser.java | 7 +++++++ src/android/java/com/hydra/noods/NooActivity.java | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/android/java/com/hydra/noods/FileBrowser.java b/src/android/java/com/hydra/noods/FileBrowser.java index 757a399..6f8cd11 100644 --- a/src/android/java/com/hydra/noods/FileBrowser.java +++ b/src/android/java/com/hydra/noods/FileBrowser.java @@ -200,6 +200,13 @@ public void onActivityResult(int requestCode, int resultCode, Intent resultData) return; case 2: // Scoped directory selection + // Reload if nothing was selected + if (resultData == null) + { + openScoped(); + return; + } + // Save the returned URI with persistent permissions so it can be restored next time SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit(); int flags = Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION; diff --git a/src/android/java/com/hydra/noods/NooActivity.java b/src/android/java/com/hydra/noods/NooActivity.java index fc586e1..1bfc656 100644 --- a/src/android/java/com/hydra/noods/NooActivity.java +++ b/src/android/java/com/hydra/noods/NooActivity.java @@ -108,9 +108,12 @@ public boolean onTouch(View view, MotionEvent event) setContentView(layout); layout.addView(view); - // Create the FPS counter + // Create the FPS counter, padded for round corners fpsCounter.setTextSize(24); fpsCounter.setTextColor(Color.WHITE); + DisplayMetrics metrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getRealMetrics(metrics); + fpsCounter.setPadding((int)(metrics.density * 10), (int)(metrics.density * 10), 0, 0); // Add the FPS counter to the layout if enabled if (showingFps = (SettingsMenu.getShowFpsCounter() != 0))