From 4d72687628f569a241460d99e92472fc5bd24152 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Thu, 2 Jul 2020 13:36:46 +0200 Subject: [PATCH 01/15] Change ACTION_OPEN_DOCUMENT and flags --- .../activities/helpers/OpenFileHelper.kt | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt index 22b298b20..5907ca179 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/helpers/OpenFileHelper.kt @@ -89,13 +89,13 @@ class OpenFileHelper { @SuppressLint("InlinedApi") private fun openActivityWithActionOpenDocument() { - val intentOpenDocument = Intent(APP_ACTION_OPEN_DOCUMENT).apply { + val intentOpenDocument = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "*/*" - flags = Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION or - Intent.FLAG_GRANT_PREFIX_URI_PERMISSION or - Intent.FLAG_GRANT_READ_URI_PERMISSION or - Intent.FLAG_GRANT_WRITE_URI_PERMISSION + addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_PREFIX_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION) } if (fragment != null) fragment?.startActivityForResult(intentOpenDocument, OPEN_DOC) @@ -108,10 +108,10 @@ class OpenFileHelper { val intentGetContent = Intent(Intent.ACTION_GET_CONTENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = "*/*" - flags = Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION or - Intent.FLAG_GRANT_PREFIX_URI_PERMISSION or - Intent.FLAG_GRANT_READ_URI_PERMISSION or - Intent.FLAG_GRANT_WRITE_URI_PERMISSION + addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_PREFIX_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION) } if (fragment != null) fragment?.startActivityForResult(intentGetContent, GET_CONTENT) @@ -226,12 +226,6 @@ class OpenFileHelper { private const val TAG = "OpenFileHelper" - private var APP_ACTION_OPEN_DOCUMENT: String = try { - Intent::class.java.getField("ACTION_OPEN_DOCUMENT").get(null) as String - } catch (e: Exception) { - "android.intent.action.OPEN_DOCUMENT" - } - const val OPEN_INTENTS_FILE_BROWSE = "org.openintents.action.PICK_FILE" private const val GET_CONTENT = 25745 From b6111b35a20862525dd87e339f06fc33b10a5762 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 4 Jul 2020 11:27:21 +0200 Subject: [PATCH 02/15] Change clipboard strings and remove swipe to clear #605 --- .../ClipboardEntryNotificationService.kt | 3 --- app/src/main/res/values-ar/strings.xml | 1 - app/src/main/res/values-ca/strings.xml | 1 - app/src/main/res/values-cs/strings.xml | 1 - app/src/main/res/values-da/strings.xml | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-el/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-fi/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 11 +++++------ app/src/main/res/values-gl/strings.xml | 1 - app/src/main/res/values-hi/strings.xml | 1 - app/src/main/res/values-hr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values-iw/strings.xml | 1 - app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-ko/strings.xml | 1 - app/src/main/res/values-nb/strings.xml | 1 - app/src/main/res/values-nl/strings.xml | 1 - app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt-rBR/strings.xml | 1 - app/src/main/res/values-pt-rPT/strings.xml | 1 - app/src/main/res/values-ro/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sk/strings.xml | 1 - app/src/main/res/values-sv/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-uk/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values-zh-rTW/strings.xml | 1 - app/src/main/res/values/strings.xml | 5 ++--- 32 files changed, 7 insertions(+), 41 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt index eda16d673..bd5fa7226 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/ClipboardEntryNotificationService.kt @@ -153,9 +153,6 @@ class ClipboardEntryNotificationService : LockNotificationService() { val nextField = nextFields[0] builder.setContentText(getString(R.string.select_to_copy, nextField.label)) builder.setContentIntent(getCopyPendingIntent(nextField, nextFields)) - // Else tell to swipe for a clean - } else { - builder.setContentText(getString(R.string.clipboard_swipe_clean)) } val cleanIntent = Intent(this, ClipboardEntryNotificationService::class.java) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 57980aebf..0a65fcd18 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -29,7 +29,6 @@ مُسِحت الحافظة خطأ في الحافظة تعذَّر مسح الحافظة - اسحب لمسح الحافظة فورًا قاعدة البيانات يفك تعمية محتوى قاعدة البيانات… أرقام diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index c6d5615ea..761ef5417 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -295,7 +295,6 @@ Afegeix node Obre fitxer Fons - Llisqueu per a netejear el porta-retalls ara No ha estat possible netejar el porta-retalls Alguns dispositius no permeten que les aplicacions facin servir el porta-retalls. Error del porta-retalls diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 0ac6894cc..f2ea954c3 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -156,7 +156,6 @@ Funkce pro tvorbu klíče Rozšířené ASCII Umožnit - Schránku vymažete přejetím Databázi se nedaří načíst. Klíč se nedaří načíst, zkuste snížit množství paměti, využívané funkcí pro tvorbu klíče. Službu automatického vyplňování se nedaří zapnout. diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 5530dfa14..9912c9548 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -155,7 +155,6 @@ Nøgleafledningsfunktion Udvidet ASCII Tillad - Stryg for at at rydde udklipsholder nu Databasen kunne ikke indlæses. Kunne ikke indlæse nøglen. Prøv at reducere KDF \"hukommelsesforbrug\". Kunne ikke aktivere autofyld tjenesten. diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 35be36b5e..101fa4560 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -198,7 +198,6 @@ Schlüsselableitungsfunktion Erweiterte ASCII Erlauben - Wischen, um Zwischenablage jetzt zu leeren Autofill-Dienst kann nicht aktiviert werden. Kopie von %1$s Formularausfüllung diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 8d14ab1fc..3941ebd0f 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -157,7 +157,6 @@ Λειτουργία εξαγωγής κλειδιών Extended ASCII Δέχομαι - Σύρετε για να διαγράψετε το πρόχειρο τώρα Δεν ήταν δυνατή η ενεργοποίηση της υπηρεσίας αυτόματης συμπλήρωσης. Δεν ήταν δυνατή η εύρεση αρχείου. Δοκιμάστε να το ανοίξετε ξανά από το πρόγραμμα περιήγησης αρχείων σας. Αντιγραφή του %1$s diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 71f2b59ad..32a4159e0 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -148,7 +148,6 @@ Error del portapapeles Algunos dispositivos Android tienen un error en la implementación del portapapeles que provoca fallos al copiar desde las aplicaciones. Falló la limpieza del portapapeles - Deslizar ahora para limpiar el portapapeles Cada cadena debe tener un nombre de campo. No se pudo activar el servicio de compleción automática. Nombre del campo diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 6629171b2..7e19961b5 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -149,7 +149,6 @@ Keskikokoinen Suuri - Pyyhkäise tyhjentääksesi leikepöydän Salli Laajennettu ASCII Avaimen derivointifunktio diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8bb513f64..12bf858b3 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -40,8 +40,7 @@ Certains appareils ne permettent pas aux applications d’utiliser le presse-papier. Impossible de vider le presse-papier Expiration du presse-papier - Durée de stockage dans le presse-papier - Glisser pour vider le presse-papier maintenant + Durée de stockage dans le presse-papier (si supporté par votre appareil) Copier %1$s dans le presse-papier Récupération de la clé de la base de données… Base de données @@ -210,7 +209,7 @@ Change la fonte utilisée dans les champs pour une meilleure visibilité des caractères Faire confiance au presse-papier Autorise la copie du mot de passe de l’entrée et des champs protégés dans le presse-papier - Attention : Le presse-papiers est partagé par toutes les applications. Si des données sensibles sont copiées, d’autres logiciels peuvent les récupérer. + Attention : Le presse-papier est partagé par toutes les applications. Si des données sensibles sont copiées, d’autres logiciels peuvent les récupérer. Nom de la base de données Description de la base de données Version de la base de données @@ -219,7 +218,7 @@ Autres Clavier Magiclavier - Active un clavier personnalisé pour remplir vos mots de passe et tous les champs d’identité + Activer un clavier personnalisé pour remplir vos mots de passe et tous les champs d’identité Conseils pédagogiques Met en surbrillance les éléments pour apprendre le fonctionnement de l’application Réinitialiser les conseils pédagogiques @@ -349,7 +348,7 @@ Appuyer sur « Retour » pour verrouiller Verrouille la base de données lorsque l’utilisateur clique sur le bouton retour de l’écran racine Suppression à la fermeture - Verrouille la base de données lors de la fermeture de la notification + Verrouille la base de données lorsque la durée du presse-papier expire ou que la notification est fermée après avoir commencé à l’utiliser Corbeille Sélection de l’entrée Affiche les champs de saisie dans le Magiclavier lors de l’affichage d’une entrée @@ -413,7 +412,7 @@ La base de données contient des doublons d’UUID. Résoudre le problème en générant de nouveaux UUID pour les doublons et continuer \? Base de données ouverte - Copie les champs d’une entrée à l’aide du presse-papier de votre appareil + Copier les champs d’une entrée à l’aide du presse-papier de votre appareil Utilise le déverrouillage avancé pour ouvrir plus facilement une base de données Compression de données La compression des données réduit la taille de la base de données. diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 2e7090823..65bb3a934 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -37,7 +37,6 @@ Fallou a limpeza do portapapeis Tempo límite para o portapapeis Tempo antes de limpar o portapapeis após copiar usuario ou contrasinal - Deslice para limpar agora o portapapeis Editar entrada Seleccione para copiar %1$s para o portapapeis A criar a chave da base de dados… diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 75818629b..d472c3131 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -40,7 +40,6 @@ क्लिपबोर्ड को साफ़ नहीं किया जा सका क्लिपबोर्ड टाइमआउट क्लिपबोर्ड में भंडारण की अवधि - अब क्लिपबोर्ड को साफ करने के लिए स्वाइप करें क्लिपबोर्ड पर %1$s को कॉपी करने के लिए चयन करें डेटाबेस कुंजी पुनर्प्राप्त कर रहा है… डेटाबेस diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 803ed658d..60576d550 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -38,7 +38,6 @@ Neki uređaji neće dopustiti aplikacijama korištenje međuspremnika. Nije moguće isprazniti međuspremnik Trajanje pohrane u međuspremniku - Prijeđite prstom da biste odmah ispraznili međuspremnik Pozadina Otvori datoteku Dodaj čvor diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 40d5e50ce..eb91ae444 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -312,7 +312,6 @@ Elemek rendezése Válasszon, hogy az elemek és csoportok hogyan legyenek rendezve. Közreműködés - Seprés a vágólap azonnali törléséhez Szerkessze a bejegyzése egyéni mezőit. Az adatok hivatkozhatóak a különböző mezők között. Segítsen a stabilitás és a biztonság növelésében, és az új funkciók hozzáadásában. Számos más jelszókezelő alkalmazással ellentétben, ez egy <strong>reklámmentes</strong>, <strong>copyleft licencelésű szabad szoftver</strong>, amely nem gyűjt személyes adatokat a kiszolgálókon, bármelyik verziót is használja. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 08cc30d8b..ba560f7a0 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -168,7 +168,6 @@ Cifratura Funzione di derivazione chiave ASCII esteso - Scorri per pulire gli appunti ora Seleziona un file chiave. Attivazione del servizio di auto-completamento fallita. Non puoi spostare un gruppo in se stesso. diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 6f3c8f68d..0796b6d87 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -149,7 +149,6 @@ ערוך רשומה הצפנה אפשר - החלק לניקוי לוח העתקה עכשיו כתובת URL לא ניתן לטעון את בסיס הנתונים \ No newline at end of file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 7a168b8d5..3fdc3ffe0 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -147,7 +147,6 @@ クリップボードエラー 一部の端末ではアプリからクリップボードを使用できません。 クリップボードをクリアできません - スワイプすると今すぐクリップボードをクリアします エントリデータが見つかりませんでした。 データベースを読み込みできませんでした。 鍵を読み込みできませんでした。KDF の \"メモリ使用量\" を下げてみてください。 diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 942c764c5..c5e6b8cb9 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -41,7 +41,6 @@ 클립보드를 비울 수 없음 클립보드 시간 초과 클립보드 저장이 유지될 시간 - 클립보드를 지우기 위해 스와이프 %1$s 을(를) 클립보드에 복사하려면 선택하십시오. 데이터베이스 키를 검색하는 중… 데이터베이스 diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 98bded3bb..b791cf1c4 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -40,7 +40,6 @@ Kunne ikke tømme utklippstavle Tidsavbrudd for utklippstavle Tid før utklippstavlen tømmes etter kopiering av brukernavn og passord - Dra for å tømme utklippstavlen nå Velg for å kopier %1$s til utklippstavlen Oppretter databasenøkkel… Database diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6382def4f..f662d1f8e 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -151,7 +151,6 @@ Klembordfout Sommige apparaten staan niet toe dat apps het klembord gebruiken. Wissen van klembord mislukt - Veeg om klembord nu te wissen Geen iteminhoud gevonden. Je database kan niet worden geladen. De sleutel kan niet worden geladen. Probeer om het \"geheugengebruik\" van KDF te verminderen. diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index fc5fa1006..5943c1769 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -146,7 +146,6 @@ Błąd schowka Niektóre urządzenia nie pozwalają aplikacjom korzystać ze schowka. Nie można wyczyścić schowka - Przesuń, by wyczyścić schowek KeePassDX © %1$d Kunzisoft jest <strong>open source</strong> i <strong>bez reklam</strong>. \nJest on dostarczany w stanie, zgodnie z licencją <strong>GPLv3</strong> bez żadnych gwarancji. Nie znaleziono danych wejściowych. diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 4f05e0dc6..2861988f9 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -147,7 +147,6 @@ Erro na área de transferência Alguns dispositivos não permitem que aplicativos usem a área de transferência. Não foi possível limpar a área de transferência - Deslize para limpar a área de transferência agora Não pôde encontrar dado de entrada. Um nome do campo é necessário para cada string. Não pôde ser habilitado o serviço de preenchimento automático. diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 746a63bf5..7fd698cfc 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -208,7 +208,6 @@ Editar entrada Encriptação Função de derivação de chave - Deslize para o lado para limpar agora a área de transferência Não pôde ser habilitado o serviço de preenchimento automático. Algoritmo de encriptação usado para todos os dados. Define o tamanho padrão para palavras-passe geradas diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 23932fcea..b11921c25 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -40,7 +40,6 @@ Nu s-a putut curata memoria carnetelului Timp expirat de citire a carnetelului Durata de memorare din carnetel - Schimba ca sa cureti carnetelul acum In spate Deschide fisier Copil nod diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index e4e22b51a..faffece52 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -184,7 +184,6 @@ Время последнего доступа Изменить Разрешить - Смахните для очистки буфера обмена Невозможно загрузить базу. Невозможно загрузить ключ. Попробуйте уменьшить размер памяти, используемой функцией формирования ключа (KDF). Нельзя переместить группу в саму себя. diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 67f57a7f9..6933d7455 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -147,7 +147,6 @@ Chyba schránky Niektoré zariadenia nedovolia aplikáciám používať schránku. Nepodarilo sa vymazať schránku - Schránku vymažete potiahnutím prsta cez políčko Nenašli sa údaje záznamu Kontakt Otvoriť súbor diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index d5902e3fb..625c6d4d7 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -156,7 +156,6 @@ Nyckelhärledningsfunktion Utökad ASCII Tillåt - Svep för att rensa urklipp nu Öppna fil Lägg till nod Ny post diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 20bd633ce..f1828bb82 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -57,7 +57,6 @@ Veritabanı okunamadı. Yolun doğru olduğundan emin olun. Bir isim girin. - Şimdi panoyu temizlemek için kaydırın %1$s dosyasını panoya kopyalamak için seçin Veritabanı anahtarı alınıyor… Veritabanı içeriği deşifre ediliyor… diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 105b9b6b9..8f2e984a4 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -147,7 +147,6 @@ Відкрити файл Розширений ASCII Змінити запис - Проведіть пальцем, щоб очистити буфер обміну зараз Блокувати базу даних під час закриття сповіщення Розблокування біометричними даними підтримується, але не налаштоване. Додати групу diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 590aec2ae..b13cdff4c 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -143,7 +143,6 @@ 剪切板错误 一些设备不允许程序使用剪切板。 无法清空剪切板 - 滑动以清空剪切板 ChaCha20 AES Argon2 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 8937cfb5f..6dd8debce 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -140,7 +140,6 @@ 剪貼簿錯誤 部份設備不容許其他程式使用剪貼簿。 無法清除剪貼簿 - 滑动即可清除剪贴板 無法啟用自動填入服務。 無法移動一個群組至自己本身。 無效的演算法。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fc067296e..ce9e75a0d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -44,8 +44,7 @@ Some devices won\'t let apps use the clipboard. Could not clear clipboard Clipboard timeout - Duration of storage in the clipboard - Swipe to clear clipboard now + Duration of storage in the clipboard (if supported by your device) Background Open file Node children @@ -341,7 +340,7 @@ Enable Disable Clear at closing - Lock the database when closing the notification + Lock the database when the clipboard duration expires or the notification is closed after you start using it Database name Database description Default username From 05b8370cc040f27086be975b6a320b5aa737376d Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 4 Jul 2020 11:58:06 +0200 Subject: [PATCH 03/15] Rename saveView by validateButton --- .../com/kunzisoft/keepass/activities/EntryEditActivity.kt | 6 +++--- 1 file changed, 3 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 aac11904e..8af6038ed 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt @@ -81,7 +81,7 @@ class EntryEditActivity : LockingActivity(), private var scrollView: NestedScrollView? = null private var entryEditContentsView: EntryEditContentsView? = null private var entryEditAddToolBar: ActionMenuView? = null - private var saveView: View? = null + private var validateButton: View? = null private var lockView: View? = null // Education @@ -237,8 +237,8 @@ class EntryEditActivity : LockingActivity(), } // Save button - saveView = findViewById(R.id.entry_edit_validate) - saveView?.setOnClickListener { saveEntry() } + validateButton = findViewById(R.id.entry_edit_validate) + validateButton?.setOnClickListener { saveEntry() } // Verify the education views entryEditActivityEducation = EntryEditActivityEducation(this) From 692a971dc0577f9fcbc3d0e89536c8fcc52adb73 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 4 Jul 2020 15:45:07 +0200 Subject: [PATCH 04/15] Fix issue #615 and #612, action loading --- app/build.gradle | 3 + .../DatabaseTaskNotificationService.kt | 108 ++++++++++-------- 2 files changed, 63 insertions(+), 48 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 45da980bf..ece83fba9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -102,6 +102,9 @@ dependencies { implementation 'androidx.documentfile:documentfile:1.0.1' implementation 'androidx.biometric:biometric:1.0.1' implementation 'androidx.core:core-ktx:1.2.0' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' + // TODO #538 implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0" // To upgrade with style implementation 'com.google.android.material:material:1.0.0' // Database diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt index 219af8cc6..f10d00340 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt @@ -21,7 +21,6 @@ package com.kunzisoft.keepass.notifications import android.content.Intent import android.net.Uri -import android.os.AsyncTask import android.os.Binder import android.os.Bundle import android.os.IBinder @@ -42,17 +41,20 @@ import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ProgressTaskUpdater import com.kunzisoft.keepass.utils.DATABASE_START_TASK_ACTION import com.kunzisoft.keepass.utils.DATABASE_STOP_TASK_ACTION +import kotlinx.coroutines.* import java.util.* +import java.util.concurrent.atomic.AtomicBoolean import kotlin.collections.ArrayList class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdater { override val notificationId: Int = 575 - private var actionRunnableAsyncTask: ActionRunnableAsyncTask? = null + private val mainScope = CoroutineScope(Dispatchers.Main) private var mActionTaskBinder = ActionTaskBinder() private var mActionTaskListeners = LinkedList() + private var mAllowFinishAction = AtomicBoolean() private var mTitleId: Int? = null private var mMessageId: Int? = null @@ -84,6 +86,7 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat } override fun onBind(intent: Intent): IBinder? { + mAllowFinishAction.set(true) return mActionTaskBinder } @@ -159,34 +162,70 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat newNotification(intent.getIntExtra(DATABASE_TASK_TITLE_KEY, titleId)) // Build and launch the action - actionRunnableAsyncTask = ActionRunnableAsyncTask(this, - { - sendBroadcast(Intent(DATABASE_START_TASK_ACTION).apply { - putExtra(DATABASE_TASK_TITLE_KEY, titleId) - putExtra(DATABASE_TASK_MESSAGE_KEY, messageId) - putExtra(DATABASE_TASK_WARNING_KEY, warningId) - }) + mainScope.launch { + executeAction(this@DatabaseTaskNotificationService, + { + sendBroadcast(Intent(DATABASE_START_TASK_ACTION).apply { + putExtra(DATABASE_TASK_TITLE_KEY, titleId) + putExtra(DATABASE_TASK_MESSAGE_KEY, messageId) + putExtra(DATABASE_TASK_WARNING_KEY, warningId) + }) - mActionTaskListeners.forEach { actionTaskListener -> - actionTaskListener.onStartAction(titleId, messageId, warningId) - } + mActionTaskListeners.forEach { actionTaskListener -> + actionTaskListener.onStartAction(titleId, messageId, warningId) + } - }, { result -> - mActionTaskListeners.forEach { actionTaskListener -> - actionTaskListener.onStopAction(intentAction!!, result) - } + }, + { + actionRunnableNotNull + }, + { result -> + mActionTaskListeners.forEach { actionTaskListener -> + actionTaskListener.onStopAction(intentAction!!, result) + } - sendBroadcast(Intent(DATABASE_STOP_TASK_ACTION)) + sendBroadcast(Intent(DATABASE_STOP_TASK_ACTION)) - stopSelf() - } - ) - actionRunnableAsyncTask?.execute({ actionRunnableNotNull }) + stopSelf() + } + ) + } } return START_REDELIVER_INTENT } + /** + * Execute action with a coroutine + */ + private suspend fun executeAction(progressTaskUpdater: ProgressTaskUpdater, + onPreExecute: () -> Unit, + onExecute: (ProgressTaskUpdater?) -> ActionRunnable?, + onPostExecute: (result: ActionRunnable.Result) -> Unit) { + mAllowFinishAction.set(false) + onPreExecute.invoke() + withContext(Dispatchers.IO) { + onExecute.invoke(progressTaskUpdater)?.apply { + val asyncResult: Deferred = async { + val startTime = System.currentTimeMillis() + var timeIsUp = false + // Run the actionRunnable + run() + // Wait onBind or 4 seconds max + while (!mAllowFinishAction.get() && !timeIsUp) { + delay(100) + if (startTime + 4000 < System.currentTimeMillis()) + timeIsUp = true + } + result + } + withContext(Dispatchers.Main) { + onPostExecute.invoke(asyncResult.await()) + } + } + } + } + private fun newNotification(title: Int) { val builder = buildNewNotification() @@ -567,33 +606,6 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat } } - private class ActionRunnableAsyncTask(private val progressTaskUpdater: ProgressTaskUpdater, - private val onPreExecute: () -> Unit, - private val onPostExecute: (result: ActionRunnable.Result) -> Unit) - : AsyncTask<((ProgressTaskUpdater?) -> ActionRunnable), Void, ActionRunnable.Result>() { - - override fun onPreExecute() { - super.onPreExecute() - onPreExecute.invoke() - } - - override fun doInBackground(vararg actionRunnables: ((ProgressTaskUpdater?)-> ActionRunnable)?): ActionRunnable.Result { - var resultTask = ActionRunnable.Result(false) - actionRunnables.forEach { - it?.invoke(progressTaskUpdater)?.apply { - run() - resultTask = result - } - } - return resultTask - } - - override fun onPostExecute(result: ActionRunnable.Result) { - super.onPostExecute(result) - onPostExecute.invoke(result) - } - } - companion object { private val TAG = DatabaseTaskNotificationService::class.java.name From d5ece8d007464cc9d15e56727b9025e5025175cb Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Sat, 4 Jul 2020 19:19:05 +0200 Subject: [PATCH 05/15] Upgrade CHANGELOG --- CHANGELOG | 2 ++ fastlane/metadata/android/en-US/changelogs/36.txt | 2 ++ fastlane/metadata/android/fr-FR/changelogs/36.txt | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 2ce784f6c..af443f9fa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ KeePassDX(2.8) * Fix TOTP period (> 60s) * Fix searching in recycle bin + * Improve action tasks + * Fix minor issues KeePassDX(2.7) * Add blocklists for autofill diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt index 217c86600..37e356725 100644 --- a/fastlane/metadata/android/en-US/changelogs/36.txt +++ b/fastlane/metadata/android/en-US/changelogs/36.txt @@ -1,3 +1,5 @@ * Fix TOTP period (> 60s) * Fix searching in recycle bin + * Improving action tasks + * Fix minor issues diff --git a/fastlane/metadata/android/fr-FR/changelogs/36.txt b/fastlane/metadata/android/fr-FR/changelogs/36.txt index 9b983eccd..28b25a85b 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/36.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/36.txt @@ -1,3 +1,4 @@ * Correction de la période pour le TOTP (> 60s) * Correction de la recherche dans la corbeille - + * Amélioration des tâches d'action + * Correction de problèmes mineurs From a410ef5d9f9c174e4dc402663f4b0a0e041e3137 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 6 Jul 2020 15:59:14 +0200 Subject: [PATCH 06/15] Fix education hint in selection mode #600 --- .../activities/FileDatabaseSelectActivity.kt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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 7949e372d..9ee43bf2a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt @@ -402,12 +402,18 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), } private fun performedNextEducation(fileDatabaseSelectActivityEducation: FileDatabaseSelectActivityEducation) { + + val databaseButtonsVisible = databaseButtonsContainerView?.visibility == View.VISIBLE + val createButton = if (databaseButtonsVisible) createDatabaseButtonView else null + val openButton = if (databaseButtonsVisible) openDatabaseButtonView else null + // If no recent files - val createDatabaseEducationPerformed = createDatabaseButtonView != null && createDatabaseButtonView!!.visibility == View.VISIBLE + val createDatabaseEducationPerformed = + createButton != null && createButton.visibility == View.VISIBLE && mAdapterDatabaseHistory != null && mAdapterDatabaseHistory!!.itemCount > 0 && fileDatabaseSelectActivityEducation.checkAndPerformedCreateDatabaseEducation( - createDatabaseButtonView!!, + createButton, { createNewFile() }, @@ -417,9 +423,9 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), }) if (!createDatabaseEducationPerformed) { // selectDatabaseEducationPerformed - openDatabaseButtonView != null + openButton != null && fileDatabaseSelectActivityEducation.checkAndPerformedSelectDatabaseEducation( - openDatabaseButtonView!!, + openButton, {tapTargetView -> tapTargetView?.let { mOpenFileHelper?.openFileOnClickViewListener?.onClick(it) From 2b17d56fc7e0d222865a0c69bdae5604644a379a Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 6 Jul 2020 17:55:08 +0200 Subject: [PATCH 07/15] Allow open database during selection mode #608 --- .../activities/FileDatabaseSelectActivity.kt | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 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 9ee43bf2a..8154b2366 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/FileDatabaseSelectActivity.kt @@ -65,7 +65,6 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), // Views private var coordinatorLayout: CoordinatorLayout? = null private var fileManagerExplanationButton: View? = null - private var databaseButtonsContainerView: View? = null private var createDatabaseButtonView: View? = null private var openDatabaseButtonView: View? = null @@ -97,8 +96,6 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), UriUtil.gotoUrl(this, R.string.file_manager_explanation_url) } - databaseButtonsContainerView = findViewById(R.id.database_buttons_container) - // Create database button createDatabaseButtonView = findViewById(R.id.create_database_button) createDatabaseButtonView?.setOnClickListener { createNewFile() } @@ -271,8 +268,8 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), // Show open and create button or special mode if (mSelectionMode) { - // Disable buttons if in selection mode or request for autofill - databaseButtonsContainerView?.visibility = View.GONE + // Disable create button if in selection mode or request for autofill + createDatabaseButtonView?.visibility = View.GONE } else { if (allowCreateDocumentByStorageAccessFramework(packageManager)) { // There is an activity which can handle this intent. @@ -281,7 +278,6 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), // No Activity found that can handle this intent. createDatabaseButtonView?.visibility = View.GONE } - databaseButtonsContainerView?.visibility = View.VISIBLE } val database = Database.getInstance() @@ -402,18 +398,13 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), } private fun performedNextEducation(fileDatabaseSelectActivityEducation: FileDatabaseSelectActivityEducation) { - - val databaseButtonsVisible = databaseButtonsContainerView?.visibility == View.VISIBLE - val createButton = if (databaseButtonsVisible) createDatabaseButtonView else null - val openButton = if (databaseButtonsVisible) openDatabaseButtonView else null - // If no recent files val createDatabaseEducationPerformed = - createButton != null && createButton.visibility == View.VISIBLE + createDatabaseButtonView != null && createDatabaseButtonView!!.visibility == View.VISIBLE && mAdapterDatabaseHistory != null && mAdapterDatabaseHistory!!.itemCount > 0 && fileDatabaseSelectActivityEducation.checkAndPerformedCreateDatabaseEducation( - createButton, + createDatabaseButtonView!!, { createNewFile() }, @@ -423,9 +414,9 @@ class FileDatabaseSelectActivity : SpecialModeActivity(), }) if (!createDatabaseEducationPerformed) { // selectDatabaseEducationPerformed - openButton != null + openDatabaseButtonView != null && fileDatabaseSelectActivityEducation.checkAndPerformedSelectDatabaseEducation( - openButton, + openDatabaseButtonView!!, {tapTargetView -> tapTargetView?.let { mOpenFileHelper?.openFileOnClickViewListener?.onClick(it) From 696d2e51979da235c40a529f19cb24ac82e3af40 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 6 Jul 2020 19:55:17 +0200 Subject: [PATCH 08/15] Fix RemoteServiceException --- .../database/action/LoadDatabaseRunnable.kt | 4 ---- .../database/action/ProgressDialogThread.kt | 14 -------------- .../DatabaseTaskNotificationService.kt | 13 ++++++++++++- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt index 1f68f59f2..44546af4e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/action/LoadDatabaseRunnable.kt @@ -27,7 +27,6 @@ import com.kunzisoft.keepass.app.database.FileDatabaseHistoryAction import com.kunzisoft.keepass.database.element.Database import com.kunzisoft.keepass.database.exception.DuplicateUuidDatabaseException import com.kunzisoft.keepass.database.exception.LoadDatabaseException -import com.kunzisoft.keepass.notifications.DatabaseOpenNotificationService import com.kunzisoft.keepass.settings.PreferencesUtil import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ProgressTaskUpdater @@ -86,9 +85,6 @@ class LoadDatabaseRunnable(private val context: Context, // Register the current time to init the lock timer PreferencesUtil.saveCurrentTime(context) - - // Start the opening notification - DatabaseOpenNotificationService.start(context) } else { mDatabase.closeAndClear(cacheDirectory) } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt index b71e732fa..a96634c74 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt @@ -27,7 +27,6 @@ import android.os.Build import android.os.Bundle import android.os.IBinder import androidx.fragment.app.FragmentActivity -import com.kunzisoft.keepass.activities.lock.LockingActivity import com.kunzisoft.keepass.app.database.CipherDatabaseEntity import com.kunzisoft.keepass.crypto.keyDerivation.KdfEngine import com.kunzisoft.keepass.database.element.Entry @@ -91,8 +90,6 @@ class ProgressDialogThread(private val activity: FragmentActivity) { private val actionTaskListener = object: DatabaseTaskNotificationService.ActionTaskListener { override fun onStartAction(titleId: Int?, messageId: Int?, warningId: Int?) { TimeoutHelper.temporarilyDisableTimeout() - // Stop the opening notification - DatabaseOpenNotificationService.stop(activity) startDialog(titleId, messageId, warningId) } @@ -106,17 +103,6 @@ class ProgressDialogThread(private val activity: FragmentActivity) { // Remove the progress task stopDialog() TimeoutHelper.releaseTemporarilyDisableTimeout() - - val inTime = if (activity is LockingActivity) { - TimeoutHelper.checkTimeAndLockIfTimeout(activity) - } else { - TimeoutHelper.checkTime(activity) - } - // Start the opening notification if in time - // (databaseOpenService is open manually in Action Open Task) - if (actionTask != ACTION_DATABASE_LOAD_TASK && inTime) { - DatabaseOpenNotificationService.start(activity) - } } } diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt index f10d00340..01cae1bf6 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt @@ -39,6 +39,7 @@ import com.kunzisoft.keepass.database.element.node.NodeId import com.kunzisoft.keepass.database.element.node.Type import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ProgressTaskUpdater +import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.DATABASE_START_TASK_ACTION import com.kunzisoft.keepass.utils.DATABASE_STOP_TASK_ACTION import kotlinx.coroutines.* @@ -66,10 +67,14 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat fun addActionTaskListener(actionTaskListener: ActionTaskListener) { mActionTaskListeners.add(actionTaskListener) + mAllowFinishAction.set(true) } fun removeActionTaskListener(actionTaskListener: ActionTaskListener) { mActionTaskListeners.remove(actionTaskListener) + if (mActionTaskListeners.size == 0) { + mAllowFinishAction.set(false) + } } } @@ -86,7 +91,6 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat } override fun onBind(intent: Intent): IBinder? { - mAllowFinishAction.set(true) return mActionTaskBinder } @@ -203,6 +207,9 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat onExecute: (ProgressTaskUpdater?) -> ActionRunnable?, onPostExecute: (result: ActionRunnable.Result) -> Unit) { mAllowFinishAction.set(false) + + // Stop the opening notification + DatabaseOpenNotificationService.stop(this) onPreExecute.invoke() withContext(Dispatchers.IO) { onExecute.invoke(progressTaskUpdater)?.apply { @@ -221,6 +228,10 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat } withContext(Dispatchers.Main) { onPostExecute.invoke(asyncResult.await()) + // Start the opening notification + if (TimeoutHelper.checkTimeAndLockIfTimeout(this@DatabaseTaskNotificationService)) { + DatabaseOpenNotificationService.start(this@DatabaseTaskNotificationService) + } } } } From 440a72fc42a999fbc6e9c016d978912408c7f986 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 6 Jul 2020 19:59:11 +0200 Subject: [PATCH 09/15] Move timeout helper call in service --- .../keepass/database/action/ProgressDialogThread.kt | 5 ----- .../keepass/notifications/DatabaseTaskNotificationService.kt | 2 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt index a96634c74..273012e9c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/action/ProgressDialogThread.kt @@ -36,7 +36,6 @@ import com.kunzisoft.keepass.database.element.node.Node import com.kunzisoft.keepass.database.element.node.NodeId import com.kunzisoft.keepass.database.element.node.Type import com.kunzisoft.keepass.database.element.security.EncryptionAlgorithm -import com.kunzisoft.keepass.notifications.DatabaseOpenNotificationService import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_ASSIGN_PASSWORD_TASK import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.ACTION_DATABASE_COPY_NODES_TASK @@ -67,7 +66,6 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Compa import com.kunzisoft.keepass.tasks.ActionRunnable import com.kunzisoft.keepass.tasks.ProgressTaskDialogFragment import com.kunzisoft.keepass.tasks.ProgressTaskDialogFragment.Companion.PROGRESS_TASK_DIALOG_TAG -import com.kunzisoft.keepass.timeout.TimeoutHelper import com.kunzisoft.keepass.utils.DATABASE_START_TASK_ACTION import com.kunzisoft.keepass.utils.DATABASE_STOP_TASK_ACTION import java.util.* @@ -89,7 +87,6 @@ class ProgressDialogThread(private val activity: FragmentActivity) { private val actionTaskListener = object: DatabaseTaskNotificationService.ActionTaskListener { override fun onStartAction(titleId: Int?, messageId: Int?, warningId: Int?) { - TimeoutHelper.temporarilyDisableTimeout() startDialog(titleId, messageId, warningId) } @@ -99,10 +96,8 @@ class ProgressDialogThread(private val activity: FragmentActivity) { override fun onStopAction(actionTask: String, result: ActionRunnable.Result) { onActionFinish?.invoke(actionTask, result) - // Remove the progress task stopDialog() - TimeoutHelper.releaseTemporarilyDisableTimeout() } } diff --git a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt index 01cae1bf6..1ab1f9cee 100644 --- a/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/DatabaseTaskNotificationService.kt @@ -210,6 +210,7 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat // Stop the opening notification DatabaseOpenNotificationService.stop(this) + TimeoutHelper.temporarilyDisableTimeout() onPreExecute.invoke() withContext(Dispatchers.IO) { onExecute.invoke(progressTaskUpdater)?.apply { @@ -228,6 +229,7 @@ class DatabaseTaskNotificationService : NotificationService(), ProgressTaskUpdat } withContext(Dispatchers.Main) { onPostExecute.invoke(asyncResult.await()) + TimeoutHelper.releaseTemporarilyDisableTimeout() // Start the opening notification if (TimeoutHelper.checkTimeAndLockIfTimeout(this@DatabaseTaskNotificationService)) { DatabaseOpenNotificationService.start(this@DatabaseTaskNotificationService) From a891683806e38d4fccd1c3d9dc5dddf448613992 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Mon, 6 Jul 2020 20:05:03 +0200 Subject: [PATCH 10/15] Fix close option menu error --- .../com/kunzisoft/keepass/activities/lock/LockingActivity.kt | 1 + 1 file changed, 1 insertion(+) 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 9d047a3ea..69fcfcf03 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 @@ -71,6 +71,7 @@ abstract class LockingActivity : SpecialModeActivity() { LOCKING_ACTIVITY_UI_VISIBLE_DURING_LOCK = LOCKING_ACTIVITY_UI_VISIBLE // Add onActivityForResult response setResult(RESULT_EXIT_LOCK) + closeOptionsMenu() finish() } registerLockReceiver(mLockReceiver) From 13b933cd0b8d1c0575f5bc8508f7b4ba0b910ff7 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Thu, 9 Jul 2020 19:34:57 +0200 Subject: [PATCH 11/15] Try to fix biometric prompt in other activities #602 --- .../keepass/biometric/AdvancedUnlockedManager.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt index d913acd17..d0120e32a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt +++ b/app/src/main/java/com/kunzisoft/keepass/biometric/AdvancedUnlockedManager.kt @@ -52,12 +52,19 @@ class AdvancedUnlockedManager(var context: FragmentActivity, private var biometricUnlockDatabaseHelper: BiometricUnlockDatabaseHelper? = null private var biometricMode: Mode = Mode.UNAVAILABLE + /** + * Manage setting to auto open biometric prompt + */ private var biometricPromptAutoOpenPreference = PreferencesUtil.isBiometricPromptAutoOpenEnable(context) var isBiometricPromptAutoOpenEnable: Boolean = true get() { return field && biometricPromptAutoOpenPreference } + // Variable to check if the prompt can be open (if the right activity is currently shown) + // checkBiometricAvailability() allows open biometric prompt and onDestroy() removes the authorization + private var allowOpenBiometricPrompt = false + private var cipherDatabaseAction = CipherDatabaseAction.getInstance(context.applicationContext) init { @@ -77,6 +84,7 @@ class AdvancedUnlockedManager(var context: FragmentActivity, // biometric not supported (by API level or hardware) so keep option hidden // or manually disable val biometricCanAuthenticate = BiometricManager.from(context).canAuthenticate() + allowOpenBiometricPrompt = true if (!PreferencesUtil.isBiometricUnlockEnable(context) || biometricCanAuthenticate == BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE @@ -210,7 +218,8 @@ class AdvancedUnlockedManager(var context: FragmentActivity, cryptoObject: BiometricPrompt.CryptoObject, promptInfo: BiometricPrompt.PromptInfo) { context.runOnUiThread { - biometricPrompt?.authenticate(promptInfo, cryptoObject) + if (allowOpenBiometricPrompt) + biometricPrompt?.authenticate(promptInfo, cryptoObject) } } @@ -277,6 +286,7 @@ class AdvancedUnlockedManager(var context: FragmentActivity, fun destroy() { // Close the biometric prompt + allowOpenBiometricPrompt = false biometricUnlockDatabaseHelper?.closeBiometricPrompt() // Restore the checked listener checkboxPasswordView?.setOnCheckedChangeListener(onCheckedPasswordChangeListener) From fe902648ad123fb95e752c6cdde0e77e74a0fa34 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 10 Jul 2020 13:00:27 +0200 Subject: [PATCH 12/15] Settings to back to the previous keyboard during database credentials and after form filling #601 --- CHANGELOG | 1 + .../keepass/activities/PasswordActivity.kt | 9 ++++++--- .../kunzisoft/keepass/magikeyboard/MagikIME.kt | 9 ++++++++- .../kunzisoft/keepass/settings/PreferencesUtil.kt | 12 ++++++++++++ .../kunzisoft/keepass/utils/BroadcastAction.kt | 15 ++++++++++++--- app/src/main/res/values/donottranslate.xml | 4 ++++ app/src/main/res/values/strings.xml | 5 +++++ app/src/main/res/xml/preferences_keyboard.xml | 14 ++++++++++++++ fastlane/metadata/android/en-US/changelogs/36.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/36.txt | 1 + 10 files changed, 64 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index af443f9fa..4048d8d1d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ KeePassDX(2.8) * Fix TOTP period (> 60s) * Fix searching in recycle bin + * Settings to back to the previous keyboard during database credentials and after form filling * Improve action tasks * Fix minor issues 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 a995994c1..515e3ac08 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/PasswordActivity.kt @@ -64,9 +64,7 @@ import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Compa import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.MASTER_PASSWORD_KEY import com.kunzisoft.keepass.notifications.DatabaseTaskNotificationService.Companion.READ_ONLY_KEY import com.kunzisoft.keepass.settings.PreferencesUtil -import com.kunzisoft.keepass.utils.FileDatabaseInfo -import com.kunzisoft.keepass.utils.MenuUtil -import com.kunzisoft.keepass.utils.UriUtil +import com.kunzisoft.keepass.utils.* import com.kunzisoft.keepass.view.AdvancedUnlockInfoView import com.kunzisoft.keepass.view.KeyFileSelectionView import com.kunzisoft.keepass.view.asError @@ -355,6 +353,11 @@ open class PasswordActivity : SpecialModeActivity() { mProgressDialogThread?.registerProgressTask() + // Back to previous keyboard is setting activated + if (PreferencesUtil.isKeyboardPreviousDatabaseCredentialsEnable(this)) { + sendBroadcast(Intent(BACK_PREVIOUS_KEYBOARD_ACTION)) + } + // Don't allow auto open prompt if lock become when UI visible mAllowAutoOpenBiometricPrompt = if (LockingActivity.LOCKING_ACTIVITY_UI_VISIBLE_DURING_LOCK == true) false diff --git a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt index 665eeaf3a..2eabbca78 100644 --- a/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt +++ b/app/src/main/java/com/kunzisoft/keepass/magikeyboard/MagikIME.kt @@ -65,6 +65,9 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { removeEntryInfo() assignKeyboardView() } + lockReceiver?.backToPreviousKeyboardAction = { + switchToPreviousKeyboard() + } registerLockReceiver(lockReceiver, true) } @@ -262,8 +265,12 @@ class MagikIME : InputMethodService(), KeyboardView.OnKeyboardActionListener { } private fun actionGoAutomatically() { - if (PreferencesUtil.isAutoGoActionEnable(this)) + if (PreferencesUtil.isAutoGoActionEnable(this)) { currentInputConnection.performEditorAction(EditorInfo.IME_ACTION_GO) + if (PreferencesUtil.isKeyboardPreviousFillInEnable(this)) { + switchToPreviousKeyboard() + } + } } override fun onPress(primaryCode: Int) { 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 cac7c0338..2f537b1ca 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.kt @@ -369,6 +369,18 @@ object PreferencesUtil { context.resources.getBoolean(R.bool.keyboard_key_sound_default)) } + fun isKeyboardPreviousDatabaseCredentialsEnable(context: Context): Boolean { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getBoolean(context.getString(R.string.keyboard_previous_database_credentials_key), + context.resources.getBoolean(R.bool.keyboard_previous_database_credentials_default)) + } + + fun isKeyboardPreviousFillInEnable(context: Context): Boolean { + val prefs = PreferenceManager.getDefaultSharedPreferences(context) + return prefs.getBoolean(context.getString(R.string.keyboard_previous_fill_in_key), + context.resources.getBoolean(R.bool.keyboard_previous_fill_in_default)) + } + fun isAutofillAutoSearchEnable(context: Context): Boolean { val prefs = PreferenceManager.getDefaultSharedPreferences(context) return prefs.getBoolean(context.getString(R.string.autofill_auto_search_key), diff --git a/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt b/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt index 236a11563..cc11945a2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt +++ b/app/src/main/java/com/kunzisoft/keepass/utils/BroadcastAction.kt @@ -42,10 +42,12 @@ const val DATABASE_STOP_TASK_ACTION = "com.kunzisoft.keepass.DATABASE_STOP_TASK_ const val LOCK_ACTION = "com.kunzisoft.keepass.LOCK" const val REMOVE_ENTRY_MAGIKEYBOARD_ACTION = "com.kunzisoft.keepass.REMOVE_ENTRY_MAGIKEYBOARD" +const val BACK_PREVIOUS_KEYBOARD_ACTION = "com.kunzisoft.keepass.BACK_PREVIOUS_KEYBOARD" class LockReceiver(var lockAction: () -> Unit) : BroadcastReceiver() { var mLockPendingIntent: PendingIntent? = null + var backToPreviousKeyboardAction: (() -> Unit)? = null override fun onReceive(context: Context, intent: Intent) { // If allowed, lock and exit @@ -76,7 +78,12 @@ class LockReceiver(var lockAction: () -> Unit) : BroadcastReceiver() { } } LOCK_ACTION, - REMOVE_ENTRY_MAGIKEYBOARD_ACTION -> lockAction.invoke() + REMOVE_ENTRY_MAGIKEYBOARD_ACTION -> { + lockAction.invoke() + } + BACK_PREVIOUS_KEYBOARD_ACTION -> { + backToPreviousKeyboardAction?.invoke() + } else -> {} } } @@ -93,14 +100,16 @@ class LockReceiver(var lockAction: () -> Unit) : BroadcastReceiver() { } fun Context.registerLockReceiver(lockReceiver: LockReceiver?, - registerRemoveEntryMagikeyboard: Boolean = false) { + registerKeyboardAction: Boolean = false) { lockReceiver?.let { registerReceiver(it, IntentFilter().apply { addAction(Intent.ACTION_SCREEN_OFF) addAction(Intent.ACTION_SCREEN_ON) addAction(LOCK_ACTION) - if (registerRemoveEntryMagikeyboard) + if (registerKeyboardAction) { addAction(REMOVE_ENTRY_MAGIKEYBOARD_ACTION) + addAction(BACK_PREVIOUS_KEYBOARD_ACTION) + } }) } } diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index 00f7ef8fe..e75382b0c 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -132,6 +132,10 @@ true keyboard_key_sound_key false + keyboard_previous_database_credentials_key + false + keyboard_previous_fill_in_key + false autofill_auto_search_key true autofill_application_id_blocklist_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ce9e75a0d..46d2a7dd6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -381,6 +381,11 @@ \"Go\" key action after pressing a \"Field\" key Vibratory keypresses Audible keypresses + Keyboard change + Previous keyboard during database credentials + Automatically back to the previous keyboard if the database credentials screen is shown + Previous keyboard after form filling + Automatically back to the previous keyboard if the form is filling and "Go" key action is auto activated Auto search Automatically suggest search results from the web domain or application ID Application blocklist diff --git a/app/src/main/res/xml/preferences_keyboard.xml b/app/src/main/res/xml/preferences_keyboard.xml index 1a80f680c..0150ba583 100644 --- a/app/src/main/res/xml/preferences_keyboard.xml +++ b/app/src/main/res/xml/preferences_keyboard.xml @@ -67,4 +67,18 @@ android:defaultValue="@bool/keyboard_key_sound_default" android:title="@string/keyboard_key_sound_title" /> + + + + \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt index 37e356725..fde533cd5 100644 --- a/fastlane/metadata/android/en-US/changelogs/36.txt +++ b/fastlane/metadata/android/en-US/changelogs/36.txt @@ -1,5 +1,6 @@ * Fix TOTP period (> 60s) * Fix searching in recycle bin + * Settings to back to the previous keyboard during database credentials and after form filling * Improving action tasks * Fix minor issues diff --git a/fastlane/metadata/android/fr-FR/changelogs/36.txt b/fastlane/metadata/android/fr-FR/changelogs/36.txt index 28b25a85b..a980f9e53 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/36.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/36.txt @@ -1,4 +1,5 @@ * Correction de la période pour le TOTP (> 60s) * Correction de la recherche dans la corbeille + * Paramètres pour revenir automatiquement au clavier précédent durant l'identification de la base et après le remplissage de formulaire * Amélioration des tâches d'action * Correction de problèmes mineurs From 9f99b675635aa979bb2d792d1e367ec2dd201a95 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 10 Jul 2020 17:46:14 +0200 Subject: [PATCH 13/15] Improve recognition to reset app timeout #562 --- CHANGELOG | 1 + .../kunzisoft/keepass/activities/EntryActivity.kt | 3 +++ .../keepass/activities/EntryEditActivity.kt | 2 +- .../kunzisoft/keepass/activities/GroupActivity.kt | 5 ++++- .../keepass/activities/lock/LockingActivity.kt | 15 +++++++++++++-- .../keepass/settings/SettingsActivity.kt | 3 +++ .../kunzisoft/keepass/timeout/TimeoutHelper.kt | 9 ++++++++- app/src/main/res/layout/activity_group.xml | 1 + fastlane/metadata/android/en-US/changelogs/36.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/36.txt | 1 + 10 files changed, 36 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4048d8d1d..02b22f218 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ KeePassDX(2.8) * Fix searching in recycle bin * Settings to back to the previous keyboard during database credentials and after form filling * Improve action tasks + * Improve recognition to reset app timeout * Fix minor issues KeePassDX(2.7) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt index fbc5a6000..a05be5aec 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt @@ -130,6 +130,9 @@ class EntryActivity : LockingActivity() { lockAndExit() } + // Focus view to reinitialize timeout + resetAppTimeoutWhenViewFocusedOrChanged(coordinatorLayout) + // Init the clipboard helper clipboardHelper = ClipboardHelper(this) firstLaunchOfActivity = true 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 8af6038ed..06157706c 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.kt @@ -121,7 +121,7 @@ class EntryEditActivity : LockingActivity(), } // Focus view to reinitialize timeout - resetAppTimeoutWhenViewFocusedOrChanged(entryEditContentsView) + resetAppTimeoutWhenViewFocusedOrChanged(coordinatorLayout) stopService(Intent(this, ClipboardEntryNotificationService::class.java)) stopService(Intent(this, KeyboardEntryNotificationService::class.java)) 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 be3f58e07..8c0ca66da 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.view.ViewGroup import android.widget.ImageView import android.widget.TextView import androidx.annotation.RequiresApi @@ -90,6 +91,7 @@ class GroupActivity : LockingActivity(), SortDialogFragment.SortSelectionListener { // Views + private var rootContainerView: ViewGroup? = null private var coordinatorLayout: CoordinatorLayout? = null private var lockView: View? = null private var toolbar: Toolbar? = null @@ -130,6 +132,7 @@ class GroupActivity : LockingActivity(), setContentView(layoutInflater.inflate(R.layout.activity_group, null)) // Initialize views + rootContainerView = findViewById(R.id.activity_group_container_view) coordinatorLayout = findViewById(R.id.group_coordinator) iconView = findViewById(R.id.group_icon) numberChildrenView = findViewById(R.id.group_numbers) @@ -153,7 +156,7 @@ class GroupActivity : LockingActivity(), taTextColor.recycle() // Focus view to reinitialize timeout - resetAppTimeoutWhenViewFocusedOrChanged(addNodeButtonView) + resetAppTimeoutWhenViewFocusedOrChanged(rootContainerView) // Retrieve elements after an orientation change if (savedInstanceState != null) { 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 69fcfcf03..d63487362 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 @@ -19,9 +19,10 @@ */ package com.kunzisoft.keepass.activities.lock +import android.annotation.SuppressLint import android.content.Intent import android.os.Bundle -import android.util.Log +import android.view.MotionEvent import android.view.View import android.view.ViewGroup import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper @@ -152,11 +153,21 @@ abstract class LockingActivity : SpecialModeActivity() { /** * To reset the app timeout when a view is focused or changed */ + @SuppressLint("ClickableViewAccessibility") protected fun resetAppTimeoutWhenViewFocusedOrChanged(vararg views: View?) { views.forEach { + it?.setOnTouchListener { _, event -> + when (event.action) { + MotionEvent.ACTION_DOWN -> { + // Log.d(TAG, "View touched, try to reset app timeout") + TimeoutHelper.checkTimeAndLockIfTimeoutOrResetTimeout(this) + } + } + false + } it?.setOnFocusChangeListener { _, hasFocus -> if (hasFocus) { - Log.d(TAG, "View focused, reset app timeout") + // Log.d(TAG, "View focused, try to reset app timeout") TimeoutHelper.checkTimeAndLockIfTimeoutOrResetTimeout(this) } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt index 09fd9ff9e..29f01e7ab 100644 --- a/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.kt @@ -92,6 +92,9 @@ open class SettingsActivity lockAndExit() } + // Focus view to reinitialize timeout + resetAppTimeoutWhenViewFocusedOrChanged(coordinatorLayout) + if (savedInstanceState == null) { supportFragmentManager.beginTransaction() .add(R.id.fragment_container, retrieveMainFragment()) diff --git a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt index 0dcd69de5..a8b87560a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt @@ -38,6 +38,7 @@ object TimeoutHelper { private const val TAG = "TimeoutHelper" + private var lastAppTimeoutRecord: Long? = null var temporarilyDisableTimeout = false private set @@ -141,7 +142,13 @@ object TimeoutHelper { */ fun checkTimeAndLockIfTimeoutOrResetTimeout(context: Context, action: (() -> Unit)? = null) { if (checkTimeAndLockIfTimeout(context)) { - recordTime(context) + // To prevent spam registration, record after at least 2 seconds + if (lastAppTimeoutRecord == null + || lastAppTimeoutRecord!! + 2000 <= System.currentTimeMillis()) { + Log.d(TAG, "Record app timeout") + recordTime(context) + lastAppTimeoutRecord = System.currentTimeMillis() + } action?.invoke() } } diff --git a/app/src/main/res/layout/activity_group.xml b/app/src/main/res/layout/activity_group.xml index 4d292f51e..c680f668c 100644 --- a/app/src/main/res/layout/activity_group.xml +++ b/app/src/main/res/layout/activity_group.xml @@ -21,6 +21,7 @@ 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/activity_group_container_view" android:layout_width="match_parent" android:layout_height="match_parent"> diff --git a/fastlane/metadata/android/en-US/changelogs/36.txt b/fastlane/metadata/android/en-US/changelogs/36.txt index fde533cd5..f119964b3 100644 --- a/fastlane/metadata/android/en-US/changelogs/36.txt +++ b/fastlane/metadata/android/en-US/changelogs/36.txt @@ -2,5 +2,6 @@ * Fix searching in recycle bin * Settings to back to the previous keyboard during database credentials and after form filling * Improving action tasks + * Improve recognition to reset app timeout * Fix minor issues diff --git a/fastlane/metadata/android/fr-FR/changelogs/36.txt b/fastlane/metadata/android/fr-FR/changelogs/36.txt index a980f9e53..2fe8c2a72 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/36.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/36.txt @@ -2,4 +2,5 @@ * Correction de la recherche dans la corbeille * Paramètres pour revenir automatiquement au clavier précédent durant l'identification de la base et après le remplissage de formulaire * Amélioration des tâches d'action + * Amélioration de la reconnaissance pour le temps écoulé * Correction de problèmes mineurs From 37fef66647713d05b5b06181493b00818a7fd836 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 10 Jul 2020 17:52:58 +0200 Subject: [PATCH 14/15] Improve recognition to reset app timeout #562 --- .../keepass/timeout/TimeoutHelper.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt index a8b87560a..f5b4d8ff2 100644 --- a/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.kt @@ -85,9 +85,15 @@ object TimeoutHelper { * Record the current time, to check it later with checkTime and start a new lock timer */ fun recordTime(context: Context) { - // Record timeout time in case timeout service is killed - PreferencesUtil.saveCurrentTime(context) - startLockTimer(context) + // To prevent spam registration, record after at least 2 seconds + if (lastAppTimeoutRecord == null + || lastAppTimeoutRecord!! + 2000 <= System.currentTimeMillis()) { + Log.d(TAG, "Record app timeout") + // Record timeout time in case timeout service is killed + PreferencesUtil.saveCurrentTime(context) + startLockTimer(context) + lastAppTimeoutRecord = System.currentTimeMillis() + } } /** @@ -142,13 +148,7 @@ object TimeoutHelper { */ fun checkTimeAndLockIfTimeoutOrResetTimeout(context: Context, action: (() -> Unit)? = null) { if (checkTimeAndLockIfTimeout(context)) { - // To prevent spam registration, record after at least 2 seconds - if (lastAppTimeoutRecord == null - || lastAppTimeoutRecord!! + 2000 <= System.currentTimeMillis()) { - Log.d(TAG, "Record app timeout") - recordTime(context) - lastAppTimeoutRecord = System.currentTimeMillis() - } + recordTime(context) action?.invoke() } } From f9e0aacfeb67eefe426733838b48f2361a26b894 Mon Sep 17 00:00:00 2001 From: J-Jamet Date: Fri, 10 Jul 2020 18:08:26 +0200 Subject: [PATCH 15/15] Fix clipboard notification after orientation change --- .../kunzisoft/keepass/activities/EntryActivity.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt index a05be5aec..09f441b3a 100644 --- a/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.kt @@ -89,7 +89,7 @@ class EntryActivity : LockingActivity() { private var mAttachmentsToDownload: HashMap = HashMap() private var clipboardHelper: ClipboardHelper? = null - private var firstLaunchOfActivity: Boolean = false + private var mFirstLaunchOfActivity: Boolean = false private var iconColor: Int = 0 @@ -135,7 +135,7 @@ class EntryActivity : LockingActivity() { // Init the clipboard helper clipboardHelper = ClipboardHelper(this) - firstLaunchOfActivity = true + mFirstLaunchOfActivity = savedInstanceState?.getBoolean(KEY_FIRST_LAUNCH_ACTIVITY) ?: true // Init attachment service binder manager mAttachmentFileBinderManager = AttachmentFileBinderManager(this) @@ -199,7 +199,7 @@ class EntryActivity : LockingActivity() { val entryInfo = entry.getEntryInfo(Database.getInstance()) // Manage entry copy to start notification if allowed - if (firstLaunchOfActivity) { + if (mFirstLaunchOfActivity) { // Manage entry to launch copying notification if allowed ClipboardEntryNotificationService.launchNotificationIfAllowed(this, entryInfo) // Manage entry to populate Magikeyboard and launch keyboard notification if allowed @@ -218,7 +218,7 @@ class EntryActivity : LockingActivity() { } } - firstLaunchOfActivity = false + mFirstLaunchOfActivity = false } override fun onPause() { @@ -545,6 +545,11 @@ class EntryActivity : LockingActivity() { return super.onOptionsItemSelected(item) } + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + + outState.putBoolean(KEY_FIRST_LAUNCH_ACTIVITY, mFirstLaunchOfActivity) + } override fun finish() { // Transit data in previous Activity after an update @@ -558,6 +563,8 @@ class EntryActivity : LockingActivity() { companion object { private val TAG = EntryActivity::class.java.name + private const val KEY_FIRST_LAUNCH_ACTIVITY = "KEY_FIRST_LAUNCH_ACTIVITY" + const val KEY_ENTRY = "KEY_ENTRY" const val KEY_ENTRY_HISTORY_POSITION = "KEY_ENTRY_HISTORY_POSITION"