mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-04-13 15:02:05 +02:00
do not allow opening videos and images
This commit is contained in:
parent
0c8003105a
commit
d29473aa47
@ -32,7 +32,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.9.2'
|
||||
compile 'com.simplemobiletools:commons:2.9.3'
|
||||
compile 'com.facebook.stetho:stetho:1.4.1'
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
|
@ -164,14 +164,20 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
|
||||
private fun openFile() {
|
||||
FilePickerDialog(this) {
|
||||
if (File(it).length() > 10 * 1000 * 1000) {
|
||||
val file = File(it)
|
||||
if (file.isImageVideoGif()) {
|
||||
toast(R.string.invalid_file_format)
|
||||
return@FilePickerDialog
|
||||
}
|
||||
|
||||
if (file.length() > 10 * 1000 * 1000) {
|
||||
toast(R.string.file_too_large)
|
||||
} else {
|
||||
val filename = it.getFilenameFromPath()
|
||||
if (mDb.doesTitleExist(filename)) {
|
||||
toast(R.string.title_taken)
|
||||
} else {
|
||||
val content = File(it).readText()
|
||||
val content = file.readText()
|
||||
val note = Note(0, filename, content, TYPE_NOTE)
|
||||
addNewNote(note)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user