cap the filesize at 10MB

This commit is contained in:
tibbi 2017-03-07 19:58:20 +01:00
parent 4e845db003
commit 87a17a671a
10 changed files with 17 additions and 4 deletions

View File

@ -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)
}
}
}

View File

@ -16,6 +16,7 @@
<string name="general_note">Hauptnotiz</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="widget_note">Widget Notiz</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">Nota principal</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="note_font_size">Tamaño de fuente</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">Note générale</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="widget_note">Note utilisée dans le widget</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">Alapértelmezett jegyzet</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="widget_note">A widget-ben használt jegyzet</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="note_font_size">Note font size</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">全般メモ</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="note_font_size">メモのフォントサイズ</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">Nota genérica</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="note_font_size">Tamanho do texto da nota</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="note_font_size">Note font size</string>

View File

@ -16,6 +16,7 @@
<string name="general_note">General note</string>
<string name="open_file">Open file</string>
<string name="save_as_file">Save as file</string>
<string name="file_too_large">File too large, the limit is 10MB</string>
<!-- Settings -->
<string name="widget_note">Note used in widget</string>