From 096279c11c59e82fe563587625d9ced22c24ced8 Mon Sep 17 00:00:00 2001
From: Om Godse <64728411+OmGodse@users.noreply.github.com>
Date: Sun, 17 Dec 2023 23:50:32 +0530
Subject: [PATCH] Cleaned up code
---
app/src/main/java/android/print/PostPDFGenerator.kt | 12 ++++--------
.../values-es/{Update strings.xml => strings.xml} | 2 +-
app/src/main/res/values-ro/strings.xml | 2 +-
3 files changed, 6 insertions(+), 10 deletions(-)
rename app/src/main/res/values-es/{Update strings.xml => strings.xml} (99%)
diff --git a/app/src/main/java/android/print/PostPDFGenerator.kt b/app/src/main/java/android/print/PostPDFGenerator.kt
index 7c871e26..904d14fc 100644
--- a/app/src/main/java/android/print/PostPDFGenerator.kt
+++ b/app/src/main/java/android/print/PostPDFGenerator.kt
@@ -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)
}
@@ -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)
diff --git a/app/src/main/res/values-es/Update strings.xml b/app/src/main/res/values-es/strings.xml
similarity index 99%
rename from app/src/main/res/values-es/Update strings.xml
rename to app/src/main/res/values-es/strings.xml
index 061204d5..a8dd78d1 100644
--- a/app/src/main/res/values-es/Update strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -114,4 +114,4 @@
Bibliotecas
Calificar esta app
Enviar comentarios
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml
index 02af301d..429b8f9f 100644
--- a/app/src/main/res/values-ro/strings.xml
+++ b/app/src/main/res/values-ro/strings.xml
@@ -122,6 +122,6 @@
Trimite feedback
- Notă unică
+ Notă unică
Selectați nota