Apply suggestions from code review
Refactored for conciseness Co-authored-by: Tobi <TobiGr@users.noreply.github.com>
This commit is contained in:
parent
5762da2dbd
commit
0821adc486
|
@ -885,17 +885,16 @@ public class DownloadDialog extends DialogFragment
|
||||||
|
|
||||||
// Check for free memory space (for api 24 and up)
|
// Check for free memory space (for api 24 and up)
|
||||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
|
||||||
final long freeSpace;
|
final long freeSpace = mainStorage.getFreeMemory();
|
||||||
freeSpace = mainStorage.getFreeMemory();
|
|
||||||
if (freeSpace <= size) {
|
if (freeSpace <= size) {
|
||||||
Toast.makeText(context, getString(R.
|
Toast.makeText(context, getString(R.
|
||||||
string.error_insufficient_storage), Toast.LENGTH_LONG).show();
|
string.error_insufficient_storage), Toast.LENGTH_LONG).show();
|
||||||
// move the user to storage setting tab
|
// move the user to storage setting tab
|
||||||
final Intent storageSettingsIntent = new Intent(Settings.
|
final Intent storageSettingsIntent = new Intent(Settings.
|
||||||
ACTION_INTERNAL_STORAGE_SETTINGS);
|
ACTION_INTERNAL_STORAGE_SETTINGS);
|
||||||
NoFileManagerSafeGuard.launchSafe(requestStorageSettingsLauncher,
|
if (storageSettingsIntent.resolveActivity(context.getPackageManager()) != null) {
|
||||||
storageSettingsIntent, TAG,
|
startActivity(storageSettingsIntent);
|
||||||
context);
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue