From b9208ea94e15e6b69d3cf5a87c9db227fb43c14c Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:23:18 +0000 Subject: [PATCH 01/59] Translated using Weblate (Catalan) Currently translated at 59.7% (258 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/ca/ --- app/src/main/res/values-ca/strings.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index 8d13e65f0..412acc571 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -17,9 +17,8 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . Catalan translation by Oriol Garrote ---> - - Comentaris: +--> + Comentaris Pàgina inici: KeePassDX és una implementació per a Android de KeePass password manager Accepta From 8784f1da707facb1d82922283129868903449421 Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:26:16 +0000 Subject: [PATCH 02/59] Translated using Weblate (Basque) Currently translated at 15.7% (68 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/eu/ --- app/src/main/res/values-eu/strings.xml | 31 ++++++++++++-------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index 46c924ca2..5bf3db29d 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -17,9 +17,8 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . Basque translation by David García-Abad ---> - - Feedback: +--> + Feedback Hasiera orria Keepass pasahitza kudeatzailearen Androiderako inplementazioa Onartu @@ -135,23 +134,21 @@ Euskarririk gabeko datubase bertsioa. Maiuskulak Bertsioa %1$s - Sartu pasahitz eta / edo gako fitxategi bat zure datubasea desblokeatzeko. - - 5 segundu - 10 segundu - 20 segundu - 30 segundu - minutu 1 - 5 minutu - 15 minutu - 30 minutu - Inoiz ez + 5 segundu + 10 segundu + 20 segundu + 30 segundu + minutu 1 + 5 minutu + 15 minutu + 30 minutu + Inoiz ez - Txikia - Ertaina - Handia + Txikia + Ertaina + Handia \ No newline at end of file From 38dd2bdf6ec9dd9a1354b00b9a32194e430d9353 Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:26:04 +0000 Subject: [PATCH 03/59] Translated using Weblate (Finnish) Currently translated at 20.1% (87 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/fi/ --- app/src/main/res/values-fi/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 25a2b4781..1d5d6851b 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . --> - Palaute: - Kotisivu: + Palaute + Kotisivu KeePass-salasanahallintaohjelman Android toteutus Hyväksy Lisää uusi salasanatietue From 6cf2b450513dd14cd6b82223011f827af98fe93b Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:25:48 +0000 Subject: [PATCH 04/59] Translated using Weblate (Lithuanian) Currently translated at 12.7% (55 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/lt/ --- app/src/main/res/values-lt/strings.xml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index b9a0624a5..990e37ea3 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -16,13 +16,12 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . ---> - +--> KeePassDX yra KeePass slaptažodžių tvarkyklės realizacija Android platformai Iškarpinė išvalyta. Neteisingas slaptažodis arba rakto failas. - Atsiliepimai: - Pagrindinis puslapis: + Atsiliepimai + Pagrindinis puslapis Priimti Pridėti įrašą Pridėti grupę @@ -108,7 +107,5 @@ Slėpti slaptažodžius pagal nutylėjimą Neteisingas algoritmas. Neteisingas kelias. - Įveskite slaptažodį rba raktą, tam kad atidarytumėte duomenų bazę. - - + \ No newline at end of file From 1a4c24dd86990eeea902b54df5306e73c852ba28 Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:25:22 +0000 Subject: [PATCH 05/59] Translated using Weblate (Latvian) Currently translated at 16.2% (70 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/lv/ --- app/src/main/res/values-lv/strings.xml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index d3b4ba20f..38a3b5736 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -1,4 +1,4 @@ - + - - Atsauksmes: - Mājaslapa: +--> + Atsauksmes + Mājaslapa KeePassDX ir KeePass paroļu menedžera Android implementācija Pieņemt Jauns ieraksts @@ -132,9 +131,7 @@ Neatbalstīta datu bāzes versija. Lielie burti Versija %1$s - Ievadiet paroli/atslēgas failu, lai atbloķētu savu datu bāzi. - 5 sekundes 10 sekundes @@ -151,9 +148,9 @@ Vidējs Liels -Labot ierakstu + Labot ierakstu Šifrēšana Paplašinātais ASCII Atļaut KeePassDX © %1$d Kunzisoft nāk bez jebkādas garantijas. Šī ir bezmaksas programmatūra un jūs to varat izplatīt apstākļos, kas aprakstīti GPL 3 versijā vai jaunākā. - + \ No newline at end of file From 2aecf69b674301f80f10dc00e155adb737645d3a Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:25:09 +0000 Subject: [PATCH 06/59] Translated using Weblate (Norwegian Nynorsk) Currently translated at 14.5% (63 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/nn/ --- app/src/main/res/values-nn/strings.xml | 37 ++++++++++++-------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/app/src/main/res/values-nn/strings.xml b/app/src/main/res/values-nn/strings.xml index e0d684343..1ac743e35 100644 --- a/app/src/main/res/values-nn/strings.xml +++ b/app/src/main/res/values-nn/strings.xml @@ -16,12 +16,11 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . ---> - - Tilbakemelding: - Heimeside: +--> + Tilbakemelding + Heimeside KeePassDX er ei android-utgåve av KeePass passordstyrar. - Godta + Godta Legg til post Legg til gruppe Algoritme @@ -122,23 +121,21 @@ Kan ikkje bruka databaseutgåva. Store bokstavar Utgåve %1$s - Skriv inn passordet og/eller nøkkelfil for å låsa opp databasen. - - 5 sekund - 10 sekund - 20 sekund - 30 sekund - 1 minutt - 5 minutt - 15 minutt - 30 minutt - Aldri + 5 sekund + 10 sekund + 20 sekund + 30 sekund + 1 minutt + 5 minutt + 15 minutt + 30 minutt + Aldri - Liten - Middels - Stor + Liten + Middels + Stor - + \ No newline at end of file From ea8888a685c4c2af3bb9b8415e04c7b89f2dcb21 Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:24:56 +0000 Subject: [PATCH 07/59] Translated using Weblate (Galician) Currently translated at 6.7% (29 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/gl/ --- app/src/main/res/values-gl/strings.xml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 636611a81..db5ce380a 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -16,10 +16,9 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . ---> - - Comentarios: - Páxina inicial: +--> + Comentarios + Páxina inicial KeePassDX é unha implementación para Android do xestor de contrasinais KeePass. Aceptar Engadir entrada From a8f712c335357ed48bec5147d9219448e6baca73 Mon Sep 17 00:00:00 2001 From: Kunzisoft Date: Thu, 4 Jun 2020 10:24:30 +0000 Subject: [PATCH 08/59] Translated using Weblate (Telugu) Currently translated at 1.8% (8 of 432 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/te/ --- app/src/main/res/values-te/strings.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-te/strings.xml b/app/src/main/res/values-te/strings.xml index 4bf499514..86dc465bb 100644 --- a/app/src/main/res/values-te/strings.xml +++ b/app/src/main/res/values-te/strings.xml @@ -1,4 +1,4 @@ - + - - అభిప్రాయం: - హోమ్ పేజీ: +--> + అభిప్రాయం + హోమ్ పేజీ KeePassDX అనేది KeePass పాస్వర్డ్ మేనేజర్ యొక్క యాండ్రాయిడ్ అమలు. ఆమోదించు "ఎంట్రీని జత చెయ్యండి " @@ -29,4 +28,4 @@ ఎన్క్రిప్షన్ అల్గోరిథం కీ వ్యుత్పత్తి ఫంక్షన్ యాప్ కి అనువర్తించిన గడువు ముగిసింది - + \ No newline at end of file From 2b5cf75a5382b1eb1d8e787ac3e255217df42bb7 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 5 Jun 2020 15:46:25 +0200 Subject: [PATCH 09/59] Update to 2.7 --- CHANGELOG | 3 +++ app/build.gradle | 4 ++-- fastlane/metadata/android/en-US/changelogs/35.txt | 2 ++ fastlane/metadata/android/fr-FR/changelogs/35.txt | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/35.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/35.txt diff --git a/CHANGELOG b/CHANGELOG index 1bb76791b..301f65de8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +KeePassDX(2.7) + * + KeePassDX(2.6) * Share a web domain to automatically search for an entry * Default group icon for a new entry diff --git a/app/build.gradle b/app/build.gradle index 5ae090213..ebf802c17 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.kunzisoft.keepass" minSdkVersion 14 targetSdkVersion 29 - versionCode = 34 - versionName = "2.6" + versionCode = 35 + versionName = "2.7" multiDexEnabled true testApplicationId = "com.kunzisoft.keepass.tests" diff --git a/fastlane/metadata/android/en-US/changelogs/35.txt b/fastlane/metadata/android/en-US/changelogs/35.txt new file mode 100644 index 000000000..e3209a3bf --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/35.txt @@ -0,0 +1,2 @@ + * + diff --git a/fastlane/metadata/android/fr-FR/changelogs/35.txt b/fastlane/metadata/android/fr-FR/changelogs/35.txt new file mode 100644 index 000000000..e3209a3bf --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/35.txt @@ -0,0 +1,2 @@ + * + From e2a1e3f3274e92058c8dd67c00160e9897a2923a Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 5 Jun 2020 22:56:00 +0200 Subject: [PATCH 10/59] Fix autofill for chrome 83.0.4103.96 #551 --- .../keepass/autofill/StructureParser.kt | 98 +++++---- app/src/main/res/xml/dataset_service.xml | 192 ++++++++++++++++-- 2 files changed, 239 insertions(+), 51 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt index 987b386ff..dae1a2633 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt @@ -163,44 +163,74 @@ internal class StructureParser(private val structure: AssistStructure) { return false } + private fun inputIsVariationType(inputType: Int, vararg type: Int): Boolean { + type.forEach { + if (inputType and InputType.TYPE_MASK_VARIATION == it) + return true + } + return false + } + private fun parseNodeByAndroidInput(node: AssistStructure.ViewNode): Boolean { val autofillId = node.autofillId val inputType = node.inputType - if (inputType and InputType.TYPE_CLASS_TEXT != 0) { - when { - inputType and InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS != 0 -> { - result?.usernameId = autofillId - Log.d(TAG, "Autofill username android type: $inputType") + when (inputType and InputType.TYPE_MASK_CLASS) { + InputType.TYPE_CLASS_TEXT -> { + when { + inputIsVariationType(inputType, + InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS, + InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) -> { + result?.usernameId = autofillId + Log.d(TAG, "Autofill username android text type: $inputType") + } + inputIsVariationType(inputType, + InputType.TYPE_TEXT_VARIATION_NORMAL, + InputType.TYPE_TEXT_VARIATION_PERSON_NAME, + InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) -> { + usernameCandidate = autofillId + Log.d(TAG, "Autofill username candidate android text type: $inputType") + } + inputIsVariationType(inputType, + InputType.TYPE_TEXT_VARIATION_PASSWORD, + InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, + InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD) -> { + result?.passwordId = autofillId + Log.d(TAG, "Autofill password android text type: $inputType") + usernameNeeded = false + return true + } + inputIsVariationType(inputType, + InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT, + InputType.TYPE_TEXT_VARIATION_FILTER, + InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE, + InputType.TYPE_TEXT_VARIATION_PHONETIC, + InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS, + InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE, + InputType.TYPE_TEXT_VARIATION_URI) -> { + // Type not used + } + else -> { + Log.d(TAG, "Autofill unknown android text type: $inputType") + } } - inputType and InputType.TYPE_TEXT_VARIATION_NORMAL != 0 || - inputType and InputType.TYPE_NUMBER_VARIATION_NORMAL != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_PERSON_NAME != 0 -> { - usernameCandidate = autofillId - Log.d(TAG, "Autofill username candidate android type: $inputType") - } - inputType and InputType.TYPE_TEXT_VARIATION_PASSWORD != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD != 0 || - inputType and InputType.TYPE_NUMBER_VARIATION_PASSWORD != 0 -> { - result?.passwordId = autofillId - Log.d(TAG, "Autofill password android type: $inputType") - // Username not needed in this case - usernameNeeded = false - return true - } - inputType and InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_FILTER != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_PHONETIC != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_URI != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS != 0 || - inputType and InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD != 0 -> { - // Type not used - } - else -> { - Log.d(TAG, "Autofill unknown android type: $inputType") - usernameCandidate = autofillId + } + InputType.TYPE_CLASS_NUMBER -> { + when { + inputIsVariationType(inputType, + InputType.TYPE_NUMBER_VARIATION_NORMAL) -> { + usernameCandidate = autofillId + Log.d(TAG, "Autofill usernale candidate android number type: $inputType") + } + inputIsVariationType(inputType, + InputType.TYPE_NUMBER_VARIATION_PASSWORD) -> { + result?.passwordId = autofillId + Log.d(TAG, "Autofill password android number type: $inputType") + usernameNeeded = false + return true + } + else -> { + Log.d(TAG, "Autofill unknown android number type: $inputType") + } } } } diff --git a/app/src/main/res/xml/dataset_service.xml b/app/src/main/res/xml/dataset_service.xml index 7b52fd83e..805123a22 100644 --- a/app/src/main/res/xml/dataset_service.xml +++ b/app/src/main/res/xml/dataset_service.xml @@ -1,22 +1,180 @@ - - + \ No newline at end of file + xmlns:tools="http://schemas.android.com/tools" + tools:targetApi="p" + android:settingsActivity="com.kunzisoft.keepass.settings.AutofillSettingsActivity" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 0cad43c18b218a20ac625fff5d121f7c6663eb20 Mon Sep 17 00:00:00 2001 From: jan madsen Date: Sat, 6 Jun 2020 06:51:49 +0000 Subject: [PATCH 11/59] Translated using Weblate (Danish) Currently translated at 98.6% (427 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/da/ --- app/src/main/res/values-da/strings.xml | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 3cd1fb9b2..5530dfa14 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -193,11 +193,11 @@ Bekræft brug af ingen adgangskode til beskyttelse mod oplåsning\? Fortsæt uden krypteringsnøgle\? Biometrisk prompt understøttes, men er ikke konfigureret. - Åbn den biometriske prompt for at låse databasen op + Åbn biometriske forespørgsel for at låse databasen op Krypteret adgangskode er gemt Kan ikke læse den biometriske nøgle. Slet den og gentag den biometriske genkendelsesprocedure. - Kunne ikke genkende fingeraftryk - Problem med fingeraftryk: %1$s + Kunne ikke genkende biometrisk + Biometrisk fejl: %1$s Åbn den biometriske prompt for at gemme legitimationsoplysninger Databasen har endnu ikke en adgangskode. Historik @@ -220,11 +220,11 @@ Skærmlås Lås databasen, når skærmen er slukket Fingeraftryk - Fingeraftryksscanning - Lader dig scanne din biometrisk for at åbne databasen + Biometrisk oplåsning + Giver mulighed for at scanne biometriske for at åbne databasen Slet krypteringsnøgler - Slet alle krypteringsnøgler, der er relateret til fingeraftryk - Slet alle nøgler, der er relateret til fingeraftryksgenkendelse\? + Slet alle krypteringsnøgler, der er relateret til biometrisk genkendelse + Slet alle krypteringsnøgler, der er relateret til biometrisk genkendelse\? Funktionen kunne ikke startes. Android-version %1$s opfylder ikke minimum versionskrav %2$s. Kunne ikke finde den tilsvarende hardware. @@ -269,8 +269,8 @@ \nGrupper (~mapper) organiserer poster i databasen. Søg i poster Indtast titel, brugernavn eller indhold af andre felter for at hente adgangskoder. - Database oplåsning med fingeraftryk - Link adgangskoden til det scannede fingeraftryk for hurtigt at låse databasen op. + Oplåsning af database ved hjælp af biometrisk + Knyt adgangskoden til det scannede biometri for hurtigt at låse databasen op. Rediger posten Rediger post med brugerdefinerede felter. Pool data kan refereres mellem forskellige indtastningsfelter. Opret en stærk adgangskode @@ -343,7 +343,7 @@ Valg af indtastning Vis indtastningsfelter i Magikeyboard, når der vises en post Slet adgangskode - Sletter adgangskoden som er indtastet efter et forbindelsesforsøg + Sletter adgangskoden der er angivet efter et forsøg på at oprette forbindelse til en database Åbn fil Undernode Tilføj knude @@ -374,7 +374,7 @@ Uddrag databasens legitimationsoplysninger med biometriske data Biometrisk Åbn automatisk biometrisk prompt - Spørg automatisk efter biometrisk, hvis databasen er konfigureret til at bruge den + Spørg automatisk efter biometri, hvis databasen er konfigureret til at bruge den Aktiver Deaktiver Hovednøgle @@ -428,7 +428,7 @@ Udfører kommandoen… Slet markerede noder permanent\? Nøglelageret er ikke korrekt initialiseret. - Skriv adgangskoden, før der klikkes på den biometriske knap. + Indtast adgangskoden, og klik derefter på knappen \"Biometrisk\". Papirkurvsgruppe Gem automatisk database Gem databasen efter hver en vigtig handling (i tilstanden \"Modificerbar\") @@ -475,4 +475,6 @@ Indstillinger for automatisk udfyldning Adgang til filen tilbagekaldt af filadministratoren Etiketten findes allerede. - + Søg automatisk efter delte oplysninger for at udfylde tastaturet + Søg i delte oplysninger + \ No newline at end of file From 3d906fd5823afbc7bacd665caf7952c1818ad44d Mon Sep 17 00:00:00 2001 From: WaldiS Date: Sat, 6 Jun 2020 07:59:16 +0000 Subject: [PATCH 12/59] Translated using Weblate (Polish) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/pl/ --- app/src/main/res/values-pl/strings.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index f4b1aa0c4..fc5fa1006 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -115,7 +115,7 @@ Porządek naturalny Znaki specjalne Szukaj - Dwie ryby + Algorytm szyfrujący Twofish Podkreślenie Nieobsługiwana wersja bazy danych. Wielkie litery @@ -344,7 +344,7 @@ Wybór wpisu Pokaż pola wprowadzania w Magikeyboard podczas przeglądania wpisu Usuń hasło - Usuwa hasło wprowadzone po próbie połączenia + Usuwa hasło wprowadzone po próbie połączenia z bazą danych Otwórz plik Dodaj wpis Dodaj grupę @@ -474,4 +474,6 @@ Ustawienia autouzupełniania Dostęp do pliku anulowany przez menedżera plików Ta etykieta już istnieje. - + Automatyczne wyszukiwanie udostępnionych informacji w celu zapełnienia klawiatury + Wyszukaj udostępnione informacje + \ No newline at end of file From 29d7e2dcfe192483f63097cc3802908fb00677fe Mon Sep 17 00:00:00 2001 From: solokot Date: Sat, 6 Jun 2020 08:14:33 +0000 Subject: [PATCH 13/59] Translated using Weblate (Russian) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/ru/ --- app/src/main/res/values-ru/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 2588e006e..e4e22b51a 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -344,7 +344,7 @@ Выбор записи Показывать поля ввода в Magikeyboard при просмотре записи Удалять пароль - Забывать введённый пароль + Забывать введённый пароль после попытки входа в базу Открыть файл Дочерний узел Добавить узел @@ -474,4 +474,6 @@ Доступ к файлу отменён файловым менеджером Автопоиск Настройки автозаполнения - + Выполнять автоматический поиск общедоступной информации для подстановки в клавиатуру + Поиск доступной информации + \ No newline at end of file From da40cc98306d488d8a5e4c09891fa3f4495dc86e Mon Sep 17 00:00:00 2001 From: ihor_ck Date: Sat, 6 Jun 2020 23:42:13 +0000 Subject: [PATCH 14/59] Translated using Weblate (Ukrainian) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/uk/ --- app/src/main/res/values-uk/strings.xml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 5be3562be..542a5e639 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -18,7 +18,7 @@ along with KeePassDX. If not, see . --> Відгук - Домашня сторінка + Домівка KeePassDX є Android-версією менеджера паролів KeePass Прийняти Додати запис @@ -141,7 +141,7 @@ Середній Великий - Допомога проєкту + Допомогти проєкту Контакти Довжина пароля Відкрити файл @@ -149,7 +149,7 @@ Змінити запис Проведіть пальцем, щоб очистити буфер обміну зараз Блокувати базу даних під час закриття сповіщення - Розблокування за допомогою біометричних даних підтримується, але не налаштоване. + Розблокування біометричними даними підтримується, але не налаштоване. Додати групу Оновити Клавіатура @@ -344,7 +344,7 @@ Автозбереження бази даних Типово відкривати базу даних лише для читання Захист від запису - Видаляти пароль, введений після спроби з\'єднання + Видаляти пароль, введений після спроби з\'єднання з базою даних Видалити пароль Увімкнути кнопку \"Відкрити\", якщо не вибрано головний пароль Дозволити без головного ключа @@ -421,7 +421,7 @@ Якщо не вдалось очистити буфер обміну автоматично, видаліть його історію вручну. Увімкнути сповіщення буфера обміну для копіювання полів під час перегляду запису Сповіщення буфера обміну - Копіювати облікові дані за допомогою буфера обміну вашого пристрою + Копіювати облікові дані за допомогою буфера обміну пристрою Буфер обміну Базу даних відкрито Встановіть дозволені символи для створення пароля @@ -474,4 +474,6 @@ Паралельність Використання пам\'яті Алгоритм шифрування бази даних, застосований для всіх даних. - + Автоматичний пошук загальнодоступної інформації для заповнення клавіатури + Пошук доступної інформації + \ No newline at end of file From cc4125e7663ed46acef559751a711b71874cb2aa Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 6 Jun 2020 13:05:10 +0000 Subject: [PATCH 15/59] Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/zh_Hans/ --- app/src/main/res/values-zh-rCN/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 70faa81c0..590aec2ae 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -347,7 +347,7 @@ 条目选择 在查看条目时,在专用键盘中显示输入字段 删除密码 - 密码错误后删除已输入的密码 + 在连接数据库尝试后删除输入的密码 打开文件 子节点 增加节点 @@ -474,4 +474,6 @@ 自动填充设置 访问文件管理器撤消访问权限的文件 该标签已经存在。 - + 自动搜索共享信息以填充键盘 + 搜索分享的信息 + \ No newline at end of file From 972edd3a30918dde0196b169c1cb446e09f4bb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allan=20Nordh=C3=B8y?= Date: Sat, 6 Jun 2020 19:35:50 +0000 Subject: [PATCH 16/59] =?UTF-8?q?Translated=20using=20Weblate=20(Norwegian?= =?UTF-8?q?=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 80.3% (348 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/nb_NO/ --- app/src/main/res/values-nb/strings.xml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 3a14b392b..2e46690fd 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -222,7 +222,7 @@ Endre skriften brukt i felter for bedre tegngjengivelse Kopi av passord Tillat kopiering av adgangspassordet og beskyttede felter til utklippstavlen - ADVARSEL: Utklippstavlen deles av alle programmer. Hvis sensitiv data kopieres, kan annen programvare gjenopprette den. + Advarsel: Utklippstavlen deles av alle programmer. Hvis sensitiv data kopieres, kan annen programvare gjenopprette den. Databasenavn Databasebeskrivelse Databaseversjon @@ -255,7 +255,7 @@ Lenk passordet og fingeravtrykket ditt for å låse opp databasen din enkelt. Rediger oppføringen Rediger din oppføring med egendefinerte felter, referanser til pooldata kan legges til mellom felter av forskjellige oppføringer. - Opprett et sterkt passord. + Opprett et sterkt passord Generer et sterkt passord å tilknytte oppføringen din, definer det i henhold til kriteriene i skjemaet, og ikke glem å gjøre passordet sikkert. Legg til egendefinerte felter Du ønsker å registrere et grunnleggende felt som ikke allerede finnes, fyll inn et nytt et du også kan beskytte visuelt. @@ -281,7 +281,7 @@ Ulikt mange passordbehandlingsprogrammer, er dette <strong>reklamefri</strong>, <strong>copyleftbasert fri programvare</strong> og samler ikke inn personlig data på tjenerne sine, selv i sin gratisversjon. Ved kjøp av pro-versjonen, vil du få tilgang til denne <strong>visuelle funksjonen</strong> og du vil spesielt hjelpe <strong> realiseringen av gemenskapsprosjekter.</strong> - Denne <strong>visuelle funksjonen</strong> er tilgjengelig takket være din generøsitet. + Denne visuelle stilen er tilgjengelig takket være din generøsitet. For å beholde vår frihet og alltid være aktive, stoler vi på dine <strong>bidrag.</strong> Denne funksjonen er <strong>under utvikling</strong> og krever <strong>bidrag</strong> for å bli tilgjengelig snart. @@ -296,7 +296,7 @@ Rijndael (AES) Twofish ChaCha20 - AES KDF + AES Argon2 Velg en drakt Tilpass programdrakten ved å endre fargene @@ -319,8 +319,8 @@ Utseende Tastaturdrakt Taster - Vibrer ved tastetrykk - Lyd ved tastetrykk + Vibrasjonstastetrykk + Hørbare tastetrykk Valgmodus Ikke drep programmet… Tilbakelås @@ -331,7 +331,7 @@ Oppføringsvalg Vis inndatafelter i Magikeyboard når en oppføring vises Slett passord - Sletter passord innskrevet etter et tilkoblingsforsøk + Sletter passord innskrevet etter et tilkoblingsforsøk til en database Åpne fil Legg til node Legg til oppføring @@ -428,4 +428,9 @@ Vis låseknapp Denne etiketten finnes allerede. Bekreft + Åpne database med biometrisk gjenkjenning + Tilgang til filen nektes av filbehandleren + Innvilg skrivetilgang for å lagre databaseendringer + Skjul ødelagte lenker i listen over nylige databaser + Skjul ødelagte databaselenker \ No newline at end of file From 419099318cff6fa998e99fd91e5774c6cbab3dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Ersen?= Date: Sat, 6 Jun 2020 10:24:35 +0000 Subject: [PATCH 17/59] Translated using Weblate (Turkish) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/tr/ --- app/src/main/res/values-tr/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 6b4988c7d..20bd633ce 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -346,7 +346,7 @@ Giriş seçimi Bir girişi görüntülerken Magikeyboard\'da giriş alanlarını göster Parolayı sil - Bir bağlantı denemesinden sonra girilen parolayı siler + Veri tabanına bağlantı denemesinden sonra girilen parolayı siler Alt düğüm Parola görünürlüğünü değiştirmeyi tekrarla Arka plan @@ -458,4 +458,6 @@ Otomatik doldurma ayarları Dosyaya erişim dosya yöneticisi tarafından iptal edildi Bu etiket zaten var. - + Klavyeyi doldurmak için paylaşılan bilgileri otomatik olarak ara + Paylaşılan bilgileri ara + \ No newline at end of file From 65e4cf83d86ef072ceb8a421a3f16ab1d0c76dd3 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Tue, 9 Jun 2020 18:35:40 +0200 Subject: [PATCH 18/59] First commit for autofill blocklist --- .../keepass/activities/GroupActivity.kt | 3 +- .../keepass/database/element/Database.kt | 9 +- .../com/kunzisoft/keepass/model/SearchInfo.kt | 41 +++++++- .../settings/AutofillSettingsFragment.kt | 31 +++++- .../preference/InputListPreference.kt | 38 ++++++++ ...BlacklistPreferenceDialogFragmentCompat.kt | 94 +++++++++++++++++++ .../adapter/AutofillBlacklistAdapter.kt | 85 +++++++++++++++++ .../res/layout/pref_dialog_input_list.xml | 90 ++++++++++++++++++ .../pref_dialog_list_removable_item.xml | 43 +++++++++ app/src/main/res/values/donottranslate.xml | 1 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/xml/preferences_autofill.xml | 8 +- 12 files changed, 435 insertions(+), 11 deletions(-) create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlacklistPreferenceDialogFragmentCompat.kt create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/AutofillBlacklistAdapter.kt create mode 100644 app/src/main/res/layout/pref_dialog_input_list.xml create mode 100644 app/src/main/res/layout/pref_dialog_list_removable_item.xml diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index 766cda86d..50dd998f8 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -307,9 +307,8 @@ class GroupActivity : LockingActivity(), val searchInfo: SearchInfo? = intent.getParcelableExtra(KEY_SEARCH_INFO) if (searchInfo != null) { intent.action = Intent.ACTION_SEARCH - val searchQuery = searchInfo.webDomain ?: searchInfo.applicationId intent.removeExtra(KEY_SEARCH_INFO) - intent.putExtra(SearchManager.QUERY, searchQuery) + intent.putExtra(SearchManager.QUERY, searchInfo.toString()) return true } return false diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt index 4a006c620..5cdbf0dd4 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt @@ -406,12 +406,9 @@ class Database { fun createVirtualGroupFromSearch(searchInfo: SearchInfo, max: Int = Integer.MAX_VALUE): Group? { - val query = (if (searchInfo.webDomain != null) - searchInfo.webDomain - else - searchInfo.applicationId) - ?: return null - return mSearchHelper?.createVirtualGroupWithSearchResult(this, query, SearchParameters().apply { + if (searchInfo.isNull()) + return null + return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchInfo.toString(), SearchParameters().apply { searchInTitles = false searchInUserNames = false searchInPasswords = false diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index 8ad6e99f4..283d9f78c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -1,13 +1,17 @@ package com.kunzisoft.keepass.model +import android.content.res.Resources import android.os.Parcel import android.os.Parcelable +import com.kunzisoft.keepass.utils.ObjectNameResource -class SearchInfo : Parcelable { +class SearchInfo : ObjectNameResource, Parcelable { var applicationId: String? = null var webDomain: String? = null + var genericInfo: String? = null + constructor() private constructor(parcel: Parcel) { @@ -15,6 +19,8 @@ class SearchInfo : Parcelable { applicationId = if (readAppId.isNullOrEmpty()) null else readAppId val readDomain = parcel.readString() webDomain = if (readDomain.isNullOrEmpty()) null else readDomain + val readGeneric = parcel.readString() + genericInfo = if (readGeneric.isNullOrEmpty()) null else readGeneric } override fun describeContents(): Int { @@ -24,6 +30,39 @@ class SearchInfo : Parcelable { override fun writeToParcel(parcel: Parcel, flags: Int) { parcel.writeString(applicationId ?: "") parcel.writeString(webDomain ?: "") + parcel.writeString(genericInfo ?: "") + } + + override fun getName(resources: Resources): String { + return applicationId ?: webDomain ?: genericInfo ?: "" + } + + fun isNull(): Boolean { + return applicationId == null && webDomain == null && genericInfo == null + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as SearchInfo + + if (applicationId != other.applicationId) return false + if (webDomain != other.webDomain) return false + if (genericInfo != other.genericInfo) return false + + return true + } + + override fun hashCode(): Int { + var result = applicationId?.hashCode() ?: 0 + result = 31 * result + (webDomain?.hashCode() ?: 0) + result = 31 * result + (genericInfo?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return applicationId ?: webDomain ?: genericInfo ?: "" } companion object { diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt index 96558b1b4..3e560442c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt @@ -20,9 +20,11 @@ package com.kunzisoft.keepass.settings import android.os.Bundle +import androidx.fragment.app.DialogFragment +import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat - import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlacklistPreferenceDialogFragmentCompat class AutofillSettingsFragment : PreferenceFragmentCompat() { @@ -30,4 +32,31 @@ class AutofillSettingsFragment : PreferenceFragmentCompat() { // Load the preferences from an XML resource setPreferencesFromResource(R.xml.preferences_autofill, rootKey) } + + override fun onDisplayPreferenceDialog(preference: Preference?) { + var otherDialogFragment = false + + var dialogFragment: DialogFragment? = null + + when (preference?.key) { + getString(R.string.autofill_blocklist_key) -> { + dialogFragment = AutofillBlacklistPreferenceDialogFragmentCompat.newInstance(preference.key) + } + else -> otherDialogFragment = true + } + + if (dialogFragment != null) { + dialogFragment.setTargetFragment(this, 0) + dialogFragment.show(parentFragmentManager, TAG_AUTOFILL_PREF_FRAGMENT) + } + // Could not be handled here. Try with the super method. + else if (otherDialogFragment) { + super.onDisplayPreferenceDialog(preference) + } + } + + companion object { + + private const val TAG_AUTOFILL_PREF_FRAGMENT = "TAG_AUTOFILL_PREF_FRAGMENT" + } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt new file mode 100644 index 000000000..21965e957 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2019 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preference + +import android.content.Context +import android.util.AttributeSet +import androidx.preference.DialogPreference +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.icons.IconPackChooser +import java.util.ArrayList + +open class InputListPreference @JvmOverloads constructor(context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = R.attr.dialogPreferenceStyle, + defStyleRes: Int = defStyleAttr) + : DialogPreference(context, attrs, defStyleAttr, defStyleRes) { + + override fun getDialogLayoutResource(): Int { + return R.layout.pref_dialog_input_list + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlacklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlacklistPreferenceDialogFragmentCompat.kt new file mode 100644 index 000000000..454cf7359 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlacklistPreferenceDialogFragmentCompat.kt @@ -0,0 +1,94 @@ +/* + * Copyright 2020 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferencedialogfragment + +import android.os.Bundle +import android.view.View +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.RecyclerView +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.model.SearchInfo +import com.kunzisoft.keepass.settings.preferencedialogfragment.adapter.AutofillBlacklistAdapter + +class AutofillBlacklistPreferenceDialogFragmentCompat + : InputPreferenceDialogFragmentCompat(), + AutofillBlacklistAdapter.ItemDeletedCallback { + + private var persistedItems = HashSet() + + private var filterAdapter: AutofillBlacklistAdapter? = null + + override fun onBindDialogView(view: View) { + super.onBindDialogView(view) + + // TODO persistedItems.add + + val addItemButton = view.findViewById(R.id.add_item_button) + addItemButton?.setOnClickListener { + persistedItems.add(SearchInfo().apply { + genericInfo = inputText + }) + filterAdapter?.replaceItems(persistedItems.toList()) + } + + val recyclerView = view.findViewById(R.id.pref_dialog_list) + recyclerView.layoutManager = LinearLayoutManager(context) + + activity?.let { activity -> + filterAdapter = AutofillBlacklistAdapter(activity) + filterAdapter?.setItemDeletedCallback(this) + recyclerView.adapter = filterAdapter + filterAdapter?.replaceItems(persistedItems.toList()) + } + } + + override fun onItemDeleted(item: SearchInfo) { + persistedItems.remove(item) + filterAdapter?.replaceItems(persistedItems.toList()) + } + + private fun getStringItems(): Set { + val setItems = HashSet() + persistedItems.forEach { + it.getName(resources).let { item -> + setItems.add(item) + } + } + return setItems + } + + override fun onDialogClosed(positiveResult: Boolean) { + if (positiveResult) { + preference.persistStringSet(getStringItems()) + } + } + + companion object { + + fun newInstance(key: String): AutofillBlacklistPreferenceDialogFragmentCompat { + val fragment = AutofillBlacklistPreferenceDialogFragmentCompat() + val bundle = Bundle(1) + bundle.putString(ARG_KEY, key) + fragment.arguments = bundle + + return fragment + } + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/AutofillBlacklistAdapter.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/AutofillBlacklistAdapter.kt new file mode 100644 index 000000000..7886ba443 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/adapter/AutofillBlacklistAdapter.kt @@ -0,0 +1,85 @@ +/* + * Copyright 2020 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferencedialogfragment.adapter + +import android.content.Context +import androidx.recyclerview.widget.RecyclerView +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView + +import com.kunzisoft.keepass.R +import com.kunzisoft.keepass.utils.ObjectNameResource + +import java.util.ArrayList + +class AutofillBlacklistAdapter(private val context: Context) + : RecyclerView.Adapter() { + + private val inflater: LayoutInflater = LayoutInflater.from(context) + + val items: MutableList = ArrayList() + + private var itemDeletedCallback: ItemDeletedCallback? = null + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BlacklistItemViewHolder { + val view = inflater.inflate(R.layout.pref_dialog_list_removable_item, parent, false) + return BlacklistItemViewHolder(view) + } + + override fun onBindViewHolder(holder: BlacklistItemViewHolder, position: Int) { + val item = this.items[position] + holder.textItem.text = item.getName(context.resources) + holder.deleteButton.setOnClickListener(OnItemDeleteClickListener(item)) + } + + override fun getItemCount(): Int { + return items.size + } + + fun replaceItems(items: List) { + this.items.clear() + this.items.addAll(items) + notifyDataSetChanged() + } + + private inner class OnItemDeleteClickListener(private val itemClicked: T) : View.OnClickListener { + + override fun onClick(view: View) { + itemDeletedCallback?.onItemDeleted(itemClicked) + notifyDataSetChanged() + } + } + + fun setItemDeletedCallback(itemDeletedCallback: ItemDeletedCallback) { + this.itemDeletedCallback = itemDeletedCallback + } + + interface ItemDeletedCallback { + fun onItemDeleted(item: T) + } + + class BlacklistItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { + var textItem: TextView = itemView.findViewById(R.id.pref_dialog_list_text) + var deleteButton: ImageView = itemView.findViewById(R.id.pref_dialog_list_delete_button) + } +} diff --git a/app/src/main/res/layout/pref_dialog_input_list.xml b/app/src/main/res/layout/pref_dialog_input_list.xml new file mode 100644 index 000000000..1b3ca8eee --- /dev/null +++ b/app/src/main/res/layout/pref_dialog_input_list.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/pref_dialog_list_removable_item.xml b/app/src/main/res/layout/pref_dialog_list_removable_item.xml new file mode 100644 index 000000000..24f079b79 --- /dev/null +++ b/app/src/main/res/layout/pref_dialog_list_removable_item.xml @@ -0,0 +1,43 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 9c6b93295..6def8bff3 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -132,6 +132,7 @@ false autofill_auto_search_key true + autofill_blocklist_key settings_advanced_unlock_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d69fc5be0..30b9b083d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -52,6 +52,7 @@ Add node Add entry Add group + Add item File information Password checkbox Keyfile checkbox @@ -230,6 +231,7 @@ Do not kill the app… Space Search + Filter Sort Lowest first ↓ Groups before @@ -379,6 +381,7 @@ Audible keypresses Auto search Automatically suggest search results from the web domain or application Id + Blacklist Allow no master key Enable the \"Open\" button if no credentials are selected Delete password diff --git a/app/src/main/res/xml/preferences_autofill.xml b/app/src/main/res/xml/preferences_autofill.xml index ca7d0e860..6dc635efc 100644 --- a/app/src/main/res/xml/preferences_autofill.xml +++ b/app/src/main/res/xml/preferences_autofill.xml @@ -1,6 +1,6 @@ Reacties Website - Android-implementatie van de KeePass-wachtwoordbeheerder + Android-implementatie van KeePass-wachtwoordbeheer Accepteren Item toevoegen Groep toevoegen @@ -31,7 +31,7 @@ App App-instellingen Haakjes - Een bestandsbeheerder die de Intent-actie ACTION_CREATE_DOCUMENT en ACTION_OPEN_DOCUMENT accepteert, is nodig om databasebestanden te maken, te openen en op te slaan. + Bestandsbeheer dat de Intent-actie ACTION_CREATE_DOCUMENT en ACTION_OPEN_DOCUMENT accepteert, is nodig om databasebestanden aan te maken, te openen en op te slaan. Klembord gewist Klembordtime-out Tijd van opslag op het klembord @@ -48,7 +48,7 @@ Annuleren Opmerkingen Wachtwoord bevestigen - Gecreëerd op + Aangemaakt Verloopt op Sleutelbestand Bewerkt op @@ -59,7 +59,7 @@ Gebruikersnaam De Arcfour stream-versleuteling wordt niet ondersteund. KeePassDX kan deze URI niet verwerken. - Kan bestand niet creëren: + Bestand is niet aangemaakt: Kan database niet uitlezen. Zorg ervoor dat het pad juist is. Voer een naam in. @@ -81,12 +81,12 @@ Kan referenties niet lezen. Databaseformaat kan niet worden herkend. Lengte - Lengte van itemlijst - Tekstgrootte van itemlijst + Lengte van lijst met items + Tekstgrootte in de lijst Database laden… Kleine letters - Wachtwoord verbergen - Wachtwoorden standaard afschermen (***) + Wachtwoorden verbergen + Wachtwoorden standaard verbergen (***) Over Hoofdsleutel wijzigen Instellingen @@ -124,7 +124,7 @@ Niet-ondersteunde databaseversie. Hoofdletters Versie %1$s - Geef het wachtwoord en/of sleutelbestand op om je database te ontgrendelen. + Voer het wachtwoord en/of sleutelbestand in om je database te ontgrendelen. \n \nMaak na elke aanpassing een kopie van je .kdbx-bestand op een veilige locatie. @@ -160,11 +160,11 @@ Een groep kan niet naar zichzelf worden verplaatst. Veldnaam Veldwaarde - Bestand niet gevonden. Probeer opnieuw te openen via je bestandsbeheerder. + Bestand niet gevonden. Probeer opnieuw te openen via bestandsbeheer. Ongeldig algoritme. Het sleutelbestand is leeg. Gebruikersnamen tonen - Gebruikersnamen tonen in itemlijsten + Gebruikersnamen tonen in lijsten Kopie van %1$s Formulierinvulling Kopiëren @@ -177,8 +177,8 @@ Beveiliging Alleen-lezen KeePassDX moet worden gemachtigd om je databank te kunnen aanpassen. - Recente bestandgeschiedenis - Recent gebruikte bestandsnamen onthouden + Bestandsgeschiedenis + Toon locaties van recente databases Database-encryptie-algoritme dat voor alle gegevens wordt gebruikt. Om de sleutel voor het algoritme te kunnen genereren, wordt de hoofdsleutel getransformeerd middels een willekeurige afleidingsfunctie. Geheugengebruik @@ -200,12 +200,12 @@ Doorgaan zonder beveiliging voor wachtwoordontgrendeling\? Doorgaan zonder coderingssleutel\? Vingerafdruk wordt ondersteund, maar is niet ingesteld. - Open de biometrische prompt om de database te ontgrendelen + Vingerafdruk gebruiken om de database te ontgrendelen Versleuteld wachtwoord is opgeslagen - Kan de biometrische sleutel niet lezen. Verwijder deze en herhaal de procedure voor biometrische herkenning. + Kan de vingerafdruk-sleutel niet lezen. Verwijder deze en herhaal de procedure voor vingerafdrukherkenning. Vingerafdruk niet herkend - Vingerafdrukprobleem: %1$s - Vingerafdruk gebruiken om dit wachtwoord op te slaan + Probleem met vingerafdruk: %1$s + Vingerafdruk gebruiken om wachtwoorden op te slaan Deze databank heeft nog geen wachtwoord. Geschiedenis Uiterlijk @@ -213,12 +213,12 @@ Auto-aanvullen KeePassDX auto-aanvullendienst Inloggen met KeePassDX - Standaard aanvuldienst instellen + Dienst voor automatisch aanvullen Schakel de dienst in om formulieren in andere apps snel in te vullen Gegenereerde wachtwoordlengte Standaardlengte van gegenereerd wachtwoord instellen Wachtwoordtekens - Standaard wachtwoordtekens instellen + Toegestane wachtwoordtekens instellen Klembord Klembordmeldingen Schakel klembordmeldingen in om velden te kopiëren bij het bekijken van een item @@ -226,12 +226,12 @@ Vergrendelen Schermvergrendeling Database vergrendelen wanneer het scherm is uitgeschakeld - Vingerafdruk - Vingerafdrukherkenning - Laat u uw biometrische gegevens scannen om de database te openen - Sleutels voor versleuteling verwijderen - Alle aan vingerafdrukherkenning gerelateerde sleutels wilt verwijderen - Alle coderingssleutels voor biometrische herkenning verwijderen\? + Geavanceerd ontgrendelen + Ontgrendelen met vingerafdruk + Gebruik vingerafdrukherkenning om de database te openen + Coderingssleutels verwijderen + Alle vingerafdruk-gerelateerde sleutels verwijderen + Alle coderingssleutels voor vingerafdrukherkenning verwijderen\? Kan deze functie niet starten. Je Android-versie, %1$s, voldoet niet aan de minimumvereiste %2$s. De bijbehorende hardware werd niet gevonden. @@ -257,15 +257,15 @@ Toetsenbord Magikeyboard Aangepast toetsenbord met je wachtwoorden en alle identiteitsvelden activeren - Geen hoofdwachtwoord toestaan + Geen hoofdwachtwoord Schakel de knop \"Openen\" in als er geen referenties zijn geselecteerd Alleen-lezen Open de database standaard alleen-lezen - Educatieve hints + Informatieve tips Markeer elementen om te leren hoe de app werkt - Educatieve hints opnieuw instellen - Educatieve informatie opnieuw weergeven - Educatieve hints opnieuw ingesteld + Informatieve tips opnieuw instellen + Informatieve tips opnieuw weergeven + Informatieve tips opnieuw ingesteld Maak je databasebestand aan Maak je eerste wachtwoordbeheerbestand aan. Open een bestaande database @@ -276,8 +276,8 @@ \nGroepen (~mappen) organiseren de items in je database. Doorzoek al je items Doorzoek items op titel, gebruikersnaam of andere velden om wachtwoorden te vinden. - Ontgrendel de database met biometrie - Koppel je wachtwoord en vingerafdruk om de database snel te ontgrendelen. + Database-ontgrendeling met vingerafdruk + Koppel je wachtwoord aan je vingerafdruk om de database snel te ontgrendelen. Item bewerken Bewerk het item met aangepaste velden. Referenties kunnen worden toegevoegd tussen velden van verschillende items. Genereer een sterk wachtwoord @@ -304,8 +304,7 @@ In tegenstelling tot veel apps voor wachtwoordbeheer, is deze <strong> reclamevrij</strong>, <strong> vrije software </strong> en verzamelt het geen persoonlijke gegevens op haar servers, ongeacht welke versie je gebruikt. Door de pro-versie te kopen krijg je toegang tot dit <strong>visuele thema</strong> en draag je bij aan het <strong>realiseren van gemeenschapsprojecten.</strong> Dit <strong>visuele thema</strong> is beschikbaar gemaakt dankzij jouw vrijgevigheid. - Om altijd vrij en actief te blijven, zijn we afhankelijk van jouw <strong>bijdrage.</strong> - + Om altijd vrij en actief te blijven, rekenen we op jouw bijdrage. Deze functie <strong>wordt momenteel ontwikkeld</strong> en kan alleen beschikbaar komen middels jouw <strong>bijdrage</strong>. Door de <strong>pro</strong>-versie te kopen, Door <strong>bij te dragen</strong>, @@ -322,7 +321,7 @@ Thema gebruikt in de app Icoonverzameling Iconenverzameling gebruikt in de app - Bouw %1$s + Build %1$s Magikeyboard Magikeyboard (KeePassDX) Instellingen Magikeyboard @@ -343,7 +342,7 @@ Geluid bij toetsaanslag Selectiemodus App niet afsluiten… - Druk op \'Terug\' om te vergrendelen + Druk \'Terug\' om te vergrendelen Vergrendel de database wanneer de gebruiker op de knop Terug in het hoofdscherm klikt Wissen bij afsluiten Vergrendel de database wanneer u de melding sluit @@ -351,7 +350,7 @@ Itemselectie Invoervelden in Magikeyboard tonen bij het bekijken van een item Wachtwoord wissen - Wist het ingevoerde wachtwoord na een verbindingspoging + Wis het ingevoerde wachtwoord na een poging met een database te verbinden Bestand openen Onderliggende items Knooppunt toevoegen @@ -369,20 +368,20 @@ UUID Je kan hier geen item plaatsen. Je kan hier geen item kopiëren. - Het aantal items tonen + Toon het aantal items Toon het aantal items in een groep Achtergrond Update Velden sluiten - Kan geen database maken met dit wachtwoord en dit sleutelbestand. + Kan geen database aanmaken met dit wachtwoord en sleutelbestand. Geavanceerd ontgrendelen - Biometrische herkenning opslaan - Waarschuwing: Je moet nog steeds je hoofdwachtwoord onthouden als je biometrische herkenning gebruikt. - Database met biometrische herkenning openen - Database-referenties uitpakken met biometrische gegevens - Biometrisch - Automatisch biometrische prompt openen - Vraag automatisch om biometrie als een database hiervoor is ingesteld + Vingerafdruk opslaan + Waarschuwing: Je moet nog steeds je hoofdwachtwoord onthouden als je ontgrendeling met vingerafdruk gebruikt. + Database openen met vingerdafdruk + Database-referenties met vingerafdruk uitpakken + Vingerafdruk + Automatisch om vingerafdruk vragen + Automatisch om vingerafdruk vragen als een database hiervoor is ingesteld Inschakelen Uitschakelen Hoofdsleutel @@ -423,33 +422,33 @@ Vernieuwing afdwingen De hoofdsleutel verplicht wijzigen (dagen) Volgende keer verplicht vernieuwen - Het hoofdwachtwoord de volgende keer vernieuwen (eenmalig) + Het hoofdwachtwoord de volgende keer (eenmalig) vernieuwen Standaard gebruikersnaam Aangepaste databasekleur Compressie Geen gzip - Toetsenbordinstellingen voor apparaat - Sla de database op na elke belangrijke actie (in \"Modificeerbare\" modus) + Toetsenbordinstellingen + Sla de database op na elke belangrijke actie (in \"Schrijf\" modus) Instellingen OTP Locatie van sleutelbestanden opslaan - Locatie van de databases opslaan - Verlopen items zijn verborgen - Verlopen items verbergen + Databaselocatie opslaan + Verlopen items worden verborgen + Verberg verlopen items Klaar! Tik om het bestand te openen. Voltooien… Voortgang: %1$d%% Initialiseren… Download %1$s Stel eenmalig wachtwoordbeheer (HOTP / TOTP) in om een token te genereren dat is aangevraagd voor tweefactorauthenticatie (2FA). - Database automatisch opslaan + Automatisch opslaan Automatisch zoekresultaten voorstellen vanuit het webdomein of de toepassings-ID Automatisch zoeken Prullenbak Geeft de vergrendelknop weer in de gebruikersinterface Vergrendelknop weergeven - Instellingen voor automatisch invullen - Typ het wachtwoord in en klik vervolgens op de knop \"Biometrisch\". + Instellingen voor automatisch aanvullen + Voer het wachtwoord in en klik vervolgens op de knop \"Vingerafdruk\". De sleutelopslag is niet correct geïnitialiseerd. Geselecteerde knooppunten definitief verwijderen\? Toegang tot het bestand ingetrokken door bestandsbeheer @@ -466,14 +465,16 @@ Prullenbak legen Database opslaan Kan database niet opslaan. - Kan databasebestand niet aanmaken. + Databasebestand is niet aangemaakt. Dit label bestaat al. Bijlagen - Om <strong>onze vrijheid te behouden</strong>, <strong>bugs te verhelpen</strong>, <strong>functies toe te voegen</strong> en <strong>altijd actief te blijven</strong>, kunnen wij niet zonder uw <strong>bijdrage</strong>. + Om onze vrijheid te behouden, bugs te verhelpen, functies toe te voegen en altijd actief te blijven, rekenen wij op jouw bijdrage. Bijlage toevoegen Weggooien Veranderingen ongedaan maken\? Valideren Bijdragen Contact - + Zoek automatisch naar gedeelde informatie om het toetsenbord te vullen + Gedeelde informatie zoeken + \ No newline at end of file From 59f11a1b268d2e2d150a7c458cfa0e833e1d9248 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 15:40:04 +0200 Subject: [PATCH 22/59] Distinct block lists for AppId and WebDomain --- .../keepass/database/element/Database.kt | 2 +- .../com/kunzisoft/keepass/model/SearchInfo.kt | 15 ++---- .../settings/AutofillSettingsFragment.kt | 10 ++-- ...listAppIdPreferenceDialogFragmentCompat.kt | 49 ++++++++++++++++++ ...BlocklistPreferenceDialogFragmentCompat.kt | 35 ++++++------- ...WebDomainPreferenceDialogFragmentCompat.kt | 51 +++++++++++++++++++ .../res/layout/pref_dialog_input_list.xml | 20 ++++---- app/src/main/res/values/donottranslate.xml | 3 +- app/src/main/res/values/strings.xml | 7 ++- app/src/main/res/xml/preferences_autofill.xml | 9 +++- 10 files changed, 151 insertions(+), 50 deletions(-) create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt create mode 100644 app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt index 5cdbf0dd4..18357c23b 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt @@ -406,7 +406,7 @@ class Database { fun createVirtualGroupFromSearch(searchInfo: SearchInfo, max: Int = Integer.MAX_VALUE): Group? { - if (searchInfo.isNull()) + if (searchInfo.containsOnlyNullValues()) return null return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchInfo.toString(), SearchParameters().apply { searchInTitles = false diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index 283d9f78c..efb05b191 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -10,8 +10,6 @@ class SearchInfo : ObjectNameResource, Parcelable { var applicationId: String? = null var webDomain: String? = null - var genericInfo: String? = null - constructor() private constructor(parcel: Parcel) { @@ -19,8 +17,6 @@ class SearchInfo : ObjectNameResource, Parcelable { applicationId = if (readAppId.isNullOrEmpty()) null else readAppId val readDomain = parcel.readString() webDomain = if (readDomain.isNullOrEmpty()) null else readDomain - val readGeneric = parcel.readString() - genericInfo = if (readGeneric.isNullOrEmpty()) null else readGeneric } override fun describeContents(): Int { @@ -30,15 +26,14 @@ class SearchInfo : ObjectNameResource, Parcelable { override fun writeToParcel(parcel: Parcel, flags: Int) { parcel.writeString(applicationId ?: "") parcel.writeString(webDomain ?: "") - parcel.writeString(genericInfo ?: "") } override fun getName(resources: Resources): String { - return applicationId ?: webDomain ?: genericInfo ?: "" + return applicationId ?: webDomain ?: "" } - fun isNull(): Boolean { - return applicationId == null && webDomain == null && genericInfo == null + fun containsOnlyNullValues(): Boolean { + return applicationId == null && webDomain == null } override fun equals(other: Any?): Boolean { @@ -49,7 +44,6 @@ class SearchInfo : ObjectNameResource, Parcelable { if (applicationId != other.applicationId) return false if (webDomain != other.webDomain) return false - if (genericInfo != other.genericInfo) return false return true } @@ -57,12 +51,11 @@ class SearchInfo : ObjectNameResource, Parcelable { override fun hashCode(): Int { var result = applicationId?.hashCode() ?: 0 result = 31 * result + (webDomain?.hashCode() ?: 0) - result = 31 * result + (genericInfo?.hashCode() ?: 0) return result } override fun toString(): String { - return applicationId ?: webDomain ?: genericInfo ?: "" + return applicationId ?: webDomain ?: "" } companion object { diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt index f3e94a30d..cba9c231d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsFragment.kt @@ -24,7 +24,8 @@ import androidx.fragment.app.DialogFragment import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistPreferenceDialogFragmentCompat +import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistAppIdPreferenceDialogFragmentCompat +import com.kunzisoft.keepass.settings.preferencedialogfragment.AutofillBlocklistWebDomainPreferenceDialogFragmentCompat class AutofillSettingsFragment : PreferenceFragmentCompat() { @@ -39,8 +40,11 @@ class AutofillSettingsFragment : PreferenceFragmentCompat() { var dialogFragment: DialogFragment? = null when (preference?.key) { - getString(R.string.autofill_blocklist_key) -> { - dialogFragment = AutofillBlocklistPreferenceDialogFragmentCompat.newInstance(preference.key) + getString(R.string.autofill_application_id_blocklist_key) -> { + dialogFragment = AutofillBlocklistAppIdPreferenceDialogFragmentCompat.newInstance(preference.key) + } + getString(R.string.autofill_web_domain_blocklist_key) -> { + dialogFragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.newInstance(preference.key) } else -> otherDialogFragment = true } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt new file mode 100644 index 000000000..d24628793 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt @@ -0,0 +1,49 @@ +/* + * Copyright 2020 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferencedialogfragment + +import android.os.Bundle +import com.kunzisoft.keepass.model.SearchInfo + +class AutofillBlocklistAppIdPreferenceDialogFragmentCompat + : AutofillBlocklistPreferenceDialogFragmentCompat() { + + override fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? { + return if (Regex(APPLICATION_ID_REGEX).matches(searchInfoString)) { + SearchInfo().apply { this.applicationId = searchInfoString } + } else { + null + } + } + + companion object { + // https://gist.github.com/rishabhmhjn/8663966 + private const val APPLICATION_ID_REGEX = "^(?:[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)(?:\\.[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)+\$" + + fun newInstance(key: String): AutofillBlocklistAppIdPreferenceDialogFragmentCompat { + val fragment = AutofillBlocklistAppIdPreferenceDialogFragmentCompat() + val bundle = Bundle(1) + bundle.putString(ARG_KEY, key) + fragment.arguments = bundle + + return fragment + } + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt index c1ed9a830..28c171147 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt @@ -19,34 +19,37 @@ */ package com.kunzisoft.keepass.settings.preferencedialogfragment -import android.os.Bundle import android.view.View import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.kunzisoft.keepass.R import com.kunzisoft.keepass.model.SearchInfo import com.kunzisoft.keepass.settings.preferencedialogfragment.adapter.AutofillBlocklistAdapter +import java.util.* +import kotlin.Comparator +import kotlin.collections.HashSet -class AutofillBlocklistPreferenceDialogFragmentCompat +abstract class AutofillBlocklistPreferenceDialogFragmentCompat : InputPreferenceDialogFragmentCompat(), AutofillBlocklistAdapter.ItemDeletedCallback { - private var persistedItems = HashSet() + private var persistedItems = TreeSet( + Comparator { o1, o2 -> o1.toString().compareTo(o2.toString()) }) private var filterAdapter: AutofillBlocklistAdapter? = null + abstract fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? + override fun onBindDialogView(view: View) { super.onBindDialogView(view) preference.getPersistedStringSet(emptySet()).forEach { searchInfoString -> - persistedItems.add(SearchInfo().apply { genericInfo = searchInfoString }) + addSearchInfo(searchInfoString) } val addItemButton = view.findViewById(R.id.add_item_button) addItemButton?.setOnClickListener { - persistedItems.add(SearchInfo().apply { - genericInfo = inputText - }) + addSearchInfo(inputText) filterAdapter?.replaceItems(persistedItems.toList()) } @@ -61,6 +64,12 @@ class AutofillBlocklistPreferenceDialogFragmentCompat } } + private fun addSearchInfo(searchInfoString: String) { + val itemToAdd = buildSearchInfoFromString(searchInfoString) + if (itemToAdd != null && !itemToAdd.containsOnlyNullValues()) + persistedItems.add(itemToAdd) + } + override fun onItemDeleted(item: SearchInfo) { persistedItems.remove(item) filterAdapter?.replaceItems(persistedItems.toList()) @@ -81,16 +90,4 @@ class AutofillBlocklistPreferenceDialogFragmentCompat preference.persistStringSet(getStringItems()) } } - - companion object { - - fun newInstance(key: String): AutofillBlocklistPreferenceDialogFragmentCompat { - val fragment = AutofillBlocklistPreferenceDialogFragmentCompat() - val bundle = Bundle(1) - bundle.putString(ARG_KEY, key) - fragment.arguments = bundle - - return fragment - } - } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt new file mode 100644 index 000000000..5a0baaca2 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt @@ -0,0 +1,51 @@ +/* + * Copyright 2020 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferencedialogfragment + +import android.os.Bundle +import com.kunzisoft.keepass.model.SearchInfo +import java.net.URI + +class AutofillBlocklistWebDomainPreferenceDialogFragmentCompat + : AutofillBlocklistPreferenceDialogFragmentCompat() { + + override fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? { + // remove prefix https:// + val newSearchInfo = searchInfoString.replace(Regex("^.*?://"), "") + return if (Regex(WEB_DOMAIN_REGEX).matches(newSearchInfo)) { + SearchInfo().apply { webDomain = newSearchInfo } + } else { + null + } + } + + companion object { + private const val WEB_DOMAIN_REGEX = "^(?!://)([a-zA-Z0-9-_]+\\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\\.[a-zA-Z]{2,11}?\$" + + fun newInstance(key: String): AutofillBlocklistWebDomainPreferenceDialogFragmentCompat { + val fragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat() + val bundle = Bundle(1) + bundle.putString(ARG_KEY, key) + fragment.arguments = bundle + + return fragment + } + } +} diff --git a/app/src/main/res/layout/pref_dialog_input_list.xml b/app/src/main/res/layout/pref_dialog_input_list.xml index e153b46bc..a5f31ee02 100644 --- a/app/src/main/res/layout/pref_dialog_input_list.xml +++ b/app/src/main/res/layout/pref_dialog_input_list.xml @@ -42,7 +42,7 @@ android:id="@+id/switch_element" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_margin="20dp" + android:layout_margin="24dp" android:text="@string/enable" android:background="@drawable/background_button_small" android:textColor="?attr/textColorInverse" @@ -55,18 +55,16 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:layout_marginStart="@dimen/default_margin" - android:layout_marginLeft="@dimen/default_margin" - android:layout_marginEnd="@dimen/default_margin" - android:layout_marginRight="@dimen/default_margin" + android:layout_marginStart="24dp" + android:layout_marginLeft="24dp" + android:layout_marginEnd="24dp" + android:layout_marginRight="24dp" app:layout_constraintTop_toBottomOf="@id/switch_element" android:orientation="horizontal"> diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 6def8bff3..136661d38 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -132,7 +132,8 @@ false autofill_auto_search_key true - autofill_blocklist_key + autofill_application_id_blocklist_key + autofill_web_domain_blocklist_key settings_advanced_unlock_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fa6c3d126..18dbd89c2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -380,8 +380,11 @@ Vibratory keypresses Audible keypresses Auto search - Automatically suggest search results from the web domain or application Id - Blocklist + Automatically suggest search results from the web domain or application ID + Application block list + Block list that prevents auto filling of apps + Web domain block list + Block list that prevents auto filling of web domains Allow no master key Enable the \"Open\" button if no credentials are selected Delete password diff --git a/app/src/main/res/xml/preferences_autofill.xml b/app/src/main/res/xml/preferences_autofill.xml index 6dc635efc..2cd5447c4 100644 --- a/app/src/main/res/xml/preferences_autofill.xml +++ b/app/src/main/res/xml/preferences_autofill.xml @@ -29,7 +29,12 @@ + android:key="@string/autofill_application_id_blocklist_key" + android:title="@string/autofill_application_id_blocklist_title" + android:summary="@string/autofill_application_id_blocklist_summary"/> + \ No newline at end of file From ade9af9ecd91effec4fdbbc98e925033e8fef703 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 16:43:23 +0200 Subject: [PATCH 23/59] Block list verification --- .../keepass/autofill/KeeAutofillService.kt | 60 ++++++++++++------- .../com/kunzisoft/keepass/model/SearchInfo.kt | 17 ++++++ .../keepass/settings/PreferencesUtil.kt | 12 ++++ ...listAppIdPreferenceDialogFragmentCompat.kt | 12 ++-- ...WebDomainPreferenceDialogFragmentCompat.kt | 15 ++--- 5 files changed, 76 insertions(+), 40 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt index d42e65023..d1744c822 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt @@ -30,6 +30,7 @@ import com.kunzisoft.keepass.activities.AutofillLauncherActivity import com.kunzisoft.keepass.database.element.Database import com.kunzisoft.keepass.database.search.SearchHelper import com.kunzisoft.keepass.model.SearchInfo +import com.kunzisoft.keepass.settings.PreferencesUtil @RequiresApi(api = Build.VERSION_CODES.O) class KeeAutofillService : AutofillService() { @@ -45,32 +46,45 @@ class KeeAutofillService : AutofillService() { // Check user's settings for authenticating Responses and Datasets. StructureParser(latestStructure).parse()?.let { parseResult -> - val searchInfo = SearchInfo().apply { - applicationId = parseResult.applicationId - webDomain = parseResult.domain + // Build search info only if applicationId or webDomain are not blocked + var searchAllowed = true + parseResult.applicationId?.let { + if (PreferencesUtil.applicationIdBlocklist(this).contains(it)) + searchAllowed = false + } + parseResult.domain?.let { + if (PreferencesUtil.webDomainBlocklist(this).contains(it)) + searchAllowed = false } - SearchHelper.checkAutoSearchInfo(this, - Database.getInstance(), - searchInfo, - { items -> - val responseBuilder = FillResponse.Builder() - AutofillHelper.addHeader(responseBuilder, packageName, - parseResult.domain, parseResult.applicationId) - items.forEach { - responseBuilder.addDataset(AutofillHelper.buildDataset(this, it, parseResult)) + if (searchAllowed) { + val searchInfo = SearchInfo().apply { + applicationId = parseResult.applicationId + webDomain = parseResult.domain + } + + SearchHelper.checkAutoSearchInfo(this, + Database.getInstance(), + searchInfo, + { items -> + val responseBuilder = FillResponse.Builder() + AutofillHelper.addHeader(responseBuilder, packageName, + parseResult.domain, parseResult.applicationId) + items.forEach { + responseBuilder.addDataset(AutofillHelper.buildDataset(this, it, parseResult)) + } + callback.onSuccess(responseBuilder.build()) + }, + { + // Show UI if no search result + showUIForEntrySelection(parseResult, searchInfo, callback) + }, + { + // Show UI if database not open + showUIForEntrySelection(parseResult, searchInfo, callback) } - callback.onSuccess(responseBuilder.build()) - }, - { - // Show UI if no search result - showUIForEntrySelection(parseResult, searchInfo, callback) - }, - { - // Show UI if database not open - showUIForEntrySelection(parseResult, searchInfo, callback) - } - ) + ) + } } } diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index efb05b191..96ab97b4e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -8,7 +8,21 @@ import com.kunzisoft.keepass.utils.ObjectNameResource class SearchInfo : ObjectNameResource, Parcelable { var applicationId: String? = null + set(value) { + field = when { + value == null -> null + Regex(APPLICATION_ID_REGEX).matches(value) -> value + else -> null + } + } var webDomain: String? = null + set(value) { + field = when { + value == null -> null + Regex(WEB_DOMAIN_REGEX).matches(value) -> value + else -> null + } + } constructor() @@ -59,6 +73,9 @@ class SearchInfo : ObjectNameResource, Parcelable { } companion object { + // https://gist.github.com/rishabhmhjn/8663966 + const val APPLICATION_ID_REGEX = "^(?:[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)(?:\\.[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)+\$" + const val WEB_DOMAIN_REGEX = "^(?!://)([a-zA-Z0-9-_]+\\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\\.[a-zA-Z]{2,11}?\$" @JvmField val CREATOR: Parcelable.Creator = object : Parcelable.Creator { diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt index a3208bc15..9b0773e77 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt @@ -366,4 +366,16 @@ object PreferencesUtil { return prefs.getBoolean(context.getString(R.string.autofill_auto_search_key), context.resources.getBoolean(R.bool.autofill_auto_search_default)) } + + fun applicationIdBlocklist(context: Context): Set { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getStringSet(context.getString(R.string.autofill_application_id_blocklist_key), null) + ?: emptySet() + } + + fun webDomainBlocklist(context: Context): Set { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getStringSet(context.getString(R.string.autofill_web_domain_blocklist_key), null) + ?: emptySet() + } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt index d24628793..a783b91c3 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt @@ -26,17 +26,13 @@ class AutofillBlocklistAppIdPreferenceDialogFragmentCompat : AutofillBlocklistPreferenceDialogFragmentCompat() { override fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? { - return if (Regex(APPLICATION_ID_REGEX).matches(searchInfoString)) { - SearchInfo().apply { this.applicationId = searchInfoString } - } else { - null - } + val newSearchInfo = searchInfoString + // remove chars not allowed in application ID + .replace(Regex("[^a-zA-Z0-9_.]+"), "") + return SearchInfo().apply { this.applicationId = newSearchInfo } } companion object { - // https://gist.github.com/rishabhmhjn/8663966 - private const val APPLICATION_ID_REGEX = "^(?:[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)(?:\\.[a-zA-Z]+(?:\\d*[a-zA-Z_]*)*)+\$" - fun newInstance(key: String): AutofillBlocklistAppIdPreferenceDialogFragmentCompat { val fragment = AutofillBlocklistAppIdPreferenceDialogFragmentCompat() val bundle = Bundle(1) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt index 5a0baaca2..82c7aa0c5 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt @@ -27,18 +27,15 @@ class AutofillBlocklistWebDomainPreferenceDialogFragmentCompat : AutofillBlocklistPreferenceDialogFragmentCompat() { override fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? { - // remove prefix https:// - val newSearchInfo = searchInfoString.replace(Regex("^.*?://"), "") - return if (Regex(WEB_DOMAIN_REGEX).matches(newSearchInfo)) { - SearchInfo().apply { webDomain = newSearchInfo } - } else { - null - } + val newSearchInfo = searchInfoString + // remove prefix https:// + .replace(Regex("^.*://"), "") + // Remove suffix /login... + .replace(Regex("/.*$"), "") + return SearchInfo().apply { webDomain = newSearchInfo } } companion object { - private const val WEB_DOMAIN_REGEX = "^(?!://)([a-zA-Z0-9-_]+\\.)*[a-zA-Z0-9][a-zA-Z0-9-_]+\\.[a-zA-Z]{2,11}?\$" - fun newInstance(key: String): AutofillBlocklistWebDomainPreferenceDialogFragmentCompat { val fragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat() val bundle = Bundle(1) From 9e542d0bbefb60515d066d0d2d7cbb9794197632 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 17:52:35 +0200 Subject: [PATCH 24/59] Dialog input much better --- ...BlocklistPreferenceDialogFragmentCompat.kt | 33 +++++++++++-- .../InputPreferenceDialogFragmentCompat.kt | 49 +++++++++++++++---- app/src/main/res/values/strings.xml | 1 + 3 files changed, 70 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt index 28c171147..cdd56ac7b 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt @@ -20,6 +20,8 @@ package com.kunzisoft.keepass.settings.preferencedialogfragment import android.view.View +import android.view.inputmethod.EditorInfo +import android.widget.TextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.kunzisoft.keepass.R @@ -47,10 +49,20 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat addSearchInfo(searchInfoString) } + setOnInputTextEditorActionListener(TextView.OnEditorActionListener { _, actionId, _ -> + when (actionId) { + EditorInfo.IME_ACTION_DONE -> { + addItemFromInputText() + hideKeyboard() + false + } + else -> false + } + }) + val addItemButton = view.findViewById(R.id.add_item_button) addItemButton?.setOnClickListener { - addSearchInfo(inputText) - filterAdapter?.replaceItems(persistedItems.toList()) + addItemFromInputText() } val recyclerView = view.findViewById(R.id.pref_dialog_list) @@ -64,10 +76,23 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat } } - private fun addSearchInfo(searchInfoString: String) { + private fun addSearchInfo(searchInfoString: String): Boolean { val itemToAdd = buildSearchInfoFromString(searchInfoString) - if (itemToAdd != null && !itemToAdd.containsOnlyNullValues()) + return if (itemToAdd != null && !itemToAdd.containsOnlyNullValues()) { persistedItems.add(itemToAdd) + true + } else { + false + } + } + + private fun addItemFromInputText() { + if (addSearchInfo(inputText)) { + inputText = "" + } else { + setInputTextError(getString(R.string.error_string_type)) + } + filterAdapter?.replaceItems(persistedItems.toList()) } override fun onItemDeleted(item: SearchInfo) { diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt index 1db7c8e49..7932e3d3d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/InputPreferenceDialogFragmentCompat.kt @@ -21,10 +21,12 @@ package com.kunzisoft.keepass.settings.preferencedialogfragment import android.view.View import android.view.inputmethod.EditorInfo +import android.view.inputmethod.InputMethodManager import android.widget.CompoundButton import android.widget.EditText import android.widget.TextView import androidx.annotation.StringRes +import androidx.core.content.ContextCompat import androidx.preference.PreferenceDialogFragmentCompat import com.kunzisoft.keepass.R @@ -34,6 +36,8 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom private var textExplanationView: TextView? = null private var switchElementView: CompoundButton? = null + private var mOnInputTextEditorActionListener: TextView.OnEditorActionListener? = null + var inputText: String get() = this.inputTextView?.text?.toString() ?: "" set(inputText) { @@ -43,6 +47,14 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom } } + fun setInputTextError(error: CharSequence) { + this.inputTextView?.error = error + } + + fun setOnInputTextEditorActionListener(onEditorActionListener: TextView.OnEditorActionListener) { + this.mOnInputTextEditorActionListener = onEditorActionListener + } + var explanationText: String? get() = textExplanationView?.text?.toString() ?: "" set(explanationText) { @@ -63,16 +75,21 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom inputTextView = view.findViewById(R.id.input_text) inputTextView?.apply { imeOptions = EditorInfo.IME_ACTION_DONE - setOnEditorActionListener { _, actionId, _ -> - when (actionId) { - EditorInfo.IME_ACTION_DONE -> { - onDialogClosed(true) - dialog?.dismiss() - true - } - else -> { - false + setOnEditorActionListener { v, actionId, event -> + if (mOnInputTextEditorActionListener == null) { + when (actionId) { + EditorInfo.IME_ACTION_DONE -> { + onDialogClosed(true) + dialog?.dismiss() + true + } + else -> { + false + } } + } else { + mOnInputTextEditorActionListener?.onEditorAction(v, actionId, event) + ?: false } } } @@ -82,6 +99,20 @@ abstract class InputPreferenceDialogFragmentCompat : PreferenceDialogFragmentCom switchElementView?.visibility = View.GONE } + protected fun hideKeyboard(): Boolean { + context?.let { + ContextCompat.getSystemService(it, InputMethodManager::class.java)?.let { inputManager -> + activity?.currentFocus?.let { focus -> + val windowToken = focus.windowToken + if (windowToken != null) { + return inputManager.hideSoftInputFromWindow(windowToken, 0) + } + } + } + } + return false + } + fun setInoutText(@StringRes inputTextId: Int) { inputText = getString(inputTextId) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 18dbd89c2..94e63e242 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -132,6 +132,7 @@ Counter must be between %1$d and %2$d. Period must be between %1$d and %2$d seconds. Token must contain %1$d to %2$d digits. + This text does not match the requested item. Field name Field value Could not find file. Try reopening it from your file browser. From 6e2d84be337c191e0bcdf7293f9e3b8e6618cc64 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 18:02:52 +0200 Subject: [PATCH 25/59] Dialog input much better --- ...AutofillBlocklistPreferenceDialogFragmentCompat.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt index cdd56ac7b..ef9ee1af1 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt @@ -52,9 +52,14 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat setOnInputTextEditorActionListener(TextView.OnEditorActionListener { _, actionId, _ -> when (actionId) { EditorInfo.IME_ACTION_DONE -> { - addItemFromInputText() - hideKeyboard() - false + if (inputText.isEmpty()) { + onDialogClosed(true) + dialog?.dismiss() + true + } else { + addItemFromInputText() + false + } } else -> false } From 6903099873a74b1babe17ddc873c25c815645332 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 18:16:37 +0200 Subject: [PATCH 26/59] Better block list algorithm --- .../kunzisoft/keepass/autofill/KeeAutofillService.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt index d1744c822..deb37bccd 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt @@ -49,12 +49,20 @@ class KeeAutofillService : AutofillService() { // Build search info only if applicationId or webDomain are not blocked var searchAllowed = true parseResult.applicationId?.let { - if (PreferencesUtil.applicationIdBlocklist(this).contains(it)) + if (PreferencesUtil.applicationIdBlocklist(this).any { appIdBlocked -> + it.contains(appIdBlocked) + } + ) { searchAllowed = false + } } parseResult.domain?.let { - if (PreferencesUtil.webDomainBlocklist(this).contains(it)) + if (PreferencesUtil.webDomainBlocklist(this).any { webDomainBlocked -> + it.contains(webDomainBlocked) + } + ) { searchAllowed = false + } } if (searchAllowed) { From 55cc782cc693b00a2ad6049f62d0b43d2fabff14 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 18:33:22 +0200 Subject: [PATCH 27/59] Keep list during orientation change --- ...BlocklistPreferenceDialogFragmentCompat.kt | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt index ef9ee1af1..11383d2b0 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt @@ -19,6 +19,7 @@ */ package com.kunzisoft.keepass.settings.preferencedialogfragment +import android.os.Bundle import android.view.View import android.view.inputmethod.EditorInfo import android.widget.TextView @@ -42,13 +43,27 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat abstract fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + // To get items for saved instance state + savedInstanceState?.getParcelableArray(ITEMS_KEY)?.let { + it.forEach { itemSaved -> + (itemSaved as SearchInfo?)?.let { item -> + persistedItems.add(item) + } + } + } ?: run { + // Or from preference + preference.getPersistedStringSet(emptySet()).forEach { searchInfoString -> + addSearchInfo(searchInfoString) + } + } + } + override fun onBindDialogView(view: View) { super.onBindDialogView(view) - preference.getPersistedStringSet(emptySet()).forEach { searchInfoString -> - addSearchInfo(searchInfoString) - } - setOnInputTextEditorActionListener(TextView.OnEditorActionListener { _, actionId, _ -> when (actionId) { EditorInfo.IME_ACTION_DONE -> { @@ -115,9 +130,18 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat return setItems } + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + outState.putParcelableArray(ITEMS_KEY, persistedItems.toTypedArray()) + } + override fun onDialogClosed(positiveResult: Boolean) { if (positiveResult) { preference.persistStringSet(getStringItems()) } } + + companion object { + private const val ITEMS_KEY = "ITEMS_KEY" + } } From dff23865941826e9b8e05e2a2fb7048653ba9906 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 18:47:10 +0200 Subject: [PATCH 28/59] Fix shrink --- .../main/res/layout/pref_dialog_input_list.xml | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/app/src/main/res/layout/pref_dialog_input_list.xml b/app/src/main/res/layout/pref_dialog_input_list.xml index a5f31ee02..a26dc04c9 100644 --- a/app/src/main/res/layout/pref_dialog_input_list.xml +++ b/app/src/main/res/layout/pref_dialog_input_list.xml @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . --> - + android:paddingRight="24dp" /> - \ No newline at end of file + \ No newline at end of file From 2f921897c7ee25d6af7dcfd12a742c10620fc58d Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 18:58:40 +0200 Subject: [PATCH 29/59] Block list to blocklist --- app/src/main/res/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 94e63e242..5de49cfa1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -382,10 +382,10 @@ Audible keypresses Auto search Automatically suggest search results from the web domain or application ID - Application block list - Block list that prevents auto filling of apps - Web domain block list - Block list that prevents auto filling of web domains + Application blocklist + Blocklist that prevents auto filling of apps + Web domain blocklist + Blocklist that prevents auto filling of web domains Allow no master key Enable the \"Open\" button if no credentials are selected Delete password From d177001ea8c666efad138e425466f02497ad6ad2 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 19:03:28 +0200 Subject: [PATCH 30/59] Upgrade CHANGELOG --- CHANGELOG | 3 ++- fastlane/metadata/android/en-US/changelogs/35.txt | 2 +- fastlane/metadata/android/fr-FR/changelogs/35.txt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 301f65de8..9de7b6273 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ KeePassDX(2.7) - * + * Add blocklists for autofill + KeePassDX(2.6) * Share a web domain to automatically search for an entry diff --git a/fastlane/metadata/android/en-US/changelogs/35.txt b/fastlane/metadata/android/en-US/changelogs/35.txt index e3209a3bf..5f05921a3 100644 --- a/fastlane/metadata/android/en-US/changelogs/35.txt +++ b/fastlane/metadata/android/en-US/changelogs/35.txt @@ -1,2 +1,2 @@ - * + * Add blocklists for autofill diff --git a/fastlane/metadata/android/fr-FR/changelogs/35.txt b/fastlane/metadata/android/fr-FR/changelogs/35.txt index e3209a3bf..394c2e3e1 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/35.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/35.txt @@ -1,2 +1,2 @@ - * + * Ajout des listes de blocage pour le remplissage automatique From b1ccb40bd32453c7803e584ca10839c12aaa078e Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 19:08:19 +0200 Subject: [PATCH 31/59] Upgrade CHANGELOG --- CHANGELOG | 3 ++- fastlane/metadata/android/en-US/changelogs/35.txt | 2 ++ fastlane/metadata/android/fr-FR/changelogs/35.txt | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 9de7b6273..c22d7f320 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ KeePassDX(2.7) * Add blocklists for autofill - + * Add autofill compatibility mode (usefull for Browser not compatible) + * Upgrade autofill recognition algorithm KeePassDX(2.6) * Share a web domain to automatically search for an entry diff --git a/fastlane/metadata/android/en-US/changelogs/35.txt b/fastlane/metadata/android/en-US/changelogs/35.txt index 5f05921a3..d68ff6d85 100644 --- a/fastlane/metadata/android/en-US/changelogs/35.txt +++ b/fastlane/metadata/android/en-US/changelogs/35.txt @@ -1,2 +1,4 @@ * Add blocklists for autofill + * Add autofill compatibility mode (usefull for Browser not compatible) + * Upgrade autofill recognition algorithm diff --git a/fastlane/metadata/android/fr-FR/changelogs/35.txt b/fastlane/metadata/android/fr-FR/changelogs/35.txt index 394c2e3e1..062396cc8 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/35.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/35.txt @@ -1,2 +1,4 @@ * Ajout des listes de blocage pour le remplissage automatique + * Ajout du mode de compatibilité pour le remplissage automatique (utile pour les navigateurs non compatibles) + * Mise à jour de l'algorithme de reconnaissance du remplissage automatique From 93d04bfe60a4f59e78f226cdcda8c122584e4d23 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 20:20:18 +0200 Subject: [PATCH 32/59] Fix crash --- .../java/com/kunzisoft/keepass/activities/PasswordActivity.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt index 184561f98..c8cd60fbe 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt @@ -339,6 +339,7 @@ open class PasswordActivity : StylishActivity() { override fun onResume() { if (Database.getInstance().loaded) { + super.onResume() launchGroupActivity() } else { mRememberKeyFile = PreferencesUtil.rememberKeyFileLocations(this) From ab0cd4152a746111241d92e584f3e52670028921 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 20:25:54 +0200 Subject: [PATCH 33/59] Fix search and autofill performance --- .../keepass/autofill/KeeAutofillService.kt | 18 ++++++++++++++---- .../com/kunzisoft/keepass/model/SearchInfo.kt | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt index deb37bccd..0d6d7cd0d 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt @@ -35,6 +35,16 @@ import com.kunzisoft.keepass.settings.PreferencesUtil @RequiresApi(api = Build.VERSION_CODES.O) class KeeAutofillService : AutofillService() { + var applicationIdBlocklist: Set? = null + var webDomainBlocklist: Set? = null + + override fun onCreate() { + super.onCreate() + + applicationIdBlocklist = PreferencesUtil.applicationIdBlocklist(this) + webDomainBlocklist = PreferencesUtil.webDomainBlocklist(this) + } + override fun onFillRequest(request: FillRequest, cancellationSignal: CancellationSignal, callback: FillCallback) { @@ -49,17 +59,17 @@ class KeeAutofillService : AutofillService() { // Build search info only if applicationId or webDomain are not blocked var searchAllowed = true parseResult.applicationId?.let { - if (PreferencesUtil.applicationIdBlocklist(this).any { appIdBlocked -> + if (applicationIdBlocklist?.any { appIdBlocked -> it.contains(appIdBlocked) - } + } == true ) { searchAllowed = false } } parseResult.domain?.let { - if (PreferencesUtil.webDomainBlocklist(this).any { webDomainBlocked -> + if (webDomainBlocklist?.any { webDomainBlocked -> it.contains(webDomainBlocked) - } + } == true ) { searchAllowed = false } diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index 96ab97b4e..e9b21f7b8 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -69,7 +69,7 @@ class SearchInfo : ObjectNameResource, Parcelable { } override fun toString(): String { - return applicationId ?: webDomain ?: "" + return webDomain ?: applicationId ?: "" } companion object { From d0da4f03a66f78e976cc0c557bdfd082af001f91 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 20:40:01 +0200 Subject: [PATCH 34/59] Search through subdomains as parameter #584 --- .../activities/EntrySelectionLauncherActivity.kt | 5 +---- .../kunzisoft/keepass/activities/GroupActivity.kt | 3 ++- .../kunzisoft/keepass/database/element/Database.kt | 8 +++----- .../keepass/database/search/SearchHelper.kt | 9 +++++++-- .../java/com/kunzisoft/keepass/model/SearchInfo.kt | 14 ++++++++++++++ .../kunzisoft/keepass/settings/PreferencesUtil.kt | 6 ++++++ .../java/com/kunzisoft/keepass/utils/UriUtil.kt | 13 +++++++++++++ app/src/main/res/values/donottranslate.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences_application.xml | 6 +++++- 10 files changed, 55 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt index 6ea936af1..ccae18280 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt @@ -23,9 +23,7 @@ import android.app.Activity import android.content.Intent import android.net.Uri import android.os.Bundle -import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.kunzisoft.keepass.R import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper import com.kunzisoft.keepass.database.element.Database import com.kunzisoft.keepass.database.search.SearchHelper @@ -49,9 +47,8 @@ class EntrySelectionLauncherActivity : AppCompatActivity() { if ("text/plain" == intent.type) { // Retrieve web domain intent.getStringExtra(Intent.EXTRA_TEXT)?.let { - sharedWebDomain = Uri.parse(it).authority + sharedWebDomain = Uri.parse(it).host } - } } else -> {} diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index 50dd998f8..7952b8474 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -63,6 +63,7 @@ import com.kunzisoft.keepass.database.element.node.Type import com.kunzisoft.keepass.education.GroupActivityEducation import com.kunzisoft.keepass.icons.assignDatabaseIcon import com.kunzisoft.keepass.model.SearchInfo +import com.kunzisoft.keepass.model.getSearchString import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_COPY_NODES_TASK import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_GROUP_TASK import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_DELETE_NODES_TASK @@ -308,7 +309,7 @@ class GroupActivity : LockingActivity(), if (searchInfo != null) { intent.action = Intent.ACTION_SEARCH intent.removeExtra(KEY_SEARCH_INFO) - intent.putExtra(SearchManager.QUERY, searchInfo.toString()) + intent.putExtra(SearchManager.QUERY, searchInfo.getSearchString(this)) return true } return false diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt index 18357c23b..70f32c332 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/Database.kt @@ -404,11 +404,9 @@ class Database { return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchQuery, SearchParameters(), max) } - fun createVirtualGroupFromSearch(searchInfo: SearchInfo, - max: Int = Integer.MAX_VALUE): Group? { - if (searchInfo.containsOnlyNullValues()) - return null - return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchInfo.toString(), SearchParameters().apply { + fun createVirtualGroupFromSearchInfo(searchInfoString: String, + max: Int = Integer.MAX_VALUE): Group? { + return mSearchHelper?.createVirtualGroupWithSearchResult(this, searchInfoString, SearchParameters().apply { searchInTitles = false searchInUserNames = false searchInPasswords = false diff --git a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt index 9e94ab4e2..dc57f168f 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/search/SearchHelper.kt @@ -28,6 +28,7 @@ import com.kunzisoft.keepass.database.search.iterator.EntrySearchStringIteratorK import com.kunzisoft.keepass.database.search.iterator.EntrySearchStringIteratorKDBX import com.kunzisoft.keepass.model.EntryInfo import com.kunzisoft.keepass.model.SearchInfo +import com.kunzisoft.keepass.model.getSearchString import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper @@ -48,9 +49,13 @@ class SearchHelper(private val isOmitBackup: Boolean) { if (database.loaded && TimeoutHelper.checkTime(context)) { var searchWithoutUI = false if (PreferencesUtil.isAutofillAutoSearchEnable(context) - && searchInfo != null) { + && searchInfo != null + && !searchInfo.containsOnlyNullValues()) { // If search provide results - database.createVirtualGroupFromSearch(searchInfo, SearchHelper.MAX_SEARCH_ENTRY)?.let { searchGroup -> + database.createVirtualGroupFromSearchInfo( + searchInfo.getSearchString(context), + MAX_SEARCH_ENTRY + )?.let { searchGroup -> if (searchGroup.getNumberOfChildEntries() > 0) { searchWithoutUI = true onItemsFound.invoke( diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index e9b21f7b8..707ee97f3 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -1,9 +1,12 @@ package com.kunzisoft.keepass.model +import android.content.Context import android.content.res.Resources import android.os.Parcel import android.os.Parcelable +import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.utils.ObjectNameResource +import com.kunzisoft.keepass.utils.UriUtil class SearchInfo : ObjectNameResource, Parcelable { @@ -88,4 +91,15 @@ class SearchInfo : ObjectNameResource, Parcelable { } } } +} + +fun SearchInfo.getSearchString(context: Context): String { + return run { + if (!PreferencesUtil.searchSubdomains(context)) + UriUtil.getWebDomainWithoutSubDomain(webDomain) + else + webDomain + } + ?: applicationId + ?: "" } \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt index 9b0773e77..995c56551 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt @@ -97,6 +97,12 @@ object PreferencesUtil { context.resources.getBoolean(R.bool.auto_focus_search_default)) } + fun searchSubdomains(context: Context): Boolean { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getBoolean(context.getString(R.string.subdomain_search_key), + context.resources.getBoolean(R.bool.subdomain_search_default)) + } + fun showUsernamesListEntries(context: Context): Boolean { val prefs = PreferenceManager.getDefaultSharedPreferences(context) return prefs.getBoolean(context.getString(R.string.list_entries_show_username_key), diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt index 14b17346c..fa0a24625 100644 --- a/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.kt @@ -86,6 +86,19 @@ object UriUtil { null } + fun getWebDomainWithoutSubDomain(webDomain: String?): String? { + webDomain?.split(".")?.let { domainArray -> + if (domainArray.isEmpty()) { + return "" + } + if (domainArray.size == 1) { + return domainArray[0]; + } + return domainArray[domainArray.size - 2] + "." + domainArray[domainArray.size - 1] + } + return null + } + fun decode(uri: String?): String { return Uri.decode(uri) ?: "" } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 136661d38..10b67434b 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -67,6 +67,8 @@ true auto_focus_search_key false + subdomain_search_key + false app_timeout_key lock_database_screen_off_key true diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5de49cfa1..a4f82df2d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -202,6 +202,8 @@ Omits \"Backup\" and \"Recycle bin\" groups from search results Quick search Request a search when opening a database + Subdomain search + Search web domains with subdomains constraints Creating new database… Working… Protection diff --git a/app/src/main/res/xml/preferences_application.xml b/app/src/main/res/xml/preferences_application.xml index ed4599483..9c140c562 100644 --- a/app/src/main/res/xml/preferences_application.xml +++ b/app/src/main/res/xml/preferences_application.xml @@ -59,7 +59,11 @@ android:title="@string/auto_focus_search_title" android:summary="@string/auto_focus_search_summary" android:defaultValue="@bool/auto_focus_search_default"/> - + Date: Wed, 10 Jun 2020 20:43:16 +0200 Subject: [PATCH 35/59] Update CHANGELOG --- CHANGELOG | 1 + fastlane/metadata/android/en-US/changelogs/35.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/35.txt | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index c22d7f320..954022668 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ KeePassDX(2.7) * Add blocklists for autofill * Add autofill compatibility mode (usefull for Browser not compatible) * Upgrade autofill recognition algorithm + * Setting to search through web subdomains KeePassDX(2.6) * Share a web domain to automatically search for an entry diff --git a/fastlane/metadata/android/en-US/changelogs/35.txt b/fastlane/metadata/android/en-US/changelogs/35.txt index d68ff6d85..49b23592b 100644 --- a/fastlane/metadata/android/en-US/changelogs/35.txt +++ b/fastlane/metadata/android/en-US/changelogs/35.txt @@ -1,4 +1,5 @@ * Add blocklists for autofill * Add autofill compatibility mode (usefull for Browser not compatible) * Upgrade autofill recognition algorithm + * Setting to search through web subdomains diff --git a/fastlane/metadata/android/fr-FR/changelogs/35.txt b/fastlane/metadata/android/fr-FR/changelogs/35.txt index 062396cc8..06e245fd5 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/35.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/35.txt @@ -1,4 +1,4 @@ * Ajout des listes de blocage pour le remplissage automatique * Ajout du mode de compatibilité pour le remplissage automatique (utile pour les navigateurs non compatibles) * Mise à jour de l'algorithme de reconnaissance du remplissage automatique - + * Paramètre pour rechercher à travers les sous-domaines web From 0b71b2d659990dbf252a0616623944c80fc8e657 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 10 Jun 2020 20:50:55 +0200 Subject: [PATCH 36/59] Fix populate Magikeyboard when URL is present --- .../keepass/notifications/KeyboardEntryNotificationService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt index 850575bf7..0deb45eec 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/KeyboardEntryNotificationService.kt @@ -151,6 +151,7 @@ class KeyboardEntryNotificationService : LockNotificationService() { fun launchNotificationIfAllowed(context: Context, entry: EntryInfo, toast: Boolean) { + val containsURLToCopy = entry.url.isNotEmpty() val containsUsernameToCopy = entry.username.isNotEmpty() val containsPasswordToCopy = entry.password.isNotEmpty() val containsExtraFieldToCopy = entry.customFields.isNotEmpty() @@ -158,7 +159,7 @@ class KeyboardEntryNotificationService : LockNotificationService() { var startService = false val intent = Intent(context, KeyboardEntryNotificationService::class.java) - if (containsUsernameToCopy || containsPasswordToCopy || containsExtraFieldToCopy) { + if (containsURLToCopy || containsUsernameToCopy || containsPasswordToCopy || containsExtraFieldToCopy) { if (toast) { Toast.makeText(context, context.getString(R.string.keyboard_notification_entry_content_title, entry.title), From 503a4b1374a4c74f8fc41526234a5adf324650d1 Mon Sep 17 00:00:00 2001 From: zeritti Date: Tue, 9 Jun 2020 20:53:59 +0000 Subject: [PATCH 37/59] Translated using Weblate (Czech) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/cs/ --- app/src/main/res/values-cs/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index d8fd3fed4..0ac6894cc 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -344,7 +344,7 @@ Výběr položky Při prohlížení záznamu ukázat na Magikeyboard pole položek Smazat heslo - Smaže heslo zadané po pokusu o připojení + Smaže heslo zadané po pokusu o připojení k databázi Otevři soubor Potomci uzlu Přidej uzel @@ -476,4 +476,6 @@ Nastavení samovyplnění Přístup k souboru zrušenému správcem souborů Tento štítek již existuje. - + Automaticky vyhledat sdílené informace pro naplnění klávesnice + Prohledat sdílené info + \ No newline at end of file From 745de2502edddac4618b49220330995b0a6dbe71 Mon Sep 17 00:00:00 2001 From: Filip Miletic Date: Wed, 10 Jun 2020 01:43:43 +0000 Subject: [PATCH 38/59] Translated using Weblate (Croatian) Currently translated at 71.5% (310 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/hr/ --- app/src/main/res/values-hr/strings.xml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 6ef3ffd70..926c37399 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -16,8 +16,7 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . ---> - +--> Android implementacija KeePass upravitelja lozinki Prihvati Dodaj unos @@ -273,7 +272,7 @@ Obrada… Zaštićeno od pisanja Zavisno o vašem upravitelju datotekama, KeePassDX možda neće moći zapisivati u vašu pohranu. - Potvrdom ovog dialoga, KeePassDX će riješiti problem (generiranjem novih UUID-ova za duplikate) i nastaviti. + Riješi problem generiranjem novih UUID-ova za duplikate\? Korijen Količina memorije (u bajtovima) koju će koristiti funkcija izvedbe ključa. Ne zatvarajte aplikaciju… @@ -341,4 +340,15 @@ Kreirajte svoju prvu datoteku za upravljanje lozinkama. Otvaranje postojeće baze podataka Otvorite vašu prijašnju bazu podataka iz vašeg upravitelja datotekama kako bi je nastavili koristiti. + Zapamti lokaciju baze podataka + Brzo pretraživanje + Nije moguće kreirati datoteku baze podataka. + Prevelik broj \"transformacijskih rundi\". Postavljeno na 2147483648. + KeePassDX © %1$d Kunzisoft je open source te bez reklama. +\nDostupan kakav je, pod GPLv3 licencom, bez ikakvog jamstva. + Dodaj privitak + Odbaci + Odbaci promjene\? + Kontakt + Početna stranica \ No newline at end of file From ed382d102ea5d359102f56b5d4123ca49151c15c Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 12 Jun 2020 19:57:01 +0200 Subject: [PATCH 39/59] Fix backstack in selection mode, add cancel button #589 --- .../activities/FileDatabaseSelectActivity.kt | 54 +++++++++---------- .../keepass/activities/GroupActivity.kt | 48 +++++++++++++---- .../keepass/activities/PasswordActivity.kt | 5 +- .../res/drawable-v21/background_button.xml | 4 +- .../main/res/drawable/background_button.xml | 8 +-- app/src/main/res/layout/activity_group.xml | 30 ++++++++--- 6 files changed, 99 insertions(+), 50 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt index 5abe06cab..6cdc8cd61 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt @@ -157,7 +157,7 @@ class FileDatabaseSelectActivity : StylishActivity(), UriUtil.parse(databasePath)?.let { databaseFileUri -> launchPasswordActivityWithPath(databaseFileUri) } ?: run { - Log.i(TAG, "Unable to launch Password Activity") + Log.i(TAG, "No default database to prepare") } } @@ -269,37 +269,37 @@ class FileDatabaseSelectActivity : StylishActivity(), } override fun onResume() { + super.onResume() + val database = Database.getInstance() if (database.loaded) { launchGroupActivity(database.isReadOnly) - } - - super.onResume() - - // Construct adapter with listeners - if (PreferencesUtil.showRecentFiles(this)) { - mFileDatabaseHistoryAction?.getAllFileDatabaseHistories { databaseFileHistoryList -> - databaseFileHistoryList?.let { historyList -> - val hideBrokenLocations = PreferencesUtil.hideBrokenLocations(this@FileDatabaseSelectActivity) - mAdapterDatabaseHistory?.addDatabaseFileHistoryList( - // Show only uri accessible - historyList.filter { - if (hideBrokenLocations) { - FileDatabaseInfo(this@FileDatabaseSelectActivity, - it.databaseUri).exists - } else - true - }) - mAdapterDatabaseHistory?.notifyDataSetChanged() - } - } } else { - mAdapterDatabaseHistory?.clearDatabaseFileHistoryList() - mAdapterDatabaseHistory?.notifyDataSetChanged() - } + // Construct adapter with listeners + if (PreferencesUtil.showRecentFiles(this)) { + mFileDatabaseHistoryAction?.getAllFileDatabaseHistories { databaseFileHistoryList -> + databaseFileHistoryList?.let { historyList -> + val hideBrokenLocations = PreferencesUtil.hideBrokenLocations(this@FileDatabaseSelectActivity) + mAdapterDatabaseHistory?.addDatabaseFileHistoryList( + // Show only uri accessible + historyList.filter { + if (hideBrokenLocations) { + FileDatabaseInfo(this@FileDatabaseSelectActivity, + it.databaseUri).exists + } else + true + }) + mAdapterDatabaseHistory?.notifyDataSetChanged() + } + } + } else { + mAdapterDatabaseHistory?.clearDatabaseFileHistoryList() + mAdapterDatabaseHistory?.notifyDataSetChanged() + } - // Register progress task - mProgressDialogThread?.registerProgressTask() + // Register progress task + mProgressDialogThread?.registerProgressTask() + } } override fun onPause() { diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index 7952b8474..bd88a4622 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -32,6 +32,7 @@ import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.View +import android.widget.Button import android.widget.ImageView import android.widget.TextView import androidx.annotation.RequiresApi @@ -97,7 +98,8 @@ class GroupActivity : LockingActivity(), private var toolbarAction: ToolbarAction? = null private var iconView: ImageView? = null private var numberChildrenView: TextView? = null - private var modeTitleView: TextView? = null + private var modeContainerView: View? = null + private var modeCancelButton: Button? = null private var addNodeButtonView: AddNodeButtonView? = null private var groupNameView: TextView? = null @@ -107,6 +109,9 @@ class GroupActivity : LockingActivity(), private var mCurrentGroupIsASearch: Boolean = false private var mRequestStartupSearch = true + // To manage history in selection mode + private var mSelectionModeCountBackStack = 0 + // Nodes private var mRootGroup: Group? = null private var mCurrentGroup: Group? = null @@ -136,7 +141,8 @@ class GroupActivity : LockingActivity(), searchTitleView = findViewById(R.id.search_title) groupNameView = findViewById(R.id.group_name) toolbarAction = findViewById(R.id.toolbar_action) - modeTitleView = findViewById(R.id.mode_title_view) + modeContainerView = findViewById(R.id.mode_container) + modeCancelButton = findViewById(R.id.mode_cancel_button) lockView = findViewById(R.id.lock_button) lockView?.setOnClickListener { @@ -354,6 +360,9 @@ class GroupActivity : LockingActivity(), fragmentTransaction.addToBackStack(fragmentTag) fragmentTransaction.commit() + if (mSelectionMode) + mSelectionModeCountBackStack++ + // Update last access time. group?.touch(modified = false, touchParents = false) @@ -462,9 +471,24 @@ class GroupActivity : LockingActivity(), // Show selection mode message if needed if (mSelectionMode) { - modeTitleView?.visibility = View.VISIBLE + modeCancelButton?.setOnClickListener { + // To remove the navigation history and + EntrySelectionHelper.removeEntrySelectionModeFromIntent(intent) + val fragmentManager = supportFragmentManager + if (mSelectionModeCountBackStack > 0) { + for (selectionMode in 0 .. mSelectionModeCountBackStack) { + fragmentManager.popBackStack() + } + } + // Reinit the counter for navigation history + mSelectionModeCountBackStack = 0 + // Back to the app caller + super.onBackPressed() + } + modeContainerView?.visibility = View.VISIBLE } else { - modeTitleView?.visibility = View.GONE + modeCancelButton?.setOnClickListener(null) + modeContainerView?.visibility = View.GONE } // Show button if allowed @@ -976,9 +1000,11 @@ class GroupActivity : LockingActivity(), finishNodeAction() } else { // Normal way when we are not in root - if (mRootGroup != null && mRootGroup != mCurrentGroup) + if (mRootGroup != null && mRootGroup != mCurrentGroup) { super.onBackPressed() - // Else lock if needed + rebuildListNodes() + } + // Else in root, lock if needed else { if (PreferencesUtil.isLockDatabaseWhenBackButtonOnRootClicked(this)) { lockAndExit() @@ -986,11 +1012,15 @@ class GroupActivity : LockingActivity(), } else { // To restore standard mode EntrySelectionHelper.removeEntrySelectionModeFromIntent(intent) - moveTaskToBack(true) + if (mSelectionMode) { + // To get the app caller + super.onBackPressed() + } else { + // To move the app in background + moveTaskToBack(true) + } } } - - rebuildListNodes() } } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt index c8cd60fbe..56f7e3c22 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt @@ -780,10 +780,13 @@ open class PasswordActivity : StylishActivity() { if (!keyFileResult) { // this block if not a key file response when (resultCode) { - LockingActivity.RESULT_EXIT_LOCK, Activity.RESULT_CANCELED -> { + LockingActivity.RESULT_EXIT_LOCK -> { clearCredentialsViews() Database.getInstance().closeAndClear(applicationContext.filesDir) } + Activity.RESULT_CANCELED -> { + clearCredentialsViews() + } } } } diff --git a/app/src/main/res/drawable-v21/background_button.xml b/app/src/main/res/drawable-v21/background_button.xml index 7971f309f..efe76dbbc 100644 --- a/app/src/main/res/drawable-v21/background_button.xml +++ b/app/src/main/res/drawable-v21/background_button.xml @@ -8,8 +8,8 @@ diff --git a/app/src/main/res/drawable/background_button.xml b/app/src/main/res/drawable/background_button.xml index 84c503d39..addbbc56d 100644 --- a/app/src/main/res/drawable/background_button.xml +++ b/app/src/main/res/drawable/background_button.xml @@ -5,8 +5,8 @@ @@ -17,8 +17,8 @@ diff --git a/app/src/main/res/layout/activity_group.xml b/app/src/main/res/layout/activity_group.xml index 5cfdf3803..1a3f2e717 100644 --- a/app/src/main/res/layout/activity_group.xml +++ b/app/src/main/res/layout/activity_group.xml @@ -124,15 +124,31 @@ android:orientation="vertical" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_below="@+id/toolbar"> - + android:background="?attr/colorAccent"> + + + Date: Fri, 12 Jun 2020 20:17:01 +0200 Subject: [PATCH 40/59] Fix default entry icon #589 --- .../keepass/activities/EntryEditActivity.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt index 8bd935f42..aac11904e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt @@ -43,6 +43,7 @@ import com.kunzisoft.keepass.database.element.DateInstant import com.kunzisoft.keepass.database.element.Entry import com.kunzisoft.keepass.database.element.Group import com.kunzisoft.keepass.database.element.icon.IconImage +import com.kunzisoft.keepass.database.element.icon.IconImageStandard import com.kunzisoft.keepass.database.element.node.NodeId import com.kunzisoft.keepass.education.EntryEditActivityEducation import com.kunzisoft.keepass.notifications.ClipboardEntryNotificationService @@ -166,11 +167,16 @@ class EntryEditActivity : LockingActivity(), mNewEntry = mDatabase?.createEntry() } mParent = mDatabase?.getGroupById(it) - // Add the default icon from parent - mParent?.icon?.let { parentIcon -> + // Add the default icon from parent if not a folder + val parentIcon = mParent?.icon + if (parentIcon != null + && parentIcon.iconId != IconImage.UNKNOWN_ID + && parentIcon.iconId != IconImageStandard.FOLDER) { temporarilySaveAndShowSelectedIcon(parentIcon) - } ?: mDatabase?.drawFactory?.let { iconFactory -> + } else { + mDatabase?.drawFactory?.let { iconFactory -> entryEditContentsView?.setDefaultIcon(iconFactory) + } } } From 7b6d3698c4491deec7499e1534e761a51a450a7c Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 13 Jun 2020 15:20:24 +0200 Subject: [PATCH 41/59] Add inputType as Hex --- .../keepass/autofill/StructureParser.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt index dae1a2633..fc663e4ca 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt @@ -171,6 +171,10 @@ internal class StructureParser(private val structure: AssistStructure) { return false } + private fun showHexInputType(inputType: Int): String { + return "0x${"%08x".format(inputType)}" + } + private fun parseNodeByAndroidInput(node: AssistStructure.ViewNode): Boolean { val autofillId = node.autofillId val inputType = node.inputType @@ -181,21 +185,21 @@ internal class StructureParser(private val structure: AssistStructure) { InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS, InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) -> { result?.usernameId = autofillId - Log.d(TAG, "Autofill username android text type: $inputType") + Log.d(TAG, "Autofill username android text type: ${showHexInputType(inputType)}") } inputIsVariationType(inputType, InputType.TYPE_TEXT_VARIATION_NORMAL, InputType.TYPE_TEXT_VARIATION_PERSON_NAME, InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) -> { usernameCandidate = autofillId - Log.d(TAG, "Autofill username candidate android text type: $inputType") + Log.d(TAG, "Autofill username candidate android text type: ${showHexInputType(inputType)}") } inputIsVariationType(inputType, InputType.TYPE_TEXT_VARIATION_PASSWORD, InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD) -> { result?.passwordId = autofillId - Log.d(TAG, "Autofill password android text type: $inputType") + Log.d(TAG, "Autofill password android text type: ${showHexInputType(inputType)}") usernameNeeded = false return true } @@ -210,7 +214,7 @@ internal class StructureParser(private val structure: AssistStructure) { // Type not used } else -> { - Log.d(TAG, "Autofill unknown android text type: $inputType") + Log.d(TAG, "Autofill unknown android text type: ${showHexInputType(inputType)}") } } } @@ -219,17 +223,17 @@ internal class StructureParser(private val structure: AssistStructure) { inputIsVariationType(inputType, InputType.TYPE_NUMBER_VARIATION_NORMAL) -> { usernameCandidate = autofillId - Log.d(TAG, "Autofill usernale candidate android number type: $inputType") + Log.d(TAG, "Autofill usernale candidate android number type: ${showHexInputType(inputType)}") } inputIsVariationType(inputType, InputType.TYPE_NUMBER_VARIATION_PASSWORD) -> { result?.passwordId = autofillId - Log.d(TAG, "Autofill password android number type: $inputType") + Log.d(TAG, "Autofill password android number type: ${showHexInputType(inputType)}") usernameNeeded = false return true } else -> { - Log.d(TAG, "Autofill unknown android number type: $inputType") + Log.d(TAG, "Autofill unknown android number type: ${showHexInputType(inputType)}") } } } From be0bbab0c8627a5022d272182d32c4c1619348a3 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 13 Jun 2020 17:01:59 +0200 Subject: [PATCH 42/59] Add default values in Blocklists and input password as autofill hints --- .../kunzisoft/keepass/autofill/KeeAutofillService.kt | 10 ++++++---- .../com/kunzisoft/keepass/settings/PreferencesUtil.kt | 6 ++++-- .../keepass/settings/preference/InputListPreference.kt | 2 -- ...fillBlocklistAppIdPreferenceDialogFragmentCompat.kt | 8 ++++++++ .../AutofillBlocklistPreferenceDialogFragmentCompat.kt | 4 +++- ...BlocklistWebDomainPreferenceDialogFragmentCompat.kt | 9 ++++++++- app/src/main/res/layout/activity_password.xml | 4 ++-- app/src/main/res/layout/fragment_set_password.xml | 7 ++++--- app/src/main/res/values/donottranslate.xml | 7 +++++++ 9 files changed, 42 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt index 0d6d7cd0d..ae28cd63e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt @@ -58,20 +58,22 @@ class KeeAutofillService : AutofillService() { // Build search info only if applicationId or webDomain are not blocked var searchAllowed = true - parseResult.applicationId?.let { + parseResult.applicationId?.let { appId -> if (applicationIdBlocklist?.any { appIdBlocked -> - it.contains(appIdBlocked) + appId.contains(appIdBlocked) } == true ) { searchAllowed = false + Log.d(TAG, "Autofill not allowed for $appId") } } - parseResult.domain?.let { + parseResult.domain?.let { domain -> if (webDomainBlocklist?.any { webDomainBlocked -> - it.contains(webDomainBlocked) + domain.contains(webDomainBlocked) } == true ) { searchAllowed = false + Log.d(TAG, "Autofill not allowed for $domain") } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt index 995c56551..0968af9dc 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt @@ -375,13 +375,15 @@ object PreferencesUtil { fun applicationIdBlocklist(context: Context): Set { val prefs = PreferenceManager.getDefaultSharedPreferences(context) - return prefs.getStringSet(context.getString(R.string.autofill_application_id_blocklist_key), null) + return prefs.getStringSet(context.getString(R.string.autofill_application_id_blocklist_key), + context.resources.getStringArray(R.array.autofill_application_id_blocklist_default).toMutableSet()) ?: emptySet() } fun webDomainBlocklist(context: Context): Set { val prefs = PreferenceManager.getDefaultSharedPreferences(context) - return prefs.getStringSet(context.getString(R.string.autofill_web_domain_blocklist_key), null) + return prefs.getStringSet(context.getString(R.string.autofill_web_domain_blocklist_key), + context.resources.getStringArray(R.array.autofill_web_domain_blocklist_default).toMutableSet()) ?: emptySet() } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt index 21965e957..708ba3fd1 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputListPreference.kt @@ -23,8 +23,6 @@ import android.content.Context import android.util.AttributeSet import androidx.preference.DialogPreference import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.icons.IconPackChooser -import java.util.ArrayList open class InputListPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt index a783b91c3..d691ee92e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistAppIdPreferenceDialogFragmentCompat.kt @@ -20,6 +20,7 @@ package com.kunzisoft.keepass.settings.preferencedialogfragment import android.os.Bundle +import com.kunzisoft.keepass.R import com.kunzisoft.keepass.model.SearchInfo class AutofillBlocklistAppIdPreferenceDialogFragmentCompat @@ -32,6 +33,13 @@ class AutofillBlocklistAppIdPreferenceDialogFragmentCompat return SearchInfo().apply { this.applicationId = newSearchInfo } } + override fun getDefaultValues(): Set { + return context?.resources + ?.getStringArray(R.array.autofill_application_id_blocklist_default) + ?.toMutableSet() + ?: emptySet() + } + companion object { fun newInstance(key: String): AutofillBlocklistAppIdPreferenceDialogFragmentCompat { val fragment = AutofillBlocklistAppIdPreferenceDialogFragmentCompat() diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt index 11383d2b0..d85342276 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistPreferenceDialogFragmentCompat.kt @@ -43,6 +43,8 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat abstract fun buildSearchInfoFromString(searchInfoString: String): SearchInfo? + abstract fun getDefaultValues(): Set + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -55,7 +57,7 @@ abstract class AutofillBlocklistPreferenceDialogFragmentCompat } } ?: run { // Or from preference - preference.getPersistedStringSet(emptySet()).forEach { searchInfoString -> + preference.getPersistedStringSet(getDefaultValues()).forEach { searchInfoString -> addSearchInfo(searchInfoString) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt index 82c7aa0c5..2698ec66a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferencedialogfragment/AutofillBlocklistWebDomainPreferenceDialogFragmentCompat.kt @@ -20,8 +20,8 @@ package com.kunzisoft.keepass.settings.preferencedialogfragment import android.os.Bundle +import com.kunzisoft.keepass.R import com.kunzisoft.keepass.model.SearchInfo -import java.net.URI class AutofillBlocklistWebDomainPreferenceDialogFragmentCompat : AutofillBlocklistPreferenceDialogFragmentCompat() { @@ -35,6 +35,13 @@ class AutofillBlocklistWebDomainPreferenceDialogFragmentCompat return SearchInfo().apply { webDomain = newSearchInfo } } + override fun getDefaultValues(): Set { + return context?.resources + ?.getStringArray(R.array.autofill_web_domain_blocklist_default) + ?.toMutableSet() + ?: emptySet() + } + companion object { fun newInstance(key: String): AutofillBlocklistWebDomainPreferenceDialogFragmentCompat { val fragment = AutofillBlocklistWebDomainPreferenceDialogFragmentCompat() diff --git a/app/src/main/res/layout/activity_password.xml b/app/src/main/res/layout/activity_password.xml index 5f64a1808..b73f9453d 100644 --- a/app/src/main/res/layout/activity_password.xml +++ b/app/src/main/res/layout/activity_password.xml @@ -22,7 +22,6 @@ xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/container" - android:importantForAutofill="noExcludeDescendants" android:layout_width="match_parent" android:layout_height="match_parent" tools:targetApi="o"> @@ -155,7 +154,8 @@ android:hint="@string/password" android:inputType="textPassword" android:importantForAccessibility="no" - android:importantForAutofill="no" + android:importantForAutofill="yes" + android:autofillHints="password|" android:imeOptions="actionDone" android:maxLines="1"/> diff --git a/app/src/main/res/layout/fragment_set_password.xml b/app/src/main/res/layout/fragment_set_password.xml index 98543a365..816d1d124 100644 --- a/app/src/main/res/layout/fragment_set_password.xml +++ b/app/src/main/res/layout/fragment_set_password.xml @@ -27,7 +27,6 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:importantForAutofill="noExcludeDescendants" tools:targetApi="o"> @@ -81,7 +81,8 @@ android:layout_height="wrap_content" android:inputType="textPassword" android:importantForAccessibility="no" - android:importantForAutofill="no" + android:importantForAutofill="yes" + android:autofillHints="newPassword" android:maxLines="1" android:hint="@string/hint_conf_pass"/> diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 10b67434b..4a9ff1765 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -135,7 +135,14 @@ autofill_auto_search_key true autofill_application_id_blocklist_key + + com.kunzisoft.keepass.libre + com.kunzisoft.keepass.free + com.kunzisoft.keepass.pro + autofill_web_domain_blocklist_key + + settings_advanced_unlock_key From 9cce63659e883e88440e0a314bfb2d35bdbcabc1 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 13 Jun 2020 23:18:39 +0200 Subject: [PATCH 43/59] Fix selection mode and search with autofill --- .../activities/FileDatabaseSelectActivity.kt | 60 +++++++++++----- .../keepass/activities/GroupActivity.kt | 56 +++++++-------- .../keepass/activities/PasswordActivity.kt | 29 +++++--- .../dialogs/IconPickerDialogFragment.kt | 4 +- .../activities/lock/LockingActivity.kt | 7 +- .../selection/SpecialModeActivity.kt | 25 +++++++ .../settings/AutofillSettingsActivity.kt | 4 +- .../settings/MagikeyboardSettingsActivity.kt | 4 +- .../kunzisoft/keepass/view/SpecialModeView.kt | 68 +++++++++++++++++++ .../res/layout/activity_file_selection.xml | 20 ++++-- app/src/main/res/layout/activity_group.xml | 42 ++++-------- app/src/main/res/layout/activity_password.xml | 9 ++- .../main/res/layout/selection_mode_view.xml | 39 +++++++++++ 13 files changed, 257 insertions(+), 110 deletions(-) create mode 100644 app/src/main/java/com/kunzisoft/keepass/activities/selection/SpecialModeActivity.kt create mode 100644 app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt create mode 100644 app/src/main/res/layout/selection_mode_view.xml diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt index 6cdc8cd61..b55a32526 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt @@ -44,7 +44,7 @@ import com.kunzisoft.keepass.activities.dialogs.AssignMasterKeyDialogFragment import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper.KEY_SEARCH_INFO import com.kunzisoft.keepass.activities.helpers.OpenFileHelper -import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.activities.selection.SpecialModeActivity import com.kunzisoft.keepass.adapters.FileDatabaseHistoryAdapter import com.kunzisoft.keepass.app.database.FileDatabaseHistoryAction import com.kunzisoft.keepass.autofill.AutofillHelper @@ -55,18 +55,21 @@ import com.kunzisoft.keepass.model.SearchInfo import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_CREATE_TASK import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.utils.* +import com.kunzisoft.keepass.view.SpecialModeView import com.kunzisoft.keepass.view.asError import kotlinx.android.synthetic.main.activity_file_selection.* import java.io.FileNotFoundException -class FileDatabaseSelectActivity : StylishActivity(), +class FileDatabaseSelectActivity : SpecialModeActivity(), AssignMasterKeyDialogFragment.AssignPasswordDialogListener { // Views private var coordinatorLayout: CoordinatorLayout? = null private var fileManagerExplanationButton: View? = null - private var createButtonView: View? = null + private var databaseButtonsContainerView: View? = null + private var createDatabaseButtonView: View? = null private var openDatabaseButtonView: View? = null + private var specialModeView: SpecialModeView? = null // Adapter to manage database history list private var mAdapterDatabaseHistory: FileDatabaseHistoryAdapter? = null @@ -96,19 +99,13 @@ class FileDatabaseSelectActivity : StylishActivity(), UriUtil.gotoUrl(this, R.string.file_manager_explanation_url) } - // Create button - createButtonView = findViewById(R.id.create_database_button) - if (allowCreateDocumentByStorageAccessFramework(packageManager)) { - // There is an activity which can handle this intent. - createButtonView?.visibility = View.VISIBLE - } - else{ - // No Activity found that can handle this intent. - createButtonView?.visibility = View.GONE - } + databaseButtonsContainerView = findViewById(R.id.database_buttons_container) - createButtonView?.setOnClickListener { createNewFile() } + // Create database button + createDatabaseButtonView = findViewById(R.id.create_database_button) + createDatabaseButtonView?.setOnClickListener { createNewFile() } + // Open database button mOpenFileHelper = OpenFileHelper(this) openDatabaseButtonView = findViewById(R.id.open_keyfile_button) openDatabaseButtonView?.apply { @@ -118,6 +115,9 @@ class FileDatabaseSelectActivity : StylishActivity(), } } + // Special mode view + specialModeView = findViewById(R.id.special_mode_view) + // History list val fileDatabaseHistoryRecyclerView = findViewById(R.id.file_list) fileDatabaseHistoryRecyclerView.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false) @@ -271,6 +271,29 @@ class FileDatabaseSelectActivity : StylishActivity(), override fun onResume() { super.onResume() + // To show the selection mode + specialModeView?.apply { + visible = mSelectionMode + onCancelButtonClickListener = View.OnClickListener { + onBackPressed() + } + } + + // Show open and create button or special mode + if (mSelectionMode) { + // Disable buttons if in selection mode or request for autofill + databaseButtonsContainerView?.visibility = View.GONE + } else { + if (allowCreateDocumentByStorageAccessFramework(packageManager)) { + // There is an activity which can handle this intent. + createDatabaseButtonView?.visibility = View.VISIBLE + } else{ + // No Activity found that can handle this intent. + createDatabaseButtonView?.visibility = View.GONE + } + databaseButtonsContainerView?.visibility = View.VISIBLE + } + val database = Database.getInstance() if (database.loaded) { launchGroupActivity(database.isReadOnly) @@ -378,7 +401,10 @@ class FileDatabaseSelectActivity : StylishActivity(), override fun onCreateOptionsMenu(menu: Menu): Boolean { super.onCreateOptionsMenu(menu) - MenuUtil.defaultMenuInflater(menuInflater, menu) + + if (!mSelectionMode) { + MenuUtil.defaultMenuInflater(menuInflater, menu) + } Handler().post { performedNextEducation(FileDatabaseSelectActivityEducation(this)) } @@ -387,11 +413,11 @@ class FileDatabaseSelectActivity : StylishActivity(), private fun performedNextEducation(fileDatabaseSelectActivityEducation: FileDatabaseSelectActivityEducation) { // If no recent files - val createDatabaseEducationPerformed = createButtonView != null && createButtonView!!.visibility == View.VISIBLE + val createDatabaseEducationPerformed = createDatabaseButtonView != null && createDatabaseButtonView!!.visibility == View.VISIBLE && mAdapterDatabaseHistory != null && mAdapterDatabaseHistory!!.itemCount > 0 && fileDatabaseSelectActivityEducation.checkAndPerformedCreateDatabaseEducation( - createButtonView!!, + createDatabaseButtonView!!, { createNewFile() }, diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index bd88a4622..ab59bb3d2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -32,7 +32,6 @@ import android.util.Log import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.Button import android.widget.ImageView import android.widget.TextView import androidx.annotation.RequiresApi @@ -76,10 +75,7 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Compa import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.MenuUtil -import com.kunzisoft.keepass.view.AddNodeButtonView -import com.kunzisoft.keepass.view.ToolbarAction -import com.kunzisoft.keepass.view.asError -import com.kunzisoft.keepass.view.showActionError +import com.kunzisoft.keepass.view.* class GroupActivity : LockingActivity(), GroupEditDialogFragment.EditGroupListener, @@ -98,8 +94,7 @@ class GroupActivity : LockingActivity(), private var toolbarAction: ToolbarAction? = null private var iconView: ImageView? = null private var numberChildrenView: TextView? = null - private var modeContainerView: View? = null - private var modeCancelButton: Button? = null + private var specialModeView: SpecialModeView? = null private var addNodeButtonView: AddNodeButtonView? = null private var groupNameView: TextView? = null @@ -141,8 +136,7 @@ class GroupActivity : LockingActivity(), searchTitleView = findViewById(R.id.search_title) groupNameView = findViewById(R.id.group_name) toolbarAction = findViewById(R.id.toolbar_action) - modeContainerView = findViewById(R.id.mode_container) - modeCancelButton = findViewById(R.id.mode_cancel_button) + specialModeView = findViewById(R.id.special_mode_view) lockView = findViewById(R.id.lock_button) lockView?.setOnClickListener { @@ -470,8 +464,9 @@ class GroupActivity : LockingActivity(), refreshNumberOfChildren() // Show selection mode message if needed - if (mSelectionMode) { - modeCancelButton?.setOnClickListener { + specialModeView?.apply { + visible = mSelectionMode + onCancelButtonClickListener = View.OnClickListener { // To remove the navigation history and EntrySelectionHelper.removeEntrySelectionModeFromIntent(intent) val fragmentManager = supportFragmentManager @@ -482,13 +477,8 @@ class GroupActivity : LockingActivity(), } // Reinit the counter for navigation history mSelectionModeCountBackStack = 0 - // Back to the app caller - super.onBackPressed() + backToTheAppCaller() } - modeContainerView?.visibility = View.VISIBLE - } else { - modeCancelButton?.setOnClickListener(null) - modeContainerView?.visibility = View.GONE } // Show button if allowed @@ -726,8 +716,7 @@ class GroupActivity : LockingActivity(), menu.findItem(R.id.menu_save_database)?.isVisible = false } if (!mSelectionMode) { - inflater.inflate(R.menu.default_menu, menu) - MenuUtil.contributionMenuInflater(inflater, menu) + MenuUtil.defaultMenuInflater(inflater, menu) } // Menu for recycle bin @@ -936,19 +925,16 @@ class GroupActivity : LockingActivity(), } override fun startActivity(intent: Intent) { - // Get the intent, verify the action and get the query if (Intent.ACTION_SEARCH == intent.action) { - // manually launch the real search activity - val searchIntent = Intent(applicationContext, GroupActivity::class.java).apply { - // Add bundle of current intent - putExtras(this@GroupActivity.intent) + // manually launch the same search activity + val searchIntent = getIntent().apply { // add query to the Intent Extras action = Intent.ACTION_SEARCH putExtra(SearchManager.QUERY, intent.getStringExtra(SearchManager.QUERY)) } - - super.startActivity(searchIntent) + setIntent(searchIntent) + onNewIntent(searchIntent) } else { super.startActivity(intent) } @@ -995,6 +981,16 @@ class GroupActivity : LockingActivity(), assignGroupViewElements() } + private fun backToTheAppCaller() { + if (mAutofillSelection) { + // To get the app caller, only for autofill + super.onBackPressed() + } else { + // To move the app in background + moveTaskToBack(true) + } + } + override fun onBackPressed() { if (mListNodesFragment?.nodeActionSelectionMode == true) { finishNodeAction() @@ -1012,13 +1008,7 @@ class GroupActivity : LockingActivity(), } else { // To restore standard mode EntrySelectionHelper.removeEntrySelectionModeFromIntent(intent) - if (mSelectionMode) { - // To get the app caller - super.onBackPressed() - } else { - // To move the app in background - moveTaskToBack(true) - } + backToTheAppCaller() } } } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt index 56f7e3c22..7b16a88bc 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt @@ -46,7 +46,7 @@ import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper.KEY_SEARCH_ import com.kunzisoft.keepass.activities.helpers.OpenFileHelper import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper import com.kunzisoft.keepass.activities.lock.LockingActivity -import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.activities.selection.SpecialModeActivity import com.kunzisoft.keepass.app.database.CipherDatabaseEntity import com.kunzisoft.keepass.app.database.FileDatabaseHistoryAction import com.kunzisoft.keepass.autofill.AutofillHelper @@ -69,15 +69,16 @@ import com.kunzisoft.keepass.utils.MenuUtil import com.kunzisoft.keepass.utils.UriUtil import com.kunzisoft.keepass.view.AdvancedUnlockInfoView import com.kunzisoft.keepass.view.KeyFileSelectionView +import com.kunzisoft.keepass.view.SpecialModeView import com.kunzisoft.keepass.view.asError import kotlinx.android.synthetic.main.activity_password.* import java.io.FileNotFoundException -open class PasswordActivity : StylishActivity() { +open class PasswordActivity : SpecialModeActivity() { // Views private var toolbar: Toolbar? = null - private var containerView: View? = null + private var specialModeView: SpecialModeView? = null private var filenameView: TextView? = null private var passwordView: EditText? = null private var keyFileSelectionView: KeyFileSelectionView? = null @@ -124,7 +125,7 @@ open class PasswordActivity : StylishActivity() { supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayShowHomeEnabled(true) - containerView = findViewById(R.id.container) + specialModeView = findViewById(R.id.special_mode_view) confirmButtonView = findViewById(R.id.activity_password_open_button) filenameView = findViewById(R.id.filename) passwordView = findViewById(R.id.password) @@ -337,9 +338,17 @@ open class PasswordActivity : StylishActivity() { } override fun onResume() { + super.onResume() + + // To show the selection mode + specialModeView?.apply { + visible = mSelectionMode + onCancelButtonClickListener = View.OnClickListener { + onBackPressed() + } + } if (Database.getInstance().loaded) { - super.onResume() launchGroupActivity() } else { mRememberKeyFile = PreferencesUtil.rememberKeyFileLocations(this) @@ -350,9 +359,6 @@ open class PasswordActivity : StylishActivity() { clearCredentialsViews() } - // For check shutdown - super.onResume() - mProgressDialogThread?.registerProgressTask() // Don't allow auto open prompt if lock become when UI visible @@ -625,14 +631,15 @@ open class PasswordActivity : StylishActivity() { val inflater = menuInflater // Read menu inflater.inflate(R.menu.open_file, menu) - - if (mForceReadOnly) { + if (mSelectionMode || mForceReadOnly) { menu.removeItem(R.id.menu_open_file_read_mode_key) } else { changeOpenFileReadIcon(menu.findItem(R.id.menu_open_file_read_mode_key)) } - MenuUtil.defaultMenuInflater(inflater, menu) + if (!mSelectionMode) { + MenuUtil.defaultMenuInflater(inflater, menu) + } if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // biometric menu diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt index 48dae1d91..1665f9f85 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/dialogs/IconPickerDialogFragment.kt @@ -31,10 +31,10 @@ import android.widget.BaseAdapter import android.widget.GridView import android.widget.ImageView import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity import androidx.core.widget.ImageViewCompat import androidx.fragment.app.DialogFragment import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.activities.stylish.StylishActivity import com.kunzisoft.keepass.database.element.icon.IconImageStandard import com.kunzisoft.keepass.icons.IconPack import com.kunzisoft.keepass.icons.IconPackChooser @@ -132,7 +132,7 @@ class IconPickerDialogFragment : DialogFragment() { return bundle.getParcelable(KEY_ICON_STANDARD) } - fun launch(activity: StylishActivity) { + fun launch(activity: AppCompatActivity) { // Create an instance of the dialog fragment and show it val dialog = IconPickerDialogFragment() dialog.show(activity.supportFragmentManager, "IconPickerDialogFragment") diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt index 2cbcf53c5..9d047a3ea 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/lock/LockingActivity.kt @@ -24,16 +24,15 @@ import android.os.Bundle import android.util.Log import android.view.View import android.view.ViewGroup -import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper -import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.activities.selection.SpecialModeActivity import com.kunzisoft.keepass.database.action.ProgressDialogThread import com.kunzisoft.keepass.database.element.Database import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.* -abstract class LockingActivity : StylishActivity() { +abstract class LockingActivity : SpecialModeActivity() { protected var mTimeoutEnable: Boolean = true @@ -49,7 +48,6 @@ abstract class LockingActivity : StylishActivity() { mReadOnlyToSave = value } private var mReadOnlyToSave: Boolean = false - protected var mSelectionMode: Boolean = false protected var mAutoSaveEnable: Boolean = true var mProgressDialogThread: ProgressDialogThread? = null @@ -100,7 +98,6 @@ abstract class LockingActivity : StylishActivity() { // To refresh when back to normal workflow from selection workflow mReadOnlyToSave = ReadOnlyHelper.retrieveReadOnlyFromIntent(intent) - mSelectionMode = EntrySelectionHelper.retrieveEntrySelectionModeFromIntent(intent) mAutoSaveEnable = PreferencesUtil.isAutoSaveDatabaseEnabled(this) invalidateOptionsMenu() diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/selection/SpecialModeActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/selection/SpecialModeActivity.kt new file mode 100644 index 000000000..1880c202e --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/activities/selection/SpecialModeActivity.kt @@ -0,0 +1,25 @@ +package com.kunzisoft.keepass.activities.selection + +import android.os.Build +import com.kunzisoft.keepass.activities.helpers.EntrySelectionHelper +import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.autofill.AutofillHelper + +/** + * Activity to manage special mode (ie: selection mode) + */ +abstract class SpecialModeActivity : StylishActivity() { + + protected var mSelectionMode: Boolean = false + + protected var mAutofillSelection: Boolean = false + + override fun onResume() { + super.onResume() + + mSelectionMode = EntrySelectionHelper.retrieveEntrySelectionModeFromIntent(intent) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + mAutofillSelection = AutofillHelper.retrieveAssistStructure(intent) != null + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsActivity.kt index 8279bf6ad..29c13c85a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/AutofillSettingsActivity.kt @@ -23,9 +23,9 @@ import android.os.Bundle import android.view.MenuItem import androidx.appcompat.widget.Toolbar import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.activities.selection.SpecialModeActivity -class AutofillSettingsActivity : StylishActivity() { +class AutofillSettingsActivity : SpecialModeActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsActivity.kt index 98a5ae62a..fc1a04db9 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/MagikeyboardSettingsActivity.kt @@ -24,9 +24,9 @@ import androidx.appcompat.widget.Toolbar import android.view.MenuItem import com.kunzisoft.keepass.R -import com.kunzisoft.keepass.activities.stylish.StylishActivity +import com.kunzisoft.keepass.activities.selection.SpecialModeActivity -class MagikeyboardSettingsActivity : StylishActivity() { +class MagikeyboardSettingsActivity : SpecialModeActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt b/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt new file mode 100644 index 000000000..dd2b2554e --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt @@ -0,0 +1,68 @@ +/* + * Copyright 2019 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePassDX. + * + * KeePassDX is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * KeePassDX is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with KeePassDX. If not, see . + * + */ +package com.kunzisoft.keepass.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import com.kunzisoft.keepass.R + +class SpecialModeView @JvmOverloads constructor(context: Context, + attrs: AttributeSet? = null, + defStyle: Int = 0) + : ConstraintLayout(context, attrs, defStyle) { + + private var cancelButton: View? = null + private var titleView: TextView? = null + + init { + val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater? + inflater?.inflate(R.layout.selection_mode_view, this) + + cancelButton = findViewById(R.id.special_mode_cancel_button) + titleView = findViewById(R.id.special_mode_title_view) + } + + var title: CharSequence? + get() { + return titleView?.text + } + set(value) { + titleView?.text = value + } + + var onCancelButtonClickListener: OnClickListener? = null + set(value) { + cancelButton?.setOnClickListener(value) + } + + var visible: Boolean = false + set(value) { + visibility = if (value) { + View.VISIBLE + } else { + View.GONE + } + field = value + } +} diff --git a/app/src/main/res/layout/activity_file_selection.xml b/app/src/main/res/layout/activity_file_selection.xml index 66de7776c..ae61b7439 100644 --- a/app/src/main/res/layout/activity_file_selection.xml +++ b/app/src/main/res/layout/activity_file_selection.xml @@ -26,13 +26,19 @@ android:importantForAutofill="noExcludeDescendants" tools:targetApi="o"> + + + - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_group.xml b/app/src/main/res/layout/activity_group.xml index 1a3f2e717..c1fa6a81d 100644 --- a/app/src/main/res/layout/activity_group.xml +++ b/app/src/main/res/layout/activity_group.xml @@ -17,18 +17,25 @@ You should have received a copy of the GNU General Public License along with KeePassDX. If not, see . --> - + + + android:layout_height="0dp" + app:layout_constraintTop_toBottomOf="@+id/special_mode_view" + app:layout_constraintBottom_toTopOf="@+id/toolbar_action"> - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_password.xml b/app/src/main/res/layout/activity_password.xml index b73f9453d..18fc3017b 100644 --- a/app/src/main/res/layout/activity_password.xml +++ b/app/src/main/res/layout/activity_password.xml @@ -21,16 +21,21 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" - android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:targetApi="o"> + + + + + + \ No newline at end of file From dbcd7c8e03de1617703f32593a12706ca0093194 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 14 Jun 2020 15:36:19 +0000 Subject: [PATCH 44/59] Translated using Weblate (German) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/de/ --- app/src/main/res/values-de/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index d5a5833e5..35be36b5e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -357,7 +357,7 @@ Eintragsauswahl Eingabefelder beim Betrachten eines Eintrags im Magikeyboard anzeigen Passwort löschen - Löscht das eingegebene Passwort nach einem Verbindungsversuch + Löscht das eingegebene Passwort nach einem Verbindungsversuch zu einer Datenbank Datei öffnen Eintrag hinzufügen Gruppe hinzufügen @@ -486,4 +486,6 @@ Autofill-Einstellungen Zugriff auf die Datei durch den Dateimanager widerrufen Diese Bezeichnung existiert bereits. - + Automatische Suche nach gemeinsam genutzten Informationen zur Belegung der Tastatur + Gemeinsame Infos durchsuchen + \ No newline at end of file From ca8874c2e1e71132112a99c26ec67c3d1a40e2f5 Mon Sep 17 00:00:00 2001 From: Stephan Paternotte Date: Sun, 14 Jun 2020 18:35:00 +0000 Subject: [PATCH 45/59] Translated using Weblate (Dutch) Currently translated at 99.5% (431 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/nl/ --- app/src/main/res/values-nl/strings.xml | 49 +++++++++++++------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 3802dbe39..4c9b08683 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -171,7 +171,7 @@ Verplaatsen Plakken Annuleren - Opgeslagen vingerafdruk verwijderen + Opgeslagen biometrische gegevens verwijderen Alleen-lezen Lezen en schrijven Beveiliging @@ -199,13 +199,13 @@ Vermijd wachtwoordtekens buiten het tekstcoderingsformaat in het databasebestand (niet-herkende tekens worden geconverteerd naar dezelfde letter). Doorgaan zonder beveiliging voor wachtwoordontgrendeling\? Doorgaan zonder coderingssleutel\? - Vingerafdruk wordt ondersteund, maar is niet ingesteld. - Vingerafdruk gebruiken om de database te ontgrendelen + Biometrische herkenning is ondersteund, maar niet ingesteld. + Biometrische herkenning gebruiken om de database te ontgrendelen Versleuteld wachtwoord is opgeslagen - Kan de vingerafdruk-sleutel niet lezen. Verwijder deze en herhaal de procedure voor vingerafdrukherkenning. - Vingerafdruk niet herkend - Probleem met vingerafdruk: %1$s - Vingerafdruk gebruiken om wachtwoorden op te slaan + Kan de biometrische gegevens niet lezen. Verwijder deze en herhaal de procedure voor biometrische herkenning. + Biometrie niet herkend + Probleem met biometrie: %1$s + Biometrische herkenning gebruiken om wachtwoorden op te slaan Deze databank heeft nog geen wachtwoord. Geschiedenis Uiterlijk @@ -227,11 +227,11 @@ Schermvergrendeling Database vergrendelen wanneer het scherm is uitgeschakeld Geavanceerd ontgrendelen - Ontgrendelen met vingerafdruk - Gebruik vingerafdrukherkenning om de database te openen + Ontgrendelen met biometrie + Gebruik biometrische herkenning om de database te openen Coderingssleutels verwijderen - Alle vingerafdruk-gerelateerde sleutels verwijderen - Alle coderingssleutels voor vingerafdrukherkenning verwijderen\? + Alle sleutels voor biometrische herkenning verwijderen + Alle coderingssleutels voor biometrische herkenning verwijderen\? Kan deze functie niet starten. Je Android-versie, %1$s, voldoet niet aan de minimumvereiste %2$s. De bijbehorende hardware werd niet gevonden. @@ -276,8 +276,8 @@ \nGroepen (~mappen) organiseren de items in je database. Doorzoek al je items Doorzoek items op titel, gebruikersnaam of andere velden om wachtwoorden te vinden. - Database-ontgrendeling met vingerafdruk - Koppel je wachtwoord aan je vingerafdruk om de database snel te ontgrendelen. + Database-ontgrendeling met biometrie + Koppel je wachtwoord aan je biometrie om de database snel te ontgrendelen. Item bewerken Bewerk het item met aangepaste velden. Referenties kunnen worden toegevoegd tussen velden van verschillende items. Genereer een sterk wachtwoord @@ -286,10 +286,9 @@ Registreer een extra veld, voeg een waarde toe en bescherm dit desgewenst. Ontgrendel je database Database alleen-lezen - Wijzig de opstartmodus van de sessie. -\n -\nIn alleen-lezenmodus kunnen geen onbedoelde wijzigingen worden gemaakt. -\n + Wijzig de opstartmodus van de sessie. +\n +\nIn alleen-lezenmodus kunnen geen onbedoelde wijzigingen worden gemaakt. \nIn schrijfmodus kun je elementen toevoegen, verwijderen of aanpassen. Veld kopiëren toestaan Kopieer een veld en plak de inhoud waar je maar wilt. @@ -375,13 +374,13 @@ Velden sluiten Kan geen database aanmaken met dit wachtwoord en sleutelbestand. Geavanceerd ontgrendelen - Vingerafdruk opslaan - Waarschuwing: Je moet nog steeds je hoofdwachtwoord onthouden als je ontgrendeling met vingerafdruk gebruikt. - Database openen met vingerdafdruk - Database-referenties met vingerafdruk uitpakken - Vingerafdruk - Automatisch om vingerafdruk vragen - Automatisch om vingerafdruk vragen als een database hiervoor is ingesteld + Biometrische herkenning opslaan + Waarschuwing: Je moet nog steeds je hoofdwachtwoord onthouden als je biometrische herkenning gebruikt. + Database openen met biometrische herkenning + Database-referenties uitpakken met biometrische herkenning + Biometrie + Automatisch om biometrie vragen + Automatisch om biometrie vragen als een database hiervoor is ingesteld Inschakelen Uitschakelen Hoofdsleutel @@ -448,7 +447,7 @@ Geeft de vergrendelknop weer in de gebruikersinterface Vergrendelknop weergeven Instellingen voor automatisch aanvullen - Voer het wachtwoord in en klik vervolgens op de knop \"Vingerafdruk\". + Voer het wachtwoord in en klik vervolgens op de knop \"Biometrie\". De sleutelopslag is niet correct geïnitialiseerd. Geselecteerde knooppunten definitief verwijderen\? Toegang tot het bestand ingetrokken door bestandsbeheer From 245a7ddfe9739ef50689896d45411856d3045097 Mon Sep 17 00:00:00 2001 From: Renann Prado Date: Sat, 13 Jun 2020 15:01:24 +0000 Subject: [PATCH 46/59] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/pt_BR/ --- app/src/main/res/values-pt-rBR/strings.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index d4cac58ae..4f05e0dc6 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -192,7 +192,7 @@ Continuar sem proteção de desbloqueio de senha\? Continuar sem chave de criptografia\? Impressão digital é suportada, mas não está configurada. - Escaneamento de impressão digital + Escaneamento de impressão digital para abrir o bando de dados Senha encriptada armazenada Não pôde ler chave de impressão digital. Por favor, apague-a e repita o procedimento de reconhecimento biométrico. Não pôde reconhecer impressão digital @@ -347,7 +347,7 @@ Seleção de entrada Mostrar campos de entrada no Magikeyboard quando estiver visualizando uma Entrada Deletar senha - Deleta a senha inserida após uma tentativa de conexão + Deleta a senha inserida após uma tentativa de conexão com o banco de dados Abrir arquivo Inserir nó Adicionar entrada @@ -474,4 +474,6 @@ Descartar alterações\? Validação Contribuição + Procurar automaticamente por informação compartilhada para popular o teclado + Procurar informação compartilhada \ No newline at end of file From fb0a74c1019ff89283cfcc586fe7520200ab1ae9 Mon Sep 17 00:00:00 2001 From: ihor_ck Date: Mon, 15 Jun 2020 18:34:08 +0000 Subject: [PATCH 47/59] Translated using Weblate (Ukrainian) Currently translated at 100.0% (433 of 433 strings) Translation: KeePass DX/Strings Translate-URL: https://hosted.weblate.org/projects/keepass-dx/strings/uk/ --- app/src/main/res/values-uk/strings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 542a5e639..105b9b6b9 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -445,8 +445,8 @@ Витяг облікових даних бази даних за допомогою біометричного ключа Відкрити базу даних біометричним ключем Зберегти біометричний ключ - Скористатися біометричним ключем для розблокування базу даних - Скористатися біометричним ключем, щоби зберегти дані + Розблокувати базу даних біометричним ключем + Скористатися біометричним ключем щоби зберегти дані Сховище ключів не ініціалізовано належним чином. Збірка %1$s Видалити вибрані вузли остаточно\? From 49e2ec04981ea20b6cb25c670cff3765c927cb73 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Wed, 17 Jun 2020 20:01:45 +0200 Subject: [PATCH 48/59] Toolbar as SpecialModeView, show title --- app/build.gradle | 2 +- .../activities/AutofillLauncherActivity.kt | 7 +++- .../EntrySelectionLauncherActivity.kt | 26 ++++++++---- .../activities/FileDatabaseSelectActivity.kt | 5 +++ .../keepass/activities/GroupActivity.kt | 17 ++++++-- .../keepass/activities/PasswordActivity.kt | 19 ++++++--- .../com/kunzisoft/keepass/model/SearchInfo.kt | 2 +- .../kunzisoft/keepass/view/SpecialModeView.kt | 31 ++++---------- .../main/res/drawable/ic_block_white_24dp.xml | 9 ++++ .../res/layout/activity_file_selection.xml | 3 ++ app/src/main/res/layout/activity_group.xml | 6 ++- app/src/main/res/layout/activity_password.xml | 5 ++- app/src/main/res/layout/item_attachment.xml | 2 +- .../main/res/layout/selection_mode_view.xml | 39 ------------------ app/src/main/res/menu/autofill.xml | 27 ++++++++++++ app/src/main/res/values/attrs.xml | 3 +- app/src/main/res/values/colors.xml | 3 ++ app/src/main/res/values/strings.xml | 1 + app/src/main/res/values/style_black.xml | 15 ++++++- app/src/main/res/values/style_blue.xml | 14 ++++++- app/src/main/res/values/style_dark.xml | 25 +++++++---- app/src/main/res/values/style_purple.xml | 13 +++++- app/src/main/res/values/style_red.xml | 13 +++++- app/src/main/res/values/styles.xml | 41 +++++++++++++++++-- 24 files changed, 224 insertions(+), 104 deletions(-) create mode 100644 app/src/main/res/drawable/ic_block_white_24dp.xml delete mode 100644 app/src/main/res/layout/selection_mode_view.xml create mode 100644 app/src/main/res/menu/autofill.xml diff --git a/app/build.gradle b/app/build.gradle index ebf802c17..6286c504b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -69,7 +69,7 @@ android { buildConfigField "String", "BUILD_VERSION", "\"free\"" buildConfigField "boolean", "FULL_VERSION", "false" buildConfigField "boolean", "CLOSED_STORE", "true" - buildConfigField "String[]", "STYLES_DISABLED", "{\"KeepassDXStyle_Dark\",\"KeepassDXStyle_Blue\",\"KeepassDXStyle_Red\",\"KeepassDXStyle_Purple\"}" + buildConfigField "String[]", "STYLES_DISABLED", "{}" buildConfigField "String[]", "ICON_PACKS_DISABLED", "{}" manifestPlaceholders = [ googleAndroidBackupAPIKey:"AEdPqrEAAAAIbRfbV8fHLItXo8OcHwrO0sSNblqhPwkc0DPTqg" ] } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/AutofillLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/AutofillLauncherActivity.kt index ccb249aa9..2b9dc5edb 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/AutofillLauncherActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/AutofillLauncherActivity.kt @@ -57,12 +57,15 @@ class AutofillLauncherActivity : AppCompatActivity() { { // Show the database UI to select the entry GroupActivity.launchForAutofillResult(this, - assistStructure) + assistStructure, + false, + searchInfo) }, { // If database not open FileDatabaseSelectActivity.launchForAutofillResult(this, - assistStructure, searchInfo) + assistStructure, + searchInfo) } ) } else { diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt index ccae18280..0292db8a4 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntrySelectionLauncherActivity.kt @@ -72,29 +72,41 @@ class EntrySelectionLauncherActivity : AppCompatActivity() { if (items.size == 1) { // Automatically populate keyboard val entryPopulate = items[0] - populateKeyboardAndMoveAppToBackground(this, entryPopulate, intent) + populateKeyboardAndMoveAppToBackground(this, + entryPopulate, + intent) } else { // Select the one we want - GroupActivity.launchForEntrySelectionResult(this, searchInfo) + GroupActivity.launchForEntrySelectionResult(this, + true, + searchInfo) } } else { - GroupActivity.launch(this, searchInfo) + GroupActivity.launch(this, + true, + searchInfo) } }, { // Show the database UI to select the entry if (searchShareForMagikeyboard) { - GroupActivity.launchForEntrySelectionResult(this) + GroupActivity.launchForEntrySelectionResult(this, + false, + searchInfo) } else { - GroupActivity.launch(this) + GroupActivity.launch(this, + false, + searchInfo) } }, { // If database not open if (searchShareForMagikeyboard) { - FileDatabaseSelectActivity.launchForEntrySelectionResult(this, searchInfo) + FileDatabaseSelectActivity.launchForEntrySelectionResult(this, + searchInfo) } else { - FileDatabaseSelectActivity.launch(this, searchInfo) + FileDatabaseSelectActivity.launch(this, + searchInfo) } } ) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt index b55a32526..610f97d94 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt @@ -241,11 +241,13 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), EntrySelectionHelper.doEntrySelectionAction(intent, { GroupActivity.launch(this@FileDatabaseSelectActivity, + false, searchInfo, readOnly) }, { GroupActivity.launchForEntrySelectionResult(this@FileDatabaseSelectActivity, + false, searchInfo, readOnly) // Do not keep history @@ -255,6 +257,7 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { GroupActivity.launchForAutofillResult(this@FileDatabaseSelectActivity, assistStructure, + false, searchInfo, readOnly) } @@ -273,6 +276,8 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), // To show the selection mode specialModeView?.apply { + val searchInfo: SearchInfo? = intent.getParcelableExtra(KEY_SEARCH_INFO) + subtitle = searchInfo?.getName(resources) visible = mSelectionMode onCancelButtonClickListener = View.OnClickListener { onBackPressed() diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt index ab59bb3d2..3349945ad 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.kt @@ -286,7 +286,7 @@ class GroupActivity : LockingActivity(), intent?.let { intentNotNull -> // To transform KEY_SEARCH_INFO in ACTION_SEARCH - manageSearchInfoIntent(intent) + manageSearchInfoIntent(intentNotNull) Log.d(TAG, "setNewIntent: $intentNotNull") setIntent(intentNotNull) mCurrentGroupIsASearch = if (Intent.ACTION_SEARCH == intentNotNull.action) { @@ -306,9 +306,9 @@ class GroupActivity : LockingActivity(), private fun manageSearchInfoIntent(intent: Intent): Boolean { // To relaunch the activity as ACTION_SEARCH val searchInfo: SearchInfo? = intent.getParcelableExtra(KEY_SEARCH_INFO) - if (searchInfo != null) { + val autoSearch = intent.getBooleanExtra(AUTO_SEARCH_KEY, false) + if (searchInfo != null && autoSearch) { intent.action = Intent.ACTION_SEARCH - intent.removeExtra(KEY_SEARCH_INFO) intent.putExtra(SearchManager.QUERY, searchInfo.getSearchString(this)) return true } @@ -465,6 +465,8 @@ class GroupActivity : LockingActivity(), // Show selection mode message if needed specialModeView?.apply { + val searchInfo: SearchInfo? = intent.getParcelableExtra(KEY_SEARCH_INFO) + subtitle = searchInfo?.getName(resources) visible = mSelectionMode onCancelButtonClickListener = View.OnClickListener { // To remove the navigation history and @@ -1002,6 +1004,8 @@ class GroupActivity : LockingActivity(), } // Else in root, lock if needed else { + intent.removeExtra(AUTO_SEARCH_KEY) + intent.removeExtra(KEY_SEARCH_INFO) if (PreferencesUtil.isLockDatabaseWhenBackButtonOnRootClicked(this)) { lockAndExit() super.onBackPressed() @@ -1023,6 +1027,7 @@ class GroupActivity : LockingActivity(), private const val LIST_NODES_FRAGMENT_TAG = "LIST_NODES_FRAGMENT_TAG" private const val SEARCH_FRAGMENT_TAG = "SEARCH_FRAGMENT_TAG" private const val OLD_GROUP_TO_UPDATE_KEY = "OLD_GROUP_TO_UPDATE_KEY" + private const val AUTO_SEARCH_KEY = "AUTO_SEARCH_KEY" private fun buildIntent(context: Context, group: Group?, @@ -1060,12 +1065,14 @@ class GroupActivity : LockingActivity(), * ------------------------- */ fun launch(context: Context, + autoSearch: Boolean = false, searchInfo: SearchInfo? = null, readOnly: Boolean = PreferencesUtil.enableReadOnlyDatabase(context)) { checkTimeAndBuildIntent(context, null, readOnly) { intent -> searchInfo?.let { intent.putExtra(KEY_SEARCH_INFO, it) } + intent.putExtra(AUTO_SEARCH_KEY, autoSearch) context.startActivity(intent) } } @@ -1076,9 +1083,11 @@ class GroupActivity : LockingActivity(), * ------------------------- */ fun launchForEntrySelectionResult(context: Context, + autoSearch: Boolean = false, searchInfo: SearchInfo? = null, readOnly: Boolean = PreferencesUtil.enableReadOnlyDatabase(context)) { checkTimeAndBuildIntent(context, null, readOnly) { intent -> + intent.putExtra(AUTO_SEARCH_KEY, autoSearch) EntrySelectionHelper.startActivityForEntrySelectionResult(context, intent, searchInfo) } } @@ -1091,9 +1100,11 @@ class GroupActivity : LockingActivity(), @RequiresApi(api = Build.VERSION_CODES.O) fun launchForAutofillResult(activity: Activity, assistStructure: AssistStructure, + autoSearch: Boolean = false, searchInfo: SearchInfo? = null, readOnly: Boolean = PreferencesUtil.enableReadOnlyDatabase(activity)) { checkTimeAndBuildIntent(activity, null, readOnly) { intent -> + intent.putExtra(AUTO_SEARCH_KEY, autoSearch) AutofillHelper.startActivityForAutofillResult(activity, intent, assistStructure, searchInfo) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt index 7b16a88bc..065421ede 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt @@ -266,9 +266,10 @@ open class PasswordActivity : SpecialModeActivity() { EntrySelectionHelper.doEntrySelectionAction(intent, { GroupActivity.launch(this@PasswordActivity, + true, searchInfo, readOnly) - // Remove the search info from intent + // Finish activity if no search info if (searchInfo != null) { finish() } @@ -285,13 +286,16 @@ open class PasswordActivity : SpecialModeActivity() { intent) } else { // Select the one we want - GroupActivity.launchForEntrySelectionResult(this, searchInfo) + GroupActivity.launchForEntrySelectionResult(this, + true, + searchInfo) } }, { - // Here no search info found + // Here no search info found, disable auto search GroupActivity.launchForEntrySelectionResult(this@PasswordActivity, - null, + false, + searchInfo, readOnly) }, { @@ -312,10 +316,11 @@ open class PasswordActivity : SpecialModeActivity() { finish() }, { - // Here no search info found + // Here no search info found, disable auto search GroupActivity.launchForAutofillResult(this@PasswordActivity, assistStructure, - null, + false, + searchInfo, readOnly) }, { @@ -342,6 +347,8 @@ open class PasswordActivity : SpecialModeActivity() { // To show the selection mode specialModeView?.apply { + val searchInfo: SearchInfo? = intent.getParcelableExtra(KEY_SEARCH_INFO) + subtitle = searchInfo?.getName(resources) visible = mSelectionMode onCancelButtonClickListener = View.OnClickListener { onBackPressed() diff --git a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt index 707ee97f3..c9adeef5e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt +++ b/app/src/main/java/com/kunzisoft/keepass/model/SearchInfo.kt @@ -46,7 +46,7 @@ class SearchInfo : ObjectNameResource, Parcelable { } override fun getName(resources: Resources): String { - return applicationId ?: webDomain ?: "" + return toString() } fun containsOnlyNullValues(): Boolean { diff --git a/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt b/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt index dd2b2554e..03a840d55 100644 --- a/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt +++ b/app/src/main/java/com/kunzisoft/keepass/view/SpecialModeView.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019 Jeremy Jamet / Kunzisoft. + * Copyright 2020 Jeremy Jamet / Kunzisoft. * * This file is part of KeePassDX. * @@ -21,39 +21,24 @@ package com.kunzisoft.keepass.view import android.content.Context import android.util.AttributeSet -import android.view.LayoutInflater import android.view.View -import android.widget.TextView -import androidx.constraintlayout.widget.ConstraintLayout +import androidx.appcompat.widget.Toolbar import com.kunzisoft.keepass.R class SpecialModeView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, - defStyle: Int = 0) - : ConstraintLayout(context, attrs, defStyle) { - - private var cancelButton: View? = null - private var titleView: TextView? = null + defStyle: Int = androidx.appcompat.R.attr.toolbarStyle) + : Toolbar(context, attrs, defStyle) { init { - val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater? - inflater?.inflate(R.layout.selection_mode_view, this) - - cancelButton = findViewById(R.id.special_mode_cancel_button) - titleView = findViewById(R.id.special_mode_title_view) + setNavigationIcon(R.drawable.ic_close_white_24dp) + title = resources.getString(R.string.selection_mode) } - var title: CharSequence? - get() { - return titleView?.text - } - set(value) { - titleView?.text = value - } - var onCancelButtonClickListener: OnClickListener? = null set(value) { - cancelButton?.setOnClickListener(value) + if (value != null) + setNavigationOnClickListener(value) } var visible: Boolean = false diff --git a/app/src/main/res/drawable/ic_block_white_24dp.xml b/app/src/main/res/drawable/ic_block_white_24dp.xml new file mode 100644 index 000000000..9c5704687 --- /dev/null +++ b/app/src/main/res/drawable/ic_block_white_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_file_selection.xml b/app/src/main/res/layout/activity_file_selection.xml index ae61b7439..8ded0fa7a 100644 --- a/app/src/main/res/layout/activity_file_selection.xml +++ b/app/src/main/res/layout/activity_file_selection.xml @@ -30,6 +30,9 @@ android:id="@+id/special_mode_view" android:layout_width="match_parent" android:layout_height="wrap_content" + android:theme="?attr/specialToolbarAppearance" + app:titleTextAppearance="@style/KeepassDXStyle.TextAppearance.Toolbar.Special.Title" + app:subtitleTextAppearance="@style/KeepassDXStyle.TextAppearance.Toolbar.Special.SubTitle" app:layout_constraintTop_toTopOf="parent" /> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_password.xml b/app/src/main/res/layout/activity_password.xml index 18fc3017b..d505147f6 100644 --- a/app/src/main/res/layout/activity_password.xml +++ b/app/src/main/res/layout/activity_password.xml @@ -29,6 +29,9 @@ android:id="@+id/special_mode_view" android:layout_width="match_parent" android:layout_height="wrap_content" + android:theme="?attr/specialToolbarAppearance" + app:titleTextAppearance="@style/KeepassDXStyle.TextAppearance.Toolbar.Special.Title" + app:subtitleTextAppearance="@style/KeepassDXStyle.TextAppearance.Toolbar.Special.SubTitle" app:layout_constraintTop_toTopOf="parent" /> - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/autofill.xml b/app/src/main/res/menu/autofill.xml new file mode 100644 index 000000000..b56a23941 --- /dev/null +++ b/app/src/main/res/menu/autofill.xml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index a257e69a5..94954965d 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -19,7 +19,8 @@ --> - + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 86fb588bd..56303cb56 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -42,6 +42,9 @@ #1976D2 #1565C0 + #33b5e5 + #2c7a96 + #ef9a9a #f44336 #e53935 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a4f82df2d..fddb7c51d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -388,6 +388,7 @@ Blocklist that prevents auto filling of apps Web domain blocklist Blocklist that prevents auto filling of web domains + Block autofill Allow no master key Enable the \"Open\" button if no credentials are selected Delete password diff --git a/app/src/main/res/values/style_black.xml b/app/src/main/res/values/style_black.xml index ac10958c6..075227483 100644 --- a/app/src/main/res/values/style_black.xml +++ b/app/src/main/res/values/style_black.xml @@ -30,12 +30,13 @@ @color/green_light @color/background_dark @style/KeepassDXStyle.Toolbar.Black - @style/KeepassDXStyle.Toolbar.Black + @style/KeepassDXStyle.Toolbar.Special.Black + @style/KeepassDXStyle.Toolbar.Action.Black @style/KeepassDXStyle.Black.Dialog @style/KeepassDXStyle.Black.Dialog @style/KeepassDXStyle.ActionMode.Dark - + + + + + @@ -42,8 +43,17 @@ @color/blue_lighter @color/colorTextInverse - + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/style_purple.xml b/app/src/main/res/values/style_purple.xml index 09b2fdc1a..d0dc17371 100644 --- a/app/src/main/res/values/style_purple.xml +++ b/app/src/main/res/values/style_purple.xml @@ -29,7 +29,8 @@ @color/purple_lighter @color/background_purple @style/KeepassDXStyle.Toolbar.Purple - @style/KeepassDXStyle.Toolbar.Bottom.Purple + @style/KeepassDXStyle.Toolbar.Special.Purple + @style/KeepassDXStyle.Toolbar.Action.Purple @style/KeepassDXStyle.ActionMode.Purple @@ -42,8 +43,16 @@ @color/purple_lighter @color/colorTextInverse - + + @@ -42,6 +43,16 @@ @color/red_lighter @color/colorTextInverse + + + + + + + + + + + + + + + + @@ -257,7 +284,7 @@ ?android:attr/textColorPrimary 20sp - + + + + - - - - @@ -48,11 +48,6 @@ @color/red_dark @color/red_dark - - - - - - - -