mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-06-05 17:00:23 +02:00
update commons to 2.13.4
This commit is contained in:
@ -194,22 +194,21 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
try {
|
||||
val file = File(path)
|
||||
if (file.isDirectory) {
|
||||
toast(R.string.directory_exists)
|
||||
toast(R.string.name_taken)
|
||||
return
|
||||
}
|
||||
|
||||
if (needsStupidWritePermissions(path)) {
|
||||
if (isShowingPermDialog(file))
|
||||
return
|
||||
|
||||
var document = getFileDocument(path, config.treeUri) ?: return
|
||||
if (!file.exists()) {
|
||||
document = document.createFile("", file.name)
|
||||
}
|
||||
contentResolver.openOutputStream(document.uri).apply {
|
||||
write(content.toByteArray(Charset.forName("UTF-8")), 0, content.length)
|
||||
flush()
|
||||
close()
|
||||
handleSAFDialog(file) {
|
||||
var document = getFileDocument(path, config.treeUri) ?: return@handleSAFDialog
|
||||
if (!file.exists()) {
|
||||
document = document.createFile("", file.name)
|
||||
}
|
||||
contentResolver.openOutputStream(document.uri).apply {
|
||||
write(content.toByteArray(Charset.forName("UTF-8")), 0, content.length)
|
||||
flush()
|
||||
close()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
file.printWriter().use { out ->
|
||||
@ -254,11 +253,8 @@ class MainActivity : SimpleActivity(), ViewPager.OnPageChangeListener {
|
||||
initViewPager()
|
||||
|
||||
if (deleteFile) {
|
||||
val file = File(path)
|
||||
if (!file.delete() && !tryFastDocumentDelete(file)) {
|
||||
val document = getFileDocument(path, config.treeUri) ?: return
|
||||
|
||||
if (!document.isFile || !document.delete()) {
|
||||
deleteFile(File(path)) {
|
||||
if (!it) {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
RadioItem(FONT_SIZE_EXTRA_LARGE, res.getString(R.string.extra_large)))
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.fontSize) {
|
||||
config.fontSize = it
|
||||
config.fontSize = it as Int
|
||||
settings_font_size.text = getFontSizeText()
|
||||
updateWidget()
|
||||
}
|
||||
@ -89,7 +89,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
RadioItem(GRAVITY_RIGHT, res.getString(R.string.right)))
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.gravity) {
|
||||
config.gravity = it
|
||||
config.gravity = it as Int
|
||||
settings_gravity.text = getGravityText()
|
||||
updateWidget()
|
||||
}
|
||||
@ -114,7 +114,7 @@ class SettingsActivity : SimpleActivity() {
|
||||
val items = notes.map { RadioItem(it.id, it.title) } as ArrayList
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.widgetNoteId) {
|
||||
config.widgetNoteId = it
|
||||
config.widgetNoteId = it as Int
|
||||
settings_widget_note.text = getCurrentWidgetNoteTitle(it, notes)
|
||||
updateWidget()
|
||||
}
|
||||
|
Reference in New Issue
Block a user