mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 11:25:34 -04:00
removed showToast Mehtod added extension function of toast
This commit is contained in:
parent
64108fc6c6
commit
31e90b1468
@ -129,7 +129,7 @@ class AddNoteDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun onFailureToCreateAddNoteDialog() {
|
private fun onFailureToCreateAddNoteDialog() {
|
||||||
showToast(R.string.error_file_not_found, Toast.LENGTH_LONG)
|
context.toast(R.string.error_file_not_found, Toast.LENGTH_LONG)
|
||||||
closeKeyboard()
|
closeKeyboard()
|
||||||
requireFragmentManager().beginTransaction().remove(this).commit()
|
requireFragmentManager().beginTransaction().remove(this).commit()
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ class AddNoteDialog : DialogFragment() {
|
|||||||
TAG,
|
TAG,
|
||||||
"WRITE_EXTERNAL_STORAGE permission not granted"
|
"WRITE_EXTERNAL_STORAGE permission not granted"
|
||||||
)
|
)
|
||||||
showToast(R.string.note_save_unsuccessful, Toast.LENGTH_LONG)
|
context.toast(R.string.note_save_unsuccessful, Toast.LENGTH_LONG)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val notesFolder = File(zimNotesDirectory)
|
val notesFolder = File(zimNotesDirectory)
|
||||||
@ -359,7 +359,7 @@ class AddNoteDialog : DialogFragment() {
|
|||||||
val fileOutputStream = FileOutputStream(noteFile)
|
val fileOutputStream = FileOutputStream(noteFile)
|
||||||
fileOutputStream.write(noteText.toByteArray())
|
fileOutputStream.write(noteText.toByteArray())
|
||||||
fileOutputStream.close()
|
fileOutputStream.close()
|
||||||
showToast(R.string.note_save_successful, Toast.LENGTH_SHORT)
|
context.toast(R.string.note_save_successful, Toast.LENGTH_SHORT)
|
||||||
noteEdited = false // As no unsaved changes remain
|
noteEdited = false // As no unsaved changes remain
|
||||||
enableDeleteNoteMenuItem()
|
enableDeleteNoteMenuItem()
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
@ -449,7 +449,7 @@ class AddNoteDialog : DialogFragment() {
|
|||||||
Uri.fromFile(noteFile)
|
Uri.fromFile(noteFile)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast(R.string.note_share_error_file_missing, Toast.LENGTH_SHORT)
|
context.toast(R.string.note_share_error_file_missing, Toast.LENGTH_SHORT)
|
||||||
}
|
}
|
||||||
if (noteFileUri != null) {
|
if (noteFileUri != null) {
|
||||||
val noteFileShareIntent = Intent(Intent.ACTION_SEND)
|
val noteFileShareIntent = Intent(Intent.ACTION_SEND)
|
||||||
@ -466,10 +466,6 @@ class AddNoteDialog : DialogFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showToast(stringResource: Int, duration: Int) {
|
|
||||||
Toast.makeText(activity, stringResource, duration).show()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun dismissAddNoteDialog() {
|
private fun dismissAddNoteDialog() {
|
||||||
val dialog = dialog
|
val dialog = dialog
|
||||||
dialog?.dismiss()
|
dialog?.dismiss()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user