Skip to content

Commit

Permalink
Cleaned up code
Browse files Browse the repository at this point in the history
  • Loading branch information
OmGodse committed Dec 17, 2023
1 parent c45cb03 commit 096279c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
12 changes: 4 additions & 8 deletions app/src/main/java/android/print/PostPDFGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ object PostPDFGenerator {
}

val pages = arrayOf(PageRange.ALL_PAGES)
val fileDescriptor = getFileDescriptor(file)
if (!file.exists()) {
file.createNewFile()
}
val fileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE)
adapter.onWrite(pages, fileDescriptor, null, onWriteResult)
}

Expand All @@ -66,13 +69,6 @@ object PostPDFGenerator {
return builder.build()
}

private fun getFileDescriptor(file: File): ParcelFileDescriptor {
if (!file.exists()) {
file.createNewFile()
}
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_WRITE)
}

interface OnResult {

fun onSuccess(file: File)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,4 @@
<string name="libraries">Bibliotecas</string>
<string name="rate">Calificar esta app</string>
<string name="send_feedback">Enviar comentarios</string>
</resources>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-ro/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@
<string name="send_feedback">Trimite feedback</string>

<!-- Widget -->
<string name="single_note">Notă unică</string>
<string name="single_note_or_list">Notă unică</string>
<string name="select_note">Selectați nota</string>
</resources>

0 comments on commit 096279c

Please sign in to comment.