mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
cap the filesize at 10MB
This commit is contained in:
@ -161,10 +161,14 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
|
||||
private fun openFile() {
|
||||
FilePickerDialog(this) {
|
||||
val filename = it.getFilenameFromPath()
|
||||
val content = File(it).readText()
|
||||
val note = Note(0, filename, content, TYPE_NOTE)
|
||||
addNewNote(note)
|
||||
if (File(it).length() > 10) {
|
||||
toast(R.string.file_too_large)
|
||||
} else {
|
||||
val filename = it.getFilenameFromPath()
|
||||
val content = File(it).readText()
|
||||
val note = Note(0, filename, content, TYPE_NOTE)
|
||||
addNewNote(note)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user