mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-19 07:15:25 +02:00
fix: Show low storage message dependent on whether user uses internal or external storage
Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
parent
a6856476ce
commit
5cdbb605f2
@ -522,8 +522,8 @@ abstract class BatchesFolder(
|
|||||||
return uri!!
|
return uri!!
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getAvailableBytes(): Long {
|
fun getAvailableBytes(): Long? {
|
||||||
val storageManager = context.getSystemService(StorageManager::class.java) ?: return -1
|
val storageManager = context.getSystemService(StorageManager::class.java) ?: return null
|
||||||
val file = when (type) {
|
val file = when (type) {
|
||||||
BatchType.INTERNAL -> context.filesDir
|
BatchType.INTERNAL -> context.filesDir
|
||||||
BatchType.CUSTOM -> customFolder!!.uri.toFile()
|
BatchType.CUSTOM -> customFolder!!.uri.toFile()
|
||||||
@ -545,8 +545,8 @@ abstract class BatchesFolder(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun requiredBytesForOneMinuteOfRecording(appSettings: AppSettings): Long {
|
fun requiredBytesForOneMinuteOfRecording(appSettings: AppSettings): Long {
|
||||||
// 300 MiB sounds like a good default
|
// 250 MiB sounds like a good default
|
||||||
return 300 * 1024 * 1024
|
return 250 * 1024 * 1024
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@ fun LowStorageInfo(
|
|||||||
val availableBytes =
|
val availableBytes =
|
||||||
VideoBatchesFolder.importFromFolder(appSettings.saveFolder, context).getAvailableBytes()
|
VideoBatchesFolder.importFromFolder(appSettings.saveFolder, context).getAvailableBytes()
|
||||||
|
|
||||||
|
if (availableBytes == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val bytesPerMinute = BatchesFolder.requiredBytesForOneMinuteOfRecording(appSettings)
|
val bytesPerMinute = BatchesFolder.requiredBytesForOneMinuteOfRecording(appSettings)
|
||||||
val requiredBytes = appSettings.maxDuration / 1000 / 60 * bytesPerMinute
|
val requiredBytes = appSettings.maxDuration / 1000 / 60 * bytesPerMinute
|
||||||
|
|
||||||
@ -35,7 +39,9 @@ fun LowStorageInfo(
|
|||||||
) {
|
) {
|
||||||
MessageBox(
|
MessageBox(
|
||||||
type = MessageType.WARNING,
|
type = MessageType.WARNING,
|
||||||
message = stringResource(R.string.ui_recorder_lowOnStorage_hint),
|
message = if (appSettings.saveFolder == null)
|
||||||
|
stringResource(R.string.ui_recorder_lowOnStorage_hintANDswitchSaveFolder)
|
||||||
|
else stringResource(R.string.ui_recorder_lowOnStorage_hint)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,4 +194,5 @@
|
|||||||
<string name="ui_recorder_action_saveCurrent">Save now?</string>
|
<string name="ui_recorder_action_saveCurrent">Save now?</string>
|
||||||
<string name="ui_recorder_action_saveCurrent_explanation">You can save the current ongoing recording by pressing and holding down on the save button. The recording will continue in the background.</string>
|
<string name="ui_recorder_action_saveCurrent_explanation">You can save the current ongoing recording by pressing and holding down on the save button. The recording will continue in the background.</string>
|
||||||
<string name="ui_recorder_lowOnStorage_hint">You are low on storage. Alibi may not function properly. Please free up some space.</string>
|
<string name="ui_recorder_lowOnStorage_hint">You are low on storage. Alibi may not function properly. Please free up some space.</string>
|
||||||
|
<string name="ui_recorder_lowOnStorage_hintANDswitchSaveFolder">You are low on storage. Alibi may not function properly. Please free up some space. Alternatively, change the batches folder to a different location in the settings.</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user