Skip to content

Commit

Permalink
Android: fix a crash and pad the FPS counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydr8gon committed Aug 8, 2024
1 parent 77a822e commit c0816ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/android/java/com/hydra/noods/FileBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion src/android/java/com/hydra/noods/NooActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit c0816ca

Please sign in to comment.