From 84375597b60992d122d3ef3cbfcf8d892c68f757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 6 Jul 2023 12:53:47 +0200 Subject: [PATCH 1/7] Support opening password protected PDF files This closes #712 --- .../pro/activities/PDFViewerActivity.kt | 34 +++++++++++++-- .../pro/dialogs/EnterPasswordDialog.kt | 42 +++++++++++++++++++ .../main/res/layout/dialog_enter_password.xml | 26 ++++++++++++ app/src/main/res/values-ar/strings.xml | 6 ++- app/src/main/res/values-az/strings.xml | 4 ++ app/src/main/res/values-be/strings.xml | 6 ++- app/src/main/res/values-bg/strings.xml | 6 ++- app/src/main/res/values-ca/strings.xml | 4 ++ app/src/main/res/values-cs/strings.xml | 6 ++- app/src/main/res/values-cy/strings.xml | 4 ++ app/src/main/res/values-da/strings.xml | 4 ++ app/src/main/res/values-de/strings.xml | 6 ++- app/src/main/res/values-el/strings.xml | 4 ++ app/src/main/res/values-eo/strings.xml | 4 ++ app/src/main/res/values-es/strings.xml | 6 ++- app/src/main/res/values-et/strings.xml | 4 ++ app/src/main/res/values-fi/strings.xml | 6 ++- app/src/main/res/values-fr/strings.xml | 4 ++ app/src/main/res/values-gl/strings.xml | 6 ++- app/src/main/res/values-hi/strings.xml | 4 ++ app/src/main/res/values-hr/strings.xml | 6 ++- app/src/main/res/values-hu/strings.xml | 6 ++- app/src/main/res/values-in/strings.xml | 6 ++- app/src/main/res/values-is/strings.xml | 4 ++ app/src/main/res/values-it/strings.xml | 6 ++- app/src/main/res/values-iw/strings.xml | 4 ++ app/src/main/res/values-ja/strings.xml | 6 ++- app/src/main/res/values-ko-rKR/strings.xml | 4 ++ app/src/main/res/values-lt/strings.xml | 4 ++ app/src/main/res/values-nb-rNO/strings.xml | 4 ++ app/src/main/res/values-nl/strings.xml | 6 ++- app/src/main/res/values-pa-rPK/strings.xml | 6 ++- app/src/main/res/values-pl/strings.xml | 4 ++ app/src/main/res/values-pt-rBR/strings.xml | 4 ++ app/src/main/res/values-pt/strings.xml | 6 ++- app/src/main/res/values-ro/strings.xml | 6 ++- app/src/main/res/values-ru/strings.xml | 6 ++- app/src/main/res/values-sk/strings.xml | 4 ++ app/src/main/res/values-sl/strings.xml | 6 ++- app/src/main/res/values-sr/strings.xml | 4 ++ app/src/main/res/values-sv/strings.xml | 6 ++- app/src/main/res/values-ta/strings.xml | 4 ++ app/src/main/res/values-th/strings.xml | 4 ++ app/src/main/res/values-tr/strings.xml | 4 ++ app/src/main/res/values-uk/strings.xml | 4 ++ app/src/main/res/values-zh-rCN/strings.xml | 6 ++- app/src/main/res/values-zh-rTW/strings.xml | 4 ++ app/src/main/res/values/strings.xml | 5 +++ 48 files changed, 301 insertions(+), 24 deletions(-) create mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt create mode 100644 app/src/main/res/layout/dialog_enter_password.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 8dc4a942..a36a544f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -3,20 +3,26 @@ package com.simplemobiletools.filemanager.pro.activities import android.content.Context import android.content.res.Configuration import android.graphics.Color +import android.net.Uri import android.os.Bundle import android.print.PrintAttributes import android.print.PrintManager import android.view.WindowManager import android.widget.RelativeLayout import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle +import com.shockwave.pdfium.PdfPasswordException import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.isPiePlus import com.simplemobiletools.filemanager.pro.R +import com.simplemobiletools.filemanager.pro.dialogs.EnterPasswordDialog import com.simplemobiletools.filemanager.pro.extensions.hideSystemUI import com.simplemobiletools.filemanager.pro.extensions.showSystemUI import com.simplemobiletools.filemanager.pro.helpers.PdfDocumentAdapter -import kotlinx.android.synthetic.main.activity_pdf_viewer.* +import kotlinx.android.synthetic.main.activity_pdf_viewer.pdf_viewer +import kotlinx.android.synthetic.main.activity_pdf_viewer.pdf_viewer_appbar +import kotlinx.android.synthetic.main.activity_pdf_viewer.pdf_viewer_toolbar +import kotlinx.android.synthetic.main.activity_pdf_viewer.top_shadow class PDFViewerActivity : SimpleActivity() { private var realFilePath = "" @@ -91,15 +97,32 @@ class PDFViewerActivity : SimpleActivity() { return } + loadPdfViewer(uri) + } + + private fun loadPdfViewer(uri: Uri, filePassword: String? = null) { val primaryColor = getProperPrimaryColor() pdf_viewer.setBackgroundColor(getProperBackgroundColor()) pdf_viewer.fromUri(uri) + .password(filePassword) .scrollHandle(DefaultScrollHandle(this, primaryColor.getContrastColor(), primaryColor)) .spacing(15) .onTap { toggleFullScreen() } .onError { - showErrorToast(it.localizedMessage?.toString() ?: getString(R.string.unknown_error_occurred)) - finish() + if (it is PdfPasswordException) { + // Already entered a password and it was wrong + if (filePassword != null) { + it.showToastAndFinish() + } else { + EnterPasswordDialog( + this, + callback = { password -> loadPdfViewer(uri, password) }, + cancelCallback = { it.showToastAndFinish() } + ) + } + } else { + it.showToastAndFinish() + } } .load() @@ -151,4 +174,9 @@ class PDFViewerActivity : SimpleActivity() { window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) } } + + private fun Throwable.showToastAndFinish() { + showErrorToast(localizedMessage?.toString() ?: getString(R.string.unknown_error_occurred)) + finish() + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt new file mode 100644 index 00000000..428db6bc --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt @@ -0,0 +1,42 @@ +package com.simplemobiletools.filemanager.pro.dialogs + +import androidx.appcompat.app.AlertDialog +import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.filemanager.pro.R +import kotlinx.android.synthetic.main.dialog_enter_password.view.password + +class EnterPasswordDialog( + val activity: BaseSimpleActivity, + private val callback: (password: String) -> Unit, + private val cancelCallback: () -> Unit +) { + init { + val view = activity.layoutInflater.inflate(R.layout.dialog_enter_password, null) + + activity.getAlertDialogBuilder() + .setPositiveButton(R.string.ok, null) + .setNegativeButton(R.string.cancel, null) + .apply { + activity.setupDialogStuff(view, this, R.string.enter_password) { alertDialog -> + alertDialog.showKeyboard(view.password) + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { + val password = view.password.value + + if (password.isEmpty()) { + activity.toast(R.string.empty_password) + return@setOnClickListener + } + + callback(password) + alertDialog.setOnDismissListener(null) + alertDialog.dismiss() + } + + alertDialog.setOnDismissListener { + cancelCallback() + } + } + } + } +} diff --git a/app/src/main/res/layout/dialog_enter_password.xml b/app/src/main/res/layout/dialog_enter_password.xml new file mode 100644 index 00000000..473e2ba8 --- /dev/null +++ b/app/src/main/res/layout/dialog_enter_password.xml @@ -0,0 +1,26 @@ + + + + + + + + + diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 8aee14a7..98605c40 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -50,6 +50,10 @@ الاخرين free إجمالي مساحة التخزين: %s + + Enter password + Password + Please enter the password تفعيل الدخول الى مسار الروت تتطلب الضغط على رجوع مرتين لمغادرة التطبيق @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 49a973cd..f5ae29d1 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -55,6 +55,10 @@ Others free Total storage: %s + + Enter password + Password + Please enter the password Root icazəsini aktivləşdir diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml index bc18e9ad..08968167 100644 --- a/app/src/main/res/values-be/strings.xml +++ b/app/src/main/res/values-be/strings.xml @@ -50,6 +50,10 @@ Іншае бясплатна Агульная памяць: %s + + Enter password + Password + Please enter the password Уключыць каранёвы доступ Патрабуецца двойчы націснуць \"Назад\", каб выйсці з праграмы @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index c360a287..b934e5f3 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -50,6 +50,10 @@ Други free Общо място за съхранение: %s + + Enter password + Password + Please enter the password Активиране на root достъп Натискане два пъти Назад за излизане от приложението @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index d4f3da5d..c868d333 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -50,6 +50,10 @@ Altres lliure Emmagatzematge total: %s + + Enter password + Password + Please enter the password Habilita l\'accés «root» Cal que premeu Enrere dues vegades per sortir de l\'aplicació diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index a53f0f27..2a19f5d5 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -50,6 +50,10 @@ Ostatní volné Úložiště celkem: %s + + Enter password + Password + Please enter the password Povolit přístup jako root Pro opuštění aplikace vyžadovat stisknutí Zpět dvakrát @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-cy/strings.xml b/app/src/main/res/values-cy/strings.xml index 81e5e403..72a51ff2 100644 --- a/app/src/main/res/values-cy/strings.xml +++ b/app/src/main/res/values-cy/strings.xml @@ -55,6 +55,10 @@ Others free Total storage: %s + + Enter password + Password + Please enter the password Galluogi mynediad craidd diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 11c5089f..b2b47301 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -50,6 +50,10 @@ Andre fri Samlet lagerplads: %s + + Enter password + Password + Please enter the password Aktiver root-adgang Kræv to tryk på tilbage for at forlade appen diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f58601d9..be7bf97e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -50,6 +50,10 @@ Andere frei Gesamter Speicherplatz: %s + + Enter password + Password + Please enter the password Root-Zugriff erlauben Zweimaliges Drücken von Zurück ist erforderlich, um die Anwendung zu verlassen @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 81a65e03..08370b71 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -55,6 +55,10 @@ Άλλα ελεύθερα Σύνολο: %s + + Enter password + Password + Please enter the password Ενεργοποιήστε την πρόσβαση ριζικού καταλόγου diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index 5f4bcac9..dcf46cfb 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -50,6 +50,10 @@ Aliaj free Total storage: %s + + Enter password + Password + Please enter the password Enable root access Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index ebc4a3a7..31584332 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -50,6 +50,10 @@ Otros libre Almacenamiento total: %s + + Enter password + Password + Please enter the password Activar acceso root Se requiere presionar el botón atras dos veces para salir de la app @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 956f07b7..ef16368c 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -50,6 +50,10 @@ Muud failid vaba Kogu salvestusruum: %s + + Enter password + Password + Please enter the password Luba ligipääs juurkasutajale Rakendusest väljumiseks eelda kahte Tagasi-nupu vajutust diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index bc13b674..ccd4f71a 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -50,6 +50,10 @@ Muut ilmainen Tallennustila: %s + + Enter password + Password + Please enter the password Ota käyttöön root-ominaisuudet Ota käyttöön sovelluksesta poistuminen kahdella takaisin-painikkeen painalluksella @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d16fe02e..9e6cd9f7 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -50,6 +50,10 @@ Autres libre Stockage total : %s + + Enter password + Password + Please enter the password Activer les droits root Obligation d\'appuyer deux fois sur la touche Retour pour quitter l\'application diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 958b42a8..729dee12 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -50,6 +50,10 @@ Outros ceibe Almacenamento total: %s + + Enter password + Password + Please enter the password Activar acceso root Require premer Atrás dúas veces para saír da aplicación @@ -57,4 +61,4 @@ Non atopou todas as cadeas que debería traducir? Existen algunhas máis en https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 0083286a..38cc2911 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -54,6 +54,10 @@ Others free Total storage: %s + + Enter password + Password + Please enter the password रूट एक्सेस diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 9e17875f..68915708 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -50,6 +50,10 @@ Ostali slobodno Ukupna memorija: %s + + Enter password + Password + Please enter the password Aktiviraj administratorski pristup Zahtijevaj pritiskanje gumba „Natrag” dvaput za napuštanje aplikacije @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f92f804f..f9b23162 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -50,6 +50,10 @@ Egyebek szabad Összes tárhely: %s + + Enter password + Password + Please enter the password Root hozzáférés engedélyezése A Vissza gombot kétszer kelljen megnyomni az alkalmazásból történő kilépéshez @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 3334a5a4..be0b1e69 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -50,6 +50,10 @@ Lainnya free Total penyimpanan: %s + + Enter password + Password + Please enter the password Aktifkan akses root Wajib tekan tombol kembali dua kali untuk keluar aplikasi @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 3f7bae05..0912d0db 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -50,6 +50,10 @@ Annað laust Samtals geymslupláss: %s + + Enter password + Password + Please enter the password Virkja aðgang að rót Krefjast þess að ýta tvisvar á „til baka“ til að loka forriti diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 75e3f38f..cb1f6ce2 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -50,6 +50,10 @@ Altri libero Memoria totale: %s + + Enter password + Password + Please enter the password Abilita accesso root Richiedi di premere Indietro due volte per uscire dall\'app @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 388be542..1150dfc6 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -50,6 +50,10 @@ אחרים חינם שטח אחסון כולל: %s + + Enter password + Password + Please enter the password אפשר גישת שורש דרוש לחיצה על חזרה פעמיים כדי לצאת מהאפליקציה דרוש לחיצה על חזרה פעמיים כדי לצאת מהאפליקציה diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 4ced382a..6c78af84 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -50,6 +50,10 @@ その他 空き 合計ストレージ: %s + + Enter password + Password + Please enter the password ルートアクセスを有効にする 戻るボタンを2回押してアプリを閉じる @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 84bb4e82..d2a5dcd1 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -55,6 +55,10 @@ Others free Total storage: %s + + Enter password + Password + Please enter the password 루트 접근 활성화 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 6e87382a..464440a5 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -50,6 +50,10 @@ Kiti laisva Total storage: %s + + Enter password + Password + Please enter the password Enable root access Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 3fde9494..f48715bb 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -50,6 +50,10 @@ Others ledig Total lagring: %s + + Enter password + Password + Please enter the password Aktiver root-tilgang Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 67c256e5..da121f0c 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -50,6 +50,10 @@ Overig vrij Totale opslag: %s + + Enter password + Password + Please enter the password Root-toegang inschakelen Twee keer op de terugknop drukken om af te sluiten @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-pa-rPK/strings.xml b/app/src/main/res/values-pa-rPK/strings.xml index 0d953bd1..bf2ee53d 100644 --- a/app/src/main/res/values-pa-rPK/strings.xml +++ b/app/src/main/res/values-pa-rPK/strings.xml @@ -50,7 +50,11 @@ ہور اُپلبدھ ‫ساری سٹوریج:؜ %s‬ + + Enter password + Password + Please enter the password روٹ دی پہنچ چالو کرو بند کرن لئی دو وار پچھلے دباؤݨ دی لوڑ اے - \ No newline at end of file + diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index da93ac4d..7dac034c 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -50,6 +50,10 @@ Inne wolne Całkowita pamięć: %s + + Enter password + Password + Please enter the password Włącz dostęp do roota Wymagaj dwukrotnego naciśnięcia przycisku Wstecz, aby wyjść z aplikacji diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 755b08fb..3c464cd1 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -55,6 +55,10 @@ Outros Livre Armazenamento total: %s + + Enter password + Password + Please enter the password Ativar o acesso ao root diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 9d33e75e..2b442c04 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -50,6 +50,10 @@ Outros livre Armazenamento total: %s + + Enter password + Password + Please enter the password Conceder acesso root Premir duas vezes a tecla Back para sair da aplicação @@ -57,4 +61,4 @@ Não encontrou todas as cadeias a traduzir? Existem mais algumas em https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ 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 0fb2f2c3..93d48741 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -50,6 +50,10 @@ Altele liber Spaţiu de stocare total: %s + + Enter password + Password + Please enter the password Activați accesul root Trebuie să apăsați de două ori butonul Înapoi pentru a părăsi aplicația @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 183554ea..b42bb882 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -50,6 +50,10 @@ Другое свободно Полный объём: %s + + Enter password + Password + Please enter the password Включить root-доступ Двойное нажатие кнопки «Назад» для выхода из приложения @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 0cc36a47..8395d464 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -55,6 +55,10 @@ Iné využitých Úložisko celkom: %s + + Enter password + Password + Please enter the password Povoliť prístup ku koreňovým súborom diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 999fa690..1ab55267 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -50,7 +50,11 @@ Ostali prosto Skupno prostora za shranjevanje: %s + + Enter password + Password + Please enter the password Omogoči root (korenski) dostop Dvakratni pritisk nazaj za izhod iz aplikacije - \ No newline at end of file + diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 8d1de85f..f7186756 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -50,6 +50,10 @@ Други бесплатно Укупно складиште: %s + + Enter password + Password + Please enter the password Омогућите роот приступ Захтевајте да двапут притиснете Назад да бисте напустили апликацију diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b2ecea12..4a60bf0f 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -50,6 +50,10 @@ Annat ledigt Total lagring: %s + + Enter password + Password + Please enter the password Aktivera rotåtkomst Krävs att trycka tillbaka två gånger för att lämna appen @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index f2ba6e49..0d9d0ead 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -50,6 +50,10 @@ மற்றவை மீதம் மொத்த சேமிப்பிடம்: %s + + Enter password + Password + Please enter the password ரூட் அணுகலை இயக்கு செயலியை வெளியேற இரண்டு முறை பின் அழுத்த கோரு diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 29be3f29..486f4ffe 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -55,6 +55,10 @@ Others free Total storage: %s + + Enter password + Password + Please enter the password Enable root access diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index e0ff642c..d725d345 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -50,6 +50,10 @@ Diğerleri boş Toplam depolama: %s + + Enter password + Password + Please enter the password Root erişimini etkinleştir Uygulamadan çıkmak için Geri tuşuna iki kez basmayı gerektir diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 9ff4679e..fd41bada 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -50,6 +50,10 @@ Інше free Всього пам\'яті: %s + + Enter password + Password + Please enter the password Активувати root-доступ Натисніть Назад двічі, щоб вийти з додатка diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index c8973caf..a03d5cbd 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -50,6 +50,10 @@ 其他 空闲 总存储: %s + + Enter password + Password + Please enter the password 启用 root 访问 需要按两次返回键才能离开应用程序 @@ -57,4 +61,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index d268d081..ab7c6b55 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -50,6 +50,10 @@ 其他 free 總儲存空間:%s + + Enter password + Password + Please enter the password 啟用root權限 需按兩次返回鍵才能離開 app diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 29be3f29..a7bb4586 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -56,6 +56,11 @@ free Total storage: %s + + Enter password + Password + Please enter the password + Enable root access Require pressing Back twice to leave the app From e78a8a0430b2751405c449860b0d7827b6e02a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 6 Jul 2023 14:13:22 +0200 Subject: [PATCH 2/7] Use enter password dialog from commons --- app/build.gradle | 2 +- .../pro/activities/PDFViewerActivity.kt | 12 +++--- .../pro/dialogs/EnterPasswordDialog.kt | 42 ------------------- .../main/res/layout/dialog_enter_password.xml | 26 ------------ app/src/main/res/values-ar/strings.xml | 4 -- app/src/main/res/values-az/strings.xml | 4 -- app/src/main/res/values-be/strings.xml | 4 -- app/src/main/res/values-bg/strings.xml | 4 -- app/src/main/res/values-ca/strings.xml | 4 -- app/src/main/res/values-cs/strings.xml | 4 -- app/src/main/res/values-cy/strings.xml | 4 -- app/src/main/res/values-da/strings.xml | 4 -- app/src/main/res/values-de/strings.xml | 4 -- app/src/main/res/values-el/strings.xml | 4 -- app/src/main/res/values-eo/strings.xml | 4 -- app/src/main/res/values-es/strings.xml | 4 -- app/src/main/res/values-et/strings.xml | 4 -- app/src/main/res/values-fi/strings.xml | 4 -- app/src/main/res/values-fr/strings.xml | 4 -- app/src/main/res/values-gl/strings.xml | 4 -- app/src/main/res/values-hi/strings.xml | 4 -- app/src/main/res/values-hr/strings.xml | 4 -- app/src/main/res/values-hu/strings.xml | 4 -- app/src/main/res/values-in/strings.xml | 4 -- app/src/main/res/values-is/strings.xml | 4 -- app/src/main/res/values-it/strings.xml | 4 -- app/src/main/res/values-iw/strings.xml | 4 -- app/src/main/res/values-ja/strings.xml | 4 -- app/src/main/res/values-ko-rKR/strings.xml | 4 -- app/src/main/res/values-lt/strings.xml | 4 -- app/src/main/res/values-nb-rNO/strings.xml | 4 -- app/src/main/res/values-nl/strings.xml | 4 -- app/src/main/res/values-pa-rPK/strings.xml | 4 -- app/src/main/res/values-pl/strings.xml | 4 -- app/src/main/res/values-pt-rBR/strings.xml | 6 +-- app/src/main/res/values-pt/strings.xml | 4 -- app/src/main/res/values-ro/strings.xml | 4 -- app/src/main/res/values-ru/strings.xml | 4 -- app/src/main/res/values-sk/strings.xml | 4 -- app/src/main/res/values-sl/strings.xml | 4 -- app/src/main/res/values-sr/strings.xml | 4 -- app/src/main/res/values-sv/strings.xml | 4 -- app/src/main/res/values-ta/strings.xml | 4 -- app/src/main/res/values-th/strings.xml | 4 -- app/src/main/res/values-tr/strings.xml | 4 -- app/src/main/res/values-uk/strings.xml | 4 -- app/src/main/res/values-zh-rCN/strings.xml | 4 -- app/src/main/res/values-zh-rTW/strings.xml | 4 -- app/src/main/res/values/strings.xml | 5 --- 49 files changed, 8 insertions(+), 257 deletions(-) delete mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt delete mode 100644 app/src/main/res/layout/dialog_enter_password.xml diff --git a/app/build.gradle b/app/build.gradle index 6bf0bc9d..6ee0a7d0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:84c71fdcc1' + implementation 'com.github.SimpleMobileTools:Simple-Commons:db25f91be3' implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index a36a544f..2e6c4187 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -11,11 +11,11 @@ import android.view.WindowManager import android.widget.RelativeLayout import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle import com.shockwave.pdfium.PdfPasswordException +import com.simplemobiletools.commons.dialogs.EnterPasswordDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.isPiePlus import com.simplemobiletools.filemanager.pro.R -import com.simplemobiletools.filemanager.pro.dialogs.EnterPasswordDialog import com.simplemobiletools.filemanager.pro.extensions.hideSystemUI import com.simplemobiletools.filemanager.pro.extensions.showSystemUI import com.simplemobiletools.filemanager.pro.helpers.PdfDocumentAdapter @@ -112,16 +112,18 @@ class PDFViewerActivity : SimpleActivity() { if (it is PdfPasswordException) { // Already entered a password and it was wrong if (filePassword != null) { - it.showToastAndFinish() + showErrorToast(getString(R.string.invalid_password)) + finish() } else { EnterPasswordDialog( this, callback = { password -> loadPdfViewer(uri, password) }, - cancelCallback = { it.showToastAndFinish() } + cancelCallback = { finish() } ) } } else { - it.showToastAndFinish() + showErrorToast(it.localizedMessage?.toString() ?: getString(R.string.unknown_error_occurred)) + finish() } } .load() @@ -176,7 +178,5 @@ class PDFViewerActivity : SimpleActivity() { } private fun Throwable.showToastAndFinish() { - showErrorToast(localizedMessage?.toString() ?: getString(R.string.unknown_error_occurred)) - finish() } } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt deleted file mode 100644 index 428db6bc..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/EnterPasswordDialog.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.simplemobiletools.filemanager.pro.dialogs - -import androidx.appcompat.app.AlertDialog -import com.simplemobiletools.commons.activities.BaseSimpleActivity -import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.filemanager.pro.R -import kotlinx.android.synthetic.main.dialog_enter_password.view.password - -class EnterPasswordDialog( - val activity: BaseSimpleActivity, - private val callback: (password: String) -> Unit, - private val cancelCallback: () -> Unit -) { - init { - val view = activity.layoutInflater.inflate(R.layout.dialog_enter_password, null) - - activity.getAlertDialogBuilder() - .setPositiveButton(R.string.ok, null) - .setNegativeButton(R.string.cancel, null) - .apply { - activity.setupDialogStuff(view, this, R.string.enter_password) { alertDialog -> - alertDialog.showKeyboard(view.password) - alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { - val password = view.password.value - - if (password.isEmpty()) { - activity.toast(R.string.empty_password) - return@setOnClickListener - } - - callback(password) - alertDialog.setOnDismissListener(null) - alertDialog.dismiss() - } - - alertDialog.setOnDismissListener { - cancelCallback() - } - } - } - } -} diff --git a/app/src/main/res/layout/dialog_enter_password.xml b/app/src/main/res/layout/dialog_enter_password.xml deleted file mode 100644 index 473e2ba8..00000000 --- a/app/src/main/res/layout/dialog_enter_password.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 98605c40..a5842169 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -50,10 +50,6 @@ الاخرين free إجمالي مساحة التخزين: %s - - Enter password - Password - Please enter the password تفعيل الدخول الى مسار الروت تتطلب الضغط على رجوع مرتين لمغادرة التطبيق diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index f5ae29d1..49a973cd 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -55,10 +55,6 @@ Others free Total storage: %s - - Enter password - Password - Please enter the password Root icazəsini aktivləşdir diff --git a/app/src/main/res/values-be/strings.xml b/app/src/main/res/values-be/strings.xml index 08968167..bb4b5854 100644 --- a/app/src/main/res/values-be/strings.xml +++ b/app/src/main/res/values-be/strings.xml @@ -50,10 +50,6 @@ Іншае бясплатна Агульная памяць: %s - - Enter password - Password - Please enter the password Уключыць каранёвы доступ Патрабуецца двойчы націснуць \"Назад\", каб выйсці з праграмы diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index b934e5f3..155f73af 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -50,10 +50,6 @@ Други free Общо място за съхранение: %s - - Enter password - Password - Please enter the password Активиране на root достъп Натискане два пъти Назад за излизане от приложението diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index c868d333..d4f3da5d 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -50,10 +50,6 @@ Altres lliure Emmagatzematge total: %s - - Enter password - Password - Please enter the password Habilita l\'accés «root» Cal que premeu Enrere dues vegades per sortir de l\'aplicació diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 2a19f5d5..266ab552 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -50,10 +50,6 @@ Ostatní volné Úložiště celkem: %s - - Enter password - Password - Please enter the password Povolit přístup jako root Pro opuštění aplikace vyžadovat stisknutí Zpět dvakrát diff --git a/app/src/main/res/values-cy/strings.xml b/app/src/main/res/values-cy/strings.xml index 72a51ff2..81e5e403 100644 --- a/app/src/main/res/values-cy/strings.xml +++ b/app/src/main/res/values-cy/strings.xml @@ -55,10 +55,6 @@ Others free Total storage: %s - - Enter password - Password - Please enter the password Galluogi mynediad craidd diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index b2b47301..11c5089f 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -50,10 +50,6 @@ Andre fri Samlet lagerplads: %s - - Enter password - Password - Please enter the password Aktiver root-adgang Kræv to tryk på tilbage for at forlade appen diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index be7bf97e..a3d3b312 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -50,10 +50,6 @@ Andere frei Gesamter Speicherplatz: %s - - Enter password - Password - Please enter the password Root-Zugriff erlauben Zweimaliges Drücken von Zurück ist erforderlich, um die Anwendung zu verlassen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 08370b71..81a65e03 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -55,10 +55,6 @@ Άλλα ελεύθερα Σύνολο: %s - - Enter password - Password - Please enter the password Ενεργοποιήστε την πρόσβαση ριζικού καταλόγου diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index dcf46cfb..5f4bcac9 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -50,10 +50,6 @@ Aliaj free Total storage: %s - - Enter password - Password - Please enter the password Enable root access Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 31584332..822d7c69 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -50,10 +50,6 @@ Otros libre Almacenamiento total: %s - - Enter password - Password - Please enter the password Activar acceso root Se requiere presionar el botón atras dos veces para salir de la app diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index ef16368c..956f07b7 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -50,10 +50,6 @@ Muud failid vaba Kogu salvestusruum: %s - - Enter password - Password - Please enter the password Luba ligipääs juurkasutajale Rakendusest väljumiseks eelda kahte Tagasi-nupu vajutust diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index ccd4f71a..89ab2938 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -50,10 +50,6 @@ Muut ilmainen Tallennustila: %s - - Enter password - Password - Please enter the password Ota käyttöön root-ominaisuudet Ota käyttöön sovelluksesta poistuminen kahdella takaisin-painikkeen painalluksella diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 9e6cd9f7..d16fe02e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -50,10 +50,6 @@ Autres libre Stockage total : %s - - Enter password - Password - Please enter the password Activer les droits root Obligation d\'appuyer deux fois sur la touche Retour pour quitter l\'application diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 729dee12..1c5ccaf4 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -50,10 +50,6 @@ Outros ceibe Almacenamento total: %s - - Enter password - Password - Please enter the password Activar acceso root Require premer Atrás dúas veces para saír da aplicación diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 38cc2911..0083286a 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -54,10 +54,6 @@ Others free Total storage: %s - - Enter password - Password - Please enter the password रूट एक्सेस diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 68915708..4df9b4d1 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -50,10 +50,6 @@ Ostali slobodno Ukupna memorija: %s - - Enter password - Password - Please enter the password Aktiviraj administratorski pristup Zahtijevaj pritiskanje gumba „Natrag” dvaput za napuštanje aplikacije diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index f9b23162..d2835f7a 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -50,10 +50,6 @@ Egyebek szabad Összes tárhely: %s - - Enter password - Password - Please enter the password Root hozzáférés engedélyezése A Vissza gombot kétszer kelljen megnyomni az alkalmazásból történő kilépéshez diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index be0b1e69..72363113 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -50,10 +50,6 @@ Lainnya free Total penyimpanan: %s - - Enter password - Password - Please enter the password Aktifkan akses root Wajib tekan tombol kembali dua kali untuk keluar aplikasi diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 0912d0db..3f7bae05 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -50,10 +50,6 @@ Annað laust Samtals geymslupláss: %s - - Enter password - Password - Please enter the password Virkja aðgang að rót Krefjast þess að ýta tvisvar á „til baka“ til að loka forriti diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index cb1f6ce2..002719a9 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -50,10 +50,6 @@ Altri libero Memoria totale: %s - - Enter password - Password - Please enter the password Abilita accesso root Richiedi di premere Indietro due volte per uscire dall\'app diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 1150dfc6..388be542 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -50,10 +50,6 @@ אחרים חינם שטח אחסון כולל: %s - - Enter password - Password - Please enter the password אפשר גישת שורש דרוש לחיצה על חזרה פעמיים כדי לצאת מהאפליקציה דרוש לחיצה על חזרה פעמיים כדי לצאת מהאפליקציה diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 6c78af84..5451ad07 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -50,10 +50,6 @@ その他 空き 合計ストレージ: %s - - Enter password - Password - Please enter the password ルートアクセスを有効にする 戻るボタンを2回押してアプリを閉じる diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index d2a5dcd1..84bb4e82 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -55,10 +55,6 @@ Others free Total storage: %s - - Enter password - Password - Please enter the password 루트 접근 활성화 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 464440a5..6e87382a 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -50,10 +50,6 @@ Kiti laisva Total storage: %s - - Enter password - Password - Please enter the password Enable root access Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index f48715bb..3fde9494 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -50,10 +50,6 @@ Others ledig Total lagring: %s - - Enter password - Password - Please enter the password Aktiver root-tilgang Require pressing Back twice to leave the app diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index da121f0c..e4615a4f 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -50,10 +50,6 @@ Overig vrij Totale opslag: %s - - Enter password - Password - Please enter the password Root-toegang inschakelen Twee keer op de terugknop drukken om af te sluiten diff --git a/app/src/main/res/values-pa-rPK/strings.xml b/app/src/main/res/values-pa-rPK/strings.xml index bf2ee53d..2ff9e129 100644 --- a/app/src/main/res/values-pa-rPK/strings.xml +++ b/app/src/main/res/values-pa-rPK/strings.xml @@ -50,10 +50,6 @@ ہور اُپلبدھ ‫ساری سٹوریج:؜ %s‬ - - Enter password - Password - Please enter the password روٹ دی پہنچ چالو کرو بند کرن لئی دو وار پچھلے دباؤݨ دی لوڑ اے diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 7dac034c..da93ac4d 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -50,10 +50,6 @@ Inne wolne Całkowita pamięć: %s - - Enter password - Password - Please enter the password Włącz dostęp do roota Wymagaj dwukrotnego naciśnięcia przycisku Wstecz, aby wyjść z aplikacji diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 3c464cd1..7f413144 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -55,11 +55,7 @@ Outros Livre Armazenamento total: %s - - Enter password - Password - Please enter the password - + Ativar o acesso ao root Pressione o botão "voltar" duas vezes para sair do app diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 2b442c04..c3fe8cdf 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -50,10 +50,6 @@ Outros livre Armazenamento total: %s - - Enter password - Password - Please enter the password Conceder acesso root Premir duas vezes a tecla Back para sair da aplicação diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 93d48741..3d40a5c1 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -50,10 +50,6 @@ Altele liber Spaţiu de stocare total: %s - - Enter password - Password - Please enter the password Activați accesul root Trebuie să apăsați de două ori butonul Înapoi pentru a părăsi aplicația diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index b42bb882..ff6b08b8 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -50,10 +50,6 @@ Другое свободно Полный объём: %s - - Enter password - Password - Please enter the password Включить root-доступ Двойное нажатие кнопки «Назад» для выхода из приложения diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 8395d464..0cc36a47 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -55,10 +55,6 @@ Iné využitých Úložisko celkom: %s - - Enter password - Password - Please enter the password Povoliť prístup ku koreňovým súborom diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 1ab55267..1c4da224 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -50,10 +50,6 @@ Ostali prosto Skupno prostora za shranjevanje: %s - - Enter password - Password - Please enter the password Omogoči root (korenski) dostop Dvakratni pritisk nazaj za izhod iz aplikacije diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index f7186756..8d1de85f 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -50,10 +50,6 @@ Други бесплатно Укупно складиште: %s - - Enter password - Password - Please enter the password Омогућите роот приступ Захтевајте да двапут притиснете Назад да бисте напустили апликацију diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 4a60bf0f..52469fb5 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -50,10 +50,6 @@ Annat ledigt Total lagring: %s - - Enter password - Password - Please enter the password Aktivera rotåtkomst Krävs att trycka tillbaka två gånger för att lämna appen diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index 0d9d0ead..f2ba6e49 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -50,10 +50,6 @@ மற்றவை மீதம் மொத்த சேமிப்பிடம்: %s - - Enter password - Password - Please enter the password ரூட் அணுகலை இயக்கு செயலியை வெளியேற இரண்டு முறை பின் அழுத்த கோரு diff --git a/app/src/main/res/values-th/strings.xml b/app/src/main/res/values-th/strings.xml index 486f4ffe..29be3f29 100644 --- a/app/src/main/res/values-th/strings.xml +++ b/app/src/main/res/values-th/strings.xml @@ -55,10 +55,6 @@ Others free Total storage: %s - - Enter password - Password - Please enter the password Enable root access diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index d725d345..e0ff642c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -50,10 +50,6 @@ Diğerleri boş Toplam depolama: %s - - Enter password - Password - Please enter the password Root erişimini etkinleştir Uygulamadan çıkmak için Geri tuşuna iki kez basmayı gerektir diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index fd41bada..9ff4679e 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -50,10 +50,6 @@ Інше free Всього пам\'яті: %s - - Enter password - Password - Please enter the password Активувати root-доступ Натисніть Назад двічі, щоб вийти з додатка diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index a03d5cbd..170264fc 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -50,10 +50,6 @@ 其他 空闲 总存储: %s - - Enter password - Password - Please enter the password 启用 root 访问 需要按两次返回键才能离开应用程序 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index ab7c6b55..d268d081 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -50,10 +50,6 @@ 其他 free 總儲存空間:%s - - Enter password - Password - Please enter the password 啟用root權限 需按兩次返回鍵才能離開 app diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a7bb4586..29be3f29 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -56,11 +56,6 @@ free Total storage: %s - - Enter password - Password - Please enter the password - Enable root access Require pressing Back twice to leave the app From 4d0a7121cc4e707b73a47d45c86459db94654a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Thu, 6 Jul 2023 16:39:34 +0200 Subject: [PATCH 3/7] Remove unused showToastAndFinish method --- .../filemanager/pro/activities/PDFViewerActivity.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 2e6c4187..8e65eba3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -176,7 +176,4 @@ class PDFViewerActivity : SimpleActivity() { window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) } } - - private fun Throwable.showToastAndFinish() { - } } From 85559abbf43bb89d4fde2106c63c9e7c8838a69f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 7 Jul 2023 08:06:50 +0200 Subject: [PATCH 4/7] Clean up PDFViewerActivity for consistency --- .../filemanager/pro/activities/PDFViewerActivity.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 8e65eba3..949c60e7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -110,15 +110,19 @@ class PDFViewerActivity : SimpleActivity() { .onTap { toggleFullScreen() } .onError { if (it is PdfPasswordException) { - // Already entered a password and it was wrong + // already entered a password and it was wrong if (filePassword != null) { showErrorToast(getString(R.string.invalid_password)) finish() } else { EnterPasswordDialog( this, - callback = { password -> loadPdfViewer(uri, password) }, - cancelCallback = { finish() } + callback = { password -> + loadPdfViewer(uri, password) + }, + cancelCallback = { + finish() + } ) } } else { From 16159b3d84faf1d94f98a7d195f418dcf8540871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 7 Jul 2023 14:43:59 +0200 Subject: [PATCH 5/7] Keep password dialog displayed until correct password is entered or cancelled This requires updates to Simple-Commons to be merged first https://github.com/SimpleMobileTools/Simple-Commons/pull/1725 --- app/build.gradle | 2 +- .../filemanager/pro/activities/PDFViewerActivity.kt | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6ee0a7d0..e5bfbf5a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:db25f91be3' + implementation 'com.github.esensar:Simple-Commons:26a4275f9b' implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 949c60e7..f6ff9559 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.activity_pdf_viewer.top_shadow class PDFViewerActivity : SimpleActivity() { private var realFilePath = "" private var isFullScreen = false + private var passwordDialog: EnterPasswordDialog? = null override fun onCreate(savedInstanceState: Bundle?) { showTransparentTop = true @@ -113,9 +114,9 @@ class PDFViewerActivity : SimpleActivity() { // already entered a password and it was wrong if (filePassword != null) { showErrorToast(getString(R.string.invalid_password)) - finish() + passwordDialog?.clearPassword() } else { - EnterPasswordDialog( + passwordDialog = EnterPasswordDialog( this, callback = { password -> loadPdfViewer(uri, password) @@ -130,6 +131,9 @@ class PDFViewerActivity : SimpleActivity() { finish() } } + .onLoad { + passwordDialog?.dismiss(notify = false) + } .load() showSystemUI(true) From 4d5ac24d0d0854aaa7938560eee519c6585682fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 7 Jul 2023 16:45:21 +0200 Subject: [PATCH 6/7] Update Simple-Commons version --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index e5bfbf5a..1754d636 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.esensar:Simple-Commons:26a4275f9b' + implementation 'com.github.SimpleMobileTools:Simple-Commons:a8693482e8' implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' From d19508109fc5a3b7b633b47d98d122ec81a4e154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 7 Jul 2023 18:19:35 +0200 Subject: [PATCH 7/7] Remove error prefix from incorrect password toast --- .../filemanager/pro/activities/PDFViewerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index f6ff9559..7fa0f894 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -113,7 +113,7 @@ class PDFViewerActivity : SimpleActivity() { if (it is PdfPasswordException) { // already entered a password and it was wrong if (filePassword != null) { - showErrorToast(getString(R.string.invalid_password)) + toast(getString(R.string.invalid_password)) passwordDialog?.clearPassword() } else { passwordDialog = EnterPasswordDialog(