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