From 24ad510d3dfac1e04d3677179a5dc12629e8571e Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Fri, 16 Apr 2021 14:04:17 -0700 Subject: [PATCH] Fix a crash if the app is restarted while the edit bookmarks folder database view dialog is open. https://redmine.stoutner.com/issues/669 --- .../activities/MainWebViewActivity.java | 2 +- .../dialogs/EditBookmarkDatabaseViewDialog.kt | 2 +- .../EditBookmarkFolderDatabaseViewDialog.kt | 19 +++++++++++-------- app/src/main/res/values-de/strings.xml | 5 +++++ app/src/main/res/values-es/strings.xml | 5 +++++ app/src/main/res/values-it/strings.xml | 5 +++++ app/src/main/res/values-ru/strings.xml | 5 +++++ 7 files changed, 33 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 676c4d48..d7a74231 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -2055,7 +2055,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Make it so. startActivity(genericFileManagerIntent); - } catch (Exception gengericFileManagerException) { + } catch (Exception genericFileManagerException) { // Try an alternate file manager. try { // Create an alternate file manager intent. diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt index 542c4632..577e1a39 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkDatabaseViewDialog.kt @@ -365,7 +365,7 @@ class EditBookmarkDatabaseViewDialog : DialogFragment() { updateSaveButton(currentBookmarkName, currentUrl, currentFolderDatabaseId, currentDisplayOrder) } - override fun onNothingSelected(parent: AdapterView<*>?) { + override fun onNothingSelected(parent: AdapterView<*>) { // Do nothing. } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.kt index e15e29ef..ba538f59 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/EditBookmarkFolderDatabaseViewDialog.kt @@ -349,15 +349,18 @@ class EditBookmarkFolderDatabaseViewDialog : DialogFragment() { } }) - // Update the save button if the parent folder changes. - parentFolderSpinner.onItemSelectedListener = object: OnItemSelectedListener { - override fun onItemSelected(parent: AdapterView<*>?, view: View, position: Int, id: Long) { - // Update the save button. - updateSaveButton(bookmarksDatabaseHelper, currentFolderName, currentParentFolderDatabaseId, currentDisplayOrder) - } + // Wait to set the on item selected listener until the spinner has been inflated. Otherwise the dialog will crash on restart. + parentFolderSpinner.post { + // Update the save button if the parent folder changes. + parentFolderSpinner.onItemSelectedListener = object: OnItemSelectedListener { + override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { + // Update the save button. + updateSaveButton(bookmarksDatabaseHelper, currentFolderName, currentParentFolderDatabaseId, currentDisplayOrder) + } - override fun onNothingSelected(parent: AdapterView<*>?) { - // Do nothing. + override fun onNothingSelected(parent: AdapterView<*>) { + // Do nothing. + } } } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 69479eef..f654e158 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -121,6 +121,7 @@ Verlauf löschen Öffnen Downloads + Das System konnte keinen kompatiblen Datei-Manager ermitteln. Einstellungen Importieren/Exportieren Logcat @@ -189,6 +190,10 @@ Vorheriges Nächstes + + Die Datei ist ein MHT-Web-Archiv. + Manchmal müssen MIME-gekapselte HTML-Web-Archive (MHT) manuell festgelegt werden, um korrekt geöffnet zu werden. + URL speichern Archiv speichern diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index d6de2211..bd828d57 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -117,6 +117,7 @@ Borrar historial Abrir Descargas + El sistema no puede detectar un gestor de archivos compatible. Configuración Importar/Exportar Logcat @@ -185,6 +186,10 @@ Anterior Siguiente + + El archivo es un archivo de web MHT. + A veces se necesita especificar manualmente los archivos web MIME Encapsulated HTML (MHT) para que se abran correctamente. + Guardar URL Guardar archivo diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index de01192d..7e8fc479 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -117,6 +117,7 @@ Elimina cronologia Apri Download + Il sistema non riesce a trovare un file manager compatibile. Impostazioni Importa/Esporta Logcat @@ -185,6 +186,10 @@ Precedente Successivo + + Questo file è un archivio web MHT. + Talvolta gli archivi web del tipo MIME Encapsulated HTML (MHT) devono essere specificati manualmente per essere aperti correttamente. + Salva URL Salva Archivio diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index c95de474..a2de6373 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -114,6 +114,7 @@ Очистить историю Открыть Загрузки + Система не может обнаружить совместимый файловый менеджер. Настройки Импорт/Экспорт Logcat @@ -182,6 +183,10 @@ Предыдущий Следующий + + Файл представляет собой веб-архив MHT. + Иногда для корректного открытия веб-архивов MIME Encapsulated HTML (MHT) необходимо указать вручную. + Сохранить URL Сохранить архив -- 2.45.2