Apply suggestions from code review

Refactored for conciseness

Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
This commit is contained in:
CloudyRowly 2024-03-20 21:05:53 +07:00 committed by GitHub
parent 5762da2dbd
commit 0821adc486
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -885,17 +885,16 @@ public class DownloadDialog extends DialogFragment
// Check for free memory space (for api 24 and up)
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
final long freeSpace;
freeSpace = mainStorage.getFreeMemory();
final long freeSpace = mainStorage.getFreeMemory();
if (freeSpace <= size) {
Toast.makeText(context, getString(R.
string.error_insufficient_storage), Toast.LENGTH_LONG).show();
// move the user to storage setting tab
final Intent storageSettingsIntent = new Intent(Settings.
ACTION_INTERNAL_STORAGE_SETTINGS);
NoFileManagerSafeGuard.launchSafe(requestStorageSettingsLauncher,
storageSettingsIntent, TAG,
context);
if (storageSettingsIntent.resolveActivity(context.getPackageManager()) != null) {
startActivity(storageSettingsIntent);
}
return;
}
}