diff --git a/.gitignore b/.gitignore index 80e465e8c..cabc7c78f 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ art/logo_512.png # Dir linux .directory */.directory +.idea diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43efa..000000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf337..000000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba45..000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index f7b16a201..000000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index d5309889a..000000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b312839b..000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index c452c653a..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - 1.7 - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 4f00a87ad..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 7f68460d8..000000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index a8e70f87d..70012a84b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,8 +1,9 @@ KeepassDX (2.5.0.0beta8) * Hide custom entries protected * Best management of field references (https://keepass.info/help/base/fieldrefs.html) - * Change default settings + * Change database / default settings * Add Autofill for search + * Add sorting by last access and by creation time * Rebuild custom entries * Refactor old code * Fix bugs diff --git a/COPYING.gpl-2.0 b/COPYING.gpl-2.0 deleted file mode 100644 index d511905c1..000000000 --- a/COPYING.gpl-2.0 +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program 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 2 of the License, or - (at your option) any later version. - - This program 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 this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/LICENSE b/LICENSE index 4ee074247..873671ea7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,19 @@ --- -The KeePass icon was created by Jeremy JAMET and is licensed under the terms of GPLv3. +KeePass DX 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. + This program 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 this program. If not, see . + +The KeePass DX icon was created by Jeremy JAMET and is licensed under the terms of GPLv3. --- @@ -54,7 +66,7 @@ Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft . This program 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, diff --git a/ReadMe.md b/ReadMe.md index c7ed3f5e2..d6c1fb0be 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -4,13 +4,16 @@ ### Features -* Create database files / entries and groups -* Support for .kdb and .kdbx files (version 1 to 4) -* Open database, copy username / password, open URI / URL -* Fingerprint for fast unlocking -* Material design with themes -* AutoFill and Integration (Development in progress) -* Precise management of settings + * Create database files / entries and groups + * Support for .kdb and .kdbx files (version 1 to 4) with AES - Twofish - ChaCha20 - Argon2 algorithm + * Compatible with the majority of alternative programs (KeePass, KeePassX, KeePass XC...) + * Allows fast copy of fields and opening of URI / URL + * Fingerprint for fast unlocking + * Material design with themes + * AutoFill and Integration + * Precise management of settings + +Keepass DX is opensource and ad-free. @@ -25,13 +28,13 @@ KeePass is a free open source password manager, which helps you to manage your p Yes, KeePass is really free, and more than that: it is open source (OSI certified). You can have a look at its full source and check whether the encryption algorithms are implemented correctly. -## Donation +## Contributions -Even if the application is free, to maintain the application, you can make donations. +You can contribute in different ways to help us on our work. -[![Donation Paypal](https://4.bp.blogspot.com/-ncaIbUGaHOk/WfhaThYUPGI/AAAAAAAAAVQ/_HidNgdB1q4DaC24ujaKNzH64KUUJiQewCLcBGAs/s1600/pay-with-paypal.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KM6QMDAXZM3UU "Kunzisoft Paypal Donation") - -[![Donation Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/Kunzisoft/donate "Kunzisoft Liberapay Donation") +* Add features by a pull request. +* Help to translate into your language +* [Donate](https://www.kunzisoft.com/donation) 人◕ ‿‿ ◕人Y for a better service and a quick development of your features. @@ -54,7 +57,7 @@ Even if the application is free, to maintain the application, you can make donat KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/build.gradle b/app/build.gradle index f4e93089b..c4a663574 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,18 +1,18 @@ apply plugin: 'com.android.application' android { - compileSdkVersion = 27 - buildToolsVersion = "27.0.3" + compileSdkVersion 27 + buildToolsVersion '27.0.3' defaultConfig { applicationId "com.kunzisoft.keepass" minSdkVersion 14 targetSdkVersion 27 - versionCode = 7 - versionName = "2.5.0.0beta7" + versionCode = 8 + versionName = "2.5.0.0beta8" multiDexEnabled true - testApplicationId = "com.keepassdroid.tests" + testApplicationId = "com.kunzisoft.keepass.tests" testInstrumentationRunner = "android.test.InstrumentationTestRunner" ndk { @@ -60,12 +60,12 @@ android { } } compileOptions { - targetCompatibility 1.8 - sourceCompatibility 1.8 + targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_1_8 } } -def supportVersion = "27.1.0" +def supportVersion = "27.1.1" def spongycastleVersion = "1.58.0.0" def permissionDispatcherVersion = "3.1.0" @@ -78,16 +78,20 @@ dependencies { implementation "com.madgag.spongycastle:core:$spongycastleVersion" implementation "com.madgag.spongycastle:prov:$spongycastleVersion" // Time - implementation "joda-time:joda-time:2.9.9" - implementation "org.sufficientlysecure:html-textview:3.5" - implementation "com.nononsenseapps:filepicker:4.1.0" - implementation "com.getkeepsafe.taptargetview:taptargetview:1.11.0" + implementation 'joda-time:joda-time:2.9.9' + implementation 'org.sufficientlysecure:html-textview:3.5' + implementation 'com.nononsenseapps:filepicker:4.1.0' + implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0' // Permissions - implementation ("com.github.hotchemi:permissionsdispatcher:$permissionDispatcherVersion") { + implementation("com.github.hotchemi:permissionsdispatcher:$permissionDispatcherVersion") { // if you don't use android.app.Fragment you can exclude support for them exclude module: "support-v13" } annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionDispatcherVersion" - implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.1' - implementation group: 'com.google.guava', name: 'guava', version: '23.0-android' + // Apache Commons Collections + implementation 'commons-collections:commons-collections:3.2.1' + // Base64 + implementation 'biz.source_code:base64coder:2010-12-19' + implementation 'com.google.code.gson:gson:2.8.1' + implementation 'com.google.guava:guava:23.0-android' } diff --git a/app/src/androidTest/java/com/keepassdroid/tests/.gitignore b/app/src/androidTest/java/com/kunzisoft/keepass/tests/.gitignore similarity index 100% rename from app/src/androidTest/java/com/keepassdroid/tests/.gitignore rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/.gitignore diff --git a/app/src/androidTest/java/com/keepassdroid/tests/AccentTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/AccentTest.java similarity index 88% rename from app/src/androidTest/java/com/keepassdroid/tests/AccentTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/AccentTest.java index 25436d5f2..7aed9ad77 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/AccentTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/AccentTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import android.test.AndroidTestCase; -import com.keepassdroid.tests.database.TestData; +import com.kunzisoft.keepass.tests.database.TestData; public class AccentTest extends AndroidTestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/AllTests.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/AllTests.java similarity index 91% rename from app/src/androidTest/java/com/keepassdroid/tests/AllTests.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/AllTests.java index c23aab5cd..434cf5011 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/AllTests.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/AllTests.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import junit.framework.Test; import junit.framework.TestSuite; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/OutputTests.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/OutputTests.java similarity index 85% rename from app/src/androidTest/java/com/keepassdroid/tests/OutputTests.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/OutputTests.java index cd7b0e0c2..bf93721fc 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/OutputTests.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/OutputTests.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import junit.framework.Test; import junit.framework.TestSuite; @@ -29,7 +29,7 @@ public class OutputTests extends TestSuite { public static Test suite() { return new TestSuiteBuilder(AllTests.class) - .includePackages("com.keepassdroid.tests.output") + .includePackages("com.kunzisoft.keepass.tests.output") .build(); } } diff --git a/app/src/androidTest/java/com/keepassdroid/tests/PwDateTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.java similarity index 88% rename from app/src/androidTest/java/com/keepassdroid/tests/PwDateTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.java index 9891b9e0f..c398b062b 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/PwDateTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwDateTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import junit.framework.TestCase; -import com.keepassdroid.database.PwDate; +import com.kunzisoft.keepass.database.PwDate; public class PwDateTest extends TestCase { public void testDate() { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV3.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV3.java similarity index 89% rename from app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV3.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV3.java index ad58f6fe9..f5b8e2b14 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV3.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import static org.junit.Assert.assertArrayEquals; @@ -27,8 +27,8 @@ import java.util.Calendar; import android.test.AndroidTestCase; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.tests.database.TestData; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.tests.database.TestData; public class PwEntryTestV3 extends AndroidTestCase { PwEntryV3 mPE; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV4.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV4.java similarity index 79% rename from app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV4.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV4.java index 476ced69d..15d26127a 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/PwEntryTestV4.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwEntryTestV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; -import com.keepassdroid.database.AutoType; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.PwGroupV4; -import com.keepassdroid.database.PwIconCustom; -import com.keepassdroid.database.PwIconStandard; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.database.security.ProtectedString; +import com.kunzisoft.keepass.database.AutoType; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwGroupV4; +import com.kunzisoft.keepass.database.PwIconCustom; +import com.kunzisoft.keepass.database.PwIconStandard; +import com.kunzisoft.keepass.database.security.ProtectedBinary; +import com.kunzisoft.keepass.database.security.ProtectedString; import junit.framework.TestCase; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/PwGroupTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwGroupTest.java similarity index 84% rename from app/src/androidTest/java/com/keepassdroid/tests/PwGroupTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/PwGroupTest.java index d951dc216..3473d0ac2 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/PwGroupTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/PwGroupTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import android.test.AndroidTestCase; -import com.keepassdroid.database.PwGroupV3; -import com.keepassdroid.tests.database.TestData; +import com.kunzisoft.keepass.database.PwGroupV3; +import com.kunzisoft.keepass.tests.database.TestData; public class PwGroupTest extends AndroidTestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/TestUtil.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/TestUtil.java similarity index 90% rename from app/src/androidTest/java/com/keepassdroid/tests/TestUtil.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/TestUtil.java index 20297d2c6..c7dd69151 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/TestUtil.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/TestUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import java.io.File; import java.io.FileNotFoundException; @@ -29,8 +29,8 @@ import android.content.res.AssetManager; import android.net.Uri; import android.os.Environment; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.UriUtil; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.UriUtil; public class TestUtil { private static final File sdcard = Environment.getExternalStorageDirectory(); diff --git a/app/src/androidTest/java/com/keepassdroid/tests/TypesTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/TypesTest.java similarity index 94% rename from app/src/androidTest/java/com/keepassdroid/tests/TypesTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/TypesTest.java index bd9ed2502..38b1a0fa1 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/TypesTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/TypesTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests; +package com.kunzisoft.keepass.tests; import static org.junit.Assert.assertArrayEquals; @@ -28,10 +28,10 @@ import java.util.UUID; import junit.framework.TestCase; -import com.keepassdroid.database.PwDate; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.database.PwDate; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.utils.Types; public class TypesTest extends TestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/crypto/AESTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.java similarity index 94% rename from app/src/androidTest/java/com/keepassdroid/tests/crypto/AESTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.java index 61502863c..db147ee45 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/crypto/AESTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/AESTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.crypto; +package com.kunzisoft.keepass.tests.crypto; -import static org.junit.Assert.assertArrayEquals; +import com.kunzisoft.keepass.crypto.CipherFactory; + +import junit.framework.TestCase; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -33,9 +35,7 @@ import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import junit.framework.TestCase; - -import com.keepassdroid.crypto.CipherFactory; +import static org.junit.Assert.assertArrayEquals; public class AESTest extends TestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/crypto/CipherTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.java similarity index 89% rename from app/src/androidTest/java/com/keepassdroid/tests/crypto/CipherTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.java index f8666cc45..4adbdbcdc 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/crypto/CipherTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/CipherTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.crypto; +package com.kunzisoft.keepass.tests.crypto; import static org.junit.Assert.assertArrayEquals; @@ -37,11 +37,11 @@ import javax.crypto.NoSuchPaddingException; import junit.framework.TestCase; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.crypto.engine.AesEngine; -import com.keepassdroid.crypto.engine.CipherEngine; -import com.keepassdroid.stream.BetterCipherInputStream; -import com.keepassdroid.stream.LEDataInputStream; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.crypto.engine.AesEngine; +import com.kunzisoft.keepass.crypto.engine.CipherEngine; +import com.kunzisoft.keepass.stream.BetterCipherInputStream; +import com.kunzisoft.keepass.stream.LEDataInputStream; public class CipherTest extends TestCase { private Random rand = new Random(); diff --git a/app/src/androidTest/java/com/keepassdroid/tests/crypto/FinalKeyTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.java similarity index 87% rename from app/src/androidTest/java/com/keepassdroid/tests/crypto/FinalKeyTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.java index a20bf6d50..ba9bc8da4 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/crypto/FinalKeyTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/crypto/FinalKeyTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.crypto; +package com.kunzisoft.keepass.tests.crypto; import static org.junit.Assert.assertArrayEquals; @@ -26,8 +26,8 @@ import java.util.Random; import junit.framework.TestCase; -import com.keepassdroid.crypto.finalkey.AndroidFinalKey; -import com.keepassdroid.crypto.finalkey.NativeFinalKey; +import com.kunzisoft.keepass.crypto.finalkey.AndroidFinalKey; +import com.kunzisoft.keepass.crypto.finalkey.NativeFinalKey; public class FinalKeyTest extends TestCase { private Random mRand; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/DeleteEntry.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/DeleteEntry.java similarity index 76% rename from app/src/androidTest/java/com/keepassdroid/tests/database/DeleteEntry.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/DeleteEntry.java index f2d4304dd..99f615a2a 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/DeleteEntry.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/DeleteEntry.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,20 +17,21 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import java.util.List; import android.content.Context; import android.test.AndroidTestCase; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.edit.DeleteGroup; -import com.keepassdroid.search.SearchDbHelper; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.edit.DeleteGroup; +import com.kunzisoft.keepass.search.SearchDbHelper; public class DeleteEntry extends AndroidTestCase { private static final String GROUP1_NAME = "Group1"; @@ -54,7 +55,7 @@ public class DeleteEntry extends AndroidTestCase { return; } - PwDatabaseV3 pm = (PwDatabaseV3) db.pm; + PwDatabaseV3 pm = (PwDatabaseV3) db.getPwDatabase(); PwGroup group1 = getGroup(pm, GROUP1_NAME); assertNotNull("Could not find group1", group1); @@ -71,8 +72,8 @@ public class DeleteEntry extends AndroidTestCase { // Verify the entries were removed from the search index SearchDbHelper dbHelp = new SearchDbHelper(ctx); - PwGroup results1 = dbHelp.search(db, ENTRY1_NAME); - PwGroup results2 = dbHelp.search(db, ENTRY2_NAME); + PwGroup results1 = dbHelp.search(db.getPwDatabase(), ENTRY1_NAME); + PwGroup results2 = dbHelp.search(db.getPwDatabase(), ENTRY2_NAME); assertEquals("Entry1 was not removed from the search results", 0, results1.numbersOfChildEntries()); assertEquals("Entry2 was not removed from the search results", 0, results2.numbersOfChildEntries()); @@ -83,10 +84,10 @@ public class DeleteEntry extends AndroidTestCase { } - private PwEntry getEntry(PwDatabaseV3 pm, String name) { - List entries = pm.getEntries(); + private PwEntryV3 getEntry(PwDatabaseV3 pm, String name) { + List entries = pm.getEntries(); for ( int i = 0; i < entries.size(); i++ ) { - PwEntry entry = entries.get(i); + PwEntryV3 entry = entries.get(i); if ( entry.getTitle().equals(name) ) { return entry; } diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/EntryV4.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/EntryV4.java similarity index 86% rename from app/src/androidTest/java/com/keepassdroid/tests/database/EntryV4.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/EntryV4.java index 36aa204de..c4a7f4cea 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/EntryV4.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/EntryV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import junit.framework.TestCase; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwEntryV4; public class EntryV4 extends TestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3.java similarity index 87% rename from app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3.java index 837007ea3..25c574ccb 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import android.content.Context; import android.content.res.AssetManager; @@ -25,9 +25,9 @@ import android.net.Uri; import android.os.Environment; import android.test.AndroidTestCase; -import com.keepassdroid.database.load.ImporterV3; -import com.keepassdroid.tests.TestUtil; -import com.keepassdroid.utils.UriUtil; +import com.kunzisoft.keepass.database.load.ImporterV3; +import com.kunzisoft.keepass.tests.TestUtil; +import com.kunzisoft.keepass.utils.UriUtil; import java.io.InputStream; import java.io.File; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3Twofish.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3Twofish.java similarity index 82% rename from app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3Twofish.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3Twofish.java index f0fb98fba..f04027487 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb3Twofish.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb3Twofish.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import java.io.InputStream; @@ -25,9 +25,9 @@ import android.content.Context; import android.content.res.AssetManager; import android.test.AndroidTestCase; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwEncryptionAlgorithm; -import com.keepassdroid.database.load.ImporterV3; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.database.load.ImporterV3; public class Kdb3Twofish extends AndroidTestCase { public void testReadTwofish() throws Exception { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4.java similarity index 88% rename from app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4.java index 580a816ac..e09591a1c 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -29,16 +29,16 @@ import android.content.Context; import android.content.res.AssetManager; import android.test.AndroidTestCase; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.exception.InvalidDBException; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.database.load.Importer; -import com.keepassdroid.database.load.ImporterFactory; -import com.keepassdroid.database.load.ImporterV4; -import com.keepassdroid.database.save.PwDbOutput; -import com.keepassdroid.database.save.PwDbV4Output; -import com.keepassdroid.stream.CopyInputStream; -import com.keepassdroid.tests.TestUtil; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.database.load.Importer; +import com.kunzisoft.keepass.database.load.ImporterFactory; +import com.kunzisoft.keepass.database.load.ImporterV4; +import com.kunzisoft.keepass.database.save.PwDbOutput; +import com.kunzisoft.keepass.database.save.PwDbV4Output; +import com.kunzisoft.keepass.stream.CopyInputStream; +import com.kunzisoft.keepass.tests.TestUtil; public class Kdb4 extends AndroidTestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4Header.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4Header.java similarity index 78% rename from app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4Header.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4Header.java index 9f52727f6..a29790227 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/Kdb4Header.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/Kdb4Header.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,18 +17,17 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; - -import java.io.InputStream; +package com.kunzisoft.keepass.tests.database; import android.content.Context; import android.content.res.AssetManager; import android.test.AndroidTestCase; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.crypto.engine.AesEngine; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.load.ImporterV4; +import com.kunzisoft.keepass.crypto.engine.AesEngine; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.load.ImporterV4; + +import java.io.InputStream; public class Kdb4Header extends AndroidTestCase { public void testReadHeader() throws Exception { @@ -41,7 +40,7 @@ public class Kdb4Header extends AndroidTestCase { PwDatabaseV4 db = importer.openDatabase(is, "12345", null); - assertEquals(6000, db.getNumKeyEncRounds()); + assertEquals(6000, db.getNumberKeyEncryptionRounds()); assertTrue(db.getDataCipher().equals(AesEngine.CIPHER_UUID)); diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/SprEngineTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/SprEngineTest.java similarity index 83% rename from app/src/androidTest/java/com/keepassdroid/tests/database/SprEngineTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/SprEngineTest.java index 280309acb..62a171608 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/SprEngineTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/SprEngineTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import java.io.InputStream; import java.util.UUID; @@ -27,12 +27,12 @@ import android.content.res.AssetManager; import android.test.AndroidTestCase; import biz.source_code.base64Coder.Base64Coder; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.load.ImporterV4; -import com.keepassdroid.utils.SprEngineV4; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.load.ImporterV4; +import com.kunzisoft.keepass.utils.SprEngineV4; +import com.kunzisoft.keepass.utils.Types; public class SprEngineTest extends AndroidTestCase { private PwDatabaseV4 db; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/database/TestData.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/TestData.java similarity index 86% rename from app/src/androidTest/java/com/keepassdroid/tests/database/TestData.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/database/TestData.java index 957e8549c..dcf7ce5d4 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/database/TestData.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/database/TestData.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.database; +package com.kunzisoft.keepass.tests.database; import java.io.InputStream; @@ -25,10 +25,10 @@ import android.content.Context; import android.content.res.AssetManager; import android.net.Uri; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabaseV3Debug; -import com.keepassdroid.database.load.Importer; -import com.keepassdroid.tests.TestUtil; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabaseV3Debug; +import com.kunzisoft.keepass.database.load.Importer; +import com.kunzisoft.keepass.tests.TestUtil; public class TestData { private static final String TEST1_KEYFILE = ""; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/output/PwManagerOutputTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/output/PwManagerOutputTest.java similarity index 88% rename from app/src/androidTest/java/com/keepassdroid/tests/output/PwManagerOutputTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/output/PwManagerOutputTest.java index 4f329c6ae..46b414d25 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/output/PwManagerOutputTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/output/PwManagerOutputTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.output; +package com.kunzisoft.keepass.tests.output; import static org.junit.Assert.assertArrayEquals; @@ -32,16 +32,16 @@ import java.security.NoSuchAlgorithmException; import android.content.res.AssetManager; import android.test.AndroidTestCase; -import com.keepassdroid.database.PwDatabaseV3Debug; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.database.save.PwDbHeaderOutputV3; -import com.keepassdroid.database.save.PwDbV3Output; -import com.keepassdroid.database.save.PwDbV3OutputDebug; -import com.keepassdroid.stream.NullOutputStream; -import com.keepassdroid.tests.TestUtil; -import com.keepassdroid.tests.database.TestData; +import com.kunzisoft.keepass.database.PwDatabaseV3Debug; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.database.save.PwDbHeaderOutputV3; +import com.kunzisoft.keepass.database.save.PwDbV3Output; +import com.kunzisoft.keepass.database.save.PwDbV3OutputDebug; +import com.kunzisoft.keepass.stream.NullOutputStream; +import com.kunzisoft.keepass.tests.TestUtil; +import com.kunzisoft.keepass.tests.database.TestData; public class PwManagerOutputTest extends AndroidTestCase { PwDatabaseV3Debug mPM; diff --git a/app/src/androidTest/java/com/keepassdroid/tests/search/SearchTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/search/SearchTest.java similarity index 88% rename from app/src/androidTest/java/com/keepassdroid/tests/search/SearchTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/search/SearchTest.java index 5b507f87f..949ba6ca2 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/search/SearchTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/search/SearchTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.search; +package com.kunzisoft.keepass.tests.search; import android.content.Context; @@ -25,9 +25,9 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.test.AndroidTestCase; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.tests.database.TestData; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.tests.database.TestData; public class SearchTest extends AndroidTestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/stream/HashedBlock.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.java similarity index 92% rename from app/src/androidTest/java/com/keepassdroid/tests/stream/HashedBlock.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.java index 128c602a9..6b6bc7f01 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/stream/HashedBlock.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/stream/HashedBlock.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or +* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.stream; +package com.kunzisoft.keepass.tests.stream; import static org.junit.Assert.assertArrayEquals; @@ -30,8 +30,8 @@ import java.util.zip.GZIPOutputStream; import junit.framework.TestCase; -import com.keepassdroid.stream.HashedBlockInputStream; -import com.keepassdroid.stream.HashedBlockOutputStream; +import com.kunzisoft.keepass.stream.HashedBlockInputStream; +import com.kunzisoft.keepass.stream.HashedBlockOutputStream; public class HashedBlock extends TestCase { diff --git a/app/src/androidTest/java/com/keepassdroid/tests/utils/StrUtilTest.java b/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StrUtilTest.java similarity index 92% rename from app/src/androidTest/java/com/keepassdroid/tests/utils/StrUtilTest.java rename to app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StrUtilTest.java index fa867cfae..c6b22ad5f 100644 --- a/app/src/androidTest/java/com/keepassdroid/tests/utils/StrUtilTest.java +++ b/app/src/androidTest/java/com/kunzisoft/keepass/tests/utils/StrUtilTest.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tests.utils; +package com.kunzisoft.keepass.tests.utils; import java.util.Locale; -import com.keepassdroid.utils.StrUtil; +import com.kunzisoft.keepass.utils.StrUtil; import junit.framework.TestCase; diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 9ce08e3d3..16651f600 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -16,10 +16,10 @@ android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" - android:name="com.keepassdroid.app.App" + android:name="com.kunzisoft.keepass.app.App" android:allowBackup="true" android:fullBackupContent="@xml/backup" - android:backupAgent="com.keepassdroid.backup.SettingsBackupAgent" + android:backupAgent="com.kunzisoft.keepass.backup.SettingsBackupAgent" android:theme="@style/KeepassDXStyle.Light" tools:replace="android:theme"> @@ -38,7 +38,7 @@ android:resource="@xml/nnf_provider_paths" /> @@ -54,16 +54,16 @@ @@ -103,24 +103,24 @@ @@ -130,18 +130,18 @@ android:name="android.app.searchable" android:resource="@xml/searchable" /> - - + - + - + -* This class is used to encode and decode data in Base64 format as described in RFC 1521. -* -*

-* Project home page: www.source-code.biz/base64coder/java
-* Author: Christian d'Heureuse, Inventec Informatik AG, Zurich, Switzerland
-* Multi-licensed: EPL / LGPL / AL / BSD. -*/ -public class Base64Coder { - -// The line separator string of the operating system. -private static final String systemLineSeparator = System.getProperty("line.separator"); - -// Mapping table from 6-bit nibbles to Base64 characters. -private static char[] map1 = new char[64]; - static { - int i=0; - for (char c='A'; c<='Z'; c++) map1[i++] = c; - for (char c='a'; c<='z'; c++) map1[i++] = c; - for (char c='0'; c<='9'; c++) map1[i++] = c; - map1[i++] = '+'; map1[i++] = '/'; } - -// Mapping table from Base64 characters to 6-bit nibbles. -private static byte[] map2 = new byte[128]; - static { - for (int i=0; isun.misc.BASE64Encoder.encodeBuffer(byte[]). -* @param in An array containing the data bytes to be encoded. -* @return A String containing the Base64 encoded data, broken into lines. -*/ -public static String encodeLines (byte[] in) { - return encodeLines(in, 0, in.length, 76, systemLineSeparator); } - -/** -* Encodes a byte array into Base 64 format and breaks the output into lines. -* @param in An array containing the data bytes to be encoded. -* @param iOff Offset of the first byte in in to be processed. -* @param iLen Number of bytes to be processed in in, starting at iOff. -* @param lineLen Line length for the output data. Should be a multiple of 4. -* @param lineSeparator The line separator to be used to separate the output lines. -* @return A String containing the Base64 encoded data, broken into lines. -*/ -public static String encodeLines (byte[] in, int iOff, int iLen, int lineLen, String lineSeparator) { - int blockLen = (lineLen*3) / 4; - if (blockLen <= 0) throw new IllegalArgumentException(); - int lines = (iLen+blockLen-1) / blockLen; - int bufLen = ((iLen+2)/3)*4 + lines*lineSeparator.length(); - StringBuilder buf = new StringBuilder(bufLen); - int ip = 0; - while (ip < iLen) { - int l = Math.min(iLen-ip, blockLen); - buf.append (encode(in, iOff+ip, l)); - buf.append (lineSeparator); - ip += l; } - return buf.toString(); } - -/** -* Encodes a byte array into Base64 format. -* No blanks or line breaks are inserted in the output. -* @param in An array containing the data bytes to be encoded. -* @return A character array containing the Base64 encoded data. -*/ -public static char[] encode (byte[] in) { - return encode(in, 0, in.length); } - -/** -* Encodes a byte array into Base64 format. -* No blanks or line breaks are inserted in the output. -* @param in An array containing the data bytes to be encoded. -* @param iLen Number of bytes to process in in. -* @return A character array containing the Base64 encoded data. -*/ -public static char[] encode (byte[] in, int iLen) { - return encode(in, 0, iLen); } - -/** -* Encodes a byte array into Base64 format. -* No blanks or line breaks are inserted in the output. -* @param in An array containing the data bytes to be encoded. -* @param iOff Offset of the first byte in in to be processed. -* @param iLen Number of bytes to process in in, starting at iOff. -* @return A character array containing the Base64 encoded data. -*/ -public static char[] encode (byte[] in, int iOff, int iLen) { - int oDataLen = (iLen*4+2)/3; // output length without padding - int oLen = ((iLen+2)/3)*4; // output length including padding - char[] out = new char[oLen]; - int ip = iOff; - int iEnd = iOff + iLen; - int op = 0; - while (ip < iEnd) { - int i0 = in[ip++] & 0xff; - int i1 = ip < iEnd ? in[ip++] & 0xff : 0; - int i2 = ip < iEnd ? in[ip++] & 0xff : 0; - int o0 = i0 >>> 2; - int o1 = ((i0 & 3) << 4) | (i1 >>> 4); - int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6); - int o3 = i2 & 0x3F; - out[op++] = map1[o0]; - out[op++] = map1[o1]; - out[op] = op < oDataLen ? map1[o2] : '='; op++; - out[op] = op < oDataLen ? map1[o3] : '='; op++; } - return out; } - -/** -* Decodes a string from Base64 format. -* No blanks or line breaks are allowed within the Base64 encoded input data. -* @param s A Base64 String to be decoded. -* @return A String containing the decoded data. -* @throws IllegalArgumentException If the input is not valid Base64 encoded data. -*/ -public static String decodeString (String s) { - return new String(decode(s)); } - -/** -* Decodes a byte array from Base64 format and ignores line separators, tabs and blanks. -* CR, LF, Tab and Space characters are ignored in the input data. -* This method is compatible with sun.misc.BASE64Decoder.decodeBuffer(String). -* @param s A Base64 String to be decoded. -* @return An array containing the decoded data bytes. -* @throws IllegalArgumentException If the input is not valid Base64 encoded data. -*/ -public static byte[] decodeLines (String s) { - char[] buf = new char[s.length()]; - int p = 0; - for (int ip = 0; ip < s.length(); ip++) { - char c = s.charAt(ip); - if (c != ' ' && c != '\r' && c != '\n' && c != '\t') - buf[p++] = c; } - return decode(buf, 0, p); } - -/** -* Decodes a byte array from Base64 format. -* No blanks or line breaks are allowed within the Base64 encoded input data. -* @param s A Base64 String to be decoded. -* @return An array containing the decoded data bytes. -* @throws IllegalArgumentException If the input is not valid Base64 encoded data. -*/ -public static byte[] decode (String s) { - return decode(s.toCharArray()); } - -/** -* Decodes a byte array from Base64 format. -* No blanks or line breaks are allowed within the Base64 encoded input data. -* @param in A character array containing the Base64 encoded data. -* @return An array containing the decoded data bytes. -* @throws IllegalArgumentException If the input is not valid Base64 encoded data. -*/ -public static byte[] decode (char[] in) { - return decode(in, 0, in.length); } - -/** -* Decodes a byte array from Base64 format. -* No blanks or line breaks are allowed within the Base64 encoded input data. -* @param in A character array containing the Base64 encoded data. -* @param iOff Offset of the first character in in to be processed. -* @param iLen Number of characters to process in in, starting at iOff. -* @return An array containing the decoded data bytes. -* @throws IllegalArgumentException If the input is not valid Base64 encoded data. -*/ -public static byte[] decode (char[] in, int iOff, int iLen) { - if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4."); - while (iLen > 0 && in[iOff+iLen-1] == '=') iLen--; - int oLen = (iLen*3) / 4; - byte[] out = new byte[oLen]; - int ip = iOff; - int iEnd = iOff + iLen; - int op = 0; - while (ip < iEnd) { - int i0 = in[ip++]; - int i1 = in[ip++]; - int i2 = ip < iEnd ? in[ip++] : 'A'; - int i3 = ip < iEnd ? in[ip++] : 'A'; - if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) - throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); - int b0 = map2[i0]; - int b1 = map2[i1]; - int b2 = map2[i2]; - int b3 = map2[i3]; - if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) - throw new IllegalArgumentException ("Illegal character in Base64 encoded data."); - int o0 = ( b0 <<2) | (b1>>>4); - int o1 = ((b1 & 0xf)<<4) | (b2>>>2); - int o2 = ((b2 & 3)<<6) | b3; - out[op++] = (byte)o0; - if (op. - * - */ - -package com.keepassdroid.database; - -import java.util.Comparator; - -public enum SortNodeEnum { - DB, TITLE, USERNAME, CREATION_TIME, LAST_MODIFY_TIME, LAST_ACCESS_TIME; - - public Comparator getNodeComparator(boolean ascending, boolean groupsBefore) { - switch (this) { - case DB: - return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort - default: - case TITLE: - return new NodeTitleComparator(ascending, groupsBefore); - case USERNAME: - return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort - case CREATION_TIME: - return new NodeCreationComparator(ascending, groupsBefore); - case LAST_MODIFY_TIME: - return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort - case LAST_ACCESS_TIME: - return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort - } - } - - private static abstract class NodeComparator implements Comparator { - boolean ascending; - boolean groupsBefore; - - NodeComparator(boolean ascending, boolean groupsBefore) { - this.ascending = ascending; - this.groupsBefore = groupsBefore; - } - } - - /** - * Comparator of Node by Title, Groups first, Entries second - */ - public static class NodeTitleComparator extends NodeComparator { - - public NodeTitleComparator(boolean ascending, boolean groupsBefore) { - super(ascending, groupsBefore); - } - - public int compare(PwNode object1, PwNode object2) { - if (object1.equals(object2)) - return 0; - - if (object1 instanceof PwGroup) { - if (object2 instanceof PwGroup) { - return new GroupNameComparator(ascending) - .compare((PwGroup) object1, (PwGroup) object2); - } else if (object2 instanceof PwEntry) { - if(groupsBefore) - return -1; - else - return 1; - } else { - return -1; - } - } else if (object1 instanceof PwEntry) { - if(object2 instanceof PwEntry) { - return new EntryNameComparator(ascending) - .compare((PwEntry) object1, (PwEntry) object2); - } else if (object2 instanceof PwGroup) { - if(groupsBefore) - return 1; - else - return -1; - } else { - return -1; - } - } - int nodeNameComp = object1.getDisplayTitle() - .compareToIgnoreCase(object2.getDisplayTitle()); - // If same name, can be different - if (nodeNameComp == 0) - return object1.hashCode() - object2.hashCode(); - return nodeNameComp; - } - } - - /** - * Comparator of node by creation, Groups first, Entries second - */ - public static class NodeCreationComparator extends NodeComparator { - - - public NodeCreationComparator(boolean ascending, boolean groupsBefore) { - super(ascending, groupsBefore); - } - - @Override - public int compare(PwNode object1, PwNode object2) { - if (object1.equals(object2)) - return 0; - - if (object1 instanceof PwGroup) { - if (object2 instanceof PwGroup) { - return new GroupCreationComparator(ascending) - .compare((PwGroup) object1, (PwGroup) object2); - } else if (object2 instanceof PwEntry) { - if(groupsBefore) - return -1; - else - return 1; - } else { - return -1; - } - } else if (object1 instanceof PwEntry) { - if(object2 instanceof PwEntry) { - return new EntryCreationComparator(ascending) - .compare((PwEntry) object1, (PwEntry) object2); - } else if (object2 instanceof PwGroup) { - if(groupsBefore) - return 1; - else - return -1; - } else { - return -1; - } - } - int nodeCreationComp = object1.getCreationTime().getDate() - .compareTo(object2.getCreationTime().getDate()); - // If same creation, can be different - if (nodeCreationComp == 0) { - return object1.hashCode() - object2.hashCode(); - } - return nodeCreationComp; - } - } - - /** - * Group comparator by name - */ - public static class GroupNameComparator implements Comparator { - - private boolean ascending; - - public GroupNameComparator(boolean ascending) { - this.ascending = ascending; - } - - public int compare(PwGroup object1, PwGroup object2) { - if (object1.equals(object2)) - return 0; - - int groupNameComp = object1.getName().compareToIgnoreCase(object2.getName()); - // If same name, can be different - if (groupNameComp == 0) { - return object1.hashCode() - object2.hashCode(); - } - // If descending - if (!ascending) - groupNameComp = -groupNameComp; - - return groupNameComp; - } - } - - /** - * Group comparator by name - */ - public static class GroupCreationComparator implements Comparator { - - private boolean ascending; - - public GroupCreationComparator(boolean ascending) { - this.ascending = ascending; - } - - public int compare(PwGroup object1, PwGroup object2) { - if (object1.equals(object2)) - return 0; - - int groupCreationComp = object1.getCreationTime().getDate() - .compareTo(object2.getCreationTime().getDate()); - // If same creation, can be different - if (groupCreationComp == 0) { - return object1.hashCode() - object2.hashCode(); - } - // If descending - if (!ascending) - groupCreationComp = -groupCreationComp; - - return groupCreationComp; - } - } - - /** - * Comparator of Entry by Name - */ - public static class EntryNameComparator implements Comparator { - - private boolean ascending; - - public EntryNameComparator(boolean ascending) { - this.ascending = ascending; - } - - public int compare(PwEntry object1, PwEntry object2) { - if (object1.equals(object2)) - return 0; - - int entryTitleComp = object1.getTitle().compareToIgnoreCase(object2.getTitle()); - // If same title, can be different - if (entryTitleComp == 0) { - return object1.hashCode() - object2.hashCode(); - } - // If descending - if (!ascending) - entryTitleComp = -entryTitleComp; - - return entryTitleComp; - } - } - - /** - * Comparator of Entry by Creation - */ - public static class EntryCreationComparator implements Comparator { - - private boolean ascending; - - public EntryCreationComparator(boolean ascending) { - this.ascending = ascending; - } - - public int compare(PwEntry object1, PwEntry object2) { - if (object1.equals(object2)) - return 0; - - int entryCreationComp = object1.getCreationTime().getDate() - .compareTo(object2.getCreationTime().getDate()); - // If same creation, can be different - if (entryCreationComp == 0) { - return object1.hashCode() - object2.hashCode(); - } - // If descending - if (!ascending) - entryCreationComp = -entryCreationComp; - - return entryCreationComp; - } - } -} diff --git a/app/src/main/java/com/keepassdroid/database/edit/AfterAddNodeOnFinish.java b/app/src/main/java/com/keepassdroid/database/edit/AfterAddNodeOnFinish.java deleted file mode 100644 index 091822da5..000000000 --- a/app/src/main/java/com/keepassdroid/database/edit/AfterAddNodeOnFinish.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.keepassdroid.database.edit; - -import android.os.Handler; - -import com.keepassdroid.database.PwNode; - -public abstract class AfterAddNodeOnFinish extends OnFinish { - public AfterAddNodeOnFinish(Handler handler) { - super(handler); - } - - public abstract void run(PwNode pwNode); -} diff --git a/app/src/main/java/com/keepassdroid/password/UriIntentInitTaskCallback.java b/app/src/main/java/com/keepassdroid/password/UriIntentInitTaskCallback.java deleted file mode 100644 index 52eeef9ea..000000000 --- a/app/src/main/java/com/keepassdroid/password/UriIntentInitTaskCallback.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.keepassdroid.password; - -import android.net.Uri; - -interface UriIntentInitTaskCallback { - void onPostInitTask(Uri dbUri, Uri keyFileUri, Integer errorStringId); -} diff --git a/app/src/main/java/com/keepassdroid/settings/RoundsPreferenceDialogFragmentCompat.java b/app/src/main/java/com/keepassdroid/settings/RoundsPreferenceDialogFragmentCompat.java deleted file mode 100644 index 896fa6bf0..000000000 --- a/app/src/main/java/com/keepassdroid/settings/RoundsPreferenceDialogFragmentCompat.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.keepassdroid.settings; - -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.support.v7.preference.DialogPreference; -import android.support.v7.preference.PreferenceDialogFragmentCompat; -import android.view.View; -import android.widget.TextView; -import android.widget.Toast; - -import com.keepassdroid.database.Database; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.app.App; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.database.edit.SaveDB; -import com.kunzisoft.keepass.R; - -public class RoundsPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat { - - private PwDatabase mPM; - private TextView mRoundsView; - - public static RoundsPreferenceDialogFragmentCompat newInstance( - String key) { - final RoundsPreferenceDialogFragmentCompat - fragment = new RoundsPreferenceDialogFragmentCompat(); - final Bundle b = new Bundle(1); - b.putString(ARG_KEY, key); - fragment.setArguments(b); - - return fragment; - } - - @Override - public void onDialogClosed(boolean positiveResult) { - if ( positiveResult ) { - long rounds; - - try { - String strRounds = mRoundsView.getText().toString(); - rounds = Long.parseLong(strRounds); - } catch (NumberFormatException e) { - Toast.makeText(getContext(), R.string.error_rounds_not_number, Toast.LENGTH_LONG).show(); - return; - } - - if ( rounds < 1 ) { - rounds = 1; - } - - long oldRounds = mPM.getNumRounds(); - try { - mPM.setNumRounds(rounds); - } catch (NumberFormatException e) { - Toast.makeText(getContext(), R.string.error_rounds_too_large, Toast.LENGTH_LONG).show(); - mPM.setNumRounds(Integer.MAX_VALUE); - } - - Handler handler = new Handler(); - SaveDB save = new SaveDB(getContext(), App.getDB(), new AfterSave(getContext(), handler, oldRounds)); - ProgressTask pt = new ProgressTask(getContext(), save, R.string.saving_database); - pt.run(); - - } - } - - @Override - protected void onBindDialogView(View view) { - super.onBindDialogView(view); - - mRoundsView = view.findViewById(R.id.rounds); - - // Get the time from the related Preference - Database db = App.getDB(); - mPM = db.getPwDatabase(); - long numRounds = mPM.getNumRounds(); - - DialogPreference preference = getPreference(); - if (preference instanceof RoundsPreference) { - numRounds = ((RoundsPreference) preference).getRounds(); - } - - mRoundsView.setText(String.valueOf(numRounds)); - } - - private class AfterSave extends OnFinish { - private long mOldRounds; - private Context mCtx; - - public AfterSave(Context ctx, Handler handler, long oldRounds) { - super(handler); - - mCtx = ctx; - mOldRounds = oldRounds; - } - - @Override - public void run() { - if (!mSuccess) { - displayMessage(mCtx); - mPM.setNumRounds(mOldRounds); - } - - super.run(); - } - } -} diff --git a/app/src/main/java/com/keepassdroid/stylish/StylishActivity.java b/app/src/main/java/com/keepassdroid/stylish/StylishActivity.java deleted file mode 100644 index 670932870..000000000 --- a/app/src/main/java/com/keepassdroid/stylish/StylishActivity.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.keepassdroid.stylish; - -import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.annotation.StyleRes; -import android.support.v7.app.AppCompatActivity; -import android.util.Log; - -public abstract class StylishActivity extends AppCompatActivity { - - private @StyleRes int themeId; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - this.themeId = Stylish.getThemeId(this); - setTheme(themeId); - } - - @Override - protected void onResume() { - super.onResume(); - if(Stylish.getThemeId(this) != this.themeId) { - Log.d(this.getClass().getName(), "Theme change detected, restarting activity"); - this.recreate(); - } - } -} diff --git a/app/src/main/java/com/kunzisoft/keepass/KeePass.java b/app/src/main/java/com/kunzisoft/keepass/KeePass.java index dfd781457..ffa0de07e 100644 --- a/app/src/main/java/com/kunzisoft/keepass/KeePass.java +++ b/app/src/main/java/com/kunzisoft/keepass/KeePass.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -25,7 +25,7 @@ import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; -import com.keepassdroid.fileselect.FileSelectActivity; +import com.kunzisoft.keepass.fileselect.FileSelectActivity; public class KeePass extends Activity { diff --git a/app/src/main/java/com/keepassdroid/activities/AboutActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/AboutActivity.java similarity index 96% rename from app/src/main/java/com/keepassdroid/activities/AboutActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/AboutActivity.java index 86e44ad7a..d0a459c66 100644 --- a/app/src/main/java/com/keepassdroid/activities/AboutActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/AboutActivity.java @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; @@ -27,8 +27,8 @@ import android.util.Log; import android.view.MenuItem; import android.widget.TextView; -import com.keepassdroid.stylish.StylishActivity; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.stylish.StylishActivity; import org.joda.time.DateTime; diff --git a/app/src/main/java/com/keepassdroid/activities/EntryActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.java similarity index 90% rename from app/src/main/java/com/keepassdroid/activities/EntryActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.java index 9025074fc..de17b6600 100644 --- a/app/src/main/java/com/keepassdroid/activities/EntryActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryActivity.java @@ -6,7 +6,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -18,7 +18,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.app.Activity; import android.content.ActivityNotFoundException; @@ -39,28 +39,28 @@ import android.widget.Toast; import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.ExtraFields; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.notifications.NotificationCopyingService; -import com.keepassdroid.notifications.NotificationField; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.timeout.ClipboardHelper; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.MenuUtil; -import com.keepassdroid.utils.Types; -import com.keepassdroid.utils.Util; -import com.keepassdroid.view.EntryContentsView; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.ExtraFields; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.notifications.NotificationCopyingService; +import com.kunzisoft.keepass.notifications.NotificationField; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.timeout.ClipboardHelper; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.MenuUtil; +import com.kunzisoft.keepass.utils.Types; +import com.kunzisoft.keepass.utils.Util; +import com.kunzisoft.keepass.view.EntryContentsView; import java.util.ArrayList; import java.util.Date; import java.util.UUID; -import static com.keepassdroid.settings.PreferencesUtil.isClipboardNotificationsEnable; +import static com.kunzisoft.keepass.settings.PreferencesUtil.isClipboardNotificationsEnable; public class EntryActivity extends LockingHideActivity { private final static String TAG = EntryActivity.class.getName(); @@ -132,13 +132,6 @@ public class EntryActivity extends LockingHideActivity { entryContentsView = findViewById(R.id.entry_contents); entryContentsView.applyFontVisibilityToFields(PreferencesUtil.fieldFontIsInVisibility(this)); - // Setup Edit Buttons - editView = findViewById(R.id.entry_edit); - editView.setOnClickListener(v -> EntryEditActivity.Launch(EntryActivity.this, mEntry)); - if (readOnly) { - editView.setVisibility(View.GONE); - } - // Init the clipboard helper clipboardHelper = new ClipboardHelper(this); firstLaunchOfActivity = true; @@ -231,11 +224,12 @@ public class EntryActivity extends LockingHideActivity { new TapTargetSequence(this) .target(copyTapTarget) - .targets(TapTarget.forView(editView, - getString(R.string.education_entry_edit_title), - getString(R.string.education_entry_edit_summary)) - .tintTarget(false) - ).listener(new TapTargetSequence.Listener() { + // TODO .targets(TapTarget.forView(editView, + // getString(R.string.education_entry_edit_title), + // getString(R.string.education_entry_edit_summary)) + // .tintTarget(false) + //) + .listener(new TapTargetSequence.Listener() { @Override public void onSequenceFinish() { saveEducationPreference(); @@ -349,6 +343,12 @@ public class EntryActivity extends LockingHideActivity { inflater.inflate(R.menu.entry, menu); inflater.inflate(R.menu.database_lock, menu); + if (readOnly) { + MenuItem edit = menu.findItem(R.id.menu_edit); + if (edit != null) + edit.setVisible(false); + } + MenuItem togglePassword = menu.findItem(R.id.menu_toggle_pass); if (entryContentsView != null && togglePassword != null) { if (entryContentsView.isPasswordPresent() || entryContentsView.atLeastOneFieldProtectedPresent()) { @@ -387,6 +387,10 @@ public class EntryActivity extends LockingHideActivity { changeShowPasswordIcon(item); entryContentsView.setHiddenPasswordStyle(!mShowPassword); return true; + + case R.id.menu_edit: + EntryEditActivity.launch(EntryActivity.this, mEntry); + return true; case R.id.menu_goto_url: String url; diff --git a/app/src/main/java/com/keepassdroid/activities/EntryEditActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.java similarity index 92% rename from app/src/main/java/com/keepassdroid/activities/EntryEditActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.java index a04826501..2a968c5c9 100644 --- a/app/src/main/java/com/keepassdroid/activities/EntryEditActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/EntryEditActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.app.Activity; import android.content.Intent; @@ -39,29 +39,29 @@ import android.widget.Toast; import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDate; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.PwGroupId; -import com.keepassdroid.database.PwIconStandard; -import com.keepassdroid.database.edit.AddEntry; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.database.edit.RunnableOnFinish; -import com.keepassdroid.database.edit.UpdateEntry; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.dialogs.GeneratePasswordDialogFragment; -import com.keepassdroid.dialogs.IconPickerDialogFragment; -import com.keepassdroid.icons.Icons; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.utils.MenuUtil; -import com.keepassdroid.utils.Types; -import com.keepassdroid.utils.Util; -import com.keepassdroid.view.EntryEditCustomField; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDate; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.PwGroupId; +import com.kunzisoft.keepass.database.PwIconStandard; +import com.kunzisoft.keepass.database.edit.AddEntry; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.database.edit.RunnableOnFinish; +import com.kunzisoft.keepass.database.edit.UpdateEntry; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.dialogs.GeneratePasswordDialogFragment; +import com.kunzisoft.keepass.dialogs.IconPickerDialogFragment; +import com.kunzisoft.keepass.icons.Icons; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.tasks.ProgressTask; +import com.kunzisoft.keepass.utils.MenuUtil; +import com.kunzisoft.keepass.utils.Types; +import com.kunzisoft.keepass.utils.Util; +import com.kunzisoft.keepass.view.EntryEditCustomField; import java.util.ArrayList; import java.util.List; @@ -106,7 +106,7 @@ public class EntryEditActivity extends LockingHideActivity * @param act from activity * @param pw Entry to update */ - public static void Launch(Activity act, PwEntry pw) { + public static void launch(Activity act, PwEntry pw) { if (LockingActivity.checkTimeIsAllowedOrFinish(act)) { Intent intent = new Intent(act, EntryEditActivity.class); intent.putExtra(KEY_ENTRY, Types.UUIDtoBytes(pw.getUUID())); @@ -119,7 +119,7 @@ public class EntryEditActivity extends LockingHideActivity * @param act from activity * @param pwGroup Group who will contains new entry */ - public static void Launch(Activity act, PwGroup pwGroup) { + public static void launch(Activity act, PwGroup pwGroup) { if (LockingActivity.checkTimeIsAllowedOrFinish(act)) { Intent intent = new Intent(act, EntryEditActivity.class); intent.putExtra(KEY_PARENT, pwGroup.getId()); diff --git a/app/src/main/java/com/keepassdroid/activities/GroupActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java similarity index 91% rename from app/src/main/java/com/keepassdroid/activities/GroupActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java index e53eddd94..522d05208 100644 --- a/app/src/main/java/com/keepassdroid/activities/GroupActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/GroupActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.app.Activity; import android.app.Dialog; @@ -43,27 +43,27 @@ import android.widget.ImageView; import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; -import com.keepassdroid.adapters.NodeAdapter; -import com.keepassdroid.app.App; -import com.keepassdroid.autofill.AutofillHelper; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.PwGroupId; -import com.keepassdroid.database.PwNode; -import com.keepassdroid.database.SortNodeEnum; -import com.keepassdroid.database.edit.AddGroup; -import com.keepassdroid.database.edit.DeleteEntry; -import com.keepassdroid.database.edit.DeleteGroup; -import com.keepassdroid.dialogs.AssignMasterKeyDialogFragment; -import com.keepassdroid.dialogs.GroupEditDialogFragment; -import com.keepassdroid.dialogs.IconPickerDialogFragment; -import com.keepassdroid.dialogs.ReadOnlyDialog; -import com.keepassdroid.search.SearchResultsActivity; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.view.AddNodeButtonView; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.adapters.NodeAdapter; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.autofill.AutofillHelper; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.PwGroupId; +import com.kunzisoft.keepass.database.PwNode; +import com.kunzisoft.keepass.database.SortNodeEnum; +import com.kunzisoft.keepass.database.edit.AddGroup; +import com.kunzisoft.keepass.database.edit.DeleteEntry; +import com.kunzisoft.keepass.database.edit.DeleteGroup; +import com.kunzisoft.keepass.dialogs.AssignMasterKeyDialogFragment; +import com.kunzisoft.keepass.dialogs.GroupEditDialogFragment; +import com.kunzisoft.keepass.dialogs.IconPickerDialogFragment; +import com.kunzisoft.keepass.dialogs.ReadOnlyDialog; +import com.kunzisoft.keepass.search.SearchResultsActivity; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.tasks.ProgressTask; +import com.kunzisoft.keepass.view.AddNodeButtonView; public class GroupActivity extends ListNodesActivity implements GroupEditDialogFragment.EditGroupListener, IconPickerDialogFragment.IconPickerListener { @@ -87,12 +87,12 @@ public class GroupActivity extends ListNodesActivity private static final String TAG = "Group Activity:"; public static void launch(Activity act) { - LockingActivity.recordFirstTimeBeforeLaunch(act); + recordFirstTimeBeforeLaunch(act); launch(act, (PwGroup) null); } public static void launch(Activity act, PwGroup group) { - if (LockingActivity.checkTimeIsAllowedOrFinish(act)) { + if (checkTimeIsAllowedOrFinish(act)) { Intent intent = new Intent(act, GroupActivity.class); if (group != null) { intent.putExtra(GROUP_ID_KEY, group.getId()); @@ -104,7 +104,7 @@ public class GroupActivity extends ListNodesActivity @RequiresApi(api = Build.VERSION_CODES.O) public static void launch(Activity act, AssistStructure assistStructure) { if ( assistStructure != null ) { - LockingActivity.recordFirstTimeBeforeLaunch(act); + recordFirstTimeBeforeLaunch(act); launch(act, null, assistStructure); } else { launch(act); @@ -114,7 +114,7 @@ public class GroupActivity extends ListNodesActivity @RequiresApi(api = Build.VERSION_CODES.O) public static void launch(Activity act, PwGroup group, AssistStructure assistStructure) { if ( assistStructure != null ) { - if (LockingActivity.checkTimeIsAllowedOrFinish(act)) { + if (checkTimeIsAllowedOrFinish(act)) { Intent intent = new Intent(act, GroupActivity.class); if (group != null) { intent.putExtra(GROUP_ID_KEY, group.getId()); @@ -161,7 +161,7 @@ public class GroupActivity extends ListNodesActivity GroupEditDialogFragment.TAG_CREATE_GROUP); }); addNodeButtonView.setAddEntryClickListener(v -> - EntryEditActivity.Launch(GroupActivity.this, mCurrentGroup)); + EntryEditActivity.launch(GroupActivity.this, mCurrentGroup)); setGroupTitle(); setGroupIcon(); @@ -235,7 +235,7 @@ public class GroupActivity extends ListNodesActivity GroupEditDialogFragment.TAG_CREATE_GROUP); break; case ENTRY: - EntryEditActivity.Launch(GroupActivity.this, (PwEntry) node); + EntryEditActivity.launch(GroupActivity.this, (PwEntry) node); break; } return true; diff --git a/app/src/main/java/com/keepassdroid/activities/ListNodesActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesActivity.java similarity index 90% rename from app/src/main/java/com/keepassdroid/activities/ListNodesActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/ListNodesActivity.java index c26373ba5..5bd6a9564 100644 --- a/app/src/main/java/com/keepassdroid/activities/ListNodesActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/ListNodesActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.annotation.SuppressLint; import android.app.assist.AssistStructure; @@ -38,29 +38,29 @@ import android.view.MenuItem; import android.view.View; import android.widget.TextView; -import com.keepassdroid.adapters.NodeAdapter; -import com.keepassdroid.app.App; -import com.keepassdroid.autofill.AutofillHelper; -import com.keepassdroid.compat.EditorCompat; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.PwNode; -import com.keepassdroid.database.edit.AfterAddNodeOnFinish; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.dialogs.AssignMasterKeyDialogFragment; -import com.keepassdroid.dialogs.SortDialogFragment; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.tasks.UIToastTask; -import com.keepassdroid.utils.MenuUtil; -import com.keepassdroid.database.SortNodeEnum; -import com.keepassdroid.password.AssignPasswordHelper; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.adapters.NodeAdapter; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.autofill.AutofillHelper; +import com.kunzisoft.keepass.compat.EditorCompat; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.PwNode; +import com.kunzisoft.keepass.database.SortNodeEnum; +import com.kunzisoft.keepass.database.edit.AfterAddNodeOnFinish; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.dialogs.AssignMasterKeyDialogFragment; +import com.kunzisoft.keepass.dialogs.SortDialogFragment; +import com.kunzisoft.keepass.password.AssignPasswordHelper; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.tasks.UIToastTask; +import com.kunzisoft.keepass.utils.MenuUtil; public abstract class ListNodesActivity extends LockingActivity implements AssignMasterKeyDialogFragment.AssignPasswordDialogListener, - NodeAdapter.OnNodeClickCallback, + NodeAdapter.OnNodeClickCallback, SortDialogFragment.SortSelectionListener { protected PwGroup mCurrentGroup; @@ -332,7 +332,8 @@ public abstract class ListNodesActivity extends LockingActivity PwGroup parent = pwNode.getParent(); Database db = App.getDB(); PwDatabase database = db.getPwDatabase(); - if (db.isRecycleBinAvailabledAndEnabled()) { + if (db.isRecycleBinAvailable() && + db.isRecycleBinEnabled()) { PwGroup recycleBin = database.getRecycleBin(); // Add trash if it doesn't exists if (parent.equals(recycleBin) diff --git a/app/src/main/java/com/keepassdroid/activities/LockingActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/LockingActivity.java similarity index 93% rename from app/src/main/java/com/keepassdroid/activities/LockingActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/LockingActivity.java index 2cb83fae7..ee7d91a22 100644 --- a/app/src/main/java/com/keepassdroid/activities/LockingActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/LockingActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.app.Activity; import android.content.BroadcastReceiver; @@ -28,10 +28,10 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.util.Log; -import com.keepassdroid.app.App; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.stylish.StylishActivity; -import com.keepassdroid.timeout.TimeoutHelper; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.stylish.StylishActivity; +import com.kunzisoft.keepass.timeout.TimeoutHelper; public abstract class LockingActivity extends StylishActivity { diff --git a/app/src/main/java/com/keepassdroid/activities/LockingHideActivity.java b/app/src/main/java/com/kunzisoft/keepass/activities/LockingHideActivity.java similarity index 92% rename from app/src/main/java/com/keepassdroid/activities/LockingHideActivity.java rename to app/src/main/java/com/kunzisoft/keepass/activities/LockingHideActivity.java index 494ed94ee..04fd70183 100644 --- a/app/src/main/java/com/keepassdroid/activities/LockingHideActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/activities/LockingHideActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.activities; +package com.kunzisoft.keepass.activities; import android.content.ActivityNotFoundException; import android.content.Intent; import android.os.Bundle; import android.view.WindowManager; -import com.keepassdroid.compat.BuildCompat; +import com.kunzisoft.keepass.compat.BuildCompat; /** * Locking Hide Activity that sets FLAG_SECURE to prevent screenshots, and from diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/BasicViewHolder.java b/app/src/main/java/com/kunzisoft/keepass/adapters/BasicViewHolder.java new file mode 100644 index 000000000..05b232661 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/BasicViewHolder.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.adapters; + +import android.support.v7.widget.RecyclerView; +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +abstract class BasicViewHolder extends RecyclerView.ViewHolder { + + View container; + ImageView icon; + TextView text; + + BasicViewHolder(View itemView) { + super(itemView); + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/EntryViewHolder.java b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryViewHolder.java new file mode 100644 index 000000000..79fbd23ed --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/EntryViewHolder.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.adapters; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.kunzisoft.keepass.R; + +class EntryViewHolder extends BasicViewHolder { + + EntryViewHolder(View itemView) { + super(itemView); + container = itemView.findViewById(R.id.entry_container); + icon = (ImageView) itemView.findViewById(R.id.entry_icon); + text = (TextView) itemView.findViewById(R.id.entry_text); + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/adapters/GroupViewHolder.java b/app/src/main/java/com/kunzisoft/keepass/adapters/GroupViewHolder.java new file mode 100644 index 000000000..8722835b6 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/GroupViewHolder.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.adapters; + +import android.view.View; +import android.widget.ImageView; +import android.widget.TextView; + +import com.kunzisoft.keepass.R; + +class GroupViewHolder extends BasicViewHolder { + + GroupViewHolder(View itemView) { + super(itemView); + container = itemView.findViewById(R.id.group_container); + icon = (ImageView) itemView.findViewById(R.id.group_icon); + text = (TextView) itemView.findViewById(R.id.group_text); + } +} diff --git a/app/src/main/java/com/keepassdroid/adapters/NodeAdapter.java b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.java similarity index 96% rename from app/src/main/java/com/keepassdroid/adapters/NodeAdapter.java rename to app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.java index 0dcb10f31..8d5a86e2c 100644 --- a/app/src/main/java/com/keepassdroid/adapters/NodeAdapter.java +++ b/app/src/main/java/com/kunzisoft/keepass/adapters/NodeAdapter.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -16,9 +16,8 @@ * You should have received a copy of the GNU General Public License * along with KeePass DX. If not, see . * - * */ -package com.keepassdroid.adapters; +package com.kunzisoft.keepass.adapters; import android.content.Context; import android.support.v7.util.SortedList; @@ -32,12 +31,12 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import com.keepassdroid.app.App; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.PwNode; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.database.SortNodeEnum; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.PwNode; +import com.kunzisoft.keepass.database.SortNodeEnum; +import com.kunzisoft.keepass.settings.PreferencesUtil; public class NodeAdapter extends RecyclerView.Adapter { diff --git a/app/src/main/java/com/keepassdroid/app/App.java b/app/src/main/java/com/kunzisoft/keepass/app/App.java similarity index 87% rename from app/src/main/java/com/keepassdroid/app/App.java rename to app/src/main/java/com/kunzisoft/keepass/app/App.java index f4a436495..5544f7ae4 100644 --- a/app/src/main/java/com/keepassdroid/app/App.java +++ b/app/src/main/java/com/kunzisoft/keepass/app/App.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.app; +package com.kunzisoft.keepass.app; import android.support.multidex.MultiDexApplication; -import com.keepassdroid.compat.PRNGFixes; -import com.keepassdroid.database.Database; -import com.keepassdroid.fileselect.RecentFileHistory; -import com.keepassdroid.stylish.Stylish; +import com.kunzisoft.keepass.compat.PRNGFixes; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.fileselect.RecentFileHistory; +import com.kunzisoft.keepass.stylish.Stylish; import java.util.Calendar; diff --git a/app/src/main/java/com/keepassdroid/autofill/AutoFillAuthActivity.java b/app/src/main/java/com/kunzisoft/keepass/autofill/AutoFillAuthActivity.java similarity index 93% rename from app/src/main/java/com/keepassdroid/autofill/AutoFillAuthActivity.java rename to app/src/main/java/com/kunzisoft/keepass/autofill/AutoFillAuthActivity.java index ab4255332..7f13e0a8a 100644 --- a/app/src/main/java/com/keepassdroid/autofill/AutoFillAuthActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutoFillAuthActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.autofill; +package com.kunzisoft.keepass.autofill; import android.app.PendingIntent; import android.app.assist.AssistStructure; @@ -29,8 +29,8 @@ import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; -import com.keepassdroid.fileselect.FileSelectActivity; import com.kunzisoft.keepass.KeePass; +import com.kunzisoft.keepass.fileselect.FileSelectActivity; @RequiresApi(api = Build.VERSION_CODES.O) public class AutoFillAuthActivity extends KeePass { diff --git a/app/src/main/java/com/keepassdroid/autofill/AutofillHelper.java b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.java similarity index 97% rename from app/src/main/java/com/keepassdroid/autofill/AutofillHelper.java rename to app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.java index 770f4e597..85b574afe 100644 --- a/app/src/main/java/com/keepassdroid/autofill/AutofillHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.autofill; +package com.kunzisoft.keepass.autofill; import android.app.Activity; import android.app.assist.AssistStructure; @@ -34,8 +34,8 @@ import android.view.autofill.AutofillManager; import android.view.autofill.AutofillValue; import android.widget.RemoteViews; -import com.keepassdroid.database.PwEntry; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.PwEntry; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/autofill/KeeAutofillService.java b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.java similarity index 96% rename from app/src/main/java/com/keepassdroid/autofill/KeeAutofillService.java rename to app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.java index 0c3183796..3929bec47 100644 --- a/app/src/main/java/com/keepassdroid/autofill/KeeAutofillService.java +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.autofill; +package com.kunzisoft.keepass.autofill; import android.app.assist.AssistStructure; import android.content.IntentSender; diff --git a/app/src/main/java/com/keepassdroid/autofill/StructureParser.java b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.java similarity index 97% rename from app/src/main/java/com/keepassdroid/autofill/StructureParser.java rename to app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.java index aa6beacae..e3af9fbcc 100644 --- a/app/src/main/java/com/keepassdroid/autofill/StructureParser.java +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.autofill; +package com.kunzisoft.keepass.autofill; import android.app.assist.AssistStructure; import android.os.Build; diff --git a/app/src/main/java/com/keepassdroid/backup/SettingsBackupAgent.java b/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.java similarity index 92% rename from app/src/main/java/com/keepassdroid/backup/SettingsBackupAgent.java rename to app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.java index a9146dd96..156936444 100644 --- a/app/src/main/java/com/keepassdroid/backup/SettingsBackupAgent.java +++ b/app/src/main/java/com/kunzisoft/keepass/backup/SettingsBackupAgent.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.backup; +package com.kunzisoft.keepass.backup; import android.annotation.SuppressLint; import android.app.backup.BackupAgentHelper; diff --git a/app/src/main/java/com/keepassdroid/collections/VariantDictionary.java b/app/src/main/java/com/kunzisoft/keepass/collections/VariantDictionary.java similarity index 96% rename from app/src/main/java/com/keepassdroid/collections/VariantDictionary.java rename to app/src/main/java/com/kunzisoft/keepass/collections/VariantDictionary.java index 5887cb00e..e3db44c36 100644 --- a/app/src/main/java/com/keepassdroid/collections/VariantDictionary.java +++ b/app/src/main/java/com/kunzisoft/keepass/collections/VariantDictionary.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.collections; +package com.kunzisoft.keepass.collections; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.stream.LEDataOutputStream; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -33,7 +32,7 @@ public class VariantDictionary { private static final int VdmCritical = 0xFF00; private static final int VdmInfo = 0x00FF; - private Map dict = new HashMap(); + private Map dict = new HashMap<>(); private class VdType { public static final byte None = 0x00; diff --git a/app/src/main/java/com/keepassdroid/compat/BackupManagerCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/BackupManagerCompat.java similarity index 94% rename from app/src/main/java/com/keepassdroid/compat/BackupManagerCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/BackupManagerCompat.java index 11a07ad46..00c1c8df3 100644 --- a/app/src/main/java/com/keepassdroid/compat/BackupManagerCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/BackupManagerCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; +package com.kunzisoft.keepass.compat; + +import android.content.Context; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import android.content.Context; - @SuppressWarnings({"unchecked", "rawtypes"}) public class BackupManagerCompat { diff --git a/app/src/main/java/com/keepassdroid/compat/BitmapDrawableCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/BitmapDrawableCompat.java similarity index 93% rename from app/src/main/java/com/keepassdroid/compat/BitmapDrawableCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/BitmapDrawableCompat.java index 2170fda3d..6bb757d55 100644 --- a/app/src/main/java/com/keepassdroid/compat/BitmapDrawableCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/BitmapDrawableCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; - -import java.lang.reflect.Constructor; +package com.kunzisoft.keepass.compat; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; +import java.lang.reflect.Constructor; + // This compatiblity hack can go away when support for Android 1.5 api level 3 is dropped public class BitmapDrawableCompat { private static Constructor constResBitmap; diff --git a/app/src/main/java/com/keepassdroid/compat/BuildCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/BuildCompat.java similarity index 95% rename from app/src/main/java/com/keepassdroid/compat/BuildCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/BuildCompat.java index f94d70d22..4e5f7d375 100644 --- a/app/src/main/java/com/keepassdroid/compat/BuildCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/BuildCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; - -import java.lang.reflect.Field; +package com.kunzisoft.keepass.compat; import android.os.Build; +import java.lang.reflect.Field; + public class BuildCompat { private static Field manufacturer; private static String manuText; diff --git a/app/src/main/java/com/keepassdroid/compat/ClipDataCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/ClipDataCompat.java similarity index 96% rename from app/src/main/java/com/keepassdroid/compat/ClipDataCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/ClipDataCompat.java index 7189e3226..3bd4321bc 100644 --- a/app/src/main/java/com/keepassdroid/compat/ClipDataCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/ClipDataCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; +package com.kunzisoft.keepass.compat; import android.content.Intent; import android.net.Uri; diff --git a/app/src/main/java/com/keepassdroid/compat/ContentResolverCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/ContentResolverCompat.java similarity index 94% rename from app/src/main/java/com/keepassdroid/compat/ContentResolverCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/ContentResolverCompat.java index 4b255f130..0d81b6700 100644 --- a/app/src/main/java/com/keepassdroid/compat/ContentResolverCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/ContentResolverCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; +package com.kunzisoft.keepass.compat; import android.content.ContentResolver; import android.net.Uri; diff --git a/app/src/main/java/com/keepassdroid/compat/EditorCompat.java b/app/src/main/java/com/kunzisoft/keepass/compat/EditorCompat.java similarity index 93% rename from app/src/main/java/com/keepassdroid/compat/EditorCompat.java rename to app/src/main/java/com/kunzisoft/keepass/compat/EditorCompat.java index 1e61cc438..7e77274c6 100644 --- a/app/src/main/java/com/keepassdroid/compat/EditorCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/EditorCompat.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; - -import java.lang.reflect.Method; +package com.kunzisoft.keepass.compat; import android.app.Activity; import android.content.SharedPreferences; +import java.lang.reflect.Method; + public class EditorCompat { private static Method apply; diff --git a/app/src/main/java/com/keepassdroid/compat/PRNGFixes.java b/app/src/main/java/com/kunzisoft/keepass/compat/PRNGFixes.java similarity index 99% rename from app/src/main/java/com/keepassdroid/compat/PRNGFixes.java rename to app/src/main/java/com/kunzisoft/keepass/compat/PRNGFixes.java index 281093ea1..bfbdc9ad6 100644 --- a/app/src/main/java/com/keepassdroid/compat/PRNGFixes.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/PRNGFixes.java @@ -1,4 +1,4 @@ -package com.keepassdroid.compat; +package com.kunzisoft.keepass.compat; /* * This software is provided 'as-is', without any express or implied @@ -10,6 +10,11 @@ package com.keepassdroid.compat; * freely, as long as the origin is not misrepresented. */ +import android.os.Build; +import android.os.Process; + +import com.kunzisoft.keepass.utils.StrUtil; + import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; @@ -28,11 +33,6 @@ import java.security.SecureRandomSpi; import java.security.Security; import java.util.Locale; -import com.keepassdroid.utils.StrUtil; - -import android.os.Process; -import android.os.Build; - /** * Fixes for the output of the default PRNG having low entropy. * diff --git a/app/src/main/java/com/keepassdroid/compat/StorageAF.java b/app/src/main/java/com/kunzisoft/keepass/compat/StorageAF.java similarity index 94% rename from app/src/main/java/com/keepassdroid/compat/StorageAF.java rename to app/src/main/java/com/kunzisoft/keepass/compat/StorageAF.java index a6f74c85a..2fb445f6c 100644 --- a/app/src/main/java/com/keepassdroid/compat/StorageAF.java +++ b/app/src/main/java/com/kunzisoft/keepass/compat/StorageAF.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.compat; +package com.kunzisoft.keepass.compat; import android.content.Context; import android.content.Intent; diff --git a/app/src/main/java/com/keepassdroid/crypto/AESProvider.java b/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.java similarity index 84% rename from app/src/main/java/com/keepassdroid/crypto/AESProvider.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.java index 83012c8bf..97b1af712 100644 --- a/app/src/main/java/com/keepassdroid/crypto/AESProvider.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/AESProvider.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; import java.security.Provider; @@ -30,7 +30,7 @@ public final class AESProvider extends Provider { public AESProvider() { super("AESProvider", 1.0, ""); - put("Cipher.AES",com.keepassdroid.crypto.NativeAESCipherSpi.class.getName()); + put("Cipher.AES",NativeAESCipherSpi.class.getName()); } } diff --git a/app/src/main/java/com/keepassdroid/crypto/CipherFactory.java b/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.java similarity index 87% rename from app/src/main/java/com/keepassdroid/crypto/CipherFactory.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.java index 594ff897b..40e82d867 100644 --- a/app/src/main/java/com/keepassdroid/crypto/CipherFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/CipherFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; + +import android.os.Build; + +import com.kunzisoft.keepass.crypto.engine.AesEngine; +import com.kunzisoft.keepass.crypto.engine.ChaCha20Engine; +import com.kunzisoft.keepass.crypto.engine.CipherEngine; +import com.kunzisoft.keepass.crypto.engine.TwofishEngine; + +import org.spongycastle.jce.provider.BouncyCastleProvider; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -27,18 +36,6 @@ import java.util.UUID; import javax.crypto.Cipher; import javax.crypto.NoSuchPaddingException; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -import android.os.Build; - -import com.keepassdroid.crypto.engine.AesEngine; -import com.keepassdroid.crypto.engine.ChaCha20Engine; -import com.keepassdroid.crypto.engine.CipherEngine; -import com.keepassdroid.crypto.engine.TwofishEngine; -import com.keepassdroid.utils.Types; - -import org.spongycastle.jce.provider.BouncyCastleProvider; public class CipherFactory { private static boolean blacklistInit = false; diff --git a/app/src/main/java/com/keepassdroid/crypto/CryptoUtil.java b/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.java similarity index 93% rename from app/src/main/java/com/keepassdroid/crypto/CryptoUtil.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.java index b7c4e687d..d28bbb9d9 100644 --- a/app/src/main/java/com/keepassdroid/crypto/CryptoUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/CryptoUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.stream.NullOutputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.stream.NullOutputStream; import java.io.IOException; import java.security.DigestOutputStream; diff --git a/app/src/main/java/com/keepassdroid/crypto/NativeAESCipherSpi.java b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java similarity index 96% rename from app/src/main/java/com/keepassdroid/crypto/NativeAESCipherSpi.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java index 3f4b392ec..14d12bae1 100644 --- a/app/src/main/java/com/keepassdroid/crypto/NativeAESCipherSpi.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeAESCipherSpi.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; + +import android.util.Log; import java.lang.ref.PhantomReference; import java.lang.ref.Reference; @@ -40,10 +42,10 @@ import javax.crypto.NoSuchPaddingException; import javax.crypto.ShortBufferException; import javax.crypto.spec.IvParameterSpec; -import android.util.Log; - public class NativeAESCipherSpi extends CipherSpi { - + + private static final String TAG = NativeAESCipherSpi.class.getName(); + private static boolean mIsStaticInit = false; private static HashMap, Long> mCleanup = new HashMap, Long>(); private static ReferenceQueue mQueue = new ReferenceQueue(); @@ -65,7 +67,7 @@ public class NativeAESCipherSpi extends CipherSpi { } private static void addToCleanupQueue(NativeAESCipherSpi ref, long ptr) { - Log.d("KeepassDroid", "queued cipher context: " + ptr); + Log.d(TAG, "queued cipher context: " + ptr); mCleanup.put(new PhantomReference(ref, mQueue), ptr); } @@ -83,7 +85,7 @@ public class NativeAESCipherSpi extends CipherSpi { long ctx = mCleanup.remove(ref); nCleanup(ctx); - Log.d("KeePassDroid", "Cleaned up cipher context: " + ctx); + Log.d(TAG, "Cleaned up cipher context: " + ctx); } catch (InterruptedException e) { // Do nothing, but resume looping if mQueue.remove is interrupted diff --git a/app/src/main/java/com/keepassdroid/crypto/NativeLib.java b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.java similarity index 91% rename from app/src/main/java/com/keepassdroid/crypto/NativeLib.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.java index bd4e2262b..3f1b3f5ea 100644 --- a/app/src/main/java/com/keepassdroid/crypto/NativeLib.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/NativeLib.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; public class NativeLib { private static boolean isLoaded = false; diff --git a/app/src/main/java/com/keepassdroid/crypto/PwStreamCipherFactory.java b/app/src/main/java/com/kunzisoft/keepass/crypto/PwStreamCipherFactory.java similarity index 93% rename from app/src/main/java/com/keepassdroid/crypto/PwStreamCipherFactory.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/PwStreamCipherFactory.java index e553803f7..98d369858 100644 --- a/app/src/main/java/com/keepassdroid/crypto/PwStreamCipherFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/PwStreamCipherFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto; +package com.kunzisoft.keepass.crypto; + +import com.kunzisoft.keepass.database.CrsAlgorithm; import org.spongycastle.crypto.StreamCipher; import org.spongycastle.crypto.engines.ChaCha7539Engine; @@ -25,8 +27,6 @@ import org.spongycastle.crypto.engines.Salsa20Engine; import org.spongycastle.crypto.params.KeyParameter; import org.spongycastle.crypto.params.ParametersWithIV; -import com.keepassdroid.database.CrsAlgorithm; - public class PwStreamCipherFactory { public static StreamCipher getInstance(CrsAlgorithm alg, byte[] key) { if ( alg == CrsAlgorithm.Salsa20 ) { diff --git a/app/src/main/java/com/keepassdroid/crypto/engine/AesEngine.java b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.java similarity index 81% rename from app/src/main/java/com/keepassdroid/crypto/engine/AesEngine.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.java index 9650dc7cc..cccbf51cf 100644 --- a/app/src/main/java/com/keepassdroid/crypto/engine/AesEngine.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/AesEngine.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.engine; +package com.kunzisoft.keepass.crypto.engine; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.utils.Types; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -34,6 +35,7 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class AesEngine extends CipherEngine { + public static final UUID CIPHER_UUID = Types.bytestoUUID( new byte[]{(byte) 0x31, (byte) 0xC1, (byte) 0xF2, (byte) 0xE6, (byte) 0xBF, (byte) 0x71, (byte) 0x43, (byte) 0x50, (byte) 0xBE, (byte) 0x58, (byte) 0x05, (byte) 0x21, (byte) 0x6A, (byte) 0xFC, (byte)0x5A, (byte) 0xFF @@ -47,4 +49,9 @@ public class AesEngine extends CipherEngine { return cipher; } + + @Override + public PwEncryptionAlgorithm getPwEncryptionAlgorithm() { + return PwEncryptionAlgorithm.AES_Rijndael; + } } diff --git a/app/src/main/java/com/keepassdroid/crypto/engine/ChaCha20Engine.java b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.java similarity index 84% rename from app/src/main/java/com/keepassdroid/crypto/engine/ChaCha20Engine.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.java index d661f87a5..27d6ae852 100644 --- a/app/src/main/java/com/keepassdroid/crypto/engine/ChaCha20Engine.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/ChaCha20Engine.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.engine; +package com.kunzisoft.keepass.crypto.engine; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.utils.Types; import org.spongycastle.jce.provider.BouncyCastleProvider; @@ -34,6 +35,7 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class ChaCha20Engine extends CipherEngine { + public static final UUID CIPHER_UUID = Types.bytestoUUID( new byte[]{(byte)0xD6, (byte)0x03, (byte)0x8A, (byte)0x2B, (byte)0x8B, (byte)0x6F, (byte)0x4C, (byte)0xB5, (byte)0xA5, (byte)0x24, (byte)0x33, (byte)0x9A, (byte)0x31, @@ -50,4 +52,9 @@ public class ChaCha20Engine extends CipherEngine { cipher.init(opmode, new SecretKeySpec(key, "ChaCha7539"), new IvParameterSpec(IV)); return cipher; } + + @Override + public PwEncryptionAlgorithm getPwEncryptionAlgorithm() { + return PwEncryptionAlgorithm.ChaCha20; + } } diff --git a/app/src/main/java/com/keepassdroid/crypto/engine/CipherEngine.java b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.java similarity index 86% rename from app/src/main/java/com/keepassdroid/crypto/engine/CipherEngine.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.java index 350c4eeec..713e2e81d 100644 --- a/app/src/main/java/com/keepassdroid/crypto/engine/CipherEngine.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/CipherEngine.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.engine; +package com.kunzisoft.keepass.crypto.engine; + +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -41,4 +43,6 @@ public abstract class CipherEngine { return getCipher(opmode, key, IV, false); } + public abstract PwEncryptionAlgorithm getPwEncryptionAlgorithm(); + } diff --git a/app/src/main/java/com/keepassdroid/crypto/engine/TwofishEngine.java b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.java similarity index 83% rename from app/src/main/java/com/keepassdroid/crypto/engine/TwofishEngine.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.java index 6c9ce9abe..4cb9736b7 100644 --- a/app/src/main/java/com/keepassdroid/crypto/engine/TwofishEngine.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/engine/TwofishEngine.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.engine; +package com.kunzisoft.keepass.crypto.engine; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.utils.Types; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; @@ -33,6 +34,7 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class TwofishEngine extends CipherEngine { + public static final UUID CIPHER_UUID = Types.bytestoUUID( new byte[]{(byte)0xAD, (byte)0x68, (byte)0xF2, (byte)0x9F, (byte)0x57, (byte)0x6F, (byte)0x4B, (byte)0xB9, (byte)0xA3, (byte)0x6A, (byte)0xD4, (byte)0x7A, (byte)0xF9, (byte)0x65, (byte)0x34, (byte)0x6C @@ -50,4 +52,9 @@ public class TwofishEngine extends CipherEngine { return cipher; } + + @Override + public PwEncryptionAlgorithm getPwEncryptionAlgorithm() { + return PwEncryptionAlgorithm.Twofish; + } } diff --git a/app/src/main/java/com/keepassdroid/crypto/finalkey/AndroidFinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java similarity index 95% rename from app/src/main/java/com/keepassdroid/crypto/finalkey/AndroidFinalKey.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java index be9100549..27b536379 100644 --- a/app/src/main/java/com/keepassdroid/crypto/finalkey/AndroidFinalKey.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/AndroidFinalKey.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.finalkey; +package com.kunzisoft.keepass.crypto.finalkey; import java.io.IOException; import java.security.InvalidKeyException; diff --git a/app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java similarity index 88% rename from app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKey.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java index 765b7479e..cded04667 100644 --- a/app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKey.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKey.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.finalkey; +package com.kunzisoft.keepass.crypto.finalkey; import java.io.IOException; diff --git a/app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKeyFactory.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java similarity index 87% rename from app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKeyFactory.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java index b227f131b..429dd21e1 100644 --- a/app/src/main/java/com/keepassdroid/crypto/finalkey/FinalKeyFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/FinalKeyFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.finalkey; +package com.kunzisoft.keepass.crypto.finalkey; -import com.keepassdroid.crypto.CipherFactory; +import com.kunzisoft.keepass.crypto.CipherFactory; public class FinalKeyFactory { public static FinalKey createFinalKey() { diff --git a/app/src/main/java/com/keepassdroid/crypto/finalkey/NativeFinalKey.java b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java similarity index 89% rename from app/src/main/java/com/keepassdroid/crypto/finalkey/NativeFinalKey.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java index e5b07e492..5e0900d92 100644 --- a/app/src/main/java/com/keepassdroid/crypto/finalkey/NativeFinalKey.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/finalkey/NativeFinalKey.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.finalkey; +package com.kunzisoft.keepass.crypto.finalkey; + +import com.kunzisoft.keepass.crypto.NativeLib; import java.io.IOException; -import com.keepassdroid.crypto.NativeLib; - public class NativeFinalKey extends FinalKey { diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/AesKdf.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.java similarity index 73% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/AesKdf.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.java index 2af26d575..51ade4257 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/AesKdf.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/AesKdf.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,19 +17,22 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; -import com.keepassdroid.crypto.CryptoUtil; -import com.keepassdroid.crypto.finalkey.FinalKey; -import com.keepassdroid.crypto.finalkey.FinalKeyFactory; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.crypto.CryptoUtil; +import com.kunzisoft.keepass.crypto.finalkey.FinalKey; +import com.kunzisoft.keepass.crypto.finalkey.FinalKeyFactory; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.security.SecureRandom; import java.util.UUID; public class AesKdf extends KdfEngine { + + public static final int DEFAULT_ROUNDS = 6000; + public static final String DEFAULT_NAME = "AES-KDF"; + public static final UUID CIPHER_UUID = Types.bytestoUUID( new byte[]{(byte) 0xC9, (byte) 0xD9, (byte) 0xF3, (byte) 0x9A, (byte) 0x62, (byte) 0x8A, (byte) 0x44, (byte) 0x60, (byte) 0xBF, (byte) 0x74, (byte) 0x0D, (byte) 0x08, (byte)0xC1, (byte) 0x8A, (byte) 0x4F, (byte) 0xEA @@ -42,10 +45,14 @@ public class AesKdf extends KdfEngine { uuid = CIPHER_UUID; } + public String getName() { + return DEFAULT_NAME; + } + @Override public KdfParameters getDefaultParameters() { KdfParameters p = super.getDefaultParameters(); - p.setUInt32(ParamRounds, PwDatabaseV4.DEFAULT_ROUNDS); + p.setUInt32(ParamRounds, DEFAULT_ROUNDS); return p; } @@ -76,4 +83,14 @@ public class AesKdf extends KdfEngine { p.setByteArray(ParamSeed, seed); } + + @Override + public long getKeyRounds(KdfParameters p) { + return p.getUInt64(ParamRounds); + } + + @Override + public void setKeyRounds(KdfParameters p, long keyRounds) { + p.setUInt64(ParamRounds, keyRounds); + } } diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Kdf.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.java similarity index 87% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Kdf.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.java index f00335610..5b6353fc9 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Kdf.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Kdf.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.security.SecureRandom; @@ -62,6 +62,11 @@ public class Argon2Kdf extends KdfEngine { uuid = CIPHER_UUID; } + @Override + public String getName() { + return "Argon2"; + } + @Override public KdfParameters getDefaultParameters() { KdfParameters p = super.getDefaultParameters(); @@ -97,4 +102,15 @@ public class Argon2Kdf extends KdfEngine { p.setByteArray(ParamSalt, salt); } + + @Override + public long getKeyRounds(KdfParameters p) { + return p.getUInt64(ParamIterations); + } + + @Override + public void setKeyRounds(KdfParameters p, long keyRounds) { + p.setUInt64(ParamIterations, keyRounds); + } + } diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Native.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java similarity index 90% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Native.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java index f45aa2f54..bd3da3b1a 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/Argon2Native.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/Argon2Native.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; -import com.keepassdroid.crypto.NativeLib; +import com.kunzisoft.keepass.crypto.NativeLib; import java.io.IOException; diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfEngine.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.java similarity index 78% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfEngine.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.java index 54861170f..52f52f910 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfEngine.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfEngine.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; import java.io.IOException; import java.util.UUID; @@ -33,4 +33,10 @@ public abstract class KdfEngine { public abstract void randomize(KdfParameters p); + public abstract String getName(); + + public abstract long getKeyRounds(KdfParameters p); + + public abstract void setKeyRounds(KdfParameters p, long keyRounds); + } diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfFactory.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.java similarity index 87% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfFactory.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.java index 563fda339..a09c5fdd6 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; import java.util.ArrayList; import java.util.List; @@ -25,7 +25,7 @@ import java.util.UUID; public class KdfFactory { - public static List kdfList = new ArrayList(); + public static List kdfList = new ArrayList<>(); static { kdfList.add(new AesKdf()); diff --git a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfParameters.java b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.java similarity index 85% rename from app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfParameters.java rename to app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.java index 242f49e7d..ab21ba9fe 100644 --- a/app/src/main/java/com/keepassdroid/crypto/keyDerivation/KdfParameters.java +++ b/app/src/main/java/com/kunzisoft/keepass/crypto/keyDerivation/KdfParameters.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.crypto.keyDerivation; +package com.kunzisoft.keepass.crypto.keyDerivation; -import com.keepassdroid.collections.VariantDictionary; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.collections.VariantDictionary; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.utils.Types; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/app/src/main/java/com/keepassdroid/database/AutoType.java b/app/src/main/java/com/kunzisoft/keepass/database/AutoType.java similarity index 55% rename from app/src/main/java/com/keepassdroid/database/AutoType.java rename to app/src/main/java/com/kunzisoft/keepass/database/AutoType.java index b31c61c3b..dbdb97707 100644 --- a/app/src/main/java/com/keepassdroid/database/AutoType.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/AutoType.java @@ -1,4 +1,23 @@ -package com.keepassdroid.database; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; import java.io.Serializable; import java.util.HashMap; diff --git a/app/src/main/java/com/keepassdroid/database/BinaryPool.java b/app/src/main/java/com/kunzisoft/keepass/database/BinaryPool.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/BinaryPool.java rename to app/src/main/java/com/kunzisoft/keepass/database/BinaryPool.java index 98b88699e..84fed9719 100644 --- a/app/src/main/java/com/keepassdroid/database/BinaryPool.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/BinaryPool.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; + +import com.kunzisoft.keepass.database.security.ProtectedBinary; import java.util.Collection; import java.util.HashMap; @@ -25,8 +27,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import com.keepassdroid.database.security.ProtectedBinary; - public class BinaryPool { private HashMap pool = new HashMap<>(); diff --git a/app/src/main/java/com/keepassdroid/database/CrsAlgorithm.java b/app/src/main/java/com/kunzisoft/keepass/database/CrsAlgorithm.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/CrsAlgorithm.java rename to app/src/main/java/com/kunzisoft/keepass/database/CrsAlgorithm.java index d2b6a9fcc..81da5be75 100644 --- a/app/src/main/java/com/keepassdroid/database/CrsAlgorithm.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/CrsAlgorithm.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public enum CrsAlgorithm { diff --git a/app/src/main/java/com/keepassdroid/database/Database.java b/app/src/main/java/com/kunzisoft/keepass/database/Database.java similarity index 81% rename from app/src/main/java/com/keepassdroid/database/Database.java rename to app/src/main/java/com/kunzisoft/keepass/database/Database.java index 0fa16bcc0..92c5d99de 100644 --- a/app/src/main/java/com/keepassdroid/database/Database.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/Database.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,26 +17,27 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Resources; import android.net.Uri; import android.preference.PreferenceManager; import android.util.Log; -import com.keepassdroid.database.exception.ContentFileNotFoundException; -import com.keepassdroid.database.exception.InvalidDBException; -import com.keepassdroid.database.exception.InvalidPasswordException; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.database.load.Importer; -import com.keepassdroid.database.load.ImporterFactory; -import com.keepassdroid.database.save.PwDbOutput; -import com.keepassdroid.icons.DrawableFactory; -import com.keepassdroid.search.SearchDbHelper; -import com.keepassdroid.tasks.UpdateStatus; -import com.keepassdroid.utils.UriUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.exception.ContentFileNotFoundException; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.database.exception.InvalidPasswordException; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.database.load.Importer; +import com.kunzisoft.keepass.database.load.ImporterFactory; +import com.kunzisoft.keepass.database.save.PwDbOutput; +import com.kunzisoft.keepass.icons.DrawableFactory; +import com.kunzisoft.keepass.search.SearchDbHelper; +import com.kunzisoft.keepass.tasks.UpdateStatus; +import com.kunzisoft.keepass.utils.UriUtil; import java.io.BufferedInputStream; import java.io.File; @@ -217,11 +218,11 @@ public class Database { return null; } - public void SaveData(Context ctx) throws IOException, PwDbOutputException { - SaveData(ctx, mUri); + public void saveData(Context ctx) throws IOException, PwDbOutputException { + saveData(ctx, mUri); } - public void SaveData(Context ctx, Uri uri) throws IOException, PwDbOutputException { + public void saveData(Context ctx, Uri uri) throws IOException, PwDbOutputException { if (uri.getScheme().equals("file")) { String filename = uri.getPath(); File tempFile = new File(filename + ".tmp"); @@ -272,6 +273,101 @@ public class Database { passwordEncodingError = false; } + public String getVersion() { + return getPwDatabase().getVersion().toString(); + } + + public boolean containsName() { + switch (getPwDatabase().getVersion()) { + default: + return false; + case V4: + return true; + } + } + + public String getName() { + switch (getPwDatabase().getVersion()) { + default: + return ""; + case V4: + return ((PwDatabaseV4) getPwDatabase()).getName(); + } + } + + public void assignName(String name) { + switch (getPwDatabase().getVersion()) { + case V4: + PwDatabaseV4 databaseV4 = ((PwDatabaseV4) getPwDatabase()); + databaseV4.setName(name); + databaseV4.setNameChanged(new PwDate()); + break; + } + } + + public boolean containsDescription() { + switch (getPwDatabase().getVersion()) { + default: + return false; + case V4: + return true; + } + } + + public String getDescription() { + switch (getPwDatabase().getVersion()) { + default: + return ""; + case V4: + return ((PwDatabaseV4) getPwDatabase()).getDescription(); + } + } + + public void assignDescription(String description) { + switch (getPwDatabase().getVersion()) { + case V4: + ((PwDatabaseV4) getPwDatabase()).setDescription(description); + ((PwDatabaseV4) getPwDatabase()).setDescriptionChanged(new PwDate()); + } + } + + public String getDefaultUsername() { + switch (getPwDatabase().getVersion()) { + default: + return ""; + case V4: + return ((PwDatabaseV4) getPwDatabase()).getDefaultUserName(); + } + } + + public void setDefaultUsername(String username) { + switch (getPwDatabase().getVersion()) { + case V4: + ((PwDatabaseV4) getPwDatabase()).setDefaultUserName(username); + ((PwDatabaseV4) getPwDatabase()).setDefaultUserNameChanged(new PwDate()); + } + } + + public String getEncryptionAlgorithmName(Resources resources) { + return getPwDatabase().getEncryptionAlgorithm().getName(resources); + } + + public String getKeyDerivationName() { + return getPwDatabase().getKeyDerivationName(); + } + + public String getNumberKeyEncryptionRoundsAsString() { + return Long.toString(getPwDatabase().getNumberKeyEncryptionRounds()); + } + + public long getNumberKeyEncryptionRounds() { + return getPwDatabase().getNumberKeyEncryptionRounds(); + } + + public void setNumberKeyEncryptionRounds(long numberRounds) throws NumberFormatException { + getPwDatabase().setNumberKeyEncryptionRounds(numberRounds); + } + public void addEntryTo(PwEntry entry, PwGroup parent) { try { switch (getPwDatabase().getVersion()) { @@ -435,20 +531,12 @@ public class Database { } } - public boolean isRecycleBinAvailabledAndEnabled() { - try { - switch (getPwDatabase().getVersion()) { - case V3: - return ((PwDatabaseV3) getPwDatabase()).isRecycleBinAvailable() && - ((PwDatabaseV3) getPwDatabase()).isRecycleBinEnabled(); - case V4: - return ((PwDatabaseV4) getPwDatabase()).isRecycleBinAvailable() && - ((PwDatabaseV4) getPwDatabase()).isRecycleBinEnabled(); - } - } catch (Exception e) { - Log.e(TAG, "This version of database don't know if the Recyclebin is available", e); - } - return false; + public boolean isRecycleBinAvailable() { + return getPwDatabase().isRecycleBinAvailable(); + } + + public boolean isRecycleBinEnabled() { + return getPwDatabase().isRecycleBinEnabled(); } public void undoRecycle(PwEntry entry, PwGroup parent) { diff --git a/app/src/main/java/com/keepassdroid/database/EntryHandler.java b/app/src/main/java/com/kunzisoft/keepass/database/EntryHandler.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/EntryHandler.java rename to app/src/main/java/com/kunzisoft/keepass/database/EntryHandler.java index 68707c932..5db793118 100644 --- a/app/src/main/java/com/keepassdroid/database/EntryHandler.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/EntryHandler.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; /** "Delegate" class for operating on each entry when traversing all of * them diff --git a/app/src/main/java/com/keepassdroid/database/EntrySearchHandler.java b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandler.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/EntrySearchHandler.java rename to app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandler.java index 2a22f0323..24bed9df9 100644 --- a/app/src/main/java/com/keepassdroid/database/EntrySearchHandler.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandler.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.database.iterator.EntrySearchStringIterator; +import com.kunzisoft.keepass.database.iterator.EntrySearchStringIterator; import java.util.Date; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/database/EntrySearchHandlerAll.java b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerAll.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/EntrySearchHandlerAll.java rename to app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerAll.java index 608f619eb..87e5f175d 100644 --- a/app/src/main/java/com/keepassdroid/database/EntrySearchHandlerAll.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerAll.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.util.Date; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/database/EntrySearchHandlerV4.java b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerV4.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/EntrySearchHandlerV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerV4.java index 37a5244c8..b6dd0a1ce 100644 --- a/app/src/main/java/com/keepassdroid/database/EntrySearchHandlerV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchHandlerV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.utils.StrUtil; -import com.keepassdroid.utils.UuidUtil; +import com.kunzisoft.keepass.utils.StrUtil; +import com.kunzisoft.keepass.utils.UuidUtil; import java.util.List; import java.util.Locale; diff --git a/app/src/main/java/com/keepassdroid/database/EntrySearchV4.java b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchV4.java similarity index 74% rename from app/src/main/java/com/keepassdroid/database/EntrySearchV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/EntrySearchV4.java index dcc909aa9..25a4a67f4 100644 --- a/app/src/main/java/com/keepassdroid/database/EntrySearchV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/EntrySearchV4.java @@ -1,6 +1,25 @@ -package com.keepassdroid.database; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; -import com.keepassdroid.utils.StrUtil; +import com.kunzisoft.keepass.utils.StrUtil; import java.util.ArrayList; import java.util.Collections; diff --git a/app/src/main/java/com/keepassdroid/database/ExtraFields.java b/app/src/main/java/com/kunzisoft/keepass/database/ExtraFields.java similarity index 73% rename from app/src/main/java/com/keepassdroid/database/ExtraFields.java rename to app/src/main/java/com/kunzisoft/keepass/database/ExtraFields.java index a03ef3af0..93f5bb993 100644 --- a/app/src/main/java/com/keepassdroid/database/ExtraFields.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/ExtraFields.java @@ -1,17 +1,36 @@ -package com.keepassdroid.database; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; -import com.keepassdroid.database.security.ProtectedString; +import com.kunzisoft.keepass.database.security.ProtectedString; import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import static com.keepassdroid.database.PwEntryV4.STR_NOTES; -import static com.keepassdroid.database.PwEntryV4.STR_PASSWORD; -import static com.keepassdroid.database.PwEntryV4.STR_TITLE; -import static com.keepassdroid.database.PwEntryV4.STR_URL; -import static com.keepassdroid.database.PwEntryV4.STR_USERNAME; +import static com.kunzisoft.keepass.database.PwEntryV4.STR_NOTES; +import static com.kunzisoft.keepass.database.PwEntryV4.STR_PASSWORD; +import static com.kunzisoft.keepass.database.PwEntryV4.STR_TITLE; +import static com.kunzisoft.keepass.database.PwEntryV4.STR_URL; +import static com.kunzisoft.keepass.database.PwEntryV4.STR_USERNAME; public class ExtraFields implements Serializable, Cloneable { diff --git a/app/src/main/java/com/keepassdroid/database/GroupHandler.java b/app/src/main/java/com/kunzisoft/keepass/database/GroupHandler.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/GroupHandler.java rename to app/src/main/java/com/kunzisoft/keepass/database/GroupHandler.java index 04f3aa9eb..3b23e22a8 100644 --- a/app/src/main/java/com/keepassdroid/database/GroupHandler.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/GroupHandler.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; /** "Delegate" class for operating on each group when traversing all of diff --git a/app/src/main/java/com/kunzisoft/keepass/database/ISmallTimeLogger.java b/app/src/main/java/com/kunzisoft/keepass/database/ISmallTimeLogger.java new file mode 100644 index 000000000..c7c8c84ec --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/ISmallTimeLogger.java @@ -0,0 +1,38 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +public interface ISmallTimeLogger { + + PwDate getLastModificationTime(); + void setLastModificationTime(PwDate date); + + PwDate getCreationTime(); + void setCreationTime(PwDate date); + + PwDate getLastAccessTime(); + void setLastAccessTime(PwDate date); + + PwDate getExpiryTime(); + void setExpiryTime(PwDate date); + + boolean isExpires(); + void setExpires(boolean exp); +} diff --git a/app/src/main/java/com/keepassdroid/database/ITimeLogger.java b/app/src/main/java/com/kunzisoft/keepass/database/ITimeLogger.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/ITimeLogger.java rename to app/src/main/java/com/kunzisoft/keepass/database/ITimeLogger.java index 8317a7a40..09326a20f 100644 --- a/app/src/main/java/com/keepassdroid/database/ITimeLogger.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/ITimeLogger.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public interface ITimeLogger extends ISmallTimeLogger { diff --git a/app/src/main/java/com/kunzisoft/keepass/database/MemoryProtectionConfig.java b/app/src/main/java/com/kunzisoft/keepass/database/MemoryProtectionConfig.java new file mode 100644 index 000000000..bc3f05aa5 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/MemoryProtectionConfig.java @@ -0,0 +1,41 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +public class MemoryProtectionConfig { + + public boolean protectTitle = false; + public boolean protectUserName = false; + public boolean protectPassword = false; + public boolean protectUrl = false; + public boolean protectNotes = false; + + public boolean autoEnableVisualHiding = false; + + public boolean isProtected(String field) { + if (field.equalsIgnoreCase(PwDefsV4.TITLE_FIELD)) return protectTitle; + if (field.equalsIgnoreCase(PwDefsV4.USERNAME_FIELD)) return protectUserName; + if (field.equalsIgnoreCase(PwDefsV4.PASSWORD_FIELD)) return protectPassword; + if (field.equalsIgnoreCase(PwDefsV4.URL_FIELD)) return protectUrl; + if (field.equalsIgnoreCase(PwDefsV4.NOTES_FIELD)) return protectNotes; + + return false; + } +} diff --git a/app/src/main/java/com/keepassdroid/database/PwCompressionAlgorithm.java b/app/src/main/java/com/kunzisoft/keepass/database/PwCompressionAlgorithm.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/PwCompressionAlgorithm.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwCompressionAlgorithm.java index 2310653c3..d12f15cc9 100644 --- a/app/src/main/java/com/keepassdroid/database/PwCompressionAlgorithm.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwCompressionAlgorithm.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public enum PwCompressionAlgorithm { diff --git a/app/src/main/java/com/keepassdroid/database/PwDatabase.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabase.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/PwDatabase.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDatabase.java index 762f85b07..80c2bd56a 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDatabase.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabase.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.crypto.finalkey.FinalKey; -import com.keepassdroid.crypto.finalkey.FinalKeyFactory; -import com.keepassdroid.database.exception.InvalidKeyFileException; -import com.keepassdroid.database.exception.KeyFileEmptyException; -import com.keepassdroid.stream.NullOutputStream; -import com.keepassdroid.utils.Util; +import com.kunzisoft.keepass.crypto.finalkey.FinalKey; +import com.kunzisoft.keepass.crypto.finalkey.FinalKeyFactory; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.database.exception.KeyFileEmptyException; +import com.kunzisoft.keepass.stream.NullOutputStream; +import com.kunzisoft.keepass.utils.Util; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -44,10 +44,12 @@ public abstract class PwDatabase getGrpRoots(); diff --git a/app/src/main/java/com/keepassdroid/database/PwDatabaseV3.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/PwDatabaseV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3.java index fafd65e68..67ef1bc53 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDatabaseV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -31,7 +31,7 @@ Copyright 2006 Bill Zwicky This program 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 2 +the Free Software Foundation; either version 3 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -43,10 +43,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; // Java -import com.keepassdroid.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.crypto.keyDerivation.AesKdf; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; import java.io.IOException; import java.io.InputStream; @@ -67,8 +68,7 @@ public class PwDatabaseV3 extends PwDatabase { private List entries = new ArrayList<>(); // all groups private List groups = new ArrayList<>(); - // Algorithm used to encrypt the database - private PwEncryptionAlgorithm algorithm; + private int numKeyEncRounds; private void initAndAddGroup(String name, int iconId, PwGroupV3 parent) { @@ -80,9 +80,8 @@ public class PwDatabaseV3 extends PwDatabase { @Override public void initNew(String dbPath) { - algorithm = PwEncryptionAlgorithm.Rjindal; + algorithm = PwEncryptionAlgorithm.AES_Rijndael; numKeyEncRounds = DEFAULT_ENCRYPTION_ROUNDS; - name = "KeePass Password Manager"; // TODO as resource // Build the root tree constructTree(null); @@ -96,21 +95,9 @@ public class PwDatabaseV3 extends PwDatabase { return PwVersion.V3; } - @Override - public PwEncryptionAlgorithm getEncryptionAlgorithm() { - return algorithm; - } - - public void setEncryptionAlgorithm(PwEncryptionAlgorithm algorithm) { - this.algorithm = algorithm; - } - - public int getNumKeyEncRounds() { - return numKeyEncRounds; - } - - public void setNumKeyEncRounds(int numKeyEncRounds) { - this.numKeyEncRounds = numKeyEncRounds; + @Override + public String getKeyDerivationName() { + return AesKdf.DEFAULT_NAME; } @Override @@ -188,10 +175,6 @@ public class PwDatabaseV3 extends PwDatabase { return kids; } - public String toString() { - return name; - } - public void constructTree(PwGroupV3 currentGroup) { // I'm in root if (currentGroup == null) { @@ -278,23 +261,18 @@ public class PwDatabaseV3 extends PwDatabase { @Override - public long getNumRounds() { + public long getNumberKeyEncryptionRounds() { return numKeyEncRounds; } @Override - public void setNumRounds(long rounds) throws NumberFormatException { + public void setNumberKeyEncryptionRounds(long rounds) throws NumberFormatException { if (rounds > Integer.MAX_VALUE || rounds < Integer.MIN_VALUE) { throw new NumberFormatException(); } numKeyEncRounds = (int) rounds; } - @Override - public boolean algorithmSettingsEnabled() { - return true; - } - @Override public void addEntryTo(PwEntryV3 newEntry, PwGroupV3 parent) { super.addEntryTo(newEntry, parent); diff --git a/app/src/main/java/com/keepassdroid/database/PwDatabaseV3Debug.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3Debug.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/PwDatabaseV3Debug.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3Debug.java index 6cd1c5c43..528094435 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDatabaseV3Debug.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV3Debug.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class PwDatabaseV3Debug extends PwDatabaseV3 { diff --git a/app/src/main/java/com/keepassdroid/database/PwDatabaseV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/PwDatabaseV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4.java index cc2276d33..9b555af19 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDatabaseV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,20 +17,20 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import android.webkit.URLUtil; -import com.keepassdroid.collections.VariantDictionary; -import com.keepassdroid.crypto.CryptoUtil; -import com.keepassdroid.crypto.engine.AesEngine; -import com.keepassdroid.crypto.engine.CipherEngine; -import com.keepassdroid.crypto.keyDerivation.AesKdf; -import com.keepassdroid.crypto.keyDerivation.KdfEngine; -import com.keepassdroid.crypto.keyDerivation.KdfFactory; -import com.keepassdroid.crypto.keyDerivation.KdfParameters; -import com.keepassdroid.database.exception.InvalidKeyFileException; -import com.keepassdroid.utils.EmptyUtils; +import com.kunzisoft.keepass.collections.VariantDictionary; +import com.kunzisoft.keepass.crypto.CryptoUtil; +import com.kunzisoft.keepass.crypto.engine.AesEngine; +import com.kunzisoft.keepass.crypto.engine.CipherEngine; +import com.kunzisoft.keepass.crypto.keyDerivation.AesKdf; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfEngine; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfFactory; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfParameters; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.utils.EmptyUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -58,7 +58,6 @@ import biz.source_code.base64Coder.Base64Coder; public class PwDatabaseV4 extends PwDatabase { - public static final int DEFAULT_ROUNDS = 6000; private static final int DEFAULT_HISTORY_MAX_ITEMS = 10; // -1 unlimited private static final long DEFAULT_HISTORY_MAX_SIZE = 6 * 1024 * 1024; // -1 unlimited private static final String RECYCLEBIN_NAME = "RecycleBin"; @@ -67,9 +66,10 @@ public class PwDatabaseV4 extends PwDatabase { private UUID dataCipher = AesEngine.CIPHER_UUID; private CipherEngine dataEngine = new AesEngine(); private PwCompressionAlgorithm compressionAlgorithm = PwCompressionAlgorithm.Gzip; + private KdfEngine kdfEngine; - // TODO: Refactor me away to get directly from kdfParameters - private long numKeyEncRounds = 6000; + private long numKeyEncRounds = AesKdf.DEFAULT_ROUNDS; // By default take the AES rounds + protected String name = "KeePass DX database"; private PwDate nameChanged = new PwDate(); private PwDate settingsChanged = new PwDate(); private String description = ""; @@ -109,6 +109,14 @@ public class PwDatabaseV4 extends PwDatabase { return PwVersion.V4; } + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public byte[] getHmacKey() { return hmacKey; } @@ -123,6 +131,7 @@ public class PwDatabaseV4 extends PwDatabase { public void setDataEngine(CipherEngine dataEngine) { this.dataEngine = dataEngine; + this.algorithm = dataEngine.getPwEncryptionAlgorithm(); } public PwCompressionAlgorithm getCompressionAlgorithm() { @@ -133,15 +142,21 @@ public class PwDatabaseV4 extends PwDatabase { this.compressionAlgorithm = compressionAlgorithm; } - public long getNumKeyEncRounds() { + @Override + public long getNumberKeyEncryptionRounds() { + if (getKdfEngine() != null && getKdfParameters() != null) + numKeyEncRounds = getKdfEngine().getKeyRounds(getKdfParameters()); return numKeyEncRounds; } - public void setNumKeyEncRounds(long numKeyEncRounds) { - this.numKeyEncRounds = numKeyEncRounds; + @Override + public void setNumberKeyEncryptionRounds(long rounds) throws NumberFormatException { + if (getKdfEngine() != null && getKdfParameters() != null) + getKdfEngine().setKeyRounds(getKdfParameters(), rounds); + numKeyEncRounds = rounds; } - public PwDate getNameChanged() { + public PwDate getNameChanged() { return nameChanged; } @@ -150,10 +165,11 @@ public class PwDatabaseV4 extends PwDatabase { } public PwDate getSettingsChanged() { - return settingsChanged; // TODO change setting date + return settingsChanged; } public void setSettingsChanged(PwDate settingsChanged) { + // TODO change setting date this.settingsChanged = settingsChanged; } @@ -194,6 +210,7 @@ public class PwDatabaseV4 extends PwDatabase { } public void setKeyLastChanged(PwDate keyLastChanged) { + // TODO date this.keyLastChanged = keyLastChanged; } @@ -309,6 +326,15 @@ public class PwDatabaseV4 extends PwDatabase { this.customData.put(label, value); } + public KdfEngine getKdfEngine() { + return kdfEngine; + } + + @Override + public String getKeyDerivationName() { + return kdfEngine.getName(); + } + @Override public byte[] getMasterKey(String key, InputStream keyInputStream) throws InvalidKeyFileException, IOException { @@ -335,7 +361,7 @@ public class PwDatabaseV4 extends PwDatabase { } @Override - public void makeFinalKey(byte[] masterSeed, byte[] masterSeed2, int numRounds) throws IOException { + public void makeFinalKey(byte[] masterSeed, byte[] masterSeed2, long numRounds) throws IOException { byte[] transformedMasterKey = transformMasterKey(masterSeed2, masterKey, numRounds); @@ -363,7 +389,7 @@ public class PwDatabaseV4 extends PwDatabase { public void makeFinalKey(byte[] masterSeed, KdfParameters kdfP, long roundsFix) throws IOException { - KdfEngine kdfEngine = KdfFactory.get(kdfP.kdfUUID); + kdfEngine = KdfFactory.get(kdfP.kdfUUID); if (kdfEngine == null) { throw new IOException("Unknown key derivation function"); } @@ -490,27 +516,6 @@ public class PwDatabaseV4 extends PwDatabase { } } - @Override - public long getNumRounds() { - return numKeyEncRounds; - } - - @Override - public void setNumRounds(long rounds) throws NumberFormatException { - numKeyEncRounds = rounds; - - } - - @Override - public boolean algorithmSettingsEnabled() { - return false; - } - - @Override - public PwEncryptionAlgorithm getEncryptionAlgorithm() { - return PwEncryptionAlgorithm.Rjindal; - } - @Override public PwGroupIdV4 newGroupId() { PwGroupIdV4 id; @@ -590,6 +595,7 @@ public class PwDatabaseV4 extends PwDatabase { } public void setRecycleBinChanged(Date recycleBinChanged) { + // TODO recyclebin Date this.recycleBinChanged = recycleBinChanged; } diff --git a/app/src/main/java/com/keepassdroid/database/PwDatabaseV4XML.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4XML.java similarity index 98% rename from app/src/main/java/com/keepassdroid/database/PwDatabaseV4XML.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4XML.java index 92da28205..51b1e9f89 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDatabaseV4XML.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDatabaseV4XML.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.text.SimpleDateFormat; import java.util.TimeZone; diff --git a/app/src/main/java/com/keepassdroid/database/PwDate.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDate.java similarity index 97% rename from app/src/main/java/com/keepassdroid/database/PwDate.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDate.java index 5e97b8ab4..06ad1aa40 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDate.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDate.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.app.App; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.utils.Types; import java.io.Serializable; import java.util.Arrays; diff --git a/app/src/main/java/com/keepassdroid/database/PwDbHeader.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeader.java similarity index 90% rename from app/src/main/java/com/keepassdroid/database/PwDbHeader.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDbHeader.java index b14087989..3681d65f8 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDbHeader.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeader.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public abstract class PwDbHeader { diff --git a/app/src/main/java/com/keepassdroid/database/PwDbHeaderFactory.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderFactory.java similarity index 90% rename from app/src/main/java/com/keepassdroid/database/PwDbHeaderFactory.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderFactory.java index 6b3e0bf01..22a99f99b 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDbHeaderFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class PwDbHeaderFactory { public static PwDbHeader getInstance(PwDatabase db) { diff --git a/app/src/main/java/com/keepassdroid/database/PwDbHeaderV3.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV3.java similarity index 96% rename from app/src/main/java/com/keepassdroid/database/PwDbHeaderV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV3.java index ed8e61eee..4befe3671 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDbHeaderV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -44,12 +44,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; + +import com.kunzisoft.keepass.stream.LEDataInputStream; import java.io.IOException; -import com.keepassdroid.stream.LEDataInputStream; - public class PwDbHeaderV3 extends PwDbHeader { // DB sig from KeePass 1.03 diff --git a/app/src/main/java/com/keepassdroid/database/PwDbHeaderV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV4.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/PwDbHeaderV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV4.java index acc7a7675..7719b8175 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDbHeaderV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDbHeaderV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,27 +17,23 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; + +import com.kunzisoft.keepass.crypto.keyDerivation.AesKdf; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfParameters; +import com.kunzisoft.keepass.database.exception.InvalidDBVersionException; +import com.kunzisoft.keepass.stream.CopyInputStream; +import com.kunzisoft.keepass.stream.HmacBlockStream; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.utils.Types; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.security.DigestInputStream; import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.List; - -import com.keepassdroid.crypto.keyDerivation.AesKdf; -import com.keepassdroid.crypto.keyDerivation.KdfParameters; -import com.keepassdroid.database.exception.InvalidDBVersionException; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.stream.CopyInputStream; -import com.keepassdroid.stream.HmacBlockStream; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.utils.Types; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -65,7 +61,6 @@ public class PwDbHeaderV4 extends PwDbHeader { public static final byte InnerRandomStreamID = 10; public static final byte KdfParameters = 11; public static final byte PublicCustomData = 12; - } public class PwDbInnerHeaderV4Fields { @@ -178,7 +173,7 @@ public class PwDbHeaderV4 extends PwDbHeader { break; case PwDbHeaderV4Fields.TransformSeed: - assert(version < PwDbHeaderV4.FILE_VERSION_32_4); + assert(version < PwDbHeaderV4.FILE_VERSION_32_4); // TODO file > FILEVERSION AesKdf kdfS = new AesKdf(); if (!db.getKdfParameters().kdfUUID.equals(kdfS.uuid)) { db.setKdfParameters(kdfS.getDefaultParameters()); @@ -195,7 +190,7 @@ public class PwDbHeaderV4 extends PwDbHeader { } long rounds = LEDataInputStream.readLong(fieldData, 0); db.getKdfParameters().setUInt64(AesKdf.ParamRounds, rounds); - db.setNumKeyEncRounds(rounds); + db.setNumberKeyEncryptionRounds(rounds); break; case PwDbHeaderV4Fields.EncryptionIV: @@ -264,7 +259,7 @@ public class PwDbHeaderV4 extends PwDbHeader { throw new IOException("Rounds higher than " + Integer.MAX_VALUE + " are not currently supported."); } - db.setNumKeyEncRounds(rnd); + db.setNumberKeyEncryptionRounds(rnd); } diff --git a/app/src/main/java/com/keepassdroid/database/PwDefsV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDefsV4.java similarity index 90% rename from app/src/main/java/com/keepassdroid/database/PwDefsV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDefsV4.java index 8d3422418..eaaf67da4 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDefsV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDefsV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class PwDefsV4 { diff --git a/app/src/main/java/com/keepassdroid/database/PwDeletedObject.java b/app/src/main/java/com/kunzisoft/keepass/database/PwDeletedObject.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/PwDeletedObject.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwDeletedObject.java index 55be9349e..276122b56 100644 --- a/app/src/main/java/com/keepassdroid/database/PwDeletedObject.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwDeletedObject.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.util.Date; import java.util.UUID; diff --git a/app/src/main/java/com/kunzisoft/keepass/database/PwEncryptionAlgorithm.java b/app/src/main/java/com/kunzisoft/keepass/database/PwEncryptionAlgorithm.java new file mode 100644 index 000000000..d75b49c29 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwEncryptionAlgorithm.java @@ -0,0 +1,43 @@ +/* + * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +import android.content.res.Resources; + +import com.kunzisoft.keepass.R; + +public enum PwEncryptionAlgorithm { + + AES_Rijndael, + Twofish, + ChaCha20; + + public String getName(Resources resources) { + switch (this) { + default: + case AES_Rijndael: + return resources.getString(R.string.rijndael); + case Twofish: + return resources.getString(R.string.twofish); + case ChaCha20: + return resources.getString(R.string.chacha20); + } + } +} diff --git a/app/src/main/java/com/keepassdroid/database/PwEntry.java b/app/src/main/java/com/kunzisoft/keepass/database/PwEntry.java similarity index 95% rename from app/src/main/java/com/keepassdroid/database/PwEntry.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwEntry.java index 22037a50d..ebe31f3d8 100644 --- a/app/src/main/java/com/keepassdroid/database/PwEntry.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwEntry.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.database.iterator.EntrySearchStringIterator; -import com.keepassdroid.database.security.ProtectedString; +import com.kunzisoft.keepass.database.iterator.EntrySearchStringIterator; +import com.kunzisoft.keepass.database.security.ProtectedString; import java.util.UUID; diff --git a/app/src/main/java/com/keepassdroid/database/PwEntryV3.java b/app/src/main/java/com/kunzisoft/keepass/database/PwEntryV3.java similarity index 98% rename from app/src/main/java/com/keepassdroid/database/PwEntryV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwEntryV3.java index a46736a89..e370659ef 100644 --- a/app/src/main/java/com/keepassdroid/database/PwEntryV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwEntryV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -40,7 +40,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.io.UnsupportedEncodingException; import java.util.UUID; diff --git a/app/src/main/java/com/keepassdroid/database/PwEntryV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwEntryV4.java similarity index 97% rename from app/src/main/java/com/keepassdroid/database/PwEntryV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwEntryV4.java index 7d3bb4dc5..211e006e2 100644 --- a/app/src/main/java/com/keepassdroid/database/PwEntryV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwEntryV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.utils.SprEngineV4; +import com.kunzisoft.keepass.database.security.ProtectedBinary; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.utils.SprEngineV4; import java.util.ArrayList; import java.util.Date; diff --git a/app/src/main/java/com/keepassdroid/database/PwGroup.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroup.java similarity index 97% rename from app/src/main/java/com/keepassdroid/database/PwGroup.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwGroup.java index 69f99945c..d8cdec744 100644 --- a/app/src/main/java/com/keepassdroid/database/PwGroup.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroup.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/database/PwEncryptionAlgorithm.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupId.java similarity index 72% rename from app/src/main/java/com/keepassdroid/database/PwEncryptionAlgorithm.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwGroupId.java index 705751b0c..5e8f6013d 100644 --- a/app/src/main/java/com/keepassdroid/database/PwEncryptionAlgorithm.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupId.java @@ -1,11 +1,11 @@ /* - * Copyright 2017 Brian Pellin, Jeremy Jamet / Kunzisoft. - * + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * * This file is part of KeePass DX. * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; + +import java.io.Serializable; + +public abstract class PwGroupId implements Serializable { -public enum PwEncryptionAlgorithm { - - Rjindal, - Twofish; } diff --git a/app/src/main/java/com/keepassdroid/database/PwGroupIdV3.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV3.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/PwGroupIdV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV3.java index cde7531e3..1a12baa46 100644 --- a/app/src/main/java/com/keepassdroid/database/PwGroupIdV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class PwGroupIdV3 extends PwGroupId { diff --git a/app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV4.java new file mode 100644 index 000000000..abc158f56 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupIdV4.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +import java.util.UUID; + +public class PwGroupIdV4 extends PwGroupId { + private UUID uuid; + + public PwGroupIdV4(UUID u) { + uuid = u; + } + + @Override + public boolean equals(Object id) { + if ( ! (id instanceof PwGroupIdV4) ) { + return false; + } + PwGroupIdV4 v4 = (PwGroupIdV4) id; + return uuid.equals(v4.uuid); + } + + @Override + public int hashCode() { + return uuid.hashCode(); + } + + public UUID getId() { + return uuid; + } +} diff --git a/app/src/main/java/com/keepassdroid/database/PwGroupV3.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupV3.java similarity index 95% rename from app/src/main/java/com/keepassdroid/database/PwGroupV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwGroupV3.java index 81958c721..0b94ce4a6 100644 --- a/app/src/main/java/com/keepassdroid/database/PwGroupV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -18,7 +18,7 @@ * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; /** * @author Brian Pellin diff --git a/app/src/main/java/com/keepassdroid/database/PwGroupV4.java b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupV4.java similarity index 97% rename from app/src/main/java/com/keepassdroid/database/PwGroupV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwGroupV4.java index f43be33ba..4c3a0a449 100644 --- a/app/src/main/java/com/keepassdroid/database/PwGroupV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwGroupV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.util.HashMap; import java.util.Map; diff --git a/app/src/main/java/com/kunzisoft/keepass/database/PwIcon.java b/app/src/main/java/com/kunzisoft/keepass/database/PwIcon.java new file mode 100644 index 000000000..65beb86db --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwIcon.java @@ -0,0 +1,29 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +import java.io.Serializable; + +public abstract class PwIcon implements Serializable { + + public boolean isMetaStreamIcon() { + return false; + } +} diff --git a/app/src/main/java/com/keepassdroid/database/PwIconCustom.java b/app/src/main/java/com/kunzisoft/keepass/database/PwIconCustom.java similarity index 94% rename from app/src/main/java/com/keepassdroid/database/PwIconCustom.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwIconCustom.java index 0117a1716..cb1a8fb39 100644 --- a/app/src/main/java/com/keepassdroid/database/PwIconCustom.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwIconCustom.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; import java.util.UUID; diff --git a/app/src/main/java/com/keepassdroid/database/PwIconFactory.java b/app/src/main/java/com/kunzisoft/keepass/database/PwIconFactory.java similarity index 95% rename from app/src/main/java/com/keepassdroid/database/PwIconFactory.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwIconFactory.java index 49594ab3d..090231d4b 100644 --- a/app/src/main/java/com/keepassdroid/database/PwIconFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwIconFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; - -import java.util.UUID; +package com.kunzisoft.keepass.database; import org.apache.commons.collections.map.AbstractReferenceMap; import org.apache.commons.collections.map.ReferenceMap; +import java.util.UUID; + public class PwIconFactory { /** customIconMap * Cache for icon drawable. diff --git a/app/src/main/java/com/keepassdroid/database/PwIconStandard.java b/app/src/main/java/com/kunzisoft/keepass/database/PwIconStandard.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/PwIconStandard.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwIconStandard.java index 789e79042..00e47dd53 100644 --- a/app/src/main/java/com/keepassdroid/database/PwIconStandard.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwIconStandard.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class PwIconStandard extends PwIcon { public final int iconId; diff --git a/app/src/main/java/com/keepassdroid/database/PwNode.java b/app/src/main/java/com/kunzisoft/keepass/database/PwNode.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/PwNode.java rename to app/src/main/java/com/kunzisoft/keepass/database/PwNode.java index f7e31b9a9..9d332014c 100644 --- a/app/src/main/java/com/keepassdroid/database/PwNode.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwNode.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -18,18 +18,11 @@ * * */ -package com.keepassdroid.database; - -import android.util.Log; +package com.kunzisoft.keepass.database; import org.joda.time.LocalDate; import java.io.Serializable; -import java.sql.Date; -import java.time.temporal.ChronoUnit; - -import static com.keepassdroid.database.PwDate.NEVER_EXPIRE; -import static com.keepassdroid.database.PwDate.PW_NEVER_EXPIRE; /** * Abstract class who manage Groups and Entries @@ -43,7 +36,7 @@ public abstract class PwNode implements ISmallTimeLogger protected PwDate creation = new PwDate(); protected PwDate lastMod = new PwDate(); protected PwDate lastAccess = new PwDate(); - protected PwDate expireDate = PW_NEVER_EXPIRE; + protected PwDate expireDate = PwDate.PW_NEVER_EXPIRE; protected void construct(Parent parent) { this.parent = parent; @@ -152,13 +145,13 @@ public abstract class PwNode implements ISmallTimeLogger public void setExpires(boolean expires) { if (!expires) { - expireDate = PW_NEVER_EXPIRE; + expireDate = PwDate.PW_NEVER_EXPIRE; } } public boolean isExpires() { // If expireDate is before NEVER_EXPIRE date less 1 month (to be sure) - return expireDate.getDate().before(LocalDate.fromDateFields(NEVER_EXPIRE).minusMonths(1).toDate()); + return expireDate.getDate().before(LocalDate.fromDateFields(PwDate.NEVER_EXPIRE).minusMonths(1).toDate()); } /** diff --git a/app/src/main/java/com/kunzisoft/keepass/database/PwVersion.java b/app/src/main/java/com/kunzisoft/keepass/database/PwVersion.java new file mode 100644 index 000000000..48b337ff9 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/PwVersion.java @@ -0,0 +1,36 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database; + +public enum PwVersion { + V3, V4; + + @Override + public String toString() { + switch (this) { + case V3: + return "KeePass 1"; + case V4: + return "KeePass 2"; + default: + return "unknown"; + } + } +} diff --git a/app/src/main/java/com/keepassdroid/database/SearchParameters.java b/app/src/main/java/com/kunzisoft/keepass/database/SearchParameters.java similarity index 94% rename from app/src/main/java/com/keepassdroid/database/SearchParameters.java rename to app/src/main/java/com/kunzisoft/keepass/database/SearchParameters.java index 13ee80ab8..af87198bf 100644 --- a/app/src/main/java/com/keepassdroid/database/SearchParameters.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/SearchParameters.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; /** * @author bpellin diff --git a/app/src/main/java/com/keepassdroid/database/SearchParametersV4.java b/app/src/main/java/com/kunzisoft/keepass/database/SearchParametersV4.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/SearchParametersV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/SearchParametersV4.java index 2eef94162..f02c251b7 100644 --- a/app/src/main/java/com/keepassdroid/database/SearchParametersV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/SearchParametersV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database; +package com.kunzisoft.keepass.database; public class SearchParametersV4 extends SearchParameters implements Cloneable { public static SearchParametersV4 DEFAULT = new SearchParametersV4(); diff --git a/app/src/main/java/com/kunzisoft/keepass/database/SortNodeEnum.java b/app/src/main/java/com/kunzisoft/keepass/database/SortNodeEnum.java new file mode 100644 index 000000000..8ffab7775 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/SortNodeEnum.java @@ -0,0 +1,390 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ + +package com.kunzisoft.keepass.database; + +import java.util.Comparator; + +public enum SortNodeEnum { + DB, TITLE, USERNAME, CREATION_TIME, LAST_MODIFY_TIME, LAST_ACCESS_TIME; + + public Comparator getNodeComparator(boolean ascending, boolean groupsBefore) { + switch (this) { + case DB: + return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort + default: + case TITLE: + return new NodeTitleComparator(ascending, groupsBefore); + case USERNAME: + return new NodeCreationComparator(ascending, groupsBefore); // TODO Sort + case CREATION_TIME: + return new NodeCreationComparator(ascending, groupsBefore); + case LAST_MODIFY_TIME: + return new NodeLastModificationComparator(ascending, groupsBefore); + case LAST_ACCESS_TIME: + return new NodeLastAccessComparator(ascending, groupsBefore); + } + } + + private static abstract class NodeComparator implements Comparator { + boolean ascending; + boolean groupsBefore; + + NodeComparator(boolean ascending, boolean groupsBefore) { + this.ascending = ascending; + this.groupsBefore = groupsBefore; + } + + int compareWith(Comparator comparatorGroup, + Comparator comparatorEntry, + PwNode object1, + PwNode object2, + int resultOfNodeMethodCompare) { + if (object1.equals(object2)) + return 0; + + if (object1 instanceof PwGroup) { + if (object2 instanceof PwGroup) { + return comparatorGroup + .compare((PwGroup) object1, (PwGroup) object2); + } else if (object2 instanceof PwEntry) { + if(groupsBefore) + return -1; + else + return 1; + } else { + return -1; + } + } else if (object1 instanceof PwEntry) { + if(object2 instanceof PwEntry) { + return comparatorEntry + .compare((PwEntry) object1, (PwEntry) object2); + } else if (object2 instanceof PwGroup) { + if(groupsBefore) + return 1; + else + return -1; + } else { + return -1; + } + } + + // If same name, can be different + if (resultOfNodeMethodCompare == 0) + return object1.hashCode() - object2.hashCode(); + return resultOfNodeMethodCompare; + } + } + + /** + * Comparator of Node by Title, Groups first, Entries second + */ + public static class NodeTitleComparator extends NodeComparator { + + NodeTitleComparator(boolean ascending, boolean groupsBefore) { + super(ascending, groupsBefore); + } + + public int compare(PwNode object1, PwNode object2) { + + return compareWith( + new GroupNameComparator(ascending), + new EntryNameComparator(ascending), + object1, + object2, + object1.getDisplayTitle() + .compareToIgnoreCase(object2.getDisplayTitle())); + } + } + + /** + * Comparator of node by creation, Groups first, Entries second + */ + public static class NodeCreationComparator extends NodeComparator { + + + NodeCreationComparator(boolean ascending, boolean groupsBefore) { + super(ascending, groupsBefore); + } + + @Override + public int compare(PwNode object1, PwNode object2) { + + return compareWith( + new GroupCreationComparator(ascending), + new EntryCreationComparator(ascending), + object1, + object2, + object1.getCreationTime().getDate() + .compareTo(object2.getCreationTime().getDate())); + } + } + + /** + * Comparator of node by last modification, Groups first, Entries second + */ + public static class NodeLastModificationComparator extends NodeComparator { + + NodeLastModificationComparator(boolean ascending, boolean groupsBefore) { + super(ascending, groupsBefore); + } + + @Override + public int compare(PwNode object1, PwNode object2) { + + return compareWith( + new GroupLastModificationComparator(ascending), + new EntryLastModificationComparator(ascending), + object1, + object2, + object1.getLastModificationTime().getDate() + .compareTo(object2.getLastModificationTime().getDate())); + } + } + + /** + * Comparator of node by last access, Groups first, Entries second + */ + public static class NodeLastAccessComparator extends NodeComparator { + + NodeLastAccessComparator(boolean ascending, boolean groupsBefore) { + super(ascending, groupsBefore); + } + + @Override + public int compare(PwNode object1, PwNode object2) { + + return compareWith( + new GroupLastAccessComparator(ascending), + new EntryLastAccessComparator(ascending), + object1, + object2, + object1.getLastAccessTime().getDate() + .compareTo(object2.getLastAccessTime().getDate())); + } + } + + private static abstract class AscendingComparator implements Comparator { + + private boolean ascending; + + AscendingComparator(boolean ascending) { + this.ascending = ascending; + } + + int compareWithAscending(int basicCompareResult) { + // If descending, revert + if (!ascending) + return -basicCompareResult; + + return basicCompareResult; + } + } + + /** + * Group comparator by name + */ + public static class GroupNameComparator extends AscendingComparator { + + GroupNameComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwGroup object1, PwGroup object2) { + if (object1.equals(object2)) + return 0; + + int groupNameComp = object1.getName().compareToIgnoreCase(object2.getName()); + // If same name, can be different + if (groupNameComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(groupNameComp); + } + } + + /** + * Group comparator by name + */ + public static class GroupCreationComparator extends AscendingComparator { + + GroupCreationComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwGroup object1, PwGroup object2) { + if (object1.equals(object2)) + return 0; + + int groupCreationComp = object1.getCreationTime().getDate() + .compareTo(object2.getCreationTime().getDate()); + // If same creation, can be different + if (groupCreationComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(groupCreationComp); + } + } + + /** + * Group comparator by last modification + */ + public static class GroupLastModificationComparator extends AscendingComparator { + + GroupLastModificationComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwGroup object1, PwGroup object2) { + if (object1.equals(object2)) + return 0; + + int groupLastModificationComp = object1.getLastModificationTime().getDate() + .compareTo(object2.getLastModificationTime().getDate()); + // If same creation, can be different + if (groupLastModificationComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(groupLastModificationComp); + } + } + + /** + * Group comparator by last access + */ + public static class GroupLastAccessComparator extends AscendingComparator { + + GroupLastAccessComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwGroup object1, PwGroup object2) { + if (object1.equals(object2)) + return 0; + + int groupLastAccessComp = object1.getLastAccessTime().getDate() + .compareTo(object2.getLastAccessTime().getDate()); + // If same creation, can be different + if (groupLastAccessComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(groupLastAccessComp); + } + } + + /** + * Comparator of Entry by Name + */ + public static class EntryNameComparator extends AscendingComparator { + + EntryNameComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwEntry object1, PwEntry object2) { + if (object1.equals(object2)) + return 0; + + int entryTitleComp = object1.getTitle().compareToIgnoreCase(object2.getTitle()); + // If same title, can be different + if (entryTitleComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(entryTitleComp); + } + } + + /** + * Comparator of Entry by Creation + */ + public static class EntryCreationComparator extends AscendingComparator { + + EntryCreationComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwEntry object1, PwEntry object2) { + if (object1.equals(object2)) + return 0; + + int entryCreationComp = object1.getCreationTime().getDate() + .compareTo(object2.getCreationTime().getDate()); + // If same creation, can be different + if (entryCreationComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(entryCreationComp); + } + } + + /** + * Comparator of Entry by Last Modification + */ + public static class EntryLastModificationComparator extends AscendingComparator { + + EntryLastModificationComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwEntry object1, PwEntry object2) { + if (object1.equals(object2)) + return 0; + + int entryLastModificationComp = object1.getLastModificationTime().getDate() + .compareTo(object2.getLastModificationTime().getDate()); + // If same creation, can be different + if (entryLastModificationComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(entryLastModificationComp); + } + } + + /** + * Comparator of Entry by Last Access + */ + public static class EntryLastAccessComparator extends AscendingComparator { + + EntryLastAccessComparator(boolean ascending) { + super(ascending); + } + + public int compare(PwEntry object1, PwEntry object2) { + if (object1.equals(object2)) + return 0; + + int entryLastAccessComp = object1.getLastAccessTime().getDate() + .compareTo(object2.getLastAccessTime().getDate()); + // If same creation, can be different + if (entryLastAccessComp == 0) { + return object1.hashCode() - object2.hashCode(); + } + + return compareWithAscending(entryLastAccessComp); + } + } +} diff --git a/app/src/main/java/com/keepassdroid/database/edit/AddEntry.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/AddEntry.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/edit/AddEntry.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/AddEntry.java index 7678188f4..353cc42e4 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/AddEntry.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/AddEntry.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEntry; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwEntry; public class AddEntry extends RunnableOnFinish { diff --git a/app/src/main/java/com/keepassdroid/database/edit/AddGroup.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/AddGroup.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/edit/AddGroup.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/AddGroup.java index f7c3b0620..e43c5d35b 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/AddGroup.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/AddGroup.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwGroup; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwGroup; public class AddGroup extends RunnableOnFinish { diff --git a/app/src/main/java/com/kunzisoft/keepass/database/edit/AfterAddNodeOnFinish.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/AfterAddNodeOnFinish.java new file mode 100644 index 000000000..cb31d7807 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/AfterAddNodeOnFinish.java @@ -0,0 +1,32 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.database.edit; + +import android.os.Handler; + +import com.kunzisoft.keepass.database.PwNode; + +public abstract class AfterAddNodeOnFinish extends OnFinish { + public AfterAddNodeOnFinish(Handler handler) { + super(handler); + } + + public abstract void run(PwNode pwNode); +} diff --git a/app/src/main/java/com/keepassdroid/database/edit/CreateDB.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/CreateDB.java similarity index 83% rename from app/src/main/java/com/keepassdroid/database/edit/CreateDB.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/CreateDB.java index 330870bf4..8c9328f70 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/CreateDB.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/CreateDB.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.database.Database; -import com.keepassdroid.app.App; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.utils.UriUtil; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.utils.UriUtil; public class CreateDB extends RunnableOnFinish { diff --git a/app/src/main/java/com/keepassdroid/database/edit/DeleteEntry.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteEntry.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/edit/DeleteEntry.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteEntry.java index 4d2f99c12..832da0b2d 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/DeleteEntry.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteEntry.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwGroup; /** Task to delete entries * @author bpellin diff --git a/app/src/main/java/com/keepassdroid/database/edit/DeleteGroup.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteGroup.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/edit/DeleteGroup.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteGroup.java index d594d51c1..552d8691e 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/DeleteGroup.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/DeleteGroup.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwGroup; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwGroup; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/database/edit/FileOnFinish.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/FileOnFinish.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/edit/FileOnFinish.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/FileOnFinish.java index c07b9651a..beca8c727 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/FileOnFinish.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/FileOnFinish.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.net.Uri; diff --git a/app/src/main/java/com/keepassdroid/database/edit/LoadDB.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/LoadDB.java similarity index 81% rename from app/src/main/java/com/keepassdroid/database/edit/LoadDB.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/LoadDB.java index 3ce55f1c9..f9d42fb6d 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/LoadDB.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/LoadDB.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; import android.content.SharedPreferences; @@ -25,17 +25,17 @@ import android.net.Uri; import android.preference.PreferenceManager; import com.kunzisoft.keepass.R; -import com.keepassdroid.database.Database; -import com.keepassdroid.app.App; -import com.keepassdroid.database.exception.ArcFourException; -import com.keepassdroid.database.exception.ContentFileNotFoundException; -import com.keepassdroid.database.exception.InvalidAlgorithmException; -import com.keepassdroid.database.exception.InvalidDBException; -import com.keepassdroid.database.exception.InvalidDBSignatureException; -import com.keepassdroid.database.exception.InvalidDBVersionException; -import com.keepassdroid.database.exception.InvalidKeyFileException; -import com.keepassdroid.database.exception.InvalidPasswordException; -import com.keepassdroid.database.exception.KeyFileEmptyException; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.exception.ArcFourException; +import com.kunzisoft.keepass.database.exception.ContentFileNotFoundException; +import com.kunzisoft.keepass.database.exception.InvalidAlgorithmException; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.database.exception.InvalidDBSignatureException; +import com.kunzisoft.keepass.database.exception.InvalidDBVersionException; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.database.exception.InvalidPasswordException; +import com.kunzisoft.keepass.database.exception.KeyFileEmptyException; import java.io.FileNotFoundException; import java.io.IOException; diff --git a/app/src/main/java/com/keepassdroid/database/edit/OnFinish.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/OnFinish.java similarity index 94% rename from app/src/main/java/com/keepassdroid/database/edit/OnFinish.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/OnFinish.java index bf4a5972b..030820063 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/OnFinish.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/OnFinish.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; import android.os.Handler; diff --git a/app/src/main/java/com/keepassdroid/database/edit/RunnableOnFinish.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/RunnableOnFinish.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/edit/RunnableOnFinish.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/RunnableOnFinish.java index 54f5040dd..d2802279f 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/RunnableOnFinish.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/RunnableOnFinish.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; -import com.keepassdroid.tasks.UpdateStatus; +import com.kunzisoft.keepass.tasks.UpdateStatus; public abstract class RunnableOnFinish implements Runnable { diff --git a/app/src/main/java/com/keepassdroid/database/edit/SaveDB.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/SaveDB.java similarity index 85% rename from app/src/main/java/com/keepassdroid/database/edit/SaveDB.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/SaveDB.java index 2b981d4fd..636e022ba 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/SaveDB.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/SaveDB.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import java.io.IOException; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.exception.PwDbOutputException; +import java.io.IOException; public class SaveDB extends RunnableOnFinish { private Database mDb; @@ -52,7 +52,7 @@ public class SaveDB extends RunnableOnFinish { if ( ! mDontSave ) { try { - mDb.SaveData(mCtx); + mDb.saveData(mCtx); } catch (IOException e) { finish(false, e.getMessage()); return; diff --git a/app/src/main/java/com/keepassdroid/database/edit/SetPassword.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/SetPassword.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/edit/SetPassword.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/SetPassword.java index 4c52ce5ea..9f2cf70f8 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/SetPassword.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/SetPassword.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,17 +17,17 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; import android.content.DialogInterface; import android.net.Uri; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.exception.InvalidKeyFileException; -import com.keepassdroid.dialogs.PasswordEncodingDialogHelper; -import com.keepassdroid.utils.UriUtil; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.dialogs.PasswordEncodingDialogHelper; +import com.kunzisoft.keepass.utils.UriUtil; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/database/edit/UpdateEntry.java b/app/src/main/java/com/kunzisoft/keepass/database/edit/UpdateEntry.java similarity index 90% rename from app/src/main/java/com/keepassdroid/database/edit/UpdateEntry.java rename to app/src/main/java/com/kunzisoft/keepass/database/edit/UpdateEntry.java index e1a834c93..aef5a4170 100644 --- a/app/src/main/java/com/keepassdroid/database/edit/UpdateEntry.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/edit/UpdateEntry.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.edit; +package com.kunzisoft.keepass.database.edit; import android.content.Context; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEntry; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwEntry; public class UpdateEntry extends RunnableOnFinish { diff --git a/app/src/main/java/com/keepassdroid/database/exception/ArcFourException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/ArcFourException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/ArcFourException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/ArcFourException.java index 0817db5b1..ddc89a682 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/ArcFourException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/ArcFourException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class ArcFourException extends InvalidDBException { diff --git a/app/src/main/java/com/keepassdroid/database/exception/ContentFileNotFoundException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/ContentFileNotFoundException.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/exception/ContentFileNotFoundException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/ContentFileNotFoundException.java index 408cc7c93..1c297218b 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/ContentFileNotFoundException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/ContentFileNotFoundException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; import android.net.Uri; -import com.keepassdroid.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.EmptyUtils; import java.io.FileNotFoundException; diff --git a/app/src/main/java/com/keepassdroid/database/exception/InconsistentDBException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InconsistentDBException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/InconsistentDBException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InconsistentDBException.java index 31bff4b59..317f9f803 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InconsistentDBException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InconsistentDBException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InconsistentDBException extends Exception { diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidAlgorithmException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidAlgorithmException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidAlgorithmException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidAlgorithmException.java index 921c8d76e..bf389ab0f 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidAlgorithmException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidAlgorithmException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InvalidAlgorithmException extends InvalidDBException { /** diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBException.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidDBException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBException.java index cfe644270..3e42b7167 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InvalidDBException extends Exception { diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBSignatureException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBSignatureException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidDBSignatureException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBSignatureException.java index 80702ffaf..6b65c7bf6 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBSignatureException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBSignatureException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InvalidDBSignatureException extends InvalidDBException { /** diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBVersionException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBVersionException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidDBVersionException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBVersionException.java index 3309040f4..8f9f2f04b 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidDBVersionException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidDBVersionException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InvalidDBVersionException extends InvalidDBException { /** diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidKeyFileException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidKeyFileException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidKeyFileException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidKeyFileException.java index ae05baf94..88c5db652 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidKeyFileException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidKeyFileException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with KeePass DX. If not, see . * - */package com.keepassdroid.database.exception; + */package com.kunzisoft.keepass.database.exception; public class InvalidKeyFileException extends InvalidDBException { /** diff --git a/app/src/main/java/com/keepassdroid/database/exception/InvalidPasswordException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidPasswordException.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/exception/InvalidPasswordException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidPasswordException.java index dd07375ae..0b5f475c9 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/InvalidPasswordException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/InvalidPasswordException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class InvalidPasswordException extends InvalidDBException { diff --git a/app/src/main/java/com/keepassdroid/database/exception/KeyFileEmptyException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/KeyFileEmptyException.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/exception/KeyFileEmptyException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/KeyFileEmptyException.java index d4c69a394..1926f6ca0 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/KeyFileEmptyException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/KeyFileEmptyException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class KeyFileEmptyException extends InvalidKeyFileException { /** diff --git a/app/src/main/java/com/keepassdroid/database/exception/PwDbOutputException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/PwDbOutputException.java similarity index 90% rename from app/src/main/java/com/keepassdroid/database/exception/PwDbOutputException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/PwDbOutputException.java index 165add114..e82c6fdfa 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/PwDbOutputException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/PwDbOutputException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class PwDbOutputException extends Exception { public PwDbOutputException(String string) { diff --git a/app/src/main/java/com/keepassdroid/database/exception/SamsungClipboardException.java b/app/src/main/java/com/kunzisoft/keepass/database/exception/SamsungClipboardException.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/exception/SamsungClipboardException.java rename to app/src/main/java/com/kunzisoft/keepass/database/exception/SamsungClipboardException.java index 4f1c3b7f4..0bf93fe3f 100644 --- a/app/src/main/java/com/keepassdroid/database/exception/SamsungClipboardException.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/exception/SamsungClipboardException.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.exception; +package com.kunzisoft.keepass.database.exception; public class SamsungClipboardException extends Exception { diff --git a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIterator.java b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIterator.java similarity index 82% rename from app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIterator.java rename to app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIterator.java index dfd500377..36ae095a4 100644 --- a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIterator.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIterator.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.iterator; +package com.kunzisoft.keepass.database.iterator; + +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.SearchParameters; +import com.kunzisoft.keepass.database.SearchParametersV4; import java.util.Iterator; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.SearchParameters; -import com.keepassdroid.database.SearchParametersV4; - public abstract class EntrySearchStringIterator implements Iterator { public static EntrySearchStringIterator getInstance(PwEntry e) { diff --git a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV3.java b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV3.java similarity index 91% rename from app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV3.java index 8a55a1cc7..acfbfc5cc 100644 --- a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.iterator; +package com.kunzisoft.keepass.database.iterator; + +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.SearchParameters; import java.util.NoSuchElementException; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.database.SearchParameters; - public class EntrySearchStringIteratorV3 extends EntrySearchStringIterator { - private PwEntryV3 entry; + private PwEntryV3 entry; private SearchParameters sp; public EntrySearchStringIteratorV3(PwEntryV3 entry) { diff --git a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV4.java b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV4.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV4.java index 6d947b777..a73e69dc8 100644 --- a/app/src/main/java/com/keepassdroid/database/iterator/EntrySearchStringIteratorV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/iterator/EntrySearchStringIteratorV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.iterator; +package com.kunzisoft.keepass.database.iterator; + +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.SearchParametersV4; +import com.kunzisoft.keepass.database.security.ProtectedString; import java.util.Iterator; import java.util.Map.Entry; import java.util.NoSuchElementException; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.SearchParametersV4; -import com.keepassdroid.database.security.ProtectedString; - public class EntrySearchStringIteratorV4 extends EntrySearchStringIterator { private String current; diff --git a/app/src/main/java/com/keepassdroid/database/load/Importer.java b/app/src/main/java/com/kunzisoft/keepass/database/load/Importer.java similarity index 63% rename from app/src/main/java/com/keepassdroid/database/load/Importer.java rename to app/src/main/java/com/kunzisoft/keepass/database/load/Importer.java index 1af6b6eca..2fe04613c 100644 --- a/app/src/main/java/com/keepassdroid/database/load/Importer.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/load/Importer.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,23 +17,23 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.load; +package com.kunzisoft.keepass.database.load; + +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.tasks.UpdateStatus; import java.io.IOException; import java.io.InputStream; -import com.keepassdroid.tasks.UpdateStatus; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.exception.InvalidDBException; - public abstract class Importer { public static final boolean DEBUG = true; - public abstract PwDatabase openDatabase( InputStream inStream, String password, InputStream keyInputStream) + public abstract PwDatabase openDatabase(InputStream inStream, String password, InputStream keyInputStream) throws IOException, InvalidDBException; - public abstract PwDatabase openDatabase( InputStream inStream, String password, InputStream keyInputStream, UpdateStatus status, long roundsFix) + public abstract PwDatabase openDatabase(InputStream inStream, String password, InputStream keyInputStream, UpdateStatus status, long roundsFix) throws IOException, InvalidDBException; diff --git a/app/src/main/java/com/keepassdroid/database/load/ImporterFactory.java b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterFactory.java similarity index 80% rename from app/src/main/java/com/keepassdroid/database/load/ImporterFactory.java rename to app/src/main/java/com/kunzisoft/keepass/database/load/ImporterFactory.java index 2dc5723cc..adfe548f6 100644 --- a/app/src/main/java/com/keepassdroid/database/load/ImporterFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.load; +package com.kunzisoft.keepass.database.load; + +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.database.PwDbHeaderV4; +import com.kunzisoft.keepass.database.exception.InvalidDBSignatureException; +import com.kunzisoft.keepass.stream.LEDataInputStream; import java.io.IOException; import java.io.InputStream; -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.database.PwDbHeaderV4; -import com.keepassdroid.database.exception.InvalidDBSignatureException; -import com.keepassdroid.stream.LEDataInputStream; - public class ImporterFactory { public static Importer createImporter(InputStream is) throws InvalidDBSignatureException, IOException { diff --git a/app/src/main/java/com/keepassdroid/database/load/ImporterV3.java b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3.java similarity index 87% rename from app/src/main/java/com/keepassdroid/database/load/ImporterV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3.java index 1c6f6f489..ee15c2df2 100644 --- a/app/src/main/java/com/keepassdroid/database/load/ImporterV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -43,7 +43,30 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -package com.keepassdroid.database.load; +package com.kunzisoft.keepass.database.load; + +import android.util.Log; + +import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwDate; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.PwGroupV3; +import com.kunzisoft.keepass.database.exception.InvalidAlgorithmException; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.database.exception.InvalidDBSignatureException; +import com.kunzisoft.keepass.database.exception.InvalidDBVersionException; +import com.kunzisoft.keepass.database.exception.InvalidKeyFileException; +import com.kunzisoft.keepass.database.exception.InvalidPasswordException; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.stream.NullOutputStream; +import com.kunzisoft.keepass.tasks.UpdateStatus; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.InputStream; @@ -63,29 +86,6 @@ import javax.crypto.ShortBufferException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import android.util.Log; - -import com.kunzisoft.keepass.R; -import com.keepassdroid.tasks.UpdateStatus; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwDate; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.database.PwEncryptionAlgorithm; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.database.PwGroupV3; -import com.keepassdroid.database.exception.InvalidAlgorithmException; -import com.keepassdroid.database.exception.InvalidDBException; -import com.keepassdroid.database.exception.InvalidDBSignatureException; -import com.keepassdroid.database.exception.InvalidDBVersionException; -import com.keepassdroid.database.exception.InvalidKeyFileException; -import com.keepassdroid.database.exception.InvalidPasswordException; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.stream.NullOutputStream; -import com.keepassdroid.utils.Types; - /** * Load a v3 database file. * @@ -94,6 +94,8 @@ import com.keepassdroid.utils.Types; */ public class ImporterV3 extends Importer { + private static final String TAG = ImporterV3.class.getName(); + public ImporterV3() { super(); } @@ -110,11 +112,11 @@ public class ImporterV3 extends Importer { * @return new PwDatabaseV3 container. * * @throws IOException on any file error. - * @throws InvalidKeyFileException - * @throws InvalidPasswordException + * @throws InvalidKeyFileException + * @throws InvalidPasswordException * @throws InvalidPasswordException on a decryption error, or possible internal bug. - * @throws InvalidDBSignatureException - * @throws InvalidDBVersionException + * @throws InvalidDBSignatureException + * @throws InvalidDBVersionException * @throws IllegalBlockSizeException on a decryption error, or possible internal bug. * @throws BadPaddingException on a decryption error, or possible internal bug. * @throws NoSuchAlgorithmException on a decryption error, or possible internal bug. @@ -160,7 +162,7 @@ public class ImporterV3 extends Importer { // Select algorithm if( (hdr.flags & PwDbHeaderV3.FLAG_RIJNDAEL) != 0 ) { - newManager.setEncryptionAlgorithm(PwEncryptionAlgorithm.Rjindal); + newManager.setEncryptionAlgorithm(PwEncryptionAlgorithm.AES_Rijndael); } else if( (hdr.flags & PwDbHeaderV3.FLAG_TWOFISH) != 0 ) { newManager.setEncryptionAlgorithm(PwEncryptionAlgorithm.Twofish); } else { @@ -170,18 +172,16 @@ public class ImporterV3 extends Importer { // Copy for testing newManager.copyHeader(hdr); - newManager.setNumKeyEncRounds(hdr.numKeyEncRounds); - - newManager.setName("KeePass Password Manager"); // TODO as resource; + newManager.setNumberKeyEncryptionRounds(hdr.numKeyEncRounds); // Generate transformedMasterKey from masterKey - newManager.makeFinalKey(hdr.masterSeed, hdr.transformSeed, newManager.getNumKeyEncRounds()); + newManager.makeFinalKey(hdr.masterSeed, hdr.transformSeed, newManager.getNumberKeyEncryptionRounds()); status.updateMessage(R.string.decrypting_db); // Initialize Rijndael algorithm Cipher cipher; try { - if ( newManager.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Rjindal ) { + if ( newManager.getEncryptionAlgorithm() == PwEncryptionAlgorithm.AES_Rijndael) { cipher = CipherFactory.getInstance("AES/CBC/PKCS5Padding"); } else if ( newManager.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Twofish ) { cipher = CipherFactory.getInstance("Twofish/CBC/PKCS7PADDING"); @@ -232,7 +232,7 @@ public class ImporterV3 extends Importer { if( ! Arrays.equals(hash, hdr.contentsHash) ) { - Log.w("KeePassDroid","Database file did not decrypt correctly. (checksum code is broken)"); + Log.w(TAG,"Database file did not decrypt correctly. (checksum code is broken)"); throw new InvalidPasswordException(); } diff --git a/app/src/main/java/com/keepassdroid/database/load/ImporterV3Debug.java b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3Debug.java similarity index 71% rename from app/src/main/java/com/keepassdroid/database/load/ImporterV3Debug.java rename to app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3Debug.java index baf7e391a..df7a4609b 100644 --- a/app/src/main/java/com/keepassdroid/database/load/ImporterV3Debug.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV3Debug.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.load; +package com.kunzisoft.keepass.database.load; + +import com.kunzisoft.keepass.database.PwDatabaseV3Debug; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.tasks.UpdateStatus; import java.io.IOException; import java.io.InputStream; -import com.keepassdroid.tasks.UpdateStatus; -import com.keepassdroid.database.PwDatabaseV3Debug; -import com.keepassdroid.database.exception.InvalidDBException; - public class ImporterV3Debug extends ImporterV3 { @Override @@ -35,8 +35,8 @@ public class ImporterV3Debug extends ImporterV3 { @Override public PwDatabaseV3Debug openDatabase(InputStream inStream, String password, - InputStream keyInputStream, UpdateStatus status, long roundsFix) throws IOException, - InvalidDBException { + InputStream keyInputStream, UpdateStatus status, long roundsFix) throws IOException, + InvalidDBException { return (PwDatabaseV3Debug) super.openDatabase(inStream, password, keyInputStream, status, roundsFix); } diff --git a/app/src/main/java/com/keepassdroid/database/load/ImporterV4.java b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV4.java similarity index 66% rename from app/src/main/java/com/keepassdroid/database/load/ImporterV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV4.java index 725d689ad..5d98c2a46 100644 --- a/app/src/main/java/com/keepassdroid/database/load/ImporterV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/load/ImporterV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,36 +17,36 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.load; +package com.kunzisoft.keepass.database.load; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.crypto.PwStreamCipherFactory; -import com.keepassdroid.crypto.engine.CipherEngine; -import com.keepassdroid.database.ITimeLogger; -import com.keepassdroid.database.PwCompressionAlgorithm; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwDatabaseV4XML; -import com.keepassdroid.database.PwDate; -import com.keepassdroid.database.PwDbHeaderV4; -import com.keepassdroid.database.PwDeletedObject; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.PwGroupV4; -import com.keepassdroid.database.PwIconCustom; -import com.keepassdroid.database.exception.ArcFourException; -import com.keepassdroid.database.exception.InvalidDBException; -import com.keepassdroid.database.exception.InvalidPasswordException; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.stream.BetterCipherInputStream; -import com.keepassdroid.stream.HashedBlockInputStream; -import com.keepassdroid.stream.HmacBlockInputStream; -import com.keepassdroid.stream.LEDataInputStream; -import com.keepassdroid.tasks.UpdateStatus; -import com.keepassdroid.utils.DateUtil; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.MemUtil; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.crypto.PwStreamCipherFactory; +import com.kunzisoft.keepass.crypto.engine.CipherEngine; +import com.kunzisoft.keepass.database.ITimeLogger; +import com.kunzisoft.keepass.database.PwCompressionAlgorithm; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwDatabaseV4XML; +import com.kunzisoft.keepass.database.PwDate; +import com.kunzisoft.keepass.database.PwDbHeaderV4; +import com.kunzisoft.keepass.database.PwDeletedObject; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwGroupV4; +import com.kunzisoft.keepass.database.PwIconCustom; +import com.kunzisoft.keepass.database.exception.ArcFourException; +import com.kunzisoft.keepass.database.exception.InvalidDBException; +import com.kunzisoft.keepass.database.exception.InvalidPasswordException; +import com.kunzisoft.keepass.database.security.ProtectedBinary; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.stream.BetterCipherInputStream; +import com.kunzisoft.keepass.stream.HashedBlockInputStream; +import com.kunzisoft.keepass.stream.HmacBlockInputStream; +import com.kunzisoft.keepass.stream.LEDataInputStream; +import com.kunzisoft.keepass.tasks.UpdateStatus; +import com.kunzisoft.keepass.utils.DateUtil; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.MemUtil; +import com.kunzisoft.keepass.utils.Types; import org.spongycastle.crypto.StreamCipher; import org.xmlpull.v1.XmlPullParser; @@ -73,92 +73,6 @@ import javax.crypto.NoSuchPaddingException; import biz.source_code.base64Coder.Base64Coder; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrCompressed; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrId; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrProtected; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrRef; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoType; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeDefaultSeq; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeEnabled; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeObfuscation; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBgColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBinaries; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBinary; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCreationTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomData; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconID; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItemData; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItemID; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIcons; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDefaultUser; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDefaultUserChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDesc; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDescChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChangeForce; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChangeForceOnce; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChangeRec; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbMntncHistoryDays; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbNameChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletedObject; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletedObjects; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletionTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDocNode; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEnableAutoType; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEnableSearching; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntry; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntryTemplatesGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntryTemplatesGroupChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemExpires; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemExpiryTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemFgColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGenerator; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGroupDefaultAutoTypeSeq; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHeaderHash; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistory; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistoryMaxItems; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistoryMaxSize; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemIcon; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemIsExpanded; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemKey; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemKeystrokeSequence; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastAccessTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastModTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastSelectedGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastTopVisibleEntry; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastTopVisibleGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLocationChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemMemoryProt; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemMeta; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemNotes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemOverrideUrl; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtAutoHide; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtNotes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtPassword; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtTitle; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtURL; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtUserName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinEnabled; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinUuid; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRoot; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemSettingsChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemString; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemStringDictExItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemTags; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemTimes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemUsageCount; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemUuid; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemValue; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemWindow; -import static com.keepassdroid.database.PwDatabaseV4XML.ValTrue; - public class ImporterV4 extends Importer { private StreamCipher randomStream; @@ -465,15 +379,15 @@ public class ImporterV4 extends Importer { String name = xpp.getName(); switch (ctx) { case Null: - if ( name.equalsIgnoreCase(ElemDocNode) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDocNode) ) { return SwitchContext(ctx, KdbContext.KeePassFile, xpp); } else ReadUnknown(xpp); break; case KeePassFile: - if ( name.equalsIgnoreCase(ElemMeta) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemMeta) ) { return SwitchContext(ctx, KdbContext.Meta, xpp); - } else if ( name.equalsIgnoreCase(ElemRoot) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemRoot) ) { return SwitchContext(ctx, KdbContext.Root, xpp); } else { ReadUnknown(xpp); @@ -481,9 +395,9 @@ public class ImporterV4 extends Importer { break; case Meta: - if ( name.equalsIgnoreCase(ElemGenerator) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemGenerator) ) { ReadString(xpp); // Ignore - } else if ( name.equalsIgnoreCase(ElemHeaderHash) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemHeaderHash) ) { String encodedHash = ReadString(xpp); if (!EmptyUtils.isNullOrEmpty(encodedHash) && (hashOfHeader != null)) { byte[] hash = Base64Coder.decode(encodedHash); @@ -491,74 +405,74 @@ public class ImporterV4 extends Importer { throw new InvalidDBException(); } } - } else if (name.equalsIgnoreCase(ElemSettingsChanged)) { + } else if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemSettingsChanged)) { db.setSettingsChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbName) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbName) ) { db.setName(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbNameChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbNameChanged) ) { db.setNameChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbDesc) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbDesc) ) { db.setDescription(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbDescChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbDescChanged) ) { db.setDescriptionChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbDefaultUser) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbDefaultUser) ) { db.setDefaultUserName(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbDefaultUserChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbDefaultUserChanged) ) { db.setDefaultUserNameChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbColor)) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbColor)) { // TODO: Add support to interpret the color if we want to allow changing the database color db.setColor(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbMntncHistoryDays) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbMntncHistoryDays) ) { db.setMaintenanceHistoryDays(ReadUInt(xpp, DEFAULT_HISTORY_DAYS)); - } else if ( name.equalsIgnoreCase(ElemDbKeyChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbKeyChanged) ) { db.setKeyLastChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemDbKeyChangeRec) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbKeyChangeRec) ) { db.setKeyChangeRecDays(ReadLong(xpp, -1)); - } else if ( name.equalsIgnoreCase(ElemDbKeyChangeForce) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbKeyChangeForce) ) { db.setKeyChangeForceDays(ReadLong(xpp, -1)); - } else if ( name.equalsIgnoreCase(ElemDbKeyChangeForceOnce) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDbKeyChangeForceOnce) ) { db.setKeyChangeForceOnce(ReadBool(xpp, false)); - } else if ( name.equalsIgnoreCase(ElemMemoryProt) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemMemoryProt) ) { return SwitchContext(ctx, KdbContext.MemoryProtection, xpp); - } else if ( name.equalsIgnoreCase(ElemCustomIcons) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIcons) ) { return SwitchContext(ctx, KdbContext.CustomIcons, xpp); - } else if ( name.equalsIgnoreCase(ElemRecycleBinEnabled) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemRecycleBinEnabled) ) { db.setRecycleBinEnabled(ReadBool(xpp, true)); - } else if ( name.equalsIgnoreCase(ElemRecycleBinUuid) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemRecycleBinUuid) ) { db.setRecycleBinUUID(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemRecycleBinChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemRecycleBinChanged) ) { db.setRecycleBinChanged(ReadTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemEntryTemplatesGroup) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEntryTemplatesGroup) ) { db.setEntryTemplatesGroup(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemEntryTemplatesGroupChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEntryTemplatesGroupChanged) ) { db.setEntryTemplatesGroupChanged(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemHistoryMaxItems) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemHistoryMaxItems) ) { db.setHistoryMaxItems(ReadInt(xpp, -1)); - } else if ( name.equalsIgnoreCase(ElemHistoryMaxSize) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemHistoryMaxSize) ) { db.setHistoryMaxSize(ReadLong(xpp, -1)); - } else if ( name.equalsIgnoreCase(ElemLastSelectedGroup) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLastSelectedGroup) ) { db.setLastSelectedGroup(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemLastTopVisibleGroup) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLastTopVisibleGroup) ) { db.setLastTopVisibleGroup(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemBinaries) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemBinaries) ) { return SwitchContext(ctx, KdbContext.Binaries, xpp); - } else if ( name.equalsIgnoreCase(ElemCustomData) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData) ) { return SwitchContext(ctx, KdbContext.CustomData, xpp); } break; case MemoryProtection: - if ( name.equalsIgnoreCase(ElemProtTitle) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtTitle) ) { db.getMemoryProtection().protectTitle = ReadBool(xpp, false); - } else if ( name.equalsIgnoreCase(ElemProtUserName) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtUserName) ) { db.getMemoryProtection().protectUserName = ReadBool(xpp, false); - } else if ( name.equalsIgnoreCase(ElemProtPassword) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtPassword) ) { db.getMemoryProtection().protectPassword = ReadBool(xpp, false); - } else if ( name.equalsIgnoreCase(ElemProtURL) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtURL) ) { db.getMemoryProtection().protectUrl = ReadBool(xpp, false); - } else if ( name.equalsIgnoreCase(ElemProtNotes) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtNotes) ) { db.getMemoryProtection().protectNotes = ReadBool(xpp, false); - } else if ( name.equalsIgnoreCase(ElemProtAutoHide) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemProtAutoHide) ) { db.getMemoryProtection().autoEnableVisualHiding = ReadBool(xpp, false); } else { ReadUnknown(xpp); @@ -566,7 +480,7 @@ public class ImporterV4 extends Importer { break; case CustomIcons: - if ( name.equalsIgnoreCase(ElemCustomIconItem) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconItem) ) { return SwitchContext(ctx, KdbContext.CustomIcon, xpp); } else { ReadUnknown(xpp); @@ -574,9 +488,9 @@ public class ImporterV4 extends Importer { break; case CustomIcon: - if ( name.equalsIgnoreCase(ElemCustomIconItemID) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconItemID) ) { customIconID = ReadUuid(xpp); - } else if ( name.equalsIgnoreCase(ElemCustomIconItemData) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconItemData) ) { String strData = ReadString(xpp); if ( strData != null && strData.length() > 0 ) { customIconData = Base64Coder.decode(strData); @@ -589,8 +503,8 @@ public class ImporterV4 extends Importer { break; case Binaries: - if ( name.equalsIgnoreCase(ElemBinary) ) { - String key = xpp.getAttributeValue(null, AttrId); + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemBinary) ) { + String key = xpp.getAttributeValue(null, PwDatabaseV4XML.AttrId); if ( key != null ) { ProtectedBinary pbData = ReadProtectedBinary(xpp); int id = Integer.parseInt(key); @@ -605,7 +519,7 @@ public class ImporterV4 extends Importer { break; case CustomData: - if ( name.equalsIgnoreCase(ElemStringDictExItem) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem) ) { return SwitchContext(ctx, KdbContext.CustomDataItem, xpp); } else { ReadUnknown(xpp); @@ -613,9 +527,9 @@ public class ImporterV4 extends Importer { break; case CustomDataItem: - if ( name.equalsIgnoreCase(ElemKey) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemKey) ) { customDataKey = ReadString(xpp); - } else if ( name.equalsIgnoreCase(ElemValue) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemValue) ) { customDataValue = ReadString(xpp); } else { ReadUnknown(xpp); @@ -623,7 +537,7 @@ public class ImporterV4 extends Importer { break; case Root: - if ( name.equalsIgnoreCase(ElemGroup) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemGroup) ) { assert(ctxGroups.size() == 0); if ( ctxGroups.size() != 0 ) throw new IOException("Group list should be empty."); @@ -632,7 +546,7 @@ public class ImporterV4 extends Importer { ctxGroup = ctxGroups.peek(); return SwitchContext(ctx, KdbContext.Group, xpp); - } else if ( name.equalsIgnoreCase(ElemDeletedObjects) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDeletedObjects) ) { return SwitchContext(ctx, KdbContext.RootDeletedObjects, xpp); } else { ReadUnknown(xpp); @@ -640,37 +554,37 @@ public class ImporterV4 extends Importer { break; case Group: - if ( name.equalsIgnoreCase(ElemUuid) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemUuid) ) { ctxGroup.setUUID(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemName) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemName) ) { ctxGroup.setName(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemNotes) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemNotes) ) { ctxGroup.setNotes(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemIcon) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemIcon) ) { ctxGroup.setIcon(db.getIconFactory().getIcon((int)ReadUInt(xpp, 0))); - } else if ( name.equalsIgnoreCase(ElemCustomIconID) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconID) ) { ctxGroup.setCustomIcon(db.getIconFactory().getIcon(ReadUuid(xpp))); - } else if ( name.equalsIgnoreCase(ElemTimes) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemTimes) ) { return SwitchContext(ctx, KdbContext.GroupTimes, xpp); - } else if ( name.equalsIgnoreCase(ElemIsExpanded) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemIsExpanded) ) { ctxGroup.setExpanded(ReadBool(xpp, true)); - } else if ( name.equalsIgnoreCase(ElemGroupDefaultAutoTypeSeq) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemGroupDefaultAutoTypeSeq) ) { ctxGroup.setDefaultAutoTypeSequence(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemEnableAutoType) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEnableAutoType) ) { ctxGroup.setEnableAutoType(StringToBoolean(ReadString(xpp))); - } else if ( name.equalsIgnoreCase(ElemEnableSearching) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEnableSearching) ) { ctxGroup.setEnableSearching(StringToBoolean(ReadString(xpp))); - } else if ( name.equalsIgnoreCase(ElemLastTopVisibleEntry) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLastTopVisibleEntry) ) { ctxGroup.setLastTopVisibleEntry(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemCustomData) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData) ) { return SwitchContext(ctx, KdbContext.GroupCustomData, xpp); - } else if ( name.equalsIgnoreCase(ElemGroup) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemGroup) ) { ctxGroup = new PwGroupV4(); ctxGroups.peek().addGroup(ctxGroup); ctxGroups.push(ctxGroup); return SwitchContext(ctx, KdbContext.Group, xpp); - } else if ( name.equalsIgnoreCase(ElemEntry) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEntry) ) { ctxEntry = new PwEntryV4(); ctxGroup.addEntry(ctxEntry); @@ -681,16 +595,16 @@ public class ImporterV4 extends Importer { } break; case GroupCustomData: - if (name.equalsIgnoreCase(ElemStringDictExItem)) { + if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem)) { return SwitchContext(ctx, KdbContext.GroupCustomDataItem, xpp); } else { ReadUnknown(xpp); } break; case GroupCustomDataItem: - if (name.equalsIgnoreCase(ElemKey)) { + if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemKey)) { groupCustomDataKey = ReadString(xpp); - } else if (name.equalsIgnoreCase(ElemValue)) { + } else if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemValue)) { groupCustomDataValue = ReadString(xpp); } else { ReadUnknown(xpp); @@ -699,31 +613,31 @@ public class ImporterV4 extends Importer { case Entry: - if ( name.equalsIgnoreCase(ElemUuid) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemUuid) ) { ctxEntry.setUUID(ReadUuid(xpp)); - } else if ( name.equalsIgnoreCase(ElemIcon) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemIcon) ) { ctxEntry.setIcon(db.getIconFactory().getIcon((int)ReadUInt(xpp, 0))); - } else if ( name.equalsIgnoreCase(ElemCustomIconID) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconID) ) { ctxEntry.setCustomIcon(db.getIconFactory().getIcon(ReadUuid(xpp))); - } else if ( name.equalsIgnoreCase(ElemFgColor) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemFgColor) ) { ctxEntry.setForegroundColor(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemBgColor) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemBgColor) ) { ctxEntry.setBackgroupColor(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemOverrideUrl) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemOverrideUrl) ) { ctxEntry.setOverrideURL(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemTags) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemTags) ) { ctxEntry.setTags(ReadString(xpp)); - } else if ( name.equalsIgnoreCase(ElemTimes) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemTimes) ) { return SwitchContext(ctx, KdbContext.EntryTimes, xpp); - } else if ( name.equalsIgnoreCase(ElemString) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemString) ) { return SwitchContext(ctx, KdbContext.EntryString, xpp); - } else if ( name.equalsIgnoreCase(ElemBinary) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemBinary) ) { return SwitchContext(ctx, KdbContext.EntryBinary, xpp); - } else if ( name.equalsIgnoreCase(ElemAutoType) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoType) ) { return SwitchContext(ctx, KdbContext.EntryAutoType, xpp); - } else if ( name.equalsIgnoreCase(ElemCustomData)) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData)) { return SwitchContext(ctx, KdbContext.EntryCustomData, xpp); - } else if ( name.equalsIgnoreCase(ElemHistory) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemHistory) ) { assert(!entryInHistory); if ( ! entryInHistory ) { @@ -737,16 +651,16 @@ public class ImporterV4 extends Importer { } break; case EntryCustomData: - if (name.equalsIgnoreCase(ElemStringDictExItem)) { + if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem)) { return SwitchContext(ctx, KdbContext.EntryCustomDataItem, xpp); } else { ReadUnknown(xpp); } break; case EntryCustomDataItem: - if (name.equalsIgnoreCase(ElemKey)) { + if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemKey)) { entryCustomDataKey = ReadString(xpp); - } else if (name.equalsIgnoreCase(ElemValue)) { + } else if (name.equalsIgnoreCase(PwDatabaseV4XML.ElemValue)) { entryCustomDataValue = ReadString(xpp); } else { ReadUnknown(xpp); @@ -762,19 +676,19 @@ public class ImporterV4 extends Importer { tl = ctxEntry; } - if ( name.equalsIgnoreCase(ElemLastModTime) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLastModTime) ) { tl.setLastModificationTime(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemCreationTime) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemCreationTime) ) { tl.setCreationTime(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemLastAccessTime) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLastAccessTime) ) { tl.setLastAccessTime(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemExpiryTime) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemExpiryTime) ) { tl.setExpiryTime(ReadPwTime(xpp)); - } else if ( name.equalsIgnoreCase(ElemExpires) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemExpires) ) { tl.setExpires(ReadBool(xpp, false)); - } else if ( name.equalsIgnoreCase(ElemUsageCount) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemUsageCount) ) { tl.setUsageCount(ReadULong(xpp, 0)); - } else if ( name.equalsIgnoreCase(ElemLocationChanged) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemLocationChanged) ) { tl.setLocationChanged(ReadPwTime(xpp)); } else { ReadUnknown(xpp); @@ -782,9 +696,9 @@ public class ImporterV4 extends Importer { break; case EntryString: - if ( name.equalsIgnoreCase(ElemKey) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemKey) ) { ctxStringName = ReadString(xpp); - } else if ( name.equalsIgnoreCase(ElemValue) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemValue) ) { ctxStringValue = ReadProtectedString(xpp); } else { ReadUnknown(xpp); @@ -792,21 +706,21 @@ public class ImporterV4 extends Importer { break; case EntryBinary: - if ( name.equalsIgnoreCase(ElemKey) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemKey) ) { ctxBinaryName = ReadString(xpp); - } else if ( name.equalsIgnoreCase(ElemValue) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemValue) ) { ctxBinaryValue = ReadProtectedBinary(xpp); } break; case EntryAutoType: - if ( name.equalsIgnoreCase(ElemAutoTypeEnabled) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoTypeEnabled) ) { ctxEntry.getAutoType().enabled = ReadBool(xpp, true); - } else if ( name.equalsIgnoreCase(ElemAutoTypeObfuscation) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoTypeObfuscation) ) { ctxEntry.getAutoType().obfuscationOptions = ReadUInt(xpp, 0); - } else if ( name.equalsIgnoreCase(ElemAutoTypeDefaultSeq) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoTypeDefaultSeq) ) { ctxEntry.getAutoType().defaultSequence = ReadString(xpp); - } else if ( name.equalsIgnoreCase(ElemAutoTypeItem) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoTypeItem) ) { return SwitchContext(ctx, KdbContext.EntryAutoTypeItem, xpp); } else { ReadUnknown(xpp); @@ -814,9 +728,9 @@ public class ImporterV4 extends Importer { break; case EntryAutoTypeItem: - if ( name.equalsIgnoreCase(ElemWindow) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemWindow) ) { ctxATName = ReadString(xpp); - } else if ( name.equalsIgnoreCase(ElemKeystrokeSequence) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemKeystrokeSequence) ) { ctxATSeq = ReadString(xpp); } else { ReadUnknown(xpp); @@ -824,7 +738,7 @@ public class ImporterV4 extends Importer { break; case EntryHistory: - if ( name.equalsIgnoreCase(ElemEntry) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemEntry) ) { ctxEntry = new PwEntryV4(); ctxHistoryBase.addToHistory(ctxEntry); @@ -836,7 +750,7 @@ public class ImporterV4 extends Importer { break; case RootDeletedObjects: - if ( name.equalsIgnoreCase(ElemDeletedObject) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDeletedObject) ) { ctxDeletedObject = new PwDeletedObject(); db.addDeletedObject(ctxDeletedObject); @@ -847,9 +761,9 @@ public class ImporterV4 extends Importer { break; case DeletedObject: - if ( name.equalsIgnoreCase(ElemUuid) ) { + if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemUuid) ) { ctxDeletedObject.uuid = ReadUuid(xpp); - } else if ( name.equalsIgnoreCase(ElemDeletionTime) ) { + } else if ( name.equalsIgnoreCase(PwDatabaseV4XML.ElemDeletionTime) ) { ctxDeletedObject.setDeletionTime(ReadTime(xpp)); } else { ReadUnknown(xpp); @@ -868,17 +782,17 @@ public class ImporterV4 extends Importer { assert(xpp.getEventType() == XmlPullParser.END_TAG); String name = xpp.getName(); - if ( ctx == KdbContext.KeePassFile && name.equalsIgnoreCase(ElemDocNode) ) { + if ( ctx == KdbContext.KeePassFile && name.equalsIgnoreCase(PwDatabaseV4XML.ElemDocNode) ) { return KdbContext.Null; - } else if ( ctx == KdbContext.Meta && name.equalsIgnoreCase(ElemMeta) ) { + } else if ( ctx == KdbContext.Meta && name.equalsIgnoreCase(PwDatabaseV4XML.ElemMeta) ) { return KdbContext.KeePassFile; - } else if ( ctx == KdbContext.Root && name.equalsIgnoreCase(ElemRoot) ) { + } else if ( ctx == KdbContext.Root && name.equalsIgnoreCase(PwDatabaseV4XML.ElemRoot) ) { return KdbContext.KeePassFile; - } else if ( ctx == KdbContext.MemoryProtection && name.equalsIgnoreCase(ElemMemoryProt) ) { + } else if ( ctx == KdbContext.MemoryProtection && name.equalsIgnoreCase(PwDatabaseV4XML.ElemMemoryProt) ) { return KdbContext.Meta; - } else if ( ctx == KdbContext.CustomIcons && name.equalsIgnoreCase(ElemCustomIcons) ) { + } else if ( ctx == KdbContext.CustomIcons && name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIcons) ) { return KdbContext.Meta; - } else if ( ctx == KdbContext.CustomIcon && name.equalsIgnoreCase(ElemCustomIconItem) ) { + } else if ( ctx == KdbContext.CustomIcon && name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomIconItem) ) { if ( ! customIconID.equals(PwDatabase.UUID_ZERO) ) { PwIconCustom icon = new PwIconCustom(customIconID, customIconData); db.addCustomIcon(icon); @@ -889,11 +803,11 @@ public class ImporterV4 extends Importer { customIconData = null; return KdbContext.CustomIcons; - } else if ( ctx == KdbContext.Binaries && name.equalsIgnoreCase(ElemBinaries) ) { + } else if ( ctx == KdbContext.Binaries && name.equalsIgnoreCase(PwDatabaseV4XML.ElemBinaries) ) { return KdbContext.Meta; - } else if ( ctx == KdbContext.CustomData && name.equalsIgnoreCase(ElemCustomData) ) { + } else if ( ctx == KdbContext.CustomData && name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData) ) { return KdbContext.Meta; - } else if ( ctx == KdbContext.CustomDataItem && name.equalsIgnoreCase(ElemStringDictExItem) ) { + } else if ( ctx == KdbContext.CustomDataItem && name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem) ) { if ( customDataKey != null && customDataValue != null) { db.putCustomData(customDataKey, customDataValue); } else assert(false); @@ -902,7 +816,7 @@ public class ImporterV4 extends Importer { customDataValue = null; return KdbContext.CustomData; - } else if ( ctx == KdbContext.Group && name.equalsIgnoreCase(ElemGroup) ) { + } else if ( ctx == KdbContext.Group && name.equalsIgnoreCase(PwDatabaseV4XML.ElemGroup) ) { if ( ctxGroup.getUUID() == null || ctxGroup.getUUID().equals(PwDatabase.UUID_ZERO) ) { ctxGroup.setUUID(UUID.randomUUID()); } @@ -916,11 +830,11 @@ public class ImporterV4 extends Importer { ctxGroup = ctxGroups.peek(); return KdbContext.Group; } - } else if ( ctx == KdbContext.GroupTimes && name.equalsIgnoreCase(ElemTimes) ) { + } else if ( ctx == KdbContext.GroupTimes && name.equalsIgnoreCase(PwDatabaseV4XML.ElemTimes) ) { return KdbContext.Group; - } else if ( ctx == KdbContext.GroupCustomData && name.equalsIgnoreCase(ElemCustomData) ) { + } else if ( ctx == KdbContext.GroupCustomData && name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData) ) { return KdbContext.Group; - } else if ( ctx == KdbContext.GroupCustomDataItem && name.equalsIgnoreCase(ElemStringDictExItem)) { + } else if ( ctx == KdbContext.GroupCustomDataItem && name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem)) { if (groupCustomDataKey != null && groupCustomDataValue != null) { ctxGroup.putCustomData(groupCustomDataKey, groupCustomDataKey); } else { @@ -932,7 +846,7 @@ public class ImporterV4 extends Importer { return KdbContext.GroupCustomData; - } else if ( ctx == KdbContext.Entry && name.equalsIgnoreCase(ElemEntry) ) { + } else if ( ctx == KdbContext.Entry && name.equalsIgnoreCase(PwDatabaseV4XML.ElemEntry) ) { if ( ctxEntry.getUUID() == null || ctxEntry.getUUID().equals(PwDatabase.UUID_ZERO) ) { ctxEntry.setUUID(UUID.randomUUID()); } @@ -943,31 +857,31 @@ public class ImporterV4 extends Importer { } return KdbContext.Group; - } else if ( ctx == KdbContext.EntryTimes && name.equalsIgnoreCase(ElemTimes) ) { + } else if ( ctx == KdbContext.EntryTimes && name.equalsIgnoreCase(PwDatabaseV4XML.ElemTimes) ) { return KdbContext.Entry; - } else if ( ctx == KdbContext.EntryString && name.equalsIgnoreCase(ElemString) ) { + } else if ( ctx == KdbContext.EntryString && name.equalsIgnoreCase(PwDatabaseV4XML.ElemString) ) { ctxEntry.addExtraField(ctxStringName, ctxStringValue); ctxStringName = null; ctxStringValue = null; return KdbContext.Entry; - } else if ( ctx == KdbContext.EntryBinary && name.equalsIgnoreCase(ElemBinary) ) { + } else if ( ctx == KdbContext.EntryBinary && name.equalsIgnoreCase(PwDatabaseV4XML.ElemBinary) ) { ctxEntry.putProtectedBinary(ctxBinaryName, ctxBinaryValue); ctxBinaryName = null; ctxBinaryValue = null; return KdbContext.Entry; - } else if ( ctx == KdbContext.EntryAutoType && name.equalsIgnoreCase(ElemAutoType) ) { + } else if ( ctx == KdbContext.EntryAutoType && name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoType) ) { return KdbContext.Entry; - } else if ( ctx == KdbContext.EntryAutoTypeItem && name.equalsIgnoreCase(ElemAutoTypeItem) ) { + } else if ( ctx == KdbContext.EntryAutoTypeItem && name.equalsIgnoreCase(PwDatabaseV4XML.ElemAutoTypeItem) ) { ctxEntry.getAutoType().put(ctxATName, ctxATSeq); ctxATName = null; ctxATSeq = null; return KdbContext.EntryAutoType; - } else if ( ctx == KdbContext.EntryCustomData && name.equalsIgnoreCase(ElemCustomData)) { + } else if ( ctx == KdbContext.EntryCustomData && name.equalsIgnoreCase(PwDatabaseV4XML.ElemCustomData)) { return KdbContext.Entry; - } else if ( ctx == KdbContext.EntryCustomDataItem && name.equalsIgnoreCase(ElemStringDictExItem)) { + } else if ( ctx == KdbContext.EntryCustomDataItem && name.equalsIgnoreCase(PwDatabaseV4XML.ElemStringDictExItem)) { if (entryCustomDataKey != null && entryCustomDataValue != null) { ctxEntry.putCustomData(entryCustomDataKey, entryCustomDataValue); } else { @@ -978,12 +892,12 @@ public class ImporterV4 extends Importer { entryCustomDataValue = null; return KdbContext.EntryCustomData; - } else if ( ctx == KdbContext.EntryHistory && name.equalsIgnoreCase(ElemHistory) ) { + } else if ( ctx == KdbContext.EntryHistory && name.equalsIgnoreCase(PwDatabaseV4XML.ElemHistory) ) { entryInHistory = false; return KdbContext.Entry; - } else if ( ctx == KdbContext.RootDeletedObjects && name.equalsIgnoreCase(ElemDeletedObjects) ) { + } else if ( ctx == KdbContext.RootDeletedObjects && name.equalsIgnoreCase(PwDatabaseV4XML.ElemDeletedObjects) ) { return KdbContext.Root; - } else if ( ctx == KdbContext.DeletedObject && name.equalsIgnoreCase(ElemDeletedObject) ) { + } else if ( ctx == KdbContext.DeletedObject && name.equalsIgnoreCase(PwDatabaseV4XML.ElemDeletedObject) ) { ctxDeletedObject = null; return KdbContext.RootDeletedObjects; } else { @@ -1143,7 +1057,7 @@ public class ImporterV4 extends Importer { } private ProtectedBinary ReadProtectedBinary(XmlPullParser xpp) throws XmlPullParserException, IOException { - String ref = xpp.getAttributeValue(null, AttrRef); + String ref = xpp.getAttributeValue(null, PwDatabaseV4XML.AttrRef); if (ref != null) { xpp.next(); // Consume end tag @@ -1152,9 +1066,9 @@ public class ImporterV4 extends Importer { } boolean compressed = false; - String comp = xpp.getAttributeValue(null, AttrCompressed); + String comp = xpp.getAttributeValue(null, PwDatabaseV4XML.AttrCompressed); if (comp != null) { - compressed = comp.equalsIgnoreCase(ValTrue); + compressed = comp.equalsIgnoreCase(PwDatabaseV4XML.ValTrue); } byte[] buf = ProcessNode(xpp); @@ -1201,8 +1115,8 @@ public class ImporterV4 extends Importer { byte[] buf = null; if ( xpp.getAttributeCount() > 0 ) { - String protect = xpp.getAttributeValue(null, AttrProtected); - if ( protect != null && protect.equalsIgnoreCase(ValTrue) ) { + String protect = xpp.getAttributeValue(null, PwDatabaseV4XML.AttrProtected); + if ( protect != null && protect.equalsIgnoreCase(PwDatabaseV4XML.ValTrue) ) { String encrypted = ReadStringRaw(xpp); if ( encrypted.length() > 0 ) { diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutput.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutput.java similarity index 88% rename from app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutput.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutput.java index c48f485f5..3e1b76ca3 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutput.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutput.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; public class PwDbHeaderOutput { protected byte[] hashOfHeader = null; diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV3.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV3.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV3.java index b9d0341c7..3d06d7748 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.stream.LEDataOutputStream; import java.io.IOException; import java.io.OutputStream; - -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.stream.LEDataOutputStream; - public class PwDbHeaderOutputV3 { private PwDbHeaderV3 mHeader; private OutputStream mOS; diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV4.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV4.java similarity index 64% rename from app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV4.java index 9239dbea9..27c91950f 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbHeaderOutputV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbHeaderOutputV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,18 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.collections.VariantDictionary; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfParameters; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV4; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.stream.HmacBlockStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.stream.MacOutputStream; +import com.kunzisoft.keepass.utils.Types; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -27,18 +38,6 @@ import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import com.keepassdroid.collections.VariantDictionary; -import com.keepassdroid.crypto.keyDerivation.KdfParameters; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV4; -import com.keepassdroid.database.PwDbHeaderV4.PwDbHeaderV4Fields; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.stream.HmacBlockStream; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.stream.MacOutputStream; -import com.keepassdroid.utils.Types; - import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -92,35 +91,35 @@ public class PwDbHeaderOutputV4 extends PwDbHeaderOutput { los.writeUInt(header.version); - writeHeaderField(PwDbHeaderV4Fields.CipherID, Types.UUIDtoBytes(db.getDataCipher())); - writeHeaderField(PwDbHeaderV4Fields.CompressionFlags, LEDataOutputStream.writeIntBuf(db.getCompressionAlgorithm().id)); - writeHeaderField(PwDbHeaderV4Fields.MasterSeed, header.masterSeed); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.CipherID, Types.UUIDtoBytes(db.getDataCipher())); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.CompressionFlags, LEDataOutputStream.writeIntBuf(db.getCompressionAlgorithm().id)); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.MasterSeed, header.masterSeed); if (header.version < PwDbHeaderV4.FILE_VERSION_32_4) { - writeHeaderField(PwDbHeaderV4Fields.TransformSeed, header.getTransformSeed()); - writeHeaderField(PwDbHeaderV4Fields.TransformRounds, LEDataOutputStream.writeLongBuf(db.getNumKeyEncRounds())); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.TransformSeed, header.getTransformSeed()); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.TransformRounds, LEDataOutputStream.writeLongBuf(db.getNumberKeyEncryptionRounds())); } else { - writeHeaderField(PwDbHeaderV4Fields.KdfParameters, KdfParameters.serialize(db.getKdfParameters())); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.KdfParameters, KdfParameters.serialize(db.getKdfParameters())); } if (header.encryptionIV.length > 0) { - writeHeaderField(PwDbHeaderV4Fields.EncryptionIV, header.encryptionIV); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.EncryptionIV, header.encryptionIV); } if (header.version < PwDbHeaderV4.FILE_VERSION_32_4) { - writeHeaderField(PwDbHeaderV4Fields.InnerRandomstreamKey, header.innerRandomStreamKey); - writeHeaderField(PwDbHeaderV4Fields.StreamStartBytes, header.streamStartBytes); - writeHeaderField(PwDbHeaderV4Fields.InnerRandomStreamID, LEDataOutputStream.writeIntBuf(header.innerRandomStream.id)); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.InnerRandomstreamKey, header.innerRandomStreamKey); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.StreamStartBytes, header.streamStartBytes); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.InnerRandomStreamID, LEDataOutputStream.writeIntBuf(header.innerRandomStream.id)); } if (db.containsPublicCustomData()) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); LEDataOutputStream los = new LEDataOutputStream(bos); VariantDictionary.serialize(db.getPublicCustomData(), los); - writeHeaderField(PwDbHeaderV4Fields.PublicCustomData, bos.toByteArray()); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.PublicCustomData, bos.toByteArray()); } - writeHeaderField(PwDbHeaderV4Fields.EndOfHeader, EndHeaderValue); + writeHeaderField(PwDbHeaderV4.PwDbHeaderV4Fields.EndOfHeader, EndHeaderValue); los.flush(); hashOfHeader = dos.getMessageDigest().digest(); diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbInnerHeaderOutputV4.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbInnerHeaderOutputV4.java similarity index 67% rename from app/src/main/java/com/keepassdroid/database/save/PwDbInnerHeaderOutputV4.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbInnerHeaderOutputV4.java index cfd14a8cf..89dc3145e 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbInnerHeaderOutputV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbInnerHeaderOutputV4.java @@ -1,11 +1,11 @@ /* * Copyright 2017 Brian Pellin. * - * This file is part of KeePassDroid. + * This file is part of KeePass DX. * * KeePassDroid 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePassDroid is distributed in the hope that it will be useful, @@ -17,14 +17,12 @@ * along with KeePassDroid. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwDbHeaderV4; -import com.keepassdroid.database.PwDbHeaderV4.PwDbInnerHeaderV4Fields; -import com.keepassdroid.database.PwDbHeaderV4.KdbxBinaryFlags; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.stream.LEDataOutputStream; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwDbHeaderV4; +import com.kunzisoft.keepass.database.security.ProtectedBinary; +import com.kunzisoft.keepass.stream.LEDataOutputStream; import java.io.IOException; import java.io.OutputStream; @@ -43,23 +41,23 @@ public class PwDbInnerHeaderOutputV4 { } public void output() throws IOException { - los.write(PwDbInnerHeaderV4Fields.InnerRandomStreamID); + los.write(PwDbHeaderV4.PwDbInnerHeaderV4Fields.InnerRandomStreamID); los.writeInt(4); los.writeInt(header.innerRandomStream.id); int streamKeySize = header.innerRandomStreamKey.length; - los.write(PwDbInnerHeaderV4Fields.InnerRandomstreamKey); + los.write(PwDbHeaderV4.PwDbInnerHeaderV4Fields.InnerRandomstreamKey); los.writeInt(streamKeySize); los.write(header.innerRandomStreamKey); for (ProtectedBinary bin : db.getBinPool().binaries()) { - byte flag = KdbxBinaryFlags.None; + byte flag = PwDbHeaderV4.KdbxBinaryFlags.None; if (bin.isProtected()) { - flag |= KdbxBinaryFlags.Protected; + flag |= PwDbHeaderV4.KdbxBinaryFlags.Protected; } byte[] binData = bin.getData(); - los.write(PwDbInnerHeaderV4Fields.Binary); + los.write(PwDbHeaderV4.PwDbInnerHeaderV4Fields.Binary); los.writeInt(bin.length() + 1); los.write(flag); los.write(binData); @@ -67,7 +65,7 @@ public class PwDbInnerHeaderOutputV4 { Arrays.fill(binData, (byte)0); } - los.write(PwDbInnerHeaderV4Fields.EndOfHeader); + los.write(PwDbHeaderV4.PwDbInnerHeaderV4Fields.EndOfHeader); los.writeInt(0); } diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbOutput.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbOutput.java similarity index 77% rename from app/src/main/java/com/keepassdroid/database/save/PwDbOutput.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbOutput.java index ece27fef8..2563fa5a0 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbOutput.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbOutput.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,26 +17,26 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; import java.io.OutputStream; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.exception.PwDbOutputException; - public abstract class PwDbOutput { protected OutputStream mOS; public static PwDbOutput getInstance(PwDatabase pm, OutputStream os) { - if ( pm instanceof PwDatabaseV3 ) { + if ( pm instanceof PwDatabaseV3) { return new PwDbV3Output((PwDatabaseV3)pm, os); - } else if ( pm instanceof PwDatabaseV4 ) { + } else if ( pm instanceof PwDatabaseV4) { return new PwDbV4Output((PwDatabaseV4)pm, os); } @@ -47,7 +47,7 @@ public abstract class PwDbOutput { mOS = os; } - protected SecureRandom setIVs(PwDbHeader header) throws PwDbOutputException { + protected SecureRandom setIVs(PwDbHeader header) throws PwDbOutputException { SecureRandom random; try { random = SecureRandom.getInstance("SHA1PRNG"); diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbV3Output.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3Output.java similarity index 89% rename from app/src/main/java/com/keepassdroid/database/save/PwDbV3Output.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3Output.java index 92a071493..bdd53bacd 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbV3Output.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3Output.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,18 +17,18 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.database.PwEncryptionAlgorithm; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.database.PwGroupV3; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.stream.NullOutputStream; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.database.PwEncryptionAlgorithm; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.PwGroupV3; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.stream.NullOutputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; @@ -60,7 +60,7 @@ public class PwDbV3Output extends PwDbOutput { public byte[] getFinalKey(PwDbHeader header) throws PwDbOutputException { try { PwDbHeaderV3 h3 = (PwDbHeaderV3) header; - mPM.makeFinalKey(h3.masterSeed, h3.transformSeed, mPM.getNumKeyEncRounds()); + mPM.makeFinalKey(h3.masterSeed, h3.transformSeed, mPM.getNumberKeyEncryptionRounds()); return mPM.getFinalKey(); } catch (IOException e) { throw new PwDbOutputException("Key creation failed: " + e.getMessage()); @@ -77,7 +77,7 @@ public class PwDbV3Output extends PwDbOutput { Cipher cipher; try { - if (mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Rjindal) { + if (mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.AES_Rijndael) { cipher = CipherFactory.getInstance("AES/CBC/PKCS5Padding"); } else if (mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Twofish){ cipher = CipherFactory.getInstance("Twofish/CBC/PKCS7PADDING"); @@ -127,7 +127,7 @@ public class PwDbV3Output extends PwDbOutput { header.signature2 = PwDbHeaderV3.DBSIG_2; header.flags = PwDbHeaderV3.FLAG_SHA2; - if ( mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Rjindal ) { + if ( mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.AES_Rijndael) { header.flags |= PwDbHeaderV3.FLAG_RIJNDAEL; } else if ( mPM.getEncryptionAlgorithm() == PwEncryptionAlgorithm.Twofish ) { header.flags |= PwDbHeaderV3.FLAG_TWOFISH; @@ -138,7 +138,7 @@ public class PwDbV3Output extends PwDbOutput { header.version = PwDbHeaderV3.DBVER_DW; header.numGroups = mPM.numberOfGroups(); header.numEntries = mPM.numberOfEntries(); - header.numKeyEncRounds = mPM.getNumKeyEncRounds(); + header.numKeyEncRounds = (int) mPM.getNumberKeyEncryptionRounds(); setIVs(header); diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbV3OutputDebug.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3OutputDebug.java similarity index 82% rename from app/src/main/java/com/keepassdroid/database/save/PwDbV3OutputDebug.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3OutputDebug.java index cd93c40bf..14fd7d796 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbV3OutputDebug.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV3OutputDebug.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,17 +17,17 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwDatabaseV3Debug; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV3; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; import java.io.OutputStream; import java.security.SecureRandom; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwDatabaseV3Debug; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV3; -import com.keepassdroid.database.exception.PwDbOutputException; - public class PwDbV3OutputDebug extends PwDbV3Output { PwDatabaseV3Debug debugDb; private boolean noHeaderHash; diff --git a/app/src/main/java/com/keepassdroid/database/save/PwDbV4Output.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV4Output.java similarity index 54% rename from app/src/main/java/com/keepassdroid/database/save/PwDbV4Output.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV4Output.java index 519a875b0..ab5e79aaa 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwDbV4Output.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwDbV4Output.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,41 +17,41 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; import android.util.Xml; -import com.keepassdroid.crypto.CipherFactory; -import com.keepassdroid.crypto.PwStreamCipherFactory; -import com.keepassdroid.crypto.engine.CipherEngine; -import com.keepassdroid.crypto.keyDerivation.KdfEngine; -import com.keepassdroid.crypto.keyDerivation.KdfFactory; -import com.keepassdroid.database.AutoType; -import com.keepassdroid.database.CrsAlgorithm; -import com.keepassdroid.database.EntryHandler; -import com.keepassdroid.database.GroupHandler; -import com.keepassdroid.database.ITimeLogger; -import com.keepassdroid.database.MemoryProtectionConfig; -import com.keepassdroid.database.PwCompressionAlgorithm; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwDatabaseV4XML; -import com.keepassdroid.database.PwDbHeader; -import com.keepassdroid.database.PwDbHeaderV4; -import com.keepassdroid.database.PwDefsV4; -import com.keepassdroid.database.PwDeletedObject; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.PwGroupV4; -import com.keepassdroid.database.PwIconCustom; -import com.keepassdroid.database.exception.PwDbOutputException; -import com.keepassdroid.database.security.ProtectedBinary; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.stream.HashedBlockOutputStream; -import com.keepassdroid.stream.HmacBlockOutputStream; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.utils.DateUtil; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.MemUtil; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.crypto.CipherFactory; +import com.kunzisoft.keepass.crypto.PwStreamCipherFactory; +import com.kunzisoft.keepass.crypto.engine.CipherEngine; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfEngine; +import com.kunzisoft.keepass.crypto.keyDerivation.KdfFactory; +import com.kunzisoft.keepass.database.AutoType; +import com.kunzisoft.keepass.database.CrsAlgorithm; +import com.kunzisoft.keepass.database.EntryHandler; +import com.kunzisoft.keepass.database.GroupHandler; +import com.kunzisoft.keepass.database.ITimeLogger; +import com.kunzisoft.keepass.database.MemoryProtectionConfig; +import com.kunzisoft.keepass.database.PwCompressionAlgorithm; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwDatabaseV4XML; +import com.kunzisoft.keepass.database.PwDbHeader; +import com.kunzisoft.keepass.database.PwDbHeaderV4; +import com.kunzisoft.keepass.database.PwDefsV4; +import com.kunzisoft.keepass.database.PwDeletedObject; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwGroupV4; +import com.kunzisoft.keepass.database.PwIconCustom; +import com.kunzisoft.keepass.database.exception.PwDbOutputException; +import com.kunzisoft.keepass.database.security.ProtectedBinary; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.stream.HashedBlockOutputStream; +import com.kunzisoft.keepass.stream.HmacBlockOutputStream; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.utils.DateUtil; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.MemUtil; +import com.kunzisoft.keepass.utils.Types; import org.joda.time.DateTime; import org.spongycastle.crypto.StreamCipher; @@ -74,90 +74,6 @@ import javax.crypto.CipherOutputStream; import biz.source_code.base64Coder.Base64Coder; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrCompressed; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrId; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrProtected; -import static com.keepassdroid.database.PwDatabaseV4XML.AttrRef; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoType; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeDefaultSeq; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeEnabled; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemAutoTypeObfuscation; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBgColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBinaries; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemBinary; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCreationTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomData; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconID; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItemData; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIconItemID; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemCustomIcons; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDefaultUser; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDefaultUserChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDesc; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbDescChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChangeForce; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChangeRec; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbKeyChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbMntncHistoryDays; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDbNameChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletedObject; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletedObjects; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDeletionTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemDocNode; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEnableAutoType; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEnableSearching; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntry; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntryTemplatesGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemEntryTemplatesGroupChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemExpires; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemExpiryTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemFgColor; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGenerator; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemGroupDefaultAutoTypeSeq; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHeaderHash; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistory; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistoryMaxItems; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemHistoryMaxSize; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemIcon; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemIsExpanded; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemKey; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemKeystrokeSequence; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastAccessTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastModTime; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastSelectedGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastTopVisibleEntry; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLastTopVisibleGroup; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemLocationChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemMemoryProt; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemMeta; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemNotes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemOverrideUrl; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtNotes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtPassword; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtTitle; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtURL; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemProtUserName; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinChanged; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinEnabled; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRecycleBinUuid; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemRoot; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemString; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemStringDictExItem; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemTags; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemTimes; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemUsageCount; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemUuid; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemValue; -import static com.keepassdroid.database.PwDatabaseV4XML.ElemWindow; -import static com.keepassdroid.database.PwDatabaseV4XML.ValFalse; -import static com.keepassdroid.database.PwDatabaseV4XML.ValTrue; - public class PwDbV4Output extends PwDbOutput { PwDatabaseV4 mPM; @@ -210,7 +126,7 @@ public class PwDbV4Output extends PwDbOutput { } if (header.version >= PwDbHeaderV4.FILE_VERSION_32_4) { - PwDbInnerHeaderOutputV4 ihOut = new PwDbInnerHeaderOutputV4((PwDatabaseV4)mPM, header, osXml); + PwDbInnerHeaderOutputV4 ihOut = new PwDbInnerHeaderOutputV4(mPM, header, osXml); ihOut.output(); } @@ -281,76 +197,76 @@ public class PwDbV4Output extends PwDbOutput { xml.setOutput(os, "UTF-8"); xml.startDocument("UTF-8", true); - xml.startTag(null, ElemDocNode); + xml.startTag(null, PwDatabaseV4XML.ElemDocNode); writeMeta(); - PwGroupV4 root = (PwGroupV4) mPM.getRootGroup(); - xml.startTag(null, ElemRoot); + PwGroupV4 root = mPM.getRootGroup(); + xml.startTag(null, PwDatabaseV4XML.ElemRoot); startGroup(root); - Stack groupStack = new Stack(); + Stack groupStack = new Stack<>(); groupStack.push(root); if (!root.preOrderTraverseTree(new GroupWriter(groupStack), new EntryWriter())) throw new RuntimeException("Writing groups failed"); while (groupStack.size() > 1) { - xml.endTag(null, ElemGroup); + xml.endTag(null, PwDatabaseV4XML.ElemGroup); groupStack.pop(); } endGroup(); - writeList(ElemDeletedObjects, mPM.getDeletedObjects()); + writeList(PwDatabaseV4XML.ElemDeletedObjects, mPM.getDeletedObjects()); - xml.endTag(null, ElemRoot); + xml.endTag(null, PwDatabaseV4XML.ElemRoot); - xml.endTag(null, ElemDocNode); + xml.endTag(null, PwDatabaseV4XML.ElemDocNode); xml.endDocument(); } private void writeMeta() throws IllegalArgumentException, IllegalStateException, IOException { - xml.startTag(null, ElemMeta); + xml.startTag(null, PwDatabaseV4XML.ElemMeta); - writeObject(ElemGenerator, mPM.localizedAppName); + writeObject(PwDatabaseV4XML.ElemGenerator, mPM.localizedAppName); if (hashOfHeader != null) { - writeObject(ElemHeaderHash, String.valueOf(Base64Coder.encode(hashOfHeader))); + writeObject(PwDatabaseV4XML.ElemHeaderHash, String.valueOf(Base64Coder.encode(hashOfHeader))); } - writeObject(ElemDbName, mPM.getName(), true); - writeObject(ElemDbNameChanged, mPM.getNameChanged().getDate()); - writeObject(ElemDbDesc, mPM.getDescription(), true); - writeObject(ElemDbDescChanged, mPM.getDescriptionChanged().getDate()); - writeObject(ElemDbDefaultUser, mPM.getDefaultUserName(), true); - writeObject(ElemDbDefaultUserChanged, mPM.getDefaultUserNameChanged().getDate()); - writeObject(ElemDbMntncHistoryDays, mPM.getMaintenanceHistoryDays()); - writeObject(ElemDbColor, mPM.getColor()); - writeObject(ElemDbKeyChanged, mPM.getKeyLastChanged().getDate()); - writeObject(ElemDbKeyChangeRec, mPM.getKeyChangeRecDays()); - writeObject(ElemDbKeyChangeForce, mPM.getKeyChangeForceDays()); + writeObject(PwDatabaseV4XML.ElemDbName, mPM.getName(), true); + writeObject(PwDatabaseV4XML.ElemDbNameChanged, mPM.getNameChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemDbDesc, mPM.getDescription(), true); + writeObject(PwDatabaseV4XML.ElemDbDescChanged, mPM.getDescriptionChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemDbDefaultUser, mPM.getDefaultUserName(), true); + writeObject(PwDatabaseV4XML.ElemDbDefaultUserChanged, mPM.getDefaultUserNameChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemDbMntncHistoryDays, mPM.getMaintenanceHistoryDays()); + writeObject(PwDatabaseV4XML.ElemDbColor, mPM.getColor()); + writeObject(PwDatabaseV4XML.ElemDbKeyChanged, mPM.getKeyLastChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemDbKeyChangeRec, mPM.getKeyChangeRecDays()); + writeObject(PwDatabaseV4XML.ElemDbKeyChangeForce, mPM.getKeyChangeForceDays()); - writeList(ElemMemoryProt, mPM.getMemoryProtection()); + writeList(PwDatabaseV4XML.ElemMemoryProt, mPM.getMemoryProtection()); writeCustomIconList(); - writeObject(ElemRecycleBinEnabled, mPM.isRecycleBinEnabled()); - writeObject(ElemRecycleBinUuid, mPM.getRecycleBinUUID()); - writeObject(ElemRecycleBinChanged, mPM.getRecycleBinChanged()); - writeObject(ElemEntryTemplatesGroup, mPM.getEntryTemplatesGroup()); - writeObject(ElemEntryTemplatesGroupChanged, mPM.getEntryTemplatesGroupChanged().getDate()); - writeObject(ElemHistoryMaxItems, mPM.getHistoryMaxItems()); - writeObject(ElemHistoryMaxSize, mPM.getHistoryMaxSize()); - writeObject(ElemLastSelectedGroup, mPM.getLastSelectedGroup()); - writeObject(ElemLastTopVisibleGroup, mPM.getLastTopVisibleGroup()); + writeObject(PwDatabaseV4XML.ElemRecycleBinEnabled, mPM.isRecycleBinEnabled()); + writeObject(PwDatabaseV4XML.ElemRecycleBinUuid, mPM.getRecycleBinUUID()); + writeObject(PwDatabaseV4XML.ElemRecycleBinChanged, mPM.getRecycleBinChanged()); + writeObject(PwDatabaseV4XML.ElemEntryTemplatesGroup, mPM.getEntryTemplatesGroup()); + writeObject(PwDatabaseV4XML.ElemEntryTemplatesGroupChanged, mPM.getEntryTemplatesGroupChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemHistoryMaxItems, mPM.getHistoryMaxItems()); + writeObject(PwDatabaseV4XML.ElemHistoryMaxSize, mPM.getHistoryMaxSize()); + writeObject(PwDatabaseV4XML.ElemLastSelectedGroup, mPM.getLastSelectedGroup()); + writeObject(PwDatabaseV4XML.ElemLastTopVisibleGroup, mPM.getLastTopVisibleGroup()); if (header.version < PwDbHeaderV4.FILE_VERSION_32_4) { writeBinPool(); } - writeList(ElemCustomData, mPM.getCustomData()); + writeList(PwDatabaseV4XML.ElemCustomData, mPM.getCustomData()); - xml.endTag(null, ElemMeta); + xml.endTag(null, PwDatabaseV4XML.ElemMeta); } @@ -426,71 +342,71 @@ public class PwDbV4Output extends PwDbOutput { } private void startGroup(PwGroupV4 group) throws IllegalArgumentException, IllegalStateException, IOException { - xml.startTag(null, ElemGroup); - writeObject(ElemUuid, group.getUUID()); - writeObject(ElemName, group.getName()); - writeObject(ElemNotes, group.getNotes()); - writeObject(ElemIcon, group.getIconStandard().iconId); + xml.startTag(null, PwDatabaseV4XML.ElemGroup); + writeObject(PwDatabaseV4XML.ElemUuid, group.getUUID()); + writeObject(PwDatabaseV4XML.ElemName, group.getName()); + writeObject(PwDatabaseV4XML.ElemNotes, group.getNotes()); + writeObject(PwDatabaseV4XML.ElemIcon, group.getIconStandard().iconId); if (!group.getCustomIcon().equals(PwIconCustom.ZERO)) { - writeObject(ElemCustomIconID, group.getCustomIcon().uuid); + writeObject(PwDatabaseV4XML.ElemCustomIconID, group.getCustomIcon().uuid); } - writeList(ElemTimes, group); - writeObject(ElemIsExpanded, group.isExpanded()); - writeObject(ElemGroupDefaultAutoTypeSeq, group.getDefaultAutoTypeSequence()); - writeObject(ElemEnableAutoType, group.getEnableAutoType()); - writeObject(ElemEnableSearching, group.getEnableSearching()); - writeObject(ElemLastTopVisibleEntry, group.getLastTopVisibleEntry()); + writeList(PwDatabaseV4XML.ElemTimes, group); + writeObject(PwDatabaseV4XML.ElemIsExpanded, group.isExpanded()); + writeObject(PwDatabaseV4XML.ElemGroupDefaultAutoTypeSeq, group.getDefaultAutoTypeSequence()); + writeObject(PwDatabaseV4XML.ElemEnableAutoType, group.getEnableAutoType()); + writeObject(PwDatabaseV4XML.ElemEnableSearching, group.getEnableSearching()); + writeObject(PwDatabaseV4XML.ElemLastTopVisibleEntry, group.getLastTopVisibleEntry()); } private void endGroup() throws IllegalArgumentException, IllegalStateException, IOException { - xml.endTag(null, ElemGroup); + xml.endTag(null, PwDatabaseV4XML.ElemGroup); } private void writeEntry(PwEntryV4 entry, boolean isHistory) throws IllegalArgumentException, IllegalStateException, IOException { assert(entry != null); - xml.startTag(null, ElemEntry); + xml.startTag(null, PwDatabaseV4XML.ElemEntry); - writeObject(ElemUuid, entry.getUUID()); - writeObject(ElemIcon, entry.getIconStandard().iconId); + writeObject(PwDatabaseV4XML.ElemUuid, entry.getUUID()); + writeObject(PwDatabaseV4XML.ElemIcon, entry.getIconStandard().iconId); if (!entry.getCustomIcon().equals(PwIconCustom.ZERO)) { - writeObject(ElemCustomIconID, entry.getCustomIcon().uuid); + writeObject(PwDatabaseV4XML.ElemCustomIconID, entry.getCustomIcon().uuid); } - writeObject(ElemFgColor, entry.getForegroundColor()); - writeObject(ElemBgColor, entry.getBackgroupColor()); - writeObject(ElemOverrideUrl, entry.getOverrideURL()); - writeObject(ElemTags, entry.getTags()); + writeObject(PwDatabaseV4XML.ElemFgColor, entry.getForegroundColor()); + writeObject(PwDatabaseV4XML.ElemBgColor, entry.getBackgroupColor()); + writeObject(PwDatabaseV4XML.ElemOverrideUrl, entry.getOverrideURL()); + writeObject(PwDatabaseV4XML.ElemTags, entry.getTags()); - writeList(ElemTimes, entry); + writeList(PwDatabaseV4XML.ElemTimes, entry); writeList(entry.getFields().getListOfAllFields(), true); writeList(entry.getBinaries()); - writeList(ElemAutoType, entry.getAutoType()); + writeList(PwDatabaseV4XML.ElemAutoType, entry.getAutoType()); if (!isHistory) { - writeList(ElemHistory, entry.getHistory(), true); + writeList(PwDatabaseV4XML.ElemHistory, entry.getHistory(), true); } else { assert(entry.sizeOfHistory() == 0); } - xml.endTag(null, ElemEntry); + xml.endTag(null, PwDatabaseV4XML.ElemEntry); } private void writeObject(String key, ProtectedBinary value, boolean allowRef) throws IllegalArgumentException, IllegalStateException, IOException { assert(key != null && value != null); - xml.startTag(null, ElemBinary); - xml.startTag(null, ElemKey); + xml.startTag(null, PwDatabaseV4XML.ElemBinary); + xml.startTag(null, PwDatabaseV4XML.ElemKey); xml.text(safeXmlString(key)); - xml.endTag(null, ElemKey); + xml.endTag(null, PwDatabaseV4XML.ElemKey); - xml.startTag(null, ElemValue); + xml.startTag(null, PwDatabaseV4XML.ElemValue); String strRef = null; if (allowRef) { int ref = mPM.getBinPool().poolFind(value); @@ -498,19 +414,19 @@ public class PwDbV4Output extends PwDbOutput { } if (strRef != null) { - xml.attribute(null, AttrRef, strRef); + xml.attribute(null, PwDatabaseV4XML.AttrRef, strRef); } else { subWriteValue(value); } - xml.endTag(null, ElemValue); + xml.endTag(null, PwDatabaseV4XML.ElemValue); - xml.endTag(null, ElemBinary); + xml.endTag(null, PwDatabaseV4XML.ElemBinary); } private void subWriteValue(ProtectedBinary value) throws IllegalArgumentException, IllegalStateException, IOException { if (value.isProtected()) { - xml.attribute(null, AttrProtected, ValTrue); + xml.attribute(null, PwDatabaseV4XML.AttrProtected, PwDatabaseV4XML.ValTrue); int valLength = value.length(); if (valLength > 0) { @@ -522,7 +438,7 @@ public class PwDbV4Output extends PwDbOutput { } else { if (mPM.getCompressionAlgorithm() == PwCompressionAlgorithm.Gzip) { - xml.attribute(null, AttrCompressed, ValTrue); + xml.attribute(null, PwDatabaseV4XML.AttrCompressed, PwDatabaseV4XML.ValTrue); byte[] raw = value.getData(); byte[] compressed = MemUtil.compress(raw); xml.text(String.valueOf(Base64Coder.encode(compressed))); @@ -574,10 +490,10 @@ public class PwDbV4Output extends PwDbOutput { text = "null"; } else if (value) { - text = ValTrue; + text = PwDatabaseV4XML.ValTrue; } else { - text = ValFalse; + text = PwDatabaseV4XML.ValFalse; } writeObject(name, text); @@ -607,15 +523,15 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); - writeObject(ElemAutoTypeEnabled, autoType.enabled); - writeObject(ElemAutoTypeObfuscation, autoType.obfuscationOptions); + writeObject(PwDatabaseV4XML.ElemAutoTypeEnabled, autoType.enabled); + writeObject(PwDatabaseV4XML.ElemAutoTypeObfuscation, autoType.obfuscationOptions); if (autoType.defaultSequence.length() > 0) { - writeObject(ElemAutoTypeDefaultSeq, autoType.defaultSequence, true); + writeObject(PwDatabaseV4XML.ElemAutoTypeDefaultSeq, autoType.defaultSequence, true); } for (Entry pair : autoType.entrySet()) { - writeObject(ElemAutoTypeItem, ElemWindow, pair.getKey(), ElemKeystrokeSequence, pair.getValue()); + writeObject(PwDatabaseV4XML.ElemAutoTypeItem, PwDatabaseV4XML.ElemWindow, pair.getKey(), PwDatabaseV4XML.ElemKeystrokeSequence, pair.getValue()); } xml.endTag(null, name); @@ -635,12 +551,12 @@ public class PwDbV4Output extends PwDbOutput { private void writeObject(String key, ProtectedString value, boolean isEntryString) throws IllegalArgumentException, IllegalStateException, IOException { assert(key !=null && value != null); - xml.startTag(null, ElemString); - xml.startTag(null, ElemKey); + xml.startTag(null, PwDatabaseV4XML.ElemString); + xml.startTag(null, PwDatabaseV4XML.ElemKey); xml.text(safeXmlString(key)); - xml.endTag(null, ElemKey); + xml.endTag(null, PwDatabaseV4XML.ElemKey); - xml.startTag(null, ElemValue); + xml.startTag(null, PwDatabaseV4XML.ElemValue); boolean protect = value.isProtected(); if (isEntryString) { if (key.equals(PwDefsV4.TITLE_FIELD)) { @@ -661,7 +577,7 @@ public class PwDbV4Output extends PwDbOutput { } if (protect) { - xml.attribute(null, AttrProtected, ValTrue); + xml.attribute(null, PwDatabaseV4XML.AttrProtected, PwDatabaseV4XML.ValTrue); byte[] data = value.toString().getBytes("UTF-8"); int valLength = data.length; @@ -676,8 +592,8 @@ public class PwDbV4Output extends PwDbOutput { xml.text(safeXmlString(value.toString())); } - xml.endTag(null, ElemValue); - xml.endTag(null, ElemString); + xml.endTag(null, PwDatabaseV4XML.ElemValue); + xml.endTag(null, PwDatabaseV4XML.ElemString); } @@ -686,8 +602,8 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); - writeObject(ElemUuid, value.uuid); - writeObject(ElemDeletionTime, value.getDeletionTime()); + writeObject(PwDatabaseV4XML.ElemUuid, value.uuid); + writeObject(PwDatabaseV4XML.ElemDeletionTime, value.getDeletionTime()); xml.endTag(null, name); } @@ -707,7 +623,7 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); for (PwDeletedObject pdo : value) { - writeObject(ElemDeletedObject, pdo); + writeObject(PwDatabaseV4XML.ElemDeletedObject, pdo); } xml.endTag(null, name); @@ -719,11 +635,11 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); - writeObject(ElemProtTitle, value.protectTitle); - writeObject(ElemProtUserName, value.protectUserName); - writeObject(ElemProtPassword, value.protectPassword); - writeObject(ElemProtURL, value.protectUrl); - writeObject(ElemProtNotes, value.protectNotes); + writeObject(PwDatabaseV4XML.ElemProtTitle, value.protectTitle); + writeObject(PwDatabaseV4XML.ElemProtUserName, value.protectUserName); + writeObject(PwDatabaseV4XML.ElemProtPassword, value.protectPassword); + writeObject(PwDatabaseV4XML.ElemProtURL, value.protectUrl); + writeObject(PwDatabaseV4XML.ElemProtNotes, value.protectNotes); xml.endTag(null, name); @@ -735,7 +651,7 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); for (Entry pair : customData.entrySet()) { - writeObject(ElemStringDictExItem, ElemKey, pair.getKey(), ElemValue, pair.getValue()); + writeObject(PwDatabaseV4XML.ElemStringDictExItem, PwDatabaseV4XML.ElemKey, pair.getKey(), PwDatabaseV4XML.ElemValue, pair.getValue()); } @@ -748,13 +664,13 @@ public class PwDbV4Output extends PwDbOutput { xml.startTag(null, name); - writeObject(ElemLastModTime, it.getLastModificationTime().getDate()); - writeObject(ElemCreationTime, it.getCreationTime().getDate()); - writeObject(ElemLastAccessTime, it.getLastAccessTime().getDate()); - writeObject(ElemExpiryTime, it.getExpiryTime().getDate()); - writeObject(ElemExpires, it.isExpires()); - writeObject(ElemUsageCount, it.getUsageCount()); - writeObject(ElemLocationChanged, it.getLocationChanged().getDate()); + writeObject(PwDatabaseV4XML.ElemLastModTime, it.getLastModificationTime().getDate()); + writeObject(PwDatabaseV4XML.ElemCreationTime, it.getCreationTime().getDate()); + writeObject(PwDatabaseV4XML.ElemLastAccessTime, it.getLastAccessTime().getDate()); + writeObject(PwDatabaseV4XML.ElemExpiryTime, it.getExpiryTime().getDate()); + writeObject(PwDatabaseV4XML.ElemExpires, it.isExpires()); + writeObject(PwDatabaseV4XML.ElemUsageCount, it.getUsageCount()); + writeObject(PwDatabaseV4XML.ElemLocationChanged, it.getLocationChanged().getDate()); xml.endTag(null, name); } @@ -776,34 +692,34 @@ public class PwDbV4Output extends PwDbOutput { List customIcons = mPM.getCustomIcons(); if (customIcons.size() == 0) return; - xml.startTag(null, ElemCustomIcons); + xml.startTag(null, PwDatabaseV4XML.ElemCustomIcons); for (PwIconCustom icon : customIcons) { - xml.startTag(null, ElemCustomIconItem); + xml.startTag(null, PwDatabaseV4XML.ElemCustomIconItem); - writeObject(ElemCustomIconItemID, icon.uuid); - writeObject(ElemCustomIconItemData, String.valueOf(Base64Coder.encode(icon.imageData))); + writeObject(PwDatabaseV4XML.ElemCustomIconItemID, icon.uuid); + writeObject(PwDatabaseV4XML.ElemCustomIconItemData, String.valueOf(Base64Coder.encode(icon.imageData))); - xml.endTag(null, ElemCustomIconItem); + xml.endTag(null, PwDatabaseV4XML.ElemCustomIconItem); } - xml.endTag(null, ElemCustomIcons); + xml.endTag(null, PwDatabaseV4XML.ElemCustomIcons); } private void writeBinPool() throws IllegalArgumentException, IllegalStateException, IOException { - xml.startTag(null, ElemBinaries); + xml.startTag(null, PwDatabaseV4XML.ElemBinaries); for (Entry pair : mPM.getBinPool().entrySet()) { - xml.startTag(null, ElemBinary); - xml.attribute(null, AttrId, Integer.toString(pair.getKey())); + xml.startTag(null, PwDatabaseV4XML.ElemBinary); + xml.attribute(null, PwDatabaseV4XML.AttrId, Integer.toString(pair.getKey())); subWriteValue(pair.getValue()); - xml.endTag(null, ElemBinary); + xml.endTag(null, PwDatabaseV4XML.ElemBinary); } - xml.endTag(null, ElemBinaries); + xml.endTag(null, PwDatabaseV4XML.ElemBinaries); } diff --git a/app/src/main/java/com/keepassdroid/database/save/PwEntryOutputV3.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwEntryOutputV3.java similarity index 95% rename from app/src/main/java/com/keepassdroid/database/save/PwEntryOutputV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwEntryOutputV3.java index 82634c871..2a640e843 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwEntryOutputV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwEntryOutputV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.OutputStream; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.utils.Types; - public class PwEntryOutputV3 { // Constants public static final byte[] UUID_FIELD_TYPE = LEDataOutputStream.writeUShortBuf(1); diff --git a/app/src/main/java/com/keepassdroid/database/save/PwGroupOutputV3.java b/app/src/main/java/com/kunzisoft/keepass/database/save/PwGroupOutputV3.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/save/PwGroupOutputV3.java rename to app/src/main/java/com/kunzisoft/keepass/database/save/PwGroupOutputV3.java index d5db86945..74dbff568 100644 --- a/app/src/main/java/com/keepassdroid/database/save/PwGroupOutputV3.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/save/PwGroupOutputV3.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.save; +package com.kunzisoft.keepass.database.save; + +import com.kunzisoft.keepass.database.PwGroupV3; +import com.kunzisoft.keepass.stream.LEDataOutputStream; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.OutputStream; - -import com.keepassdroid.database.PwGroupV3; -import com.keepassdroid.stream.LEDataOutputStream; -import com.keepassdroid.utils.Types; - public class PwGroupOutputV3 { // Constants public static final byte[] GROUPID_FIELD_TYPE = LEDataOutputStream.writeUShortBuf(1); diff --git a/app/src/main/java/com/keepassdroid/database/security/ProtectedBinary.java b/app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedBinary.java similarity index 93% rename from app/src/main/java/com/keepassdroid/database/security/ProtectedBinary.java rename to app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedBinary.java index 29550bc3c..f73024d92 100644 --- a/app/src/main/java/com/keepassdroid/database/security/ProtectedBinary.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedBinary.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.security; +package com.kunzisoft.keepass.database.security; import java.io.Serializable; import java.util.Arrays; diff --git a/app/src/main/java/com/keepassdroid/database/security/ProtectedString.java b/app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedString.java similarity index 92% rename from app/src/main/java/com/keepassdroid/database/security/ProtectedString.java rename to app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedString.java index c1f2b13de..a5d925535 100644 --- a/app/src/main/java/com/keepassdroid/database/security/ProtectedString.java +++ b/app/src/main/java/com/kunzisoft/keepass/database/security/ProtectedString.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.database.security; +package com.kunzisoft.keepass.database.security; import java.io.Serializable; diff --git a/app/src/main/java/com/keepassdroid/dialogs/AssignMasterKeyDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/AssignMasterKeyDialogFragment.java similarity index 97% rename from app/src/main/java/com/keepassdroid/dialogs/AssignMasterKeyDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/AssignMasterKeyDialogFragment.java index 8e287824d..c0ad76fd1 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/AssignMasterKeyDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/AssignMasterKeyDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.content.Context; @@ -37,10 +37,10 @@ import android.widget.CompoundButton; import android.widget.TextView; import android.widget.Toast; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.UriUtil; -import com.keepassdroid.fileselect.KeyFileHelper; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.fileselect.KeyFileHelper; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.UriUtil; public class AssignMasterKeyDialogFragment extends DialogFragment { diff --git a/app/src/main/java/com/keepassdroid/dialogs/CreateFileDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/CreateFileDialogFragment.java similarity index 97% rename from app/src/main/java/com/keepassdroid/dialogs/CreateFileDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/CreateFileDialogFragment.java index d54e1d5b8..7973f2dc0 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/CreateFileDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/CreateFileDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Activity; import android.app.Dialog; @@ -41,9 +41,9 @@ import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; -import com.keepassdroid.fileselect.FilePickerStylishActivity; -import com.keepassdroid.utils.UriUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.fileselect.FilePickerStylishActivity; +import com.kunzisoft.keepass.utils.UriUtil; import com.nononsenseapps.filepicker.FilePickerActivity; import com.nononsenseapps.filepicker.Utils; diff --git a/app/src/main/java/com/keepassdroid/dialogs/GeneratePasswordDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/GeneratePasswordDialogFragment.java similarity index 97% rename from app/src/main/java/com/keepassdroid/dialogs/GeneratePasswordDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/GeneratePasswordDialogFragment.java index e5b61c015..5265a16ec 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/GeneratePasswordDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/GeneratePasswordDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.content.Context; @@ -33,9 +33,9 @@ import android.widget.EditText; import android.widget.SeekBar; import android.widget.Toast; -import com.keepassdroid.password.PasswordGenerator; -import com.keepassdroid.settings.PreferencesUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.password.PasswordGenerator; +import com.kunzisoft.keepass.settings.PreferencesUtil; import java.util.Set; diff --git a/app/src/main/java/com/keepassdroid/dialogs/GroupEditDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/GroupEditDialogFragment.java similarity index 96% rename from app/src/main/java/com/keepassdroid/dialogs/GroupEditDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/GroupEditDialogFragment.java index 6bf9377d4..6de3238b2 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/GroupEditDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/GroupEditDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.content.Context; @@ -32,9 +32,9 @@ import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; -import com.keepassdroid.database.PwNode; -import com.keepassdroid.icons.Icons; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.PwNode; +import com.kunzisoft.keepass.icons.Icons; public class GroupEditDialogFragment extends DialogFragment implements IconPickerDialogFragment.IconPickerListener { diff --git a/app/src/main/java/com/keepassdroid/dialogs/IconPickerDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/IconPickerDialogFragment.java similarity index 70% rename from app/src/main/java/com/keepassdroid/dialogs/IconPickerDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/IconPickerDialogFragment.java index 6f0596731..a68aca235 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/IconPickerDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/IconPickerDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.DialogFragment; @@ -29,16 +28,13 @@ import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.GridView; import android.widget.ImageView; -import android.widget.TextView; import com.kunzisoft.keepass.R; -import com.keepassdroid.icons.Icons; -import com.keepassdroid.stylish.StylishActivity; +import com.kunzisoft.keepass.icons.Icons; +import com.kunzisoft.keepass.stylish.StylishActivity; public class IconPickerDialogFragment extends DialogFragment { @@ -75,47 +71,39 @@ public class IconPickerDialogFragment extends DialogFragment { View root = inflater.inflate(R.layout.icon_picker, null); builder.setView(root); - GridView currIconGridView = (GridView) root.findViewById(R.id.IconGridView); + GridView currIconGridView = root.findViewById(R.id.IconGridView); currIconGridView.setAdapter(new ImageAdapter(this.getContext())); - currIconGridView.setOnItemClickListener(new OnItemClickListener() { - public void onItemClick(AdapterView parent, View v, int position, long id) { - Bundle bundle = new Bundle(); - bundle.putInt(KEY_ICON_ID, position); - iconPickerListener.iconPicked(bundle); - - dismiss(); - } - }); - - builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - IconPickerDialogFragment.this.getDialog().cancel(); - } + currIconGridView.setOnItemClickListener((parent, v, position, id) -> { + Bundle bundle = new Bundle(); + bundle.putInt(KEY_ICON_ID, position); + iconPickerListener.iconPicked(bundle); + dismiss(); }); + builder.setNegativeButton(R.string.cancel, (dialog, id) -> + IconPickerDialogFragment.this.getDialog().cancel()); + return builder.create(); } public class ImageAdapter extends BaseAdapter { private Context context; - public ImageAdapter(Context c) { + ImageAdapter(Context c) { context = c; } - public int getCount() { + public int getCount() { /* Return number of KeePass icons */ return Icons.count(); } - public Object getItem(int position) - { + public Object getItem(int position) { return null; } - public long getItemId(int position) - { + public long getItemId(int position) { return 0; } @@ -123,15 +111,13 @@ public class IconPickerDialogFragment extends DialogFragment { View currView; if(convertView == null) { LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - currView = li.inflate(R.layout.icon, parent, false); + assert li != null; + currView = li.inflate(R.layout.icon, parent, false); } else { currView = convertView; } - - TextView tv = (TextView) currView.findViewById(R.id.icon_text); - tv.setText("" + position); - ImageView iv = (ImageView) currView.findViewById(R.id.icon_image); + ImageView iv = currView.findViewById(R.id.icon_image); iv.setImageResource(Icons.iconToResId(position)); return currView; diff --git a/app/src/main/java/com/keepassdroid/dialogs/PasswordEncodingDialogHelper.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/PasswordEncodingDialogHelper.java similarity index 94% rename from app/src/main/java/com/keepassdroid/dialogs/PasswordEncodingDialogHelper.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/PasswordEncodingDialogHelper.java index 22201a1dd..ac8c1d6a9 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/PasswordEncodingDialogHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/PasswordEncodingDialogHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.AlertDialog; import android.content.Context; diff --git a/app/src/main/java/com/keepassdroid/dialogs/ReadOnlyDialog.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/ReadOnlyDialog.java similarity index 88% rename from app/src/main/java/com/keepassdroid/dialogs/ReadOnlyDialog.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/ReadOnlyDialog.java index 4779ffdbc..4f260f9f3 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/ReadOnlyDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/ReadOnlyDialog.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,12 +17,12 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.content.Context; import com.kunzisoft.keepass.R; -import com.keepassdroid.compat.BuildCompat; +import com.kunzisoft.keepass.compat.BuildCompat; public class ReadOnlyDialog extends WarningDialog { diff --git a/app/src/main/java/com/keepassdroid/dialogs/SortDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/SortDialogFragment.java similarity index 76% rename from app/src/main/java/com/keepassdroid/dialogs/SortDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/SortDialogFragment.java index feca4bf97..141bfea0a 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/SortDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/SortDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.content.Context; -import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.IdRes; import android.support.annotation.NonNull; @@ -32,8 +31,8 @@ import android.view.View; import android.widget.CompoundButton; import android.widget.RadioGroup; -import com.keepassdroid.database.SortNodeEnum; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.SortNodeEnum; public class SortDialogFragment extends DialogFragment { @@ -95,6 +94,7 @@ public class SortDialogFragment extends DialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + assert getActivity() != null; AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); @@ -123,59 +123,37 @@ public class SortDialogFragment extends DialogFragment { builder.setTitle(R.string.sort_menu); builder.setView(rootView) // Add action buttons - .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - mListener.onSortSelected(sortNodeEnum, mAscending, mGroupsBefore, mRecycleBinBottom); - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) {} - }); + .setPositiveButton(android.R.string.ok, + (dialog, id) -> mListener.onSortSelected(sortNodeEnum, mAscending, mGroupsBefore, mRecycleBinBottom)) + .setNegativeButton(R.string.cancel, (dialog, id) -> {}); - CompoundButton ascendingView = (CompoundButton) rootView.findViewById(R.id.sort_selection_ascending); + CompoundButton ascendingView = rootView.findViewById(R.id.sort_selection_ascending); // Check if is ascending or descending ascendingView.setChecked(mAscending); - ascendingView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mAscending = isChecked; - } - }); + ascendingView.setOnCheckedChangeListener( + (buttonView, isChecked) -> mAscending = isChecked); - CompoundButton groupsBeforeView = (CompoundButton) rootView.findViewById(R.id.sort_selection_groups_before); + CompoundButton groupsBeforeView = rootView.findViewById(R.id.sort_selection_groups_before); // Check if groups before groupsBeforeView.setChecked(mGroupsBefore); - groupsBeforeView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mGroupsBefore = isChecked; - } - }); + groupsBeforeView.setOnCheckedChangeListener( + (buttonView, isChecked) -> mGroupsBefore = isChecked); - CompoundButton recycleBinBottomView = (CompoundButton) rootView.findViewById(R.id.sort_selection_recycle_bin_bottom); + CompoundButton recycleBinBottomView = rootView.findViewById(R.id.sort_selection_recycle_bin_bottom); if (!recycleBinAllowed) { recycleBinBottomView.setVisibility(View.GONE); } else { // Check if recycle bin at the bottom recycleBinBottomView.setChecked(mRecycleBinBottom); - recycleBinBottomView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mRecycleBinBottom = isChecked; - } - }); + recycleBinBottomView.setOnCheckedChangeListener( + (buttonView, isChecked) -> mRecycleBinBottom = isChecked); } - RadioGroup sortSelectionRadioGroupView = (RadioGroup) rootView.findViewById(R.id.sort_selection_radio_group); + RadioGroup sortSelectionRadioGroupView = rootView.findViewById(R.id.sort_selection_radio_group); // Check value by default sortSelectionRadioGroupView.check(mCheckedId); - sortSelectionRadioGroupView.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { - @Override - public void onCheckedChanged(RadioGroup group, int checkedId) { - sortNodeEnum = retrieveSortEnumFromViewId(checkedId); - } - }); + sortSelectionRadioGroupView.setOnCheckedChangeListener( + (group, checkedId) -> sortNodeEnum = retrieveSortEnumFromViewId(checkedId)); return builder.create(); } diff --git a/app/src/main/java/com/keepassdroid/dialogs/StorageAccessFrameworkDialog.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/StorageAccessFrameworkDialog.java similarity index 93% rename from app/src/main/java/com/keepassdroid/dialogs/StorageAccessFrameworkDialog.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/StorageAccessFrameworkDialog.java index 27996567d..34fd68a89 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/StorageAccessFrameworkDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/StorageAccessFrameworkDialog.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.content.Context; import android.os.Bundle; diff --git a/app/src/main/java/com/keepassdroid/dialogs/UnavailableFeatureDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/UnavailableFeatureDialogFragment.java similarity index 86% rename from app/src/main/java/com/keepassdroid/dialogs/UnavailableFeatureDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/UnavailableFeatureDialogFragment.java index 88456e914..b3cc5eef5 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/UnavailableFeatureDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/UnavailableFeatureDialogFragment.java @@ -1,4 +1,23 @@ -package com.keepassdroid.dialogs; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.dialogs; import android.app.Dialog; import android.os.Build; diff --git a/app/src/main/java/com/keepassdroid/dialogs/WarningDialog.java b/app/src/main/java/com/kunzisoft/keepass/dialogs/WarningDialog.java similarity index 95% rename from app/src/main/java/com/keepassdroid/dialogs/WarningDialog.java rename to app/src/main/java/com/kunzisoft/keepass/dialogs/WarningDialog.java index 66c523ead..7511672fe 100644 --- a/app/src/main/java/com/keepassdroid/dialogs/WarningDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/dialogs/WarningDialog.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.dialogs; +package com.kunzisoft.keepass.dialogs; import android.app.AlertDialog; import android.content.Context; diff --git a/app/src/main/java/com/keepassdroid/fileselect/BrowserDialog.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/BrowserDialog.java similarity index 92% rename from app/src/main/java/com/keepassdroid/fileselect/BrowserDialog.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/BrowserDialog.java index aa93f2717..4ded1e954 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/BrowserDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/BrowserDialog.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.app.Dialog; import android.os.Bundle; @@ -28,8 +28,8 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.Button; -import com.keepassdroid.utils.Util; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.utils.Util; public class BrowserDialog extends DialogFragment { diff --git a/app/src/main/java/com/keepassdroid/fileselect/DeleteFileHistoryAsyncTask.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/DeleteFileHistoryAsyncTask.java similarity index 94% rename from app/src/main/java/com/keepassdroid/fileselect/DeleteFileHistoryAsyncTask.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/DeleteFileHistoryAsyncTask.java index 73e05db0a..f8ceed45a 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/DeleteFileHistoryAsyncTask.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/DeleteFileHistoryAsyncTask.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.os.AsyncTask; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileDbHelper.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileDbHelper.java similarity index 97% rename from app/src/main/java/com/keepassdroid/fileselect/FileDbHelper.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileDbHelper.java index 0ece77520..7d48aa22c 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileDbHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileDbHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; - -import java.io.File; -import java.io.FileFilter; +package com.kunzisoft.keepass.fileselect; import android.content.ContentValues; import android.content.Context; @@ -30,14 +27,17 @@ import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; -import com.keepassdroid.compat.EditorCompat; +import com.kunzisoft.keepass.compat.EditorCompat; + +import java.io.File; +import java.io.FileFilter; public class FileDbHelper { public static final String LAST_FILENAME = "lastFile"; public static final String LAST_KEYFILE = "lastKey"; - public static final String DATABASE_NAME = "keepassdroid"; + public static final String DATABASE_NAME = "keepassdroid"; // TODO Change db name private static final String FILE_TABLE = "files"; private static final int DATABASE_VERSION = 1; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileInformationDialogFragment.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileInformationDialogFragment.java similarity index 97% rename from app/src/main/java/com/keepassdroid/fileselect/FileInformationDialogFragment.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileInformationDialogFragment.java index 9f3ded5c2..7c8b28810 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileInformationDialogFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileInformationDialogFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.app.Dialog; import android.content.DialogInterface; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FilePickerStylishActivity.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FilePickerStylishActivity.java similarity index 92% rename from app/src/main/java/com/keepassdroid/fileselect/FilePickerStylishActivity.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FilePickerStylishActivity.java index a40cb82db..35a38dae2 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FilePickerStylishActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FilePickerStylishActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.content.Context; import android.os.Bundle; @@ -25,8 +25,8 @@ import android.support.annotation.Nullable; import android.support.annotation.StyleRes; import android.util.Log; -import com.keepassdroid.stylish.Stylish; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.stylish.Stylish; import com.nononsenseapps.filepicker.FilePickerActivity; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectActivity.java similarity index 94% rename from app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectActivity.java index fec1ce984..0e673e5aa 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileSelectActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.Manifest; import android.app.Activity; @@ -44,24 +44,24 @@ import android.widget.Toast; import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; -import com.keepassdroid.activities.GroupActivity; -import com.keepassdroid.app.App; -import com.keepassdroid.autofill.AutofillHelper; -import com.keepassdroid.database.edit.CreateDB; -import com.keepassdroid.database.edit.FileOnFinish; -import com.keepassdroid.database.exception.ContentFileNotFoundException; -import com.keepassdroid.dialogs.AssignMasterKeyDialogFragment; -import com.keepassdroid.dialogs.CreateFileDialogFragment; -import com.keepassdroid.password.AssignPasswordHelper; -import com.keepassdroid.password.PasswordActivity; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.stylish.StylishActivity; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.MenuUtil; -import com.keepassdroid.utils.UriUtil; -import com.keepassdroid.view.FileNameView; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.activities.GroupActivity; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.autofill.AutofillHelper; +import com.kunzisoft.keepass.database.edit.CreateDB; +import com.kunzisoft.keepass.database.edit.FileOnFinish; +import com.kunzisoft.keepass.database.exception.ContentFileNotFoundException; +import com.kunzisoft.keepass.dialogs.AssignMasterKeyDialogFragment; +import com.kunzisoft.keepass.dialogs.CreateFileDialogFragment; +import com.kunzisoft.keepass.password.AssignPasswordHelper; +import com.kunzisoft.keepass.password.PasswordActivity; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.stylish.StylishActivity; +import com.kunzisoft.keepass.tasks.ProgressTask; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.MenuUtil; +import com.kunzisoft.keepass.utils.UriUtil; +import com.kunzisoft.keepass.view.FileNameView; import java.io.File; import java.io.FileNotFoundException; @@ -77,8 +77,8 @@ import permissions.dispatcher.RuntimePermissions; @RuntimePermissions public class FileSelectActivity extends StylishActivity implements - CreateFileDialogFragment.DefinePathDialogListener , - AssignMasterKeyDialogFragment.AssignPasswordDialogListener, + CreateFileDialogFragment.DefinePathDialogListener, + AssignMasterKeyDialogFragment.AssignPasswordDialogListener, FileSelectAdapter.FileItemOpenListener, FileSelectAdapter.FileSelectClearListener, FileSelectAdapter.FileInformationShowListener { diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileSelectAdapter.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectAdapter.java similarity index 97% rename from app/src/main/java/com/keepassdroid/fileselect/FileSelectAdapter.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectAdapter.java index a95ade729..f8c1baf18 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileSelectAdapter.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectAdapter.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.content.Context; import android.content.res.Resources; @@ -33,8 +33,8 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import com.keepassdroid.settings.PreferencesUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.settings.PreferencesUtil; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileSelectBean.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectBean.java similarity index 96% rename from app/src/main/java/com/keepassdroid/fileselect/FileSelectBean.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectBean.java index 55693e834..c62d9c978 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileSelectBean.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectBean.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.content.Context; import android.net.Uri; diff --git a/app/src/main/java/com/keepassdroid/fileselect/FileSelectViewHolder.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectViewHolder.java similarity index 92% rename from app/src/main/java/com/keepassdroid/fileselect/FileSelectViewHolder.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectViewHolder.java index 2610a2896..efe29e1b0 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/FileSelectViewHolder.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/FileSelectViewHolder.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.support.v7.widget.RecyclerView; import android.view.View; diff --git a/app/src/main/java/com/keepassdroid/fileselect/KeyFileHelper.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/KeyFileHelper.java similarity index 96% rename from app/src/main/java/com/keepassdroid/fileselect/KeyFileHelper.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/KeyFileHelper.java index 37dd6edb0..982b380f1 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/KeyFileHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/KeyFileHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.app.Activity; import android.content.ContentResolver; @@ -29,11 +29,10 @@ import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; -import com.keepassdroid.compat.ContentResolverCompat; -import com.keepassdroid.compat.StorageAF; -import com.keepassdroid.fileselect.BrowserDialog; -import com.keepassdroid.utils.Interaction; -import com.keepassdroid.utils.UriUtil; +import com.kunzisoft.keepass.compat.ContentResolverCompat; +import com.kunzisoft.keepass.compat.StorageAF; +import com.kunzisoft.keepass.utils.Interaction; +import com.kunzisoft.keepass.utils.UriUtil; import javax.annotation.Nullable; diff --git a/app/src/main/java/com/keepassdroid/fileselect/OpenFileHistoryAsyncTask.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/OpenFileHistoryAsyncTask.java similarity index 94% rename from app/src/main/java/com/keepassdroid/fileselect/OpenFileHistoryAsyncTask.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/OpenFileHistoryAsyncTask.java index a362195a7..872ef8179 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/OpenFileHistoryAsyncTask.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/OpenFileHistoryAsyncTask.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.os.AsyncTask; diff --git a/app/src/main/java/com/keepassdroid/fileselect/RecentFileHistory.java b/app/src/main/java/com/kunzisoft/keepass/fileselect/RecentFileHistory.java similarity index 97% rename from app/src/main/java/com/keepassdroid/fileselect/RecentFileHistory.java rename to app/src/main/java/com/kunzisoft/keepass/fileselect/RecentFileHistory.java index 4514232e5..56223830a 100644 --- a/app/src/main/java/com/keepassdroid/fileselect/RecentFileHistory.java +++ b/app/src/main/java/com/kunzisoft/keepass/fileselect/RecentFileHistory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fileselect; +package com.kunzisoft.keepass.fileselect; import android.content.Context; import android.content.SharedPreferences; @@ -26,9 +26,9 @@ import android.database.Cursor; import android.net.Uri; import android.preference.PreferenceManager; -import com.keepassdroid.compat.EditorCompat; -import com.keepassdroid.utils.UriUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.compat.EditorCompat; +import com.kunzisoft.keepass.utils.UriUtil; import java.io.File; import java.util.ArrayList; diff --git a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintAnimatedVector.java b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintAnimatedVector.java similarity index 94% rename from app/src/main/java/com/keepassdroid/fingerprint/FingerPrintAnimatedVector.java rename to app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintAnimatedVector.java index 1c15aa55d..d156455dc 100644 --- a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintAnimatedVector.java +++ b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintAnimatedVector.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fingerprint; +package com.kunzisoft.keepass.fingerprint; import android.content.Context; import android.graphics.drawable.Animatable2; diff --git a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintDialog.java b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java similarity index 94% rename from app/src/main/java/com/keepassdroid/fingerprint/FingerPrintDialog.java rename to app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java index 6115f2e8b..be2813fc6 100644 --- a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintDialog.java +++ b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintDialog.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.fingerprint; +package com.kunzisoft.keepass.fingerprint; import android.app.Dialog; import android.content.DialogInterface; @@ -32,7 +32,6 @@ import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; -import com.keepassdroid.fingerprint.FingerPrintAnimatedVector; import com.kunzisoft.keepass.R; @RequiresApi(api = Build.VERSION_CODES.M) diff --git a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintHelper.java b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintHelper.java similarity index 99% rename from app/src/main/java/com/keepassdroid/fingerprint/FingerPrintHelper.java rename to app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintHelper.java index 933699411..152188f39 100644 --- a/app/src/main/java/com/keepassdroid/fingerprint/FingerPrintHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/fingerprint/FingerPrintHelper.java @@ -5,7 +5,7 @@ * * KeePassDroid 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePassDroid is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePassDroid. If not, see . * */ -package com.keepassdroid.fingerprint; +package com.kunzisoft.keepass.fingerprint; import android.annotation.SuppressLint; import android.app.KeyguardManager; diff --git a/app/src/main/java/com/keepassdroid/icons/DrawableFactory.java b/app/src/main/java/com/kunzisoft/keepass/icons/DrawableFactory.java similarity index 92% rename from app/src/main/java/com/keepassdroid/icons/DrawableFactory.java rename to app/src/main/java/com/kunzisoft/keepass/icons/DrawableFactory.java index 8b0a84569..9d38950d4 100644 --- a/app/src/main/java/com/keepassdroid/icons/DrawableFactory.java +++ b/app/src/main/java/com/kunzisoft/keepass/icons/DrawableFactory.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.icons; - -import org.apache.commons.collections.map.AbstractReferenceMap; -import org.apache.commons.collections.map.ReferenceMap; +package com.kunzisoft.keepass.icons; import android.content.res.Resources; import android.graphics.Bitmap; @@ -29,10 +26,13 @@ import android.graphics.drawable.Drawable; import android.widget.ImageView; import com.kunzisoft.keepass.R; -import com.keepassdroid.compat.BitmapDrawableCompat; -import com.keepassdroid.database.PwIcon; -import com.keepassdroid.database.PwIconCustom; -import com.keepassdroid.database.PwIconStandard; +import com.kunzisoft.keepass.compat.BitmapDrawableCompat; +import com.kunzisoft.keepass.database.PwIcon; +import com.kunzisoft.keepass.database.PwIconCustom; +import com.kunzisoft.keepass.database.PwIconStandard; + +import org.apache.commons.collections.map.AbstractReferenceMap; +import org.apache.commons.collections.map.ReferenceMap; public class DrawableFactory { private static Drawable blank = null; diff --git a/app/src/main/java/com/keepassdroid/icons/Icons.java b/app/src/main/java/com/kunzisoft/keepass/icons/Icons.java similarity index 94% rename from app/src/main/java/com/keepassdroid/icons/Icons.java rename to app/src/main/java/com/kunzisoft/keepass/icons/Icons.java index 01e0e0280..062148584 100644 --- a/app/src/main/java/com/keepassdroid/icons/Icons.java +++ b/app/src/main/java/com/kunzisoft/keepass/icons/Icons.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.icons; +package com.kunzisoft.keepass.icons; import android.util.SparseIntArray; diff --git a/app/src/main/java/com/keepassdroid/notifications/NotificationCopyingService.java b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationCopyingService.java similarity index 90% rename from app/src/main/java/com/keepassdroid/notifications/NotificationCopyingService.java rename to app/src/main/java/com/kunzisoft/keepass/notifications/NotificationCopyingService.java index 6dffc8c3e..469b2a57c 100755 --- a/app/src/main/java/com/keepassdroid/notifications/NotificationCopyingService.java +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationCopyingService.java @@ -1,4 +1,23 @@ -package com.keepassdroid.notifications; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.notifications; import android.app.Notification; import android.app.NotificationChannel; @@ -15,10 +34,10 @@ import android.support.v4.app.NotificationCompat; import android.util.Log; import android.util.TypedValue; -import com.keepassdroid.database.exception.SamsungClipboardException; -import com.keepassdroid.stylish.Stylish; -import com.keepassdroid.timeout.ClipboardHelper; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.exception.SamsungClipboardException; +import com.kunzisoft.keepass.stylish.Stylish; +import com.kunzisoft.keepass.timeout.ClipboardHelper; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/notifications/NotificationField.java b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationField.java similarity index 97% rename from app/src/main/java/com/keepassdroid/notifications/NotificationField.java rename to app/src/main/java/com/kunzisoft/keepass/notifications/NotificationField.java index f6ea4b6d5..6d35bbf3f 100644 --- a/app/src/main/java/com/keepassdroid/notifications/NotificationField.java +++ b/app/src/main/java/com/kunzisoft/keepass/notifications/NotificationField.java @@ -6,7 +6,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -18,8 +18,7 @@ * along with KeePass DX. If not, see . * */ - -package com.keepassdroid.notifications; +package com.kunzisoft.keepass.notifications; import android.content.res.Resources; import android.os.Parcel; diff --git a/app/src/main/java/com/keepassdroid/password/AssignPasswordHelper.java b/app/src/main/java/com/kunzisoft/keepass/password/AssignPasswordHelper.java similarity index 61% rename from app/src/main/java/com/keepassdroid/password/AssignPasswordHelper.java rename to app/src/main/java/com/kunzisoft/keepass/password/AssignPasswordHelper.java index 518355134..04fae9b44 100644 --- a/app/src/main/java/com/keepassdroid/password/AssignPasswordHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/AssignPasswordHelper.java @@ -1,17 +1,35 @@ -package com.keepassdroid.password; - +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.password; import android.content.Context; import android.content.DialogInterface; import android.net.Uri; import android.os.Handler; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.app.App; -import com.keepassdroid.database.edit.FileOnFinish; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.database.edit.SetPassword; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.edit.FileOnFinish; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.database.edit.SetPassword; +import com.kunzisoft.keepass.tasks.ProgressTask; public class AssignPasswordHelper { diff --git a/app/src/main/java/com/keepassdroid/password/PasswordActivity.java b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java similarity index 95% rename from app/src/main/java/com/keepassdroid/password/PasswordActivity.java rename to app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java index 0c0d86f7c..86f42518f 100644 --- a/app/src/main/java/com/keepassdroid/password/PasswordActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.password; +package com.kunzisoft.keepass.password; import android.Manifest; import android.app.Activity; @@ -52,28 +52,28 @@ import android.widget.Toast; import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; -import com.keepassdroid.activities.GroupActivity; -import com.keepassdroid.activities.LockingActivity; -import com.keepassdroid.app.App; -import com.keepassdroid.autofill.AutofillHelper; -import com.keepassdroid.compat.BackupManagerCompat; -import com.keepassdroid.compat.ClipDataCompat; -import com.keepassdroid.compat.EditorCompat; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.edit.LoadDB; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.dialogs.PasswordEncodingDialogHelper; -import com.keepassdroid.fileselect.KeyFileHelper; -import com.keepassdroid.fingerprint.FingerPrintAnimatedVector; -import com.keepassdroid.fingerprint.FingerPrintDialog; -import com.keepassdroid.fingerprint.FingerPrintHelper; -import com.keepassdroid.settings.PreferencesUtil; -import com.keepassdroid.stylish.StylishActivity; -import com.keepassdroid.tasks.ProgressTask; -import com.keepassdroid.utils.EmptyUtils; -import com.keepassdroid.utils.MenuUtil; -import com.keepassdroid.utils.UriUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.activities.GroupActivity; +import com.kunzisoft.keepass.activities.LockingActivity; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.autofill.AutofillHelper; +import com.kunzisoft.keepass.compat.BackupManagerCompat; +import com.kunzisoft.keepass.compat.ClipDataCompat; +import com.kunzisoft.keepass.compat.EditorCompat; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.edit.LoadDB; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.dialogs.PasswordEncodingDialogHelper; +import com.kunzisoft.keepass.fileselect.KeyFileHelper; +import com.kunzisoft.keepass.fingerprint.FingerPrintAnimatedVector; +import com.kunzisoft.keepass.fingerprint.FingerPrintDialog; +import com.kunzisoft.keepass.fingerprint.FingerPrintHelper; +import com.kunzisoft.keepass.settings.PreferencesUtil; +import com.kunzisoft.keepass.stylish.StylishActivity; +import com.kunzisoft.keepass.tasks.ProgressTask; +import com.kunzisoft.keepass.utils.EmptyUtils; +import com.kunzisoft.keepass.utils.MenuUtil; +import com.kunzisoft.keepass.utils.UriUtil; import java.io.File; import java.io.FileNotFoundException; @@ -87,10 +87,6 @@ import permissions.dispatcher.OnShowRationale; import permissions.dispatcher.PermissionRequest; import permissions.dispatcher.RuntimePermissions; -import static com.keepassdroid.fingerprint.FingerPrintHelper.Mode.NOT_CONFIGURED_MODE; -import static com.keepassdroid.fingerprint.FingerPrintHelper.Mode.OPEN_MODE; -import static com.keepassdroid.fingerprint.FingerPrintHelper.Mode.STORE_MODE; - @RuntimePermissions public class PasswordActivity extends StylishActivity implements FingerPrintHelper.FingerPrintCallback, UriIntentInitTaskCallback { @@ -358,9 +354,12 @@ public class PasswordActivity extends StylishActivity targets.add(fingerprintTapTarget); } + /* + // TODO crash MenuUtil.addDonationTapTargetIfAllowed(targets, toolbar, getString(R.string.education_donation_title), getString(R.string.education_donation_summary)); + */ targets.add(TapTarget.forView(confirmButtonView, getString(R.string.education_open_and_save_database_title), @@ -490,7 +489,7 @@ public class PasswordActivity extends StylishActivity // fingerprint related code here @RequiresApi(api = Build.VERSION_CODES.M) private void initForFingerprint() { - fingerPrintMode = NOT_CONFIGURED_MODE; + fingerPrintMode = FingerPrintHelper.Mode.NOT_CONFIGURED_MODE; fingerPrintHelper = new FingerPrintHelper(this, this); @@ -517,9 +516,9 @@ public class PasswordActivity extends StylishActivity // encrypt or decrypt mode based on how much input or not setFingerPrintView(validInput ? R.string.store_with_fingerprint : R.string.scanning_fingerprint); if (validInput) - toggleFingerprintMode(STORE_MODE); + toggleFingerprintMode(FingerPrintHelper.Mode.STORE_MODE); else - toggleFingerprintMode(OPEN_MODE); + toggleFingerprintMode(FingerPrintHelper.Mode.OPEN_MODE); } } }); @@ -588,7 +587,7 @@ public class PasswordActivity extends StylishActivity @RequiresApi(api = Build.VERSION_CODES.M) private void initEncryptData() { setFingerPrintView(R.string.store_with_fingerprint); - fingerPrintMode = STORE_MODE; + fingerPrintMode = FingerPrintHelper.Mode.STORE_MODE; if (fingerPrintHelper != null) fingerPrintHelper.initEncryptData(); } @@ -596,7 +595,7 @@ public class PasswordActivity extends StylishActivity @RequiresApi(api = Build.VERSION_CODES.M) private void initDecryptData() { setFingerPrintView(R.string.scanning_fingerprint); - fingerPrintMode = OPEN_MODE; + fingerPrintMode = FingerPrintHelper.Mode.OPEN_MODE; if (fingerPrintHelper != null) { final String ivSpecValue = prefsNoBackup.getString(getPreferenceKeyIvSpec(), null); if (ivSpecValue != null) @@ -633,7 +632,7 @@ public class PasswordActivity extends StylishActivity fingerPrintAnimatedVector.stopScan(); } // stop listening when we go in background - fingerPrintMode = NOT_CONFIGURED_MODE; + fingerPrintMode = FingerPrintHelper.Mode.NOT_CONFIGURED_MODE; if (fingerPrintHelper != null) { fingerPrintHelper.stopListening(); } @@ -753,7 +752,7 @@ public class PasswordActivity extends StylishActivity private void deleteEntryKey() { fingerPrintHelper.deleteEntryKey(); removePrefsNoBackupKey(); - fingerPrintMode = NOT_CONFIGURED_MODE; + fingerPrintMode = FingerPrintHelper.Mode.NOT_CONFIGURED_MODE; checkFingerprintAvailability(); } diff --git a/app/src/main/java/com/keepassdroid/password/PasswordGenerator.java b/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.java similarity index 97% rename from app/src/main/java/com/keepassdroid/password/PasswordGenerator.java rename to app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.java index 102cd31ec..a59482314 100644 --- a/app/src/main/java/com/keepassdroid/password/PasswordGenerator.java +++ b/app/src/main/java/com/kunzisoft/keepass/password/PasswordGenerator.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.password; - -import java.security.SecureRandom; +package com.kunzisoft.keepass.password; import android.content.Context; import com.kunzisoft.keepass.R; +import java.security.SecureRandom; + public class PasswordGenerator { private static final String UPPERCASE_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String LOWERCASE_CHARS = "abcdefghijklmnopqrstuvwxyz"; diff --git a/app/src/main/java/com/kunzisoft/keepass/password/UriIntentInitTaskCallback.java b/app/src/main/java/com/kunzisoft/keepass/password/UriIntentInitTaskCallback.java new file mode 100644 index 000000000..07f11e59e --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/password/UriIntentInitTaskCallback.java @@ -0,0 +1,26 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.password; + +import android.net.Uri; + +interface UriIntentInitTaskCallback { + void onPostInitTask(Uri dbUri, Uri keyFileUri, Integer errorStringId); +} diff --git a/app/src/main/java/com/keepassdroid/search/SearchDbHelper.java b/app/src/main/java/com/kunzisoft/keepass/search/SearchDbHelper.java similarity index 84% rename from app/src/main/java/com/keepassdroid/search/SearchDbHelper.java rename to app/src/main/java/com/kunzisoft/keepass/search/SearchDbHelper.java index 0129aa40a..5cd4b7352 100644 --- a/app/src/main/java/com/keepassdroid/search/SearchDbHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/search/SearchDbHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,22 +17,22 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.search; +package com.kunzisoft.keepass.search; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV3; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwEntryV3; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.database.PwGroupV3; -import com.keepassdroid.database.PwGroupV4; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV3; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwEntryV3; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.database.PwGroupV3; +import com.kunzisoft.keepass.database.PwGroupV4; import java.util.ArrayList; import java.util.Iterator; @@ -47,7 +47,7 @@ public class SearchDbHelper. * */ -package com.keepassdroid.search; +package com.kunzisoft.keepass.search; import android.app.SearchManager; import android.content.Intent; @@ -29,12 +29,12 @@ import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; -import com.keepassdroid.activities.ListNodesActivity; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwGroup; -import com.keepassdroid.utils.MenuUtil; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.activities.ListNodesActivity; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.PwGroup; +import com.kunzisoft.keepass.utils.MenuUtil; public class SearchResultsActivity extends ListNodesActivity { diff --git a/app/src/main/java/com/keepassdroid/settings/MainPreferenceFragment.java b/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.java similarity index 72% rename from app/src/main/java/com/keepassdroid/settings/MainPreferenceFragment.java rename to app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.java index 32f451872..8f541ee81 100644 --- a/app/src/main/java/com/keepassdroid/settings/MainPreferenceFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/MainPreferenceFragment.java @@ -1,4 +1,23 @@ -package com.keepassdroid.settings; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.settings; import android.content.Context; import android.os.Bundle; @@ -6,9 +25,11 @@ import android.support.v4.app.DialogFragment; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceFragmentCompat; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.settings.preferenceDialogFragment.RoundsFixPreferenceDialogFragmentCompat; +import com.kunzisoft.keepass.settings.preference.RoundsPreference; public class MainPreferenceFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceClickListener { @@ -48,6 +69,7 @@ public class MainPreferenceFragment extends PreferenceFragmentCompat implements public void onDisplayPreferenceDialog(Preference preference) { // Try if the preference is one of our custom Preferences if (preference instanceof RoundsPreference) { + assert getFragmentManager() != null; DialogFragment dialogFragment = RoundsFixPreferenceDialogFragmentCompat.newInstance(preference.getKey()); dialogFragment.setTargetFragment(this, 0); dialogFragment.show(getFragmentManager(), null); diff --git a/app/src/main/java/com/keepassdroid/settings/NestedSettingsFragment.java b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java similarity index 78% rename from app/src/main/java/com/keepassdroid/settings/NestedSettingsFragment.java rename to app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java index 0e24553c4..3dc1181db 100644 --- a/app/src/main/java/com/keepassdroid/settings/NestedSettingsFragment.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/NestedSettingsFragment.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.settings; +package com.kunzisoft.keepass.settings; import android.content.ActivityNotFoundException; import android.content.DialogInterface; @@ -35,19 +35,22 @@ import android.support.v4.app.FragmentManager; import android.support.v4.hardware.fingerprint.FingerprintManagerCompat; import android.support.v7.app.AlertDialog; import android.support.v7.preference.Preference; +import android.support.v7.preference.PreferenceCategory; import android.support.v7.preference.PreferenceFragmentCompat; import android.util.Log; import android.view.autofill.AutofillManager; import android.widget.Toast; -import com.keepassdroid.app.App; -import com.keepassdroid.database.Database; -import com.keepassdroid.database.PwEncryptionAlgorithm; -import com.keepassdroid.dialogs.StorageAccessFrameworkDialog; -import com.keepassdroid.dialogs.UnavailableFeatureDialogFragment; -import com.keepassdroid.fingerprint.FingerPrintHelper; -import com.keepassdroid.stylish.Stylish; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.dialogs.StorageAccessFrameworkDialog; +import com.kunzisoft.keepass.dialogs.UnavailableFeatureDialogFragment; +import com.kunzisoft.keepass.fingerprint.FingerPrintHelper; +import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseDescriptionPreferenceDialogFragmentCompat; +import com.kunzisoft.keepass.settings.preferenceDialogFragment.DatabaseNamePreferenceDialogFragmentCompat; +import com.kunzisoft.keepass.settings.preferenceDialogFragment.RoundsPreferenceDialogFragmentCompat; +import com.kunzisoft.keepass.stylish.Stylish; public class NestedSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceClickListener { @@ -222,6 +225,7 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat SwitchPreference autoFillEnablePreference = (SwitchPreference) findPreference(getString(R.string.settings_autofill_enable_key)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + assert getActivity() != null; AutofillManager autofillManager = getActivity().getSystemService(AutofillManager.class); if (autofillManager != null && autofillManager.hasEnabledAutofillServices()) autoFillEnablePreference.setChecked(autofillManager.hasEnabledAutofillServices()); @@ -266,18 +270,13 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat } }); } else { - autoFillEnablePreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { - ((SwitchPreference) preference).setChecked(false); - FragmentManager fragmentManager = getFragmentManager(); - assert fragmentManager != null; - UnavailableFeatureDialogFragment.getInstance(Build.VERSION_CODES.O) - .show(fragmentManager, "unavailableFeatureDialog"); - } - return false; - } + autoFillEnablePreference.setOnPreferenceClickListener(preference -> { + ((SwitchPreference) preference).setChecked(false); + FragmentManager fragmentManager = getFragmentManager(); + assert fragmentManager != null; + UnavailableFeatureDialogFragment.getInstance(Build.VERSION_CODES.O) + .show(fragmentManager, "unavailableFeatureDialog"); + return false; }); } break; @@ -287,31 +286,53 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat Database db = App.getDB(); if (db.getLoaded()) { - if (db.getPwDatabase().algorithmSettingsEnabled()) { - Preference roundPref = findPreference(getString(R.string.rounds_key)); - roundPref.setEnabled(true); - roundPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - public boolean onPreferenceChange(Preference preference, Object newValue) { - setRounds(App.getDB(), preference); - return true; - } - }); - setRounds(db, roundPref); + PreferenceCategory dbGeneralPrefCategory = (PreferenceCategory) findPreference(getString(R.string.database_general_key)); - // TODO Algo - Preference algorithmPref = findPreference(getString(R.string.algorithm_key)); - // algorithmPref.setEnabled(true); - setAlgorithm(db, algorithmPref); + // Db name + Preference dbNamePref = findPreference(getString(R.string.database_name_key)); + if ( db.containsName() ) { + dbNamePref.setSummary(db.getName()); + } else { + dbGeneralPrefCategory.removePreference(dbNamePref); } - if (db.isRecycleBinAvailabledAndEnabled()) { - SwitchPreference recycleBinPref = (SwitchPreference) findPreference(getString(R.string.recycle_bin_key)); - // TODO Recycle - //recycleBinPref.setEnabled(true); - recycleBinPref.setChecked(db.isRecycleBinAvailabledAndEnabled()); + // Db description + Preference dbDescriptionPref = findPreference(getString(R.string.database_description_key)); + if ( db.containsDescription() ) { + dbDescriptionPref.setSummary(db.getDescription()); + } else { + dbGeneralPrefCategory.removePreference(dbDescriptionPref); } + // Recycle bin + SwitchPreference recycleBinPref = (SwitchPreference) findPreference(getString(R.string.recycle_bin_key)); + // TODO Recycle + dbGeneralPrefCategory.removePreference(recycleBinPref); // To delete + if (db.isRecycleBinAvailable()) { + + recycleBinPref.setChecked(db.isRecycleBinEnabled()); + recycleBinPref.setEnabled(false); + } else { + dbGeneralPrefCategory.removePreference(recycleBinPref); + } + + // Version + Preference dbVersionPref = findPreference(getString(R.string.database_version_key)); + dbVersionPref.setSummary(db.getVersion()); + + // Encryption Algorithm + Preference algorithmPref = findPreference(getString(R.string.encryption_algorithm_key)); + algorithmPref.setSummary(db.getEncryptionAlgorithmName(getResources())); + + // Key derivation function + Preference kdfPref = findPreference(getString(R.string.key_derivation_function_key)); + kdfPref.setSummary(db.getKeyDerivationName()); + + // Round encryption + Preference roundPref = findPreference(getString(R.string.transform_rounds_key)); + roundPref.setSummary(db.getNumberKeyEncryptionRoundsAsString()); + } else { Log.e(getClass().getName(), "Database isn't ready"); } @@ -325,33 +346,32 @@ public class NestedSettingsFragment extends PreferenceFragmentCompat @Override public void onDisplayPreferenceDialog(Preference preference) { - // Try if the preference is one of our custom Preferences - if (preference instanceof RoundsPreference) { - DialogFragment dialogFragment = RoundsPreferenceDialogFragmentCompat.newInstance(preference.getKey()); + + assert getFragmentManager() != null; + + DialogFragment dialogFragment = null; + + if (preference.getKey().equals(getString(R.string.database_name_key))) { + dialogFragment = DatabaseNamePreferenceDialogFragmentCompat.newInstance(preference.getKey()); + } + if (preference.getKey().equals(getString(R.string.database_description_key))) { + dialogFragment = DatabaseDescriptionPreferenceDialogFragmentCompat.newInstance(preference.getKey()); + } + if (preference.getKey().equals(getString(R.string.transform_rounds_key))) { + dialogFragment = RoundsPreferenceDialogFragmentCompat.newInstance(preference.getKey()); + } + + if (dialogFragment != null) { dialogFragment.setTargetFragment(this, 0); dialogFragment.show(getFragmentManager(), null); } + // Could not be handled here. Try with the super method. else { super.onDisplayPreferenceDialog(preference); } } - private void setRounds(Database db, Preference rounds) { - rounds.setSummary(Long.toString(db.getPwDatabase().getNumRounds())); - } - - private void setAlgorithm(Database db, Preference algorithm) { - int resId; - if ( db.getPwDatabase().getEncryptionAlgorithm() == PwEncryptionAlgorithm.Rjindal ) { - resId = R.string.rijndael; - } else { - resId = R.string.twofish; - } - - algorithm.setSummary(resId); - } - public static String retrieveTitle(Resources resources, int key) { switch (key) { case NESTED_SCREEN_APP_KEY: diff --git a/app/src/main/java/com/keepassdroid/settings/PreferencesUtil.java b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java similarity index 98% rename from app/src/main/java/com/keepassdroid/settings/PreferencesUtil.java rename to app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java index 39f30d410..18dd932e1 100644 --- a/app/src/main/java/com/keepassdroid/settings/PreferencesUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/PreferencesUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,14 +17,14 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.settings; +package com.kunzisoft.keepass.settings; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import com.keepassdroid.database.SortNodeEnum; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.SortNodeEnum; import java.util.Arrays; import java.util.HashSet; diff --git a/app/src/main/java/com/keepassdroid/settings/SettingsActivity.java b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.java similarity index 94% rename from app/src/main/java/com/keepassdroid/settings/SettingsActivity.java rename to app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.java index 8e2a4a51f..fbf62d198 100644 --- a/app/src/main/java/com/keepassdroid/settings/SettingsActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.settings; +package com.kunzisoft.keepass.settings; import android.app.Activity; import android.content.Intent; @@ -26,9 +26,9 @@ import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.view.MenuItem; -import com.keepassdroid.activities.LockingActivity; -import com.keepassdroid.compat.BackupManagerCompat; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.activities.LockingActivity; +import com.kunzisoft.keepass.compat.BackupManagerCompat; public class SettingsActivity extends LockingActivity implements MainPreferenceFragment.Callback { diff --git a/app/src/main/java/com/keepassdroid/settings/SettingsAutofillActivity.java b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.java similarity index 90% rename from app/src/main/java/com/keepassdroid/settings/SettingsAutofillActivity.java rename to app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.java index d4f22cfeb..de5dcc6f1 100644 --- a/app/src/main/java/com/keepassdroid/settings/SettingsAutofillActivity.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/SettingsAutofillActivity.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.settings; +package com.kunzisoft.keepass.settings; import android.support.v4.app.Fragment; diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextExplanationPreference.java b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextExplanationPreference.java new file mode 100644 index 000000000..eaafca812 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextExplanationPreference.java @@ -0,0 +1,51 @@ +package com.kunzisoft.keepass.settings.preference; + +import android.content.Context; +import android.content.res.TypedArray; +import android.support.v7.preference.DialogPreference; +import android.util.AttributeSet; + +import com.kunzisoft.keepass.R; + +public class InputTextExplanationPreference extends DialogPreference { + + protected String explanation; + + public InputTextExplanationPreference(Context context) { + this(context, null); + } + + public InputTextExplanationPreference(Context context, AttributeSet attrs) { + this(context, attrs, R.attr.dialogPreferenceStyle); + } + + public InputTextExplanationPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, defStyleAttr); + } + + public InputTextExplanationPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + TypedArray a = context.getTheme().obtainStyledAttributes( + attrs, + R.styleable.explanationDialog, + 0, 0); + try { + setExplanation(a.getString(R.styleable.explanationDialog_explanations)); + } finally { + a.recycle(); + } + } + + @Override + public int getDialogLayoutResource() { + return R.layout.pref_dialog_input_text_explanation; + } + + public String getExplanation() { + return explanation; + } + + public void setExplanation(String explanation) { + this.explanation = explanation; + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.java b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.java new file mode 100644 index 000000000..8e9bbaa46 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/InputTextPreference.java @@ -0,0 +1,31 @@ +package com.kunzisoft.keepass.settings.preference; + +import android.content.Context; +import android.support.v7.preference.DialogPreference; +import android.util.AttributeSet; + +import com.kunzisoft.keepass.R; + +public class InputTextPreference extends DialogPreference { + + public InputTextPreference(Context context) { + this(context, null); + } + + public InputTextPreference(Context context, AttributeSet attrs) { + this(context, attrs, R.attr.dialogPreferenceStyle); + } + + public InputTextPreference(Context context, AttributeSet attrs, int defStyleAttr) { + this(context, attrs, defStyleAttr, defStyleAttr); + } + + public InputTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + public int getDialogLayoutResource() { + return R.layout.pref_dialog_input_text; + } +} diff --git a/app/src/main/java/com/keepassdroid/settings/RoundsPreference.java b/app/src/main/java/com/kunzisoft/keepass/settings/preference/RoundsPreference.java similarity index 79% rename from app/src/main/java/com/keepassdroid/settings/RoundsPreference.java rename to app/src/main/java/com/kunzisoft/keepass/settings/preference/RoundsPreference.java index 724344ac4..5a744443c 100644 --- a/app/src/main/java/com/keepassdroid/settings/RoundsPreference.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preference/RoundsPreference.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,40 +17,32 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.settings; +package com.kunzisoft.keepass.settings.preference; import android.content.Context; import android.content.res.TypedArray; -import android.support.v7.preference.DialogPreference; import android.util.AttributeSet; import com.kunzisoft.keepass.R; -public class RoundsPreference extends DialogPreference { +public class RoundsPreference extends InputTextExplanationPreference { private long mRounds; - private String explanations; public RoundsPreference(Context context) { this(context, null); } + public RoundsPreference(Context context, AttributeSet attrs) { this(context, attrs, R.attr.dialogPreferenceStyle); } + public RoundsPreference(Context context, AttributeSet attrs, int defStyleAttr) { this(context, attrs, defStyleAttr, defStyleAttr); } + public RoundsPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - TypedArray a = context.getTheme().obtainStyledAttributes( - attrs, - R.styleable.RoundsDialog, - 0, 0); - try { - explanations = a.getString(R.styleable.RoundsDialog_description); - } finally { - a.recycle(); - } } @Override @@ -58,14 +50,6 @@ public class RoundsPreference extends DialogPreference { return R.layout.pref_dialog_rounds; } - public String getExplanations() { - return explanations; - } - - public void setExplanations(String explanations) { - this.explanations = explanations; - } - public long getRounds() { return mRounds; } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseDescriptionPreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseDescriptionPreferenceDialogFragmentCompat.java new file mode 100644 index 000000000..f72d500f8 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseDescriptionPreferenceDialogFragmentCompat.java @@ -0,0 +1,75 @@ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; + +import com.kunzisoft.keepass.database.edit.OnFinish; + +public class DatabaseDescriptionPreferenceDialogFragmentCompat extends DatabaseSavePreferenceDialogFragmentCompat { + + public static DatabaseDescriptionPreferenceDialogFragmentCompat newInstance( + String key) { + final DatabaseDescriptionPreferenceDialogFragmentCompat + fragment = new DatabaseDescriptionPreferenceDialogFragmentCompat(); + final Bundle b = new Bundle(1); + b.putString(ARG_KEY, key); + fragment.setArguments(b); + + return fragment; + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + setInputText(database.getDescription()); + } + + @Override + public void onDialogClosed(boolean positiveResult) { + if ( positiveResult ) { + assert getContext() != null; + + String dbDescription = getInputText(); + String oldDescription = database.getDescription(); + database.assignDescription(dbDescription); + + Handler handler = new Handler(); + setAfterSaveDatabase(new AfterDescriptionSave(getContext(), handler, dbDescription, oldDescription)); + } + + super.onDialogClosed(positiveResult); + } + + private class AfterDescriptionSave extends OnFinish { + + private String mNewDescription; + private String mOldDescription; + private Context mCtx; + + AfterDescriptionSave(Context ctx, Handler handler, String newDescription, String oldDescription) { + super(handler); + + mCtx = ctx; + mNewDescription = newDescription; + mOldDescription = oldDescription; + } + + @Override + public void run() { + String descriptionToShow = mNewDescription; + + if (!mSuccess) { + displayMessage(mCtx); + database.assignDescription(mOldDescription); + database.assignDescription(mOldDescription); + } + + getPreference().setSummary(descriptionToShow); + + super.run(); + } + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseNamePreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseNamePreferenceDialogFragmentCompat.java new file mode 100644 index 000000000..59efc8350 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseNamePreferenceDialogFragmentCompat.java @@ -0,0 +1,74 @@ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; + +import com.kunzisoft.keepass.database.edit.OnFinish; + +public class DatabaseNamePreferenceDialogFragmentCompat extends DatabaseSavePreferenceDialogFragmentCompat { + + public static DatabaseNamePreferenceDialogFragmentCompat newInstance( + String key) { + final DatabaseNamePreferenceDialogFragmentCompat + fragment = new DatabaseNamePreferenceDialogFragmentCompat(); + final Bundle b = new Bundle(1); + b.putString(ARG_KEY, key); + fragment.setArguments(b); + + return fragment; + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + setInputText(database.getName()); + } + + @Override + public void onDialogClosed(boolean positiveResult) { + if ( positiveResult ) { + assert getContext() != null; + + String dbName = getInputText(); + String oldName = database.getName(); + database.assignName(dbName); + + Handler handler = new Handler(); + setAfterSaveDatabase(new AfterNameSave(getContext(), handler, dbName, oldName)); + } + + super.onDialogClosed(positiveResult); + } + + private class AfterNameSave extends OnFinish { + + private String mNewName; + private String mOldName; + private Context mCtx; + + AfterNameSave(Context ctx, Handler handler, String newName, String oldName) { + super(handler); + + mCtx = ctx; + mNewName = newName; + mOldName = oldName; + } + + @Override + public void run() { + String nameToShow = mNewName; + + if (!mSuccess) { + displayMessage(mCtx); + database.assignName(mOldName); + } + + getPreference().setSummary(nameToShow); + + super.run(); + } + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseSavePreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseSavePreferenceDialogFragmentCompat.java new file mode 100644 index 000000000..950c2dd9f --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/DatabaseSavePreferenceDialogFragmentCompat.java @@ -0,0 +1,41 @@ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; + +import android.view.View; + +import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.database.Database; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.database.edit.SaveDB; +import com.kunzisoft.keepass.tasks.ProgressTask; + +public abstract class DatabaseSavePreferenceDialogFragmentCompat extends InputPreferenceDialogFragmentCompat { + + protected Database database; + + private OnFinish afterSaveDatabase; + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + database = App.getDB(); + } + + @Override + public void onDialogClosed(boolean positiveResult) { + if ( positiveResult ) { + assert getContext() != null; + + if (database != null && afterSaveDatabase != null) { + SaveDB save = new SaveDB(getContext(), database, afterSaveDatabase); + ProgressTask pt = new ProgressTask(getContext(), save, R.string.saving_database); + pt.run(); + } + } + } + + public void setAfterSaveDatabase(OnFinish afterSaveDatabase) { + this.afterSaveDatabase = afterSaveDatabase; + } +} diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/InputPreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/InputPreferenceDialogFragmentCompat.java new file mode 100644 index 000000000..cfa326485 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/InputPreferenceDialogFragmentCompat.java @@ -0,0 +1,43 @@ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; + +import android.support.v7.preference.PreferenceDialogFragmentCompat; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import com.kunzisoft.keepass.R; + +public abstract class InputPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat { + + private EditText inputTextView; + private TextView textExplanationView; + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + inputTextView = view.findViewById(R.id.input_text); + textExplanationView = view.findViewById(R.id.explanation_text); + } + + public String getInputText() { + return this.inputTextView.getText().toString(); + } + + public void setInputText(String inputText) { + this.inputTextView.setText(inputText); + this.inputTextView.setSelection(this.inputTextView.getText().length()); + } + + public String getExplanationText() { + if (textExplanationView != null) + return textExplanationView.getText().toString(); + else + return ""; + } + + public void setExplanationText(String explanationText) { + if (textExplanationView != null) + this.textExplanationView.setText(explanationText); + } +} diff --git a/app/src/main/java/com/keepassdroid/settings/RoundsFixPreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsFixPreferenceDialogFragmentCompat.java similarity index 59% rename from app/src/main/java/com/keepassdroid/settings/RoundsFixPreferenceDialogFragmentCompat.java rename to app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsFixPreferenceDialogFragmentCompat.java index 8b66408a1..d5e71a943 100644 --- a/app/src/main/java/com/keepassdroid/settings/RoundsFixPreferenceDialogFragmentCompat.java +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsFixPreferenceDialogFragmentCompat.java @@ -1,17 +1,33 @@ -package com.keepassdroid.settings; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; import android.os.Bundle; import android.support.v7.preference.DialogPreference; -import android.support.v7.preference.PreferenceDialogFragmentCompat; import android.view.View; -import android.widget.TextView; import android.widget.Toast; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.settings.preference.RoundsPreference; -public class RoundsFixPreferenceDialogFragmentCompat extends PreferenceDialogFragmentCompat { - - private TextView mRoundsView; +public class RoundsFixPreferenceDialogFragmentCompat extends InputPreferenceDialogFragmentCompat { public static RoundsFixPreferenceDialogFragmentCompat newInstance( String key) { @@ -24,12 +40,24 @@ public class RoundsFixPreferenceDialogFragmentCompat extends PreferenceDialogFra return fragment; } + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + DialogPreference preference = getPreference(); + if (preference instanceof RoundsPreference) { + setExplanationText(((RoundsPreference) preference).getExplanation()); + long numRounds = ((RoundsPreference) preference).getRounds(); + setInputText(String.valueOf(numRounds)); + } + } + @Override public void onDialogClosed(boolean positiveResult) { if ( positiveResult ) { long rounds; try { - String strRounds = mRoundsView.getText().toString(); + String strRounds = getInputText(); rounds = Long.valueOf(strRounds); } catch (NumberFormatException e) { Toast.makeText(getContext(), R.string.error_rounds_not_number, Toast.LENGTH_LONG).show(); @@ -47,19 +75,4 @@ public class RoundsFixPreferenceDialogFragmentCompat extends PreferenceDialogFra } } } - - @Override - protected void onBindDialogView(View view) { - super.onBindDialogView(view); - - TextView textDescriptionView = (TextView) view.findViewById(R.id.rounds_explanation); - mRoundsView = (TextView) view.findViewById(R.id.rounds); - - DialogPreference preference = getPreference(); - if (preference instanceof RoundsPreference) { - textDescriptionView.setText(((RoundsPreference) preference).getExplanations()); - long numRounds = ((RoundsPreference) preference).getRounds(); - mRoundsView.setText(String.valueOf(numRounds)); - } - } } diff --git a/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsPreferenceDialogFragmentCompat.java b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsPreferenceDialogFragmentCompat.java new file mode 100644 index 000000000..afc861034 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/settings/preferenceDialogFragment/RoundsPreferenceDialogFragmentCompat.java @@ -0,0 +1,113 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.settings.preferenceDialogFragment; + +import android.content.Context; +import android.os.Bundle; +import android.os.Handler; +import android.view.View; +import android.widget.Toast; + +import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.edit.OnFinish; + +public class RoundsPreferenceDialogFragmentCompat extends DatabaseSavePreferenceDialogFragmentCompat { + + public static RoundsPreferenceDialogFragmentCompat newInstance( + String key) { + final RoundsPreferenceDialogFragmentCompat + fragment = new RoundsPreferenceDialogFragmentCompat(); + final Bundle b = new Bundle(1); + b.putString(ARG_KEY, key); + fragment.setArguments(b); + + return fragment; + } + + @Override + protected void onBindDialogView(View view) { + super.onBindDialogView(view); + + setExplanationText(getString(R.string.rounds_explanation)); + setInputText(database.getNumberKeyEncryptionRoundsAsString()); + } + + @Override + public void onDialogClosed(boolean positiveResult) { + if ( positiveResult ) { + assert getContext() != null; + long rounds; + + try { + String strRounds = getInputText(); + rounds = Long.parseLong(strRounds); + } catch (NumberFormatException e) { + Toast.makeText(getContext(), R.string.error_rounds_not_number, Toast.LENGTH_LONG).show(); + return; + } + + if ( rounds < 1 ) { + rounds = 1; + } + + long oldRounds = database.getNumberKeyEncryptionRounds(); + try { + database.setNumberKeyEncryptionRounds(rounds); + } catch (NumberFormatException e) { + Toast.makeText(getContext(), R.string.error_rounds_too_large, Toast.LENGTH_LONG).show(); + database.setNumberKeyEncryptionRounds(Integer.MAX_VALUE); + } + + Handler handler = new Handler(); + setAfterSaveDatabase(new AfterRoundSave(getContext(), handler, rounds, oldRounds)); + } + + super.onDialogClosed(positiveResult); + } + + private class AfterRoundSave extends OnFinish { + + private long mNewRounds; + private long mOldRounds; + private Context mCtx; + + AfterRoundSave(Context ctx, Handler handler, long newRounds, long oldRounds) { + super(handler); + + mCtx = ctx; + mNewRounds = newRounds; + mOldRounds = oldRounds; + } + + @Override + public void run() { + long roundsToShow = mNewRounds; + + if (!mSuccess) { + displayMessage(mCtx); + database.setNumberKeyEncryptionRounds(mOldRounds); + } + + getPreference().setSummary(String.valueOf(roundsToShow)); + + super.run(); + } + } +} diff --git a/app/src/main/java/com/keepassdroid/stream/BetterCipherInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/BetterCipherInputStream.java similarity index 99% rename from app/src/main/java/com/keepassdroid/stream/BetterCipherInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/BetterCipherInputStream.java index b91964003..5e13428a4 100644 --- a/app/src/main/java/com/keepassdroid/stream/BetterCipherInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/BetterCipherInputStream.java @@ -15,7 +15,7 @@ * limitations under the License. */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.FilterInputStream; import java.io.IOException; diff --git a/app/src/main/java/com/keepassdroid/stream/CopyInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java similarity index 95% rename from app/src/main/java/com/keepassdroid/stream/CopyInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java index 22b205f8c..52fe74eea 100644 --- a/app/src/main/java/com/keepassdroid/stream/CopyInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/CopyInputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/CountInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java similarity index 94% rename from app/src/main/java/com/keepassdroid/stream/CountInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java index c7a5242fe..604a93b19 100644 --- a/app/src/main/java/com/keepassdroid/stream/CountInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/CountInputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/CountOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java similarity index 93% rename from app/src/main/java/com/keepassdroid/stream/CountOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java index 8ac6e7f29..945874a1c 100644 --- a/app/src/main/java/com/keepassdroid/stream/CountOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/CountOutputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/HashedBlockInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.java similarity index 96% rename from app/src/main/java/com/keepassdroid/stream/HashedBlockInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.java index ff3faca98..c44a2b6bd 100644 --- a/app/src/main/java/com/keepassdroid/stream/HashedBlockInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockInputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/HashedBlockOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java similarity index 97% rename from app/src/main/java/com/keepassdroid/stream/HashedBlockOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java index 3a8f5781d..b1fce5c47 100644 --- a/app/src/main/java/com/keepassdroid/stream/HashedBlockOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/HashedBlockOutputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/HmacBlockInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.java similarity index 97% rename from app/src/main/java/com/keepassdroid/stream/HmacBlockInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.java index 62070d91c..485700e80 100644 --- a/app/src/main/java/com/keepassdroid/stream/HmacBlockInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockInputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/HmacBlockOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java similarity index 97% rename from app/src/main/java/com/keepassdroid/stream/HmacBlockOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java index b115ce5fc..ba00ed9ff 100644 --- a/app/src/main/java/com/keepassdroid/stream/HmacBlockOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockOutputStream.java @@ -5,7 +5,7 @@ * * KeePassDroid 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePassDroid is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePassDroid. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/HmacBlockStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java similarity index 92% rename from app/src/main/java/com/keepassdroid/stream/HmacBlockStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java index 228198001..3ccbd47eb 100644 --- a/app/src/main/java/com/keepassdroid/stream/HmacBlockStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/HmacBlockStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,8 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.DigestOutputStream; import java.security.MessageDigest; diff --git a/app/src/main/java/com/keepassdroid/stream/LEDataInputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java similarity index 96% rename from app/src/main/java/com/keepassdroid/stream/LEDataInputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java index afe928c1d..a213f7c76 100644 --- a/app/src/main/java/com/keepassdroid/stream/LEDataInputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataInputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,9 +17,9 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; -import com.keepassdroid.utils.Types; +import com.kunzisoft.keepass.utils.Types; import java.io.IOException; import java.io.InputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/LEDataOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java similarity index 97% rename from app/src/main/java/com/keepassdroid/stream/LEDataOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java index 2d7c96680..82a02fbe6 100644 --- a/app/src/main/java/com/keepassdroid/stream/LEDataOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/LEDataOutputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/MacOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java similarity index 94% rename from app/src/main/java/com/keepassdroid/stream/MacOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java index 2d51fcfab..abff8df7f 100644 --- a/app/src/main/java/com/keepassdroid/stream/MacOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/MacOutputStream.java @@ -5,7 +5,7 @@ * * KeePassDroid 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePassDroid is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePassDroid. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/NullOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java similarity index 92% rename from app/src/main/java/com/keepassdroid/stream/NullOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java index ad364d0eb..0e1a70b66 100644 --- a/app/src/main/java/com/keepassdroid/stream/NullOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/NullOutputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stream/RandomFileOutputStream.java b/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java similarity index 93% rename from app/src/main/java/com/keepassdroid/stream/RandomFileOutputStream.java rename to app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java index 93a660ad4..220ba2e64 100644 --- a/app/src/main/java/com/keepassdroid/stream/RandomFileOutputStream.java +++ b/app/src/main/java/com/kunzisoft/keepass/stream/RandomFileOutputStream.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.stream; +package com.kunzisoft.keepass.stream; import java.io.IOException; import java.io.OutputStream; diff --git a/app/src/main/java/com/keepassdroid/stylish/Stylish.java b/app/src/main/java/com/kunzisoft/keepass/stylish/Stylish.java similarity index 56% rename from app/src/main/java/com/keepassdroid/stylish/Stylish.java rename to app/src/main/java/com/kunzisoft/keepass/stylish/Stylish.java index abb93d8ad..32f28b614 100644 --- a/app/src/main/java/com/keepassdroid/stylish/Stylish.java +++ b/app/src/main/java/com/kunzisoft/keepass/stylish/Stylish.java @@ -1,4 +1,23 @@ -package com.keepassdroid.stylish; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.stylish; import android.content.Context; import android.support.annotation.StyleRes; diff --git a/app/src/main/java/com/kunzisoft/keepass/stylish/StylishActivity.java b/app/src/main/java/com/kunzisoft/keepass/stylish/StylishActivity.java new file mode 100644 index 000000000..ba193be46 --- /dev/null +++ b/app/src/main/java/com/kunzisoft/keepass/stylish/StylishActivity.java @@ -0,0 +1,47 @@ +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.stylish; + +import android.os.Bundle; +import android.support.annotation.Nullable; +import android.support.annotation.StyleRes; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; + +public abstract class StylishActivity extends AppCompatActivity { + + private @StyleRes int themeId; + + @Override + protected void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + this.themeId = Stylish.getThemeId(this); + setTheme(themeId); + } + + @Override + protected void onResume() { + super.onResume(); + if(Stylish.getThemeId(this) != this.themeId) { + Log.d(this.getClass().getName(), "Theme change detected, restarting activity"); + this.recreate(); + } + } +} diff --git a/app/src/main/java/com/keepassdroid/tasks/ProgressTask.java b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTask.java similarity index 91% rename from app/src/main/java/com/keepassdroid/tasks/ProgressTask.java rename to app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTask.java index bf4450c74..3eae9817d 100644 --- a/app/src/main/java/com/keepassdroid/tasks/ProgressTask.java +++ b/app/src/main/java/com/kunzisoft/keepass/tasks/ProgressTask.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tasks; +package com.kunzisoft.keepass.tasks; import android.app.ProgressDialog; import android.content.Context; import android.os.Handler; -import com.keepassdroid.database.edit.OnFinish; -import com.keepassdroid.database.edit.RunnableOnFinish; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.edit.OnFinish; +import com.kunzisoft.keepass.database.edit.RunnableOnFinish; /** Designed to Pop up a progress dialog, run a thread in the background, * run cleanup in the current thread, close the dialog. Without blocking diff --git a/app/src/main/java/com/keepassdroid/tasks/UIToastTask.java b/app/src/main/java/com/kunzisoft/keepass/tasks/UIToastTask.java similarity index 91% rename from app/src/main/java/com/keepassdroid/tasks/UIToastTask.java rename to app/src/main/java/com/kunzisoft/keepass/tasks/UIToastTask.java index 68f245bd3..a891f10db 100644 --- a/app/src/main/java/com/keepassdroid/tasks/UIToastTask.java +++ b/app/src/main/java/com/kunzisoft/keepass/tasks/UIToastTask.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tasks; +package com.kunzisoft.keepass.tasks; import android.content.Context; import android.widget.Toast; diff --git a/app/src/main/java/com/keepassdroid/tasks/UpdateStatus.java b/app/src/main/java/com/kunzisoft/keepass/tasks/UpdateStatus.java similarity index 93% rename from app/src/main/java/com/keepassdroid/tasks/UpdateStatus.java rename to app/src/main/java/com/kunzisoft/keepass/tasks/UpdateStatus.java index 9b31e6d88..43488a9ed 100644 --- a/app/src/main/java/com/keepassdroid/tasks/UpdateStatus.java +++ b/app/src/main/java/com/kunzisoft/keepass/tasks/UpdateStatus.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.tasks; +package com.kunzisoft.keepass.tasks; import android.app.ProgressDialog; import android.content.Context; diff --git a/app/src/main/java/com/keepassdroid/timeout/ClipboardHelper.java b/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.java similarity index 95% rename from app/src/main/java/com/keepassdroid/timeout/ClipboardHelper.java rename to app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.java index 496740a08..96eaa55e9 100644 --- a/app/src/main/java/com/keepassdroid/timeout/ClipboardHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/ClipboardHelper.java @@ -6,7 +6,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -18,7 +18,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.timeout; +package com.kunzisoft.keepass.timeout; import android.app.Activity; import android.app.AlertDialog; @@ -34,9 +34,9 @@ import android.text.util.Linkify; import android.widget.TextView; import android.widget.Toast; -import com.keepassdroid.database.exception.SamsungClipboardException; -import com.keepassdroid.tasks.UIToastTask; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.exception.SamsungClipboardException; +import com.kunzisoft.keepass.tasks.UIToastTask; import java.util.Timer; import java.util.TimerTask; diff --git a/app/src/main/java/com/keepassdroid/timeout/Timeout.java b/app/src/main/java/com/kunzisoft/keepass/timeout/Timeout.java similarity index 67% rename from app/src/main/java/com/keepassdroid/timeout/Timeout.java rename to app/src/main/java/com/kunzisoft/keepass/timeout/Timeout.java index ebaee1793..f40691ca3 100644 --- a/app/src/main/java/com/keepassdroid/timeout/Timeout.java +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/Timeout.java @@ -1,4 +1,23 @@ -package com.keepassdroid.timeout; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.timeout; import android.app.AlarmManager; import android.app.PendingIntent; @@ -12,7 +31,7 @@ import com.kunzisoft.keepass.R; public class Timeout { - public static final String TIMEOUT = "com.keepassdroid.timeout"; + public static final String TIMEOUT = "com.kunzisoft.keepass.timeout"; private static final int REQUEST_ID = 0; private static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes diff --git a/app/src/main/java/com/keepassdroid/timeout/TimeoutHelper.java b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.java similarity index 91% rename from app/src/main/java/com/keepassdroid/timeout/TimeoutHelper.java rename to app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.java index 5bee13a96..a7aa33360 100644 --- a/app/src/main/java/com/keepassdroid/timeout/TimeoutHelper.java +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutHelper.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,16 +17,16 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.timeout; +package com.kunzisoft.keepass.timeout; import android.app.Activity; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import com.keepassdroid.activities.LockingActivity; import com.kunzisoft.keepass.R; -import com.keepassdroid.app.App; -import com.keepassdroid.compat.EditorCompat; +import com.kunzisoft.keepass.activities.LockingActivity; +import com.kunzisoft.keepass.app.App; +import com.kunzisoft.keepass.compat.EditorCompat; public class TimeoutHelper { diff --git a/app/src/main/java/com/keepassdroid/timeout/TimeoutService.java b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutService.java similarity index 91% rename from app/src/main/java/com/keepassdroid/timeout/TimeoutService.java rename to app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutService.java index b1017db82..b5b9aa66c 100644 --- a/app/src/main/java/com/keepassdroid/timeout/TimeoutService.java +++ b/app/src/main/java/com/kunzisoft/keepass/timeout/TimeoutService.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.timeout; +package com.kunzisoft.keepass.timeout; import android.app.NotificationManager; import android.app.Service; @@ -29,10 +29,11 @@ import android.os.Binder; import android.os.IBinder; import android.util.Log; -import com.keepassdroid.app.App; +import com.kunzisoft.keepass.app.App; public class TimeoutService extends Service { - private static final String TAG = "KeePassDroid Timer"; + + private static final String TAG = TimeoutService.class.getName(); private BroadcastReceiver mIntentReceiver; @Override diff --git a/app/src/main/java/com/keepassdroid/utils/DateUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/DateUtil.java similarity index 82% rename from app/src/main/java/com/keepassdroid/utils/DateUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/DateUtil.java index 35ea57d1f..b706a6ab8 100644 --- a/app/src/main/java/com/keepassdroid/utils/DateUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/DateUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,11 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import org.joda.time.Seconds; +import org.joda.time.Duration; import java.util.Date; @@ -32,9 +32,6 @@ public class DateUtil { private static final long epochOffset; static { - Date dotNet = dotNetEpoch.toDate(); - Date java = javaEpoch.toDate(); - epochOffset = (javaEpoch.getMillis() - dotNetEpoch.getMillis()) / 1000L; } @@ -51,7 +48,8 @@ public class DateUtil { } public static long convertDateToKDBX4Time(DateTime dt) { - Seconds secs = Seconds.secondsBetween(javaEpoch, dt); - return secs.getSeconds() + epochOffset; + Duration duration = new Duration( javaEpoch, dt ); + long seconds = ( duration.getMillis() / 1000L ); + return seconds + epochOffset; } } diff --git a/app/src/main/java/com/keepassdroid/utils/EmptyUtils.java b/app/src/main/java/com/kunzisoft/keepass/utils/EmptyUtils.java similarity index 81% rename from app/src/main/java/com/keepassdroid/utils/EmptyUtils.java rename to app/src/main/java/com/kunzisoft/keepass/utils/EmptyUtils.java index 59f94430c..c84c76f87 100644 --- a/app/src/main/java/com/keepassdroid/utils/EmptyUtils.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/EmptyUtils.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,11 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import android.net.Uri; -import com.keepassdroid.database.PwDate; - -import static com.keepassdroid.database.PwDate.DEFAULT_PWDATE; +import com.kunzisoft.keepass.database.PwDate; public class EmptyUtils { public static boolean isNullOrEmpty(String str) { @@ -35,7 +33,7 @@ public class EmptyUtils { } public static boolean isNullOrEmpty(PwDate date) { - return (date == null) || date.equals(DEFAULT_PWDATE); + return (date == null) || date.equals(PwDate.DEFAULT_PWDATE); } public static boolean isNullOrEmpty(Uri uri) { diff --git a/app/src/main/java/com/keepassdroid/utils/Interaction.java b/app/src/main/java/com/kunzisoft/keepass/utils/Interaction.java similarity index 94% rename from app/src/main/java/com/keepassdroid/utils/Interaction.java rename to app/src/main/java/com/kunzisoft/keepass/utils/Interaction.java index 0584dd9c4..f498c4e05 100644 --- a/app/src/main/java/com/keepassdroid/utils/Interaction.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/Interaction.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; - -import java.util.List; +package com.kunzisoft.keepass.utils; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import java.util.List; + public class Interaction { /** * Indicates whether the specified action can be used as an intent. This diff --git a/app/src/main/java/com/keepassdroid/utils/MemUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/MemUtil.java similarity index 93% rename from app/src/main/java/com/keepassdroid/utils/MemUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/MemUtil.java index 683665258..c39c2885d 100644 --- a/app/src/main/java/com/keepassdroid/utils/MemUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/MemUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/app/src/main/java/com/keepassdroid/utils/MenuUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.java similarity index 74% rename from app/src/main/java/com/keepassdroid/utils/MenuUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.java index 650e23847..e94521c00 100644 --- a/app/src/main/java/com/keepassdroid/utils/MenuUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/MenuUtil.java @@ -1,4 +1,23 @@ -package com.keepassdroid.utils; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.utils; import android.content.ActivityNotFoundException; import android.content.Intent; @@ -9,11 +28,11 @@ import android.view.MenuItem; import android.widget.Toast; import com.getkeepsafe.taptargetview.TapTarget; -import com.keepassdroid.activities.AboutActivity; -import com.keepassdroid.settings.SettingsActivity; -import com.keepassdroid.stylish.StylishActivity; import com.kunzisoft.keepass.BuildConfig; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.activities.AboutActivity; +import com.kunzisoft.keepass.settings.SettingsActivity; +import com.kunzisoft.keepass.stylish.StylishActivity; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/utils/SpannableReplacer.java b/app/src/main/java/com/kunzisoft/keepass/utils/SpannableReplacer.java similarity index 96% rename from app/src/main/java/com/keepassdroid/utils/SpannableReplacer.java rename to app/src/main/java/com/kunzisoft/keepass/utils/SpannableReplacer.java index 17601e6f3..38e81f2d1 100644 --- a/app/src/main/java/com/keepassdroid/utils/SpannableReplacer.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/SpannableReplacer.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import android.os.Parcel; import android.text.Spannable; diff --git a/app/src/main/java/com/keepassdroid/utils/SprContextV4.java b/app/src/main/java/com/kunzisoft/keepass/utils/SprContextV4.java similarity index 85% rename from app/src/main/java/com/keepassdroid/utils/SprContextV4.java rename to app/src/main/java/com/kunzisoft/keepass/utils/SprContextV4.java index 08a3927c9..2491c416e 100644 --- a/app/src/main/java/com/keepassdroid/utils/SprContextV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/SprContextV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,10 +17,10 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwEntryV4; import java.util.HashMap; import java.util.Map; diff --git a/app/src/main/java/com/keepassdroid/utils/SprEngineV4.java b/app/src/main/java/com/kunzisoft/keepass/utils/SprEngineV4.java similarity index 92% rename from app/src/main/java/com/keepassdroid/utils/SprEngineV4.java rename to app/src/main/java/com/kunzisoft/keepass/utils/SprEngineV4.java index 4e894749f..451018fb4 100644 --- a/app/src/main/java/com/keepassdroid/utils/SprEngineV4.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/SprEngineV4.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,15 +17,15 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; -import com.keepassdroid.database.PwDatabase; -import com.keepassdroid.database.PwDatabaseV4; -import com.keepassdroid.database.PwEntry; -import com.keepassdroid.database.PwEntryV4; -import com.keepassdroid.database.PwGroupV4; -import com.keepassdroid.database.EntrySearchV4; -import com.keepassdroid.database.SearchParametersV4; +import com.kunzisoft.keepass.database.EntrySearchV4; +import com.kunzisoft.keepass.database.PwDatabase; +import com.kunzisoft.keepass.database.PwDatabaseV4; +import com.kunzisoft.keepass.database.PwEntry; +import com.kunzisoft.keepass.database.PwEntryV4; +import com.kunzisoft.keepass.database.PwGroupV4; +import com.kunzisoft.keepass.database.SearchParametersV4; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/utils/StrUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/StrUtil.java similarity index 95% rename from app/src/main/java/com/keepassdroid/utils/StrUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/StrUtil.java index 5f8656dad..8d00133d0 100644 --- a/app/src/main/java/com/keepassdroid/utils/StrUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/StrUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import java.util.ArrayList; import java.util.List; diff --git a/app/src/main/java/com/keepassdroid/utils/Types.java b/app/src/main/java/com/kunzisoft/keepass/utils/Types.java similarity index 96% rename from app/src/main/java/com/keepassdroid/utils/Types.java rename to app/src/main/java/com/kunzisoft/keepass/utils/Types.java index 8756fe769..18271e031 100644 --- a/app/src/main/java/com/keepassdroid/utils/Types.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/Types.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -40,15 +40,15 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; + +import com.kunzisoft.keepass.stream.LEDataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.UUID; -import com.keepassdroid.stream.LEDataOutputStream; - /** * Tools for slicing and dicing Java and KeePass data types. diff --git a/app/src/main/java/com/keepassdroid/utils/UriUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.java similarity index 96% rename from app/src/main/java/com/keepassdroid/utils/UriUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.java index 83dfe87e1..475bcc178 100644 --- a/app/src/main/java/com/keepassdroid/utils/UriUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/UriUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,13 +17,13 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import android.content.Context; import android.database.Cursor; import android.net.Uri; -import com.keepassdroid.compat.StorageAF; +import com.kunzisoft.keepass.compat.StorageAF; import java.io.File; import java.io.FileInputStream; diff --git a/app/src/main/java/com/keepassdroid/utils/Util.java b/app/src/main/java/com/kunzisoft/keepass/utils/Util.java similarity index 93% rename from app/src/main/java/com/keepassdroid/utils/Util.java rename to app/src/main/java/com/kunzisoft/keepass/utils/Util.java index f5d8a5027..d4112d1b4 100644 --- a/app/src/main/java/com/keepassdroid/utils/Util.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/Util.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import android.content.ActivityNotFoundException; import android.content.Context; @@ -52,9 +52,13 @@ public class Util { public static void copyStream(InputStream in, OutputStream out) throws IOException { byte[] buf = new byte[1024]; int read; - while ((read = in.read(buf)) != -1) { - out.write(buf, 0, read); - } + try { + while ((read = in.read(buf)) != -1) { + out.write(buf, 0, read); + } + } catch (OutOfMemoryError error) { + throw new IOException(error); + } } private final static String stringToStrikeThrough = "0"; diff --git a/app/src/main/java/com/keepassdroid/utils/UuidUtil.java b/app/src/main/java/com/kunzisoft/keepass/utils/UuidUtil.java similarity index 93% rename from app/src/main/java/com/keepassdroid/utils/UuidUtil.java rename to app/src/main/java/com/kunzisoft/keepass/utils/UuidUtil.java index 110c27f02..0caa8b448 100644 --- a/app/src/main/java/com/keepassdroid/utils/UuidUtil.java +++ b/app/src/main/java/com/kunzisoft/keepass/utils/UuidUtil.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.utils; +package com.kunzisoft.keepass.utils; import java.util.UUID; diff --git a/app/src/main/java/com/keepassdroid/view/AddNodeButtonView.java b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java similarity index 99% rename from app/src/main/java/com/keepassdroid/view/AddNodeButtonView.java rename to app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java index 6edb28553..05d8d8328 100644 --- a/app/src/main/java/com/keepassdroid/view/AddNodeButtonView.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/AddNodeButtonView.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.annotation.SuppressLint; import android.content.Context; diff --git a/app/src/main/java/com/keepassdroid/view/EntryContentsView.java b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.java similarity index 97% rename from app/src/main/java/com/keepassdroid/view/EntryContentsView.java rename to app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.java index 32f4568b4..707d4c51a 100644 --- a/app/src/main/java/com/keepassdroid/view/EntryContentsView.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryContentsView.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.content.Context; import android.text.method.PasswordTransformationMethod; @@ -29,9 +29,9 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.utils.Util; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.utils.Util; import java.text.DateFormat; import java.util.Date; diff --git a/app/src/main/java/com/keepassdroid/view/EntryCustomField.java b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.java similarity index 92% rename from app/src/main/java/com/keepassdroid/view/EntryCustomField.java rename to app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.java index f384c86b5..83f593f7b 100644 --- a/app/src/main/java/com/keepassdroid/view/EntryCustomField.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomField.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.content.Context; import android.util.AttributeSet; @@ -26,9 +26,9 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.utils.Util; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.utils.Util; public class EntryCustomField extends LinearLayout { diff --git a/app/src/main/java/com/keepassdroid/view/EntryCustomFieldProtected.java b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomFieldProtected.java similarity index 59% rename from app/src/main/java/com/keepassdroid/view/EntryCustomFieldProtected.java rename to app/src/main/java/com/kunzisoft/keepass/view/EntryCustomFieldProtected.java index 06b8b04fc..b5ae29ccb 100644 --- a/app/src/main/java/com/keepassdroid/view/EntryCustomFieldProtected.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryCustomFieldProtected.java @@ -1,10 +1,29 @@ -package com.keepassdroid.view; +/* + * Copyright 2018 Jeremy Jamet / Kunzisoft. + * + * This file is part of KeePass DX. + * + * KeePass DX 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. + * + * KeePass DX 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 KeePass DX. If not, see . + * + */ +package com.kunzisoft.keepass.view; import android.content.Context; import android.text.method.PasswordTransformationMethod; import android.util.AttributeSet; -import com.keepassdroid.database.security.ProtectedString; +import com.kunzisoft.keepass.database.security.ProtectedString; public class EntryCustomFieldProtected extends EntryCustomField{ diff --git a/app/src/main/java/com/keepassdroid/view/EntryEditCustomField.java b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.java similarity index 93% rename from app/src/main/java/com/keepassdroid/view/EntryEditCustomField.java rename to app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.java index 2c50e3102..dd3d7c427 100644 --- a/app/src/main/java/com/keepassdroid/view/EntryEditCustomField.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/EntryEditCustomField.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.content.Context; import android.util.AttributeSet; @@ -30,9 +30,9 @@ import android.widget.EditText; import android.widget.RelativeLayout; import android.widget.TextView; -import com.keepassdroid.database.security.ProtectedString; -import com.keepassdroid.utils.Util; import com.kunzisoft.keepass.R; +import com.kunzisoft.keepass.database.security.ProtectedString; +import com.kunzisoft.keepass.utils.Util; public class EntryEditCustomField extends RelativeLayout { diff --git a/app/src/main/java/com/keepassdroid/view/FileNameView.java b/app/src/main/java/com/kunzisoft/keepass/view/FileNameView.java similarity index 94% rename from app/src/main/java/com/keepassdroid/view/FileNameView.java rename to app/src/main/java/com/kunzisoft/keepass/view/FileNameView.java index 4975f36f4..de1264d33 100644 --- a/app/src/main/java/com/keepassdroid/view/FileNameView.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/FileNameView.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.content.Context; import android.os.Environment; diff --git a/app/src/main/java/com/keepassdroid/view/GroupHeaderView.java b/app/src/main/java/com/kunzisoft/keepass/view/GroupHeaderView.java similarity index 91% rename from app/src/main/java/com/keepassdroid/view/GroupHeaderView.java rename to app/src/main/java/com/kunzisoft/keepass/view/GroupHeaderView.java index 19957acce..c1bbb9e4b 100644 --- a/app/src/main/java/com/keepassdroid/view/GroupHeaderView.java +++ b/app/src/main/java/com/kunzisoft/keepass/view/GroupHeaderView.java @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -17,7 +17,7 @@ * along with KeePass DX. If not, see . * */ -package com.keepassdroid.view; +package com.kunzisoft.keepass.view; import android.content.Context; import android.util.AttributeSet; @@ -26,7 +26,7 @@ import android.view.View; import android.widget.RelativeLayout; import com.kunzisoft.keepass.R; -import com.keepassdroid.app.App; +import com.kunzisoft.keepass.app.App; public class GroupHeaderView extends RelativeLayout { diff --git a/app/src/main/java/org/apache/commons/collections/IterableMap.java b/app/src/main/java/org/apache/commons/collections/IterableMap.java deleted file mode 100644 index b409c85c7..000000000 --- a/app/src/main/java/org/apache/commons/collections/IterableMap.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections; - -import java.util.Map; - -/** - * Defines a map that can be iterated directly without needing to create an entry set. - *

- * A map iterator is an efficient way of iterating over maps. - * There is no need to access the entry set or cast to Map Entry objects. - *

- * IterableMap map = new HashedMap();
- * MapIterator it = map.mapIterator();
- * while (it.hasNext()) {
- *   Object key = it.next();
- *   Object value = it.getValue();
- *   it.setValue("newValue");
- * }
- * 
- * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public interface IterableMap extends Map { - - /** - * Obtains a MapIterator over the map. - *

- * A map iterator is an efficient way of iterating over maps. - * There is no need to access the entry set or cast to Map Entry objects. - *

-     * IterableMap map = new HashedMap();
-     * MapIterator it = map.mapIterator();
-     * while (it.hasNext()) {
-     *   Object key = it.next();
-     *   Object value = it.getValue();
-     *   it.setValue("newValue");
-     * }
-     * 
- * - * @return a map iterator - */ - MapIterator mapIterator(); - -} diff --git a/app/src/main/java/org/apache/commons/collections/KeyValue.java b/app/src/main/java/org/apache/commons/collections/KeyValue.java deleted file mode 100644 index e38c3aba8..000000000 --- a/app/src/main/java/org/apache/commons/collections/KeyValue.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections; - -/** - * Defines a simple key value pair. - *

- * A Map Entry has considerable additional semantics over and above a simple - * key-value pair. This interface defines the minimum key value, with just the - * two get methods. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public interface KeyValue { - - /** - * Gets the key from the pair. - * - * @return the key - */ - Object getKey(); - - /** - * Gets the value from the pair. - * - * @return the value - */ - Object getValue(); - -} diff --git a/app/src/main/java/org/apache/commons/collections/MapIterator.java b/app/src/main/java/org/apache/commons/collections/MapIterator.java deleted file mode 100644 index a886189b5..000000000 --- a/app/src/main/java/org/apache/commons/collections/MapIterator.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** - * Defines an iterator that operates over a Map. - *

- * This iterator is a special version designed for maps. It can be more - * efficient to use this rather than an entry set iterator where the option - * is available, and it is certainly more convenient. - *

- * A map that provides this interface may not hold the data internally using - * Map Entry objects, thus this interface can avoid lots of object creation. - *

- * In use, this iterator iterates through the keys in the map. After each call - * to next(), the getValue() method provides direct - * access to the value. The value can also be set using setValue(). - *

- * MapIterator it = map.mapIterator();
- * while (it.hasNext()) {
- *   Object key = it.next();
- *   Object value = it.getValue();
- *   it.setValue(newValue);
- * }
- * 
- * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public interface MapIterator extends Iterator { - - /** - * Checks to see if there are more entries still to be iterated. - * - * @return true if the iterator has more elements - */ - boolean hasNext(); - - /** - * Gets the next key from the Map. - * - * @return the next key in the iteration - * @throws java.util.NoSuchElementException if the iteration is finished - */ - Object next(); - - //----------------------------------------------------------------------- - /** - * Gets the current key, which is the key returned by the last call - * to next(). - * - * @return the current key - * @throws IllegalStateException if next() has not yet been called - */ - Object getKey(); - - /** - * Gets the current value, which is the value associated with the last key - * returned by next(). - * - * @return the current value - * @throws IllegalStateException if next() has not yet been called - */ - Object getValue(); - - //----------------------------------------------------------------------- - /** - * Removes the last returned key from the underlying Map (optional operation). - *

- * This method can be called once per call to next(). - * - * @throws UnsupportedOperationException if remove is not supported by the map - * @throws IllegalStateException if next() has not yet been called - * @throws IllegalStateException if remove() has already been called - * since the last call to next() - */ - void remove(); - - /** - * Sets the value associated with the current key (optional operation). - * - * @param value the new value - * @return the previous value - * @throws UnsupportedOperationException if setValue is not supported by the map - * @throws IllegalStateException if next() has not yet been called - * @throws IllegalStateException if remove() has been called since the - * last call to next() - */ - Object setValue(Object value); - -} diff --git a/app/src/main/java/org/apache/commons/collections/ResettableIterator.java b/app/src/main/java/org/apache/commons/collections/ResettableIterator.java deleted file mode 100644 index 21baaef9c..000000000 --- a/app/src/main/java/org/apache/commons/collections/ResettableIterator.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections; - -import java.util.Iterator; - -/** - * Defines an iterator that can be reset back to an initial state. - *

- * This interface allows an iterator to be repeatedly reused. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public interface ResettableIterator extends Iterator { - - /** - * Resets the iterator back to the position at which the iterator - * was created. - */ - public void reset(); - -} diff --git a/app/src/main/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java b/app/src/main/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java deleted file mode 100644 index 632eff787..000000000 --- a/app/src/main/java/org/apache/commons/collections/iterators/AbstractEmptyIterator.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.iterators; - -import java.util.NoSuchElementException; - -/** - * Provides an implementation of an empty iterator. - * - * @since Commons Collections 3.1 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -abstract class AbstractEmptyIterator { - - /** - * Constructor. - */ - protected AbstractEmptyIterator() { - super(); - } - - public boolean hasNext() { - return false; - } - - public Object next() { - throw new NoSuchElementException("Iterator contains no elements"); - } - - public boolean hasPrevious() { - return false; - } - - public Object previous() { - throw new NoSuchElementException("Iterator contains no elements"); - } - - public int nextIndex() { - return 0; - } - - public int previousIndex() { - return -1; - } - - public void add(Object obj) { - throw new UnsupportedOperationException("add() not supported for empty Iterator"); - } - - public void set(Object obj) { - throw new IllegalStateException("Iterator contains no elements"); - } - - public void remove() { - throw new IllegalStateException("Iterator contains no elements"); - } - - public Object getKey() { - throw new IllegalStateException("Iterator contains no elements"); - } - - public Object getValue() { - throw new IllegalStateException("Iterator contains no elements"); - } - - public Object setValue(Object value) { - throw new IllegalStateException("Iterator contains no elements"); - } - - public void reset() { - // do nothing - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/iterators/EmptyIterator.java b/app/src/main/java/org/apache/commons/collections/iterators/EmptyIterator.java deleted file mode 100644 index 30dc4edde..000000000 --- a/app/src/main/java/org/apache/commons/collections/iterators/EmptyIterator.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.iterators; - -import java.util.Iterator; - -import org.apache.commons.collections.ResettableIterator; - -/** - * Provides an implementation of an empty iterator. - *

- * This class provides an implementation of an empty iterator. - * This class provides for binary compatability between Commons Collections - * 2.1.1 and 3.1 due to issues with IteratorUtils. - * - * @since Commons Collections 2.1.1 and 3.1 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public class EmptyIterator extends AbstractEmptyIterator implements ResettableIterator { - - /** - * Singleton instance of the iterator. - * @since Commons Collections 3.1 - */ - public static final ResettableIterator RESETTABLE_INSTANCE = new EmptyIterator(); - /** - * Singleton instance of the iterator. - * @since Commons Collections 2.1.1 and 3.1 - */ - public static final Iterator INSTANCE = RESETTABLE_INSTANCE; - - /** - * Constructor. - */ - protected EmptyIterator() { - super(); - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/iterators/EmptyMapIterator.java b/app/src/main/java/org/apache/commons/collections/iterators/EmptyMapIterator.java deleted file mode 100644 index c0fc7ff7c..000000000 --- a/app/src/main/java/org/apache/commons/collections/iterators/EmptyMapIterator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.iterators; - -import org.apache.commons.collections.MapIterator; -import org.apache.commons.collections.ResettableIterator; - -/** - * Provides an implementation of an empty map iterator. - * - * @since Commons Collections 3.1 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Stephen Colebourne - */ -public class EmptyMapIterator extends AbstractEmptyIterator implements MapIterator, ResettableIterator { - - /** - * Singleton instance of the iterator. - * @since Commons Collections 3.1 - */ - public static final MapIterator INSTANCE = new EmptyMapIterator(); - - /** - * Constructor. - */ - protected EmptyMapIterator() { - super(); - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java b/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java deleted file mode 100644 index ba4e6f508..000000000 --- a/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractKeyValue.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.keyvalue; - -import org.apache.commons.collections.KeyValue; - -/** - * Abstract pair class to assist with creating KeyValue - * and {@link java.util.Map.Entry Map.Entry} implementations. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author James Strachan - * @author Michael A. Smith - * @author Neil O'Toole - * @author Stephen Colebourne - */ -public abstract class AbstractKeyValue implements KeyValue { - - /** The key */ - protected Object key; - /** The value */ - protected Object value; - - /** - * Constructs a new pair with the specified key and given value. - * - * @param key the key for the entry, may be null - * @param value the value for the entry, may be null - */ - protected AbstractKeyValue(Object key, Object value) { - super(); - this.key = key; - this.value = value; - } - - /** - * Gets the key from the pair. - * - * @return the key - */ - public Object getKey() { - return key; - } - - /** - * Gets the value from the pair. - * - * @return the value - */ - public Object getValue() { - return value; - } - - /** - * Gets a debugging String view of the pair. - * - * @return a String view of the entry - */ - public String toString() { - return new StringBuffer() - .append(getKey()) - .append('=') - .append(getValue()) - .toString(); - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java b/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java deleted file mode 100644 index 10c056a16..000000000 --- a/app/src/main/java/org/apache/commons/collections/keyvalue/AbstractMapEntry.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.keyvalue; - -import java.util.Map; - -/** - * Abstract Pair class to assist with creating correct - * {@link java.util.Map.Entry Map.Entry} implementations. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author James Strachan - * @author Michael A. Smith - * @author Neil O'Toole - * @author Stephen Colebourne - */ -public abstract class AbstractMapEntry extends AbstractKeyValue implements Map.Entry { - - /** - * Constructs a new entry with the given key and given value. - * - * @param key the key for the entry, may be null - * @param value the value for the entry, may be null - */ - protected AbstractMapEntry(Object key, Object value) { - super(key, value); - } - - // Map.Entry interface - //------------------------------------------------------------------------- - /** - * Sets the value stored in this Map.Entry. - *

- * This Map.Entry is not connected to a Map, so only the - * local data is changed. - * - * @param value the new value - * @return the previous value - */ - public Object setValue(Object value) { - Object answer = this.value; - this.value = value; - return answer; - } - - /** - * Compares this Map.Entry with another Map.Entry. - *

- * Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)} - * - * @param obj the object to compare to - * @return true if equal key and value - */ - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj instanceof Map.Entry == false) { - return false; - } - Map.Entry other = (Map.Entry) obj; - return - (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && - (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); - } - - /** - * Gets a hashCode compatible with the equals method. - *

- * Implemented per API documentation of {@link java.util.Map.Entry#hashCode()} - * - * @return a suitable hash code - */ - public int hashCode() { - return (getKey() == null ? 0 : getKey().hashCode()) ^ - (getValue() == null ? 0 : getValue().hashCode()); - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java b/app/src/main/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java deleted file mode 100644 index e9b23409d..000000000 --- a/app/src/main/java/org/apache/commons/collections/keyvalue/DefaultMapEntry.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.keyvalue; - -import java.util.Map; - -import org.apache.commons.collections.KeyValue; - -/** - * A restricted implementation of {@link java.util.Map.Entry} that prevents - * the Map.Entry contract from being broken. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author James Strachan - * @author Michael A. Smith - * @author Neil O'Toole - * @author Stephen Colebourne - */ -public final class DefaultMapEntry extends AbstractMapEntry { - - /** - * Constructs a new entry with the specified key and given value. - * - * @param key the key for the entry, may be null - * @param value the value for the entry, may be null - */ - public DefaultMapEntry(final Object key, final Object value) { - super(key, value); - } - - /** - * Constructs a new entry from the specified KeyValue. - * - * @param pair the pair to copy, must not be null - * @throws NullPointerException if the entry is null - */ - public DefaultMapEntry(final KeyValue pair) { - super(pair.getKey(), pair.getValue()); - } - - /** - * Constructs a new entry from the specified Map.Entry. - * - * @param entry the entry to copy, must not be null - * @throws NullPointerException if the entry is null - */ - public DefaultMapEntry(final Map.Entry entry) { - super(entry.getKey(), entry.getValue()); - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java b/app/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java deleted file mode 100644 index 2f83dd296..000000000 --- a/app/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.map; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.AbstractCollection; -import java.util.AbstractMap; -import java.util.AbstractSet; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; - -import org.apache.commons.collections.IterableMap; -import org.apache.commons.collections.KeyValue; -import org.apache.commons.collections.MapIterator; -import org.apache.commons.collections.iterators.EmptyIterator; -import org.apache.commons.collections.iterators.EmptyMapIterator; - -/** - * An abstract implementation of a hash-based map which provides numerous points for - * subclasses to override. - *

- * This class implements all the features necessary for a subclass hash-based map. - * Key-value entries are stored in instances of the HashEntry class, - * which can be overridden and replaced. The iterators can similarly be replaced, - * without the need to replace the KeySet, EntrySet and Values view classes. - *

- * Overridable methods are provided to change the default hashing behaviour, and - * to change how entries are added to and removed from the map. Hopefully, all you - * need for unusual subclasses is here. - *

- * NOTE: From Commons Collections 3.1 this class extends AbstractMap. - * This is to provide backwards compatibility for ReferenceMap between v3.0 and v3.1. - * This extends clause will be removed in v4.0. - * - * @since Commons Collections 3.0 - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author java util HashMap - * @author Stephen Colebourne - * @author Christian Siefkes - */ -public class AbstractHashedMap extends AbstractMap implements IterableMap { - - protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration"; - protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration"; - protected static final String REMOVE_INVALID = "remove() can only be called once after next()"; - protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()"; - protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()"; - protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()"; - - /** The default capacity to use */ - protected static final int DEFAULT_CAPACITY = 16; - /** The default threshold to use */ - protected static final int DEFAULT_THRESHOLD = 12; - /** The default load factor to use */ - protected static final float DEFAULT_LOAD_FACTOR = 0.75f; - /** The maximum capacity allowed */ - protected static final int MAXIMUM_CAPACITY = 1 << 30; - /** An object for masking null */ - protected static final Object NULL = new Object(); - - /** Load factor, normally 0.75 */ - protected transient float loadFactor; - /** The size of the map */ - protected transient int size; - /** Map entries */ - protected transient HashEntry[] data; - /** Size at which to rehash */ - protected transient int threshold; - /** Modification count for iterators */ - protected transient int modCount; - /** Entry set */ - protected transient EntrySet entrySet; - /** Key set */ - protected transient KeySet keySet; - /** Values */ - protected transient Values values; - - /** - * Constructor only used in deserialization, do not use otherwise. - */ - protected AbstractHashedMap() { - super(); - } - - /** - * Constructor which performs no validation on the passed in parameters. - * - * @param initialCapacity the initial capacity, must be a power of two - * @param loadFactor the load factor, must be > 0.0f and generally < 1.0f - * @param threshold the threshold, must be sensible - */ - protected AbstractHashedMap(int initialCapacity, float loadFactor, int threshold) { - super(); - this.loadFactor = loadFactor; - this.data = new HashEntry[initialCapacity]; - this.threshold = threshold; - init(); - } - - /** - * Constructs a new, empty map with the specified initial capacity and - * default load factor. - * - * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less than one - */ - protected AbstractHashedMap(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - /** - * Constructs a new, empty map with the specified initial capacity and - * load factor. - * - * @param initialCapacity the initial capacity - * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less than one - * @throws IllegalArgumentException if the load factor is less than or equal to zero - */ - protected AbstractHashedMap(int initialCapacity, float loadFactor) { - super(); - if (initialCapacity < 1) { - throw new IllegalArgumentException("Initial capacity must be greater than 0"); - } - if (loadFactor <= 0.0f || Float.isNaN(loadFactor)) { - throw new IllegalArgumentException("Load factor must be greater than 0"); - } - this.loadFactor = loadFactor; - initialCapacity = calculateNewCapacity(initialCapacity); - this.threshold = calculateThreshold(initialCapacity, loadFactor); - this.data = new HashEntry[initialCapacity]; - init(); - } - - /** - * Constructor copying elements from another map. - * - * @param map the map to copy - * @throws NullPointerException if the map is null - */ - protected AbstractHashedMap(Map map) { - this(Math.max(2 * map.size(), DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR); - putAll(map); - } - - /** - * Initialise subclasses during construction, cloning or deserialization. - */ - protected void init() { - } - - //----------------------------------------------------------------------- - /** - * Gets the value mapped to the key specified. - * - * @param key the key - * @return the mapped value, null if no match - */ - public Object get(Object key) { - key = convertKey(key); - int hashCode = hash(key); - HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index - while (entry != null) { - if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { - return entry.getValue(); - } - entry = entry.next; - } - return null; - } - - /** - * Gets the size of the map. - * - * @return the size - */ - public int size() { - return size; - } - - /** - * Checks whether the map is currently empty. - * - * @return true if the map is currently size zero - */ - public boolean isEmpty() { - return (size == 0); - } - - //----------------------------------------------------------------------- - /** - * Checks whether the map contains the specified key. - * - * @param key the key to search for - * @return true if the map contains the key - */ - public boolean containsKey(Object key) { - key = convertKey(key); - int hashCode = hash(key); - HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index - while (entry != null) { - if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { - return true; - } - entry = entry.next; - } - return false; - } - - /** - * Checks whether the map contains the specified value. - * - * @param value the value to search for - * @return true if the map contains the value - */ - public boolean containsValue(Object value) { - if (value == null) { - for (int i = 0, isize = data.length; i < isize; i++) { - HashEntry entry = data[i]; - while (entry != null) { - if (entry.getValue() == null) { - return true; - } - entry = entry.next; - } - } - } else { - for (int i = 0, isize = data.length; i < isize; i++) { - HashEntry entry = data[i]; - while (entry != null) { - if (isEqualValue(value, entry.getValue())) { - return true; - } - entry = entry.next; - } - } - } - return false; - } - - //----------------------------------------------------------------------- - /** - * Puts a key-value mapping into this map. - * - * @param key the key to add - * @param value the value to add - * @return the value previously mapped to this key, null if none - */ - public Object put(Object key, Object value) { - key = convertKey(key); - int hashCode = hash(key); - int index = hashIndex(hashCode, data.length); - HashEntry entry = data[index]; - while (entry != null) { - if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { - Object oldValue = entry.getValue(); - updateEntry(entry, value); - return oldValue; - } - entry = entry.next; - } - - addMapping(index, hashCode, key, value); - return null; - } - - /** - * Puts all the values from the specified map into this map. - *

- * This implementation iterates around the specified map and - * uses {@link #put(Object, Object)}. - * - * @param map the map to add - * @throws NullPointerException if the map is null - */ - public void putAll(Map map) { - int mapSize = map.size(); - if (mapSize == 0) { - return; - } - int newSize = (int) ((size + mapSize) / loadFactor + 1); - ensureCapacity(calculateNewCapacity(newSize)); - for (Iterator it = map.entrySet().iterator(); it.hasNext();) { - Map.Entry entry = (Map.Entry) it.next(); - put(entry.getKey(), entry.getValue()); - } - } - - /** - * Removes the specified mapping from this map. - * - * @param key the mapping to remove - * @return the value mapped to the removed key, null if key not in map - */ - public Object remove(Object key) { - key = convertKey(key); - int hashCode = hash(key); - int index = hashIndex(hashCode, data.length); - HashEntry entry = data[index]; - HashEntry previous = null; - while (entry != null) { - if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { - Object oldValue = entry.getValue(); - removeMapping(entry, index, previous); - return oldValue; - } - previous = entry; - entry = entry.next; - } - return null; - } - - /** - * Clears the map, resetting the size to zero and nullifying references - * to avoid garbage collection issues. - */ - public void clear() { - modCount++; - HashEntry[] data = this.data; - for (int i = data.length - 1; i >= 0; i--) { - data[i] = null; - } - size = 0; - } - - //----------------------------------------------------------------------- - /** - * Converts input keys to another object for storage in the map. - * This implementation masks nulls. - * Subclasses can override this to perform alternate key conversions. - *

- * The reverse conversion can be changed, if required, by overriding the - * getKey() method in the hash entry. - * - * @param key the key convert - * @return the converted key - */ - protected Object convertKey(Object key) { - return (key == null ? NULL : key); - } - - /** - * Gets the hash code for the key specified. - * This implementation uses the additional hashing routine from JDK1.4. - * Subclasses can override this to return alternate hash codes. - * - * @param key the key to get a hash code for - * @return the hash code - */ - protected int hash(Object key) { - // same as JDK 1.4 - int h = key.hashCode(); - h += ~(h << 9); - h ^= (h >>> 14); - h += (h << 4); - h ^= (h >>> 10); - return h; - } - - /** - * Compares two keys, in internal converted form, to see if they are equal. - * This implementation uses the equals method and assumes neither key is null. - * Subclasses can override this to match differently. - * - * @param key1 the first key to compare passed in from outside - * @param key2 the second key extracted from the entry via entry.key - * @return true if equal - */ - protected boolean isEqualKey(Object key1, Object key2) { - return (key1 == key2 || key1.equals(key2)); - } - - /** - * Compares two values, in external form, to see if they are equal. - * This implementation uses the equals method and assumes neither value is null. - * Subclasses can override this to match differently. - * - * @param value1 the first value to compare passed in from outside - * @param value2 the second value extracted from the entry via getValue() - * @return true if equal - */ - protected boolean isEqualValue(Object value1, Object value2) { - return (value1 == value2 || value1.equals(value2)); - } - - /** - * Gets the index into the data storage for the hashCode specified. - * This implementation uses the least significant bits of the hashCode. - * Subclasses can override this to return alternate bucketing. - * - * @param hashCode the hash code to use - * @param dataSize the size of the data to pick a bucket from - * @return the bucket index - */ - protected int hashIndex(int hashCode, int dataSize) { - return hashCode & (dataSize - 1); - } - - //----------------------------------------------------------------------- - /** - * Gets the entry mapped to the key specified. - *

- * This method exists for subclasses that may need to perform a multi-step - * process accessing the entry. The public methods in this class don't use this - * method to gain a small performance boost. - * - * @param key the key - * @return the entry, null if no match - */ - protected HashEntry getEntry(Object key) { - key = convertKey(key); - int hashCode = hash(key); - HashEntry entry = data[hashIndex(hashCode, data.length)]; // no local for hash index - while (entry != null) { - if (entry.hashCode == hashCode && isEqualKey(key, entry.key)) { - return entry; - } - entry = entry.next; - } - return null; - } - - //----------------------------------------------------------------------- - /** - * Updates an existing key-value mapping to change the value. - *

- * This implementation calls setValue() on the entry. - * Subclasses could override to handle changes to the map. - * - * @param entry the entry to update - * @param newValue the new value to store - */ - protected void updateEntry(HashEntry entry, Object newValue) { - entry.setValue(newValue); - } - - /** - * Reuses an existing key-value mapping, storing completely new data. - *

- * This implementation sets all the data fields on the entry. - * Subclasses could populate additional entry fields. - * - * @param entry the entry to update, not null - * @param hashIndex the index in the data array - * @param hashCode the hash code of the key to add - * @param key the key to add - * @param value the value to add - */ - protected void reuseEntry(HashEntry entry, int hashIndex, int hashCode, Object key, Object value) { - entry.next = data[hashIndex]; - entry.hashCode = hashCode; - entry.key = key; - entry.value = value; - } - - //----------------------------------------------------------------------- - /** - * Adds a new key-value mapping into this map. - *

- * This implementation calls createEntry(), addEntry() - * and checkCapacity(). - * It also handles changes to modCount and size. - * Subclasses could override to fully control adds to the map. - * - * @param hashIndex the index into the data array to store at - * @param hashCode the hash code of the key to add - * @param key the key to add - * @param value the value to add - */ - protected void addMapping(int hashIndex, int hashCode, Object key, Object value) { - modCount++; - HashEntry entry = createEntry(data[hashIndex], hashCode, key, value); - addEntry(entry, hashIndex); - size++; - checkCapacity(); - } - - /** - * Creates an entry to store the key-value data. - *

- * This implementation creates a new HashEntry instance. - * Subclasses can override this to return a different storage class, - * or implement caching. - * - * @param next the next entry in sequence - * @param hashCode the hash code to use - * @param key the key to store - * @param value the value to store - * @return the newly created entry - */ - protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) { - return new HashEntry(next, hashCode, key, value); - } - - /** - * Adds an entry into this map. - *

- * This implementation adds the entry to the data storage table. - * Subclasses could override to handle changes to the map. - * - * @param entry the entry to add - * @param hashIndex the index into the data array to store at - */ - protected void addEntry(HashEntry entry, int hashIndex) { - data[hashIndex] = entry; - } - - //----------------------------------------------------------------------- - /** - * Removes a mapping from the map. - *

- * This implementation calls removeEntry() and destroyEntry(). - * It also handles changes to modCount and size. - * Subclasses could override to fully control removals from the map. - * - * @param entry the entry to remove - * @param hashIndex the index into the data structure - * @param previous the previous entry in the chain - */ - protected void removeMapping(HashEntry entry, int hashIndex, HashEntry previous) { - modCount++; - removeEntry(entry, hashIndex, previous); - size--; - destroyEntry(entry); - } - - /** - * Removes an entry from the chain stored in a particular index. - *

- * This implementation removes the entry from the data storage table. - * The size is not updated. - * Subclasses could override to handle changes to the map. - * - * @param entry the entry to remove - * @param hashIndex the index into the data structure - * @param previous the previous entry in the chain - */ - protected void removeEntry(HashEntry entry, int hashIndex, HashEntry previous) { - if (previous == null) { - data[hashIndex] = entry.next; - } else { - previous.next = entry.next; - } - } - - /** - * Kills an entry ready for the garbage collector. - *

- * This implementation prepares the HashEntry for garbage collection. - * Subclasses can override this to implement caching (override clear as well). - * - * @param entry the entry to destroy - */ - protected void destroyEntry(HashEntry entry) { - entry.next = null; - entry.key = null; - entry.value = null; - } - - //----------------------------------------------------------------------- - /** - * Checks the capacity of the map and enlarges it if necessary. - *

- * This implementation uses the threshold to check if the map needs enlarging - */ - protected void checkCapacity() { - if (size >= threshold) { - int newCapacity = data.length * 2; - if (newCapacity <= MAXIMUM_CAPACITY) { - ensureCapacity(newCapacity); - } - } - } - - /** - * Changes the size of the data structure to the capacity proposed. - * - * @param newCapacity the new capacity of the array (a power of two, less or equal to max) - */ - protected void ensureCapacity(int newCapacity) { - int oldCapacity = data.length; - if (newCapacity <= oldCapacity) { - return; - } - if (size == 0) { - threshold = calculateThreshold(newCapacity, loadFactor); - data = new HashEntry[newCapacity]; - } else { - HashEntry oldEntries[] = data; - HashEntry newEntries[] = new HashEntry[newCapacity]; - - modCount++; - for (int i = oldCapacity - 1; i >= 0; i--) { - HashEntry entry = oldEntries[i]; - if (entry != null) { - oldEntries[i] = null; // gc - do { - HashEntry next = entry.next; - int index = hashIndex(entry.hashCode, newCapacity); - entry.next = newEntries[index]; - newEntries[index] = entry; - entry = next; - } while (entry != null); - } - } - threshold = calculateThreshold(newCapacity, loadFactor); - data = newEntries; - } - } - - /** - * Calculates the new capacity of the map. - * This implementation normalizes the capacity to a power of two. - * - * @param proposedCapacity the proposed capacity - * @return the normalized new capacity - */ - protected int calculateNewCapacity(int proposedCapacity) { - int newCapacity = 1; - if (proposedCapacity > MAXIMUM_CAPACITY) { - newCapacity = MAXIMUM_CAPACITY; - } else { - while (newCapacity < proposedCapacity) { - newCapacity <<= 1; // multiply by two - } - if (newCapacity > MAXIMUM_CAPACITY) { - newCapacity = MAXIMUM_CAPACITY; - } - } - return newCapacity; - } - - /** - * Calculates the new threshold of the map, where it will be resized. - * This implementation uses the load factor. - * - * @param newCapacity the new capacity - * @param factor the load factor - * @return the new resize threshold - */ - protected int calculateThreshold(int newCapacity, float factor) { - return (int) (newCapacity * factor); - } - - //----------------------------------------------------------------------- - /** - * Gets the next field from a HashEntry. - * Used in subclasses that have no visibility of the field. - * - * @param entry the entry to query, must not be null - * @return the next field of the entry - * @throws NullPointerException if the entry is null - * @since Commons Collections 3.1 - */ - protected HashEntry entryNext(HashEntry entry) { - return entry.next; - } - - /** - * Gets the hashCode field from a HashEntry. - * Used in subclasses that have no visibility of the field. - * - * @param entry the entry to query, must not be null - * @return the hashCode field of the entry - * @throws NullPointerException if the entry is null - * @since Commons Collections 3.1 - */ - protected int entryHashCode(HashEntry entry) { - return entry.hashCode; - } - - /** - * Gets the key field from a HashEntry. - * Used in subclasses that have no visibility of the field. - * - * @param entry the entry to query, must not be null - * @return the key field of the entry - * @throws NullPointerException if the entry is null - * @since Commons Collections 3.1 - */ - protected Object entryKey(HashEntry entry) { - return entry.key; - } - - /** - * Gets the value field from a HashEntry. - * Used in subclasses that have no visibility of the field. - * - * @param entry the entry to query, must not be null - * @return the value field of the entry - * @throws NullPointerException if the entry is null - * @since Commons Collections 3.1 - */ - protected Object entryValue(HashEntry entry) { - return entry.value; - } - - //----------------------------------------------------------------------- - /** - * Gets an iterator over the map. - * Changes made to the iterator affect this map. - *

- * A MapIterator returns the keys in the map. It also provides convenient - * methods to get the key and value, and set the value. - * It avoids the need to create an entrySet/keySet/values object. - * It also avoids creating the Map.Entry object. - * - * @return the map iterator - */ - public MapIterator mapIterator() { - if (size == 0) { - return EmptyMapIterator.INSTANCE; - } - return new HashMapIterator(this); - } - - /** - * MapIterator implementation. - */ - protected static class HashMapIterator extends HashIterator implements MapIterator { - - protected HashMapIterator(AbstractHashedMap parent) { - super(parent); - } - - public Object next() { - return super.nextEntry().getKey(); - } - - public Object getKey() { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID); - } - return current.getKey(); - } - - public Object getValue() { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); - } - return current.getValue(); - } - - public Object setValue(Object value) { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID); - } - return current.setValue(value); - } - } - - //----------------------------------------------------------------------- - /** - * Gets the entrySet view of the map. - * Changes made to the view affect this map. - * To simply iterate through the entries, use {@link #mapIterator()}. - * - * @return the entrySet view - */ - public Set entrySet() { - if (entrySet == null) { - entrySet = new EntrySet(this); - } - return entrySet; - } - - /** - * Creates an entry set iterator. - * Subclasses can override this to return iterators with different properties. - * - * @return the entrySet iterator - */ - protected Iterator createEntrySetIterator() { - if (size() == 0) { - return EmptyIterator.INSTANCE; - } - return new EntrySetIterator(this); - } - - /** - * EntrySet implementation. - */ - protected static class EntrySet extends AbstractSet { - /** The parent map */ - protected final AbstractHashedMap parent; - - protected EntrySet(AbstractHashedMap parent) { - super(); - this.parent = parent; - } - - public int size() { - return parent.size(); - } - - public void clear() { - parent.clear(); - } - - public boolean contains(Object entry) { - if (entry instanceof Map.Entry) { - Map.Entry e = (Map.Entry) entry; - Entry match = parent.getEntry(e.getKey()); - return (match != null && match.equals(e)); - } - return false; - } - - public boolean remove(Object obj) { - if (obj instanceof Map.Entry == false) { - return false; - } - if (contains(obj) == false) { - return false; - } - Map.Entry entry = (Map.Entry) obj; - Object key = entry.getKey(); - parent.remove(key); - return true; - } - - public Iterator iterator() { - return parent.createEntrySetIterator(); - } - } - - /** - * EntrySet iterator. - */ - protected static class EntrySetIterator extends HashIterator { - - protected EntrySetIterator(AbstractHashedMap parent) { - super(parent); - } - - public Object next() { - return super.nextEntry(); - } - } - - //----------------------------------------------------------------------- - /** - * Gets the keySet view of the map. - * Changes made to the view affect this map. - * To simply iterate through the keys, use {@link #mapIterator()}. - * - * @return the keySet view - */ - public Set keySet() { - if (keySet == null) { - keySet = new KeySet(this); - } - return keySet; - } - - /** - * Creates a key set iterator. - * Subclasses can override this to return iterators with different properties. - * - * @return the keySet iterator - */ - protected Iterator createKeySetIterator() { - if (size() == 0) { - return EmptyIterator.INSTANCE; - } - return new KeySetIterator(this); - } - - /** - * KeySet implementation. - */ - protected static class KeySet extends AbstractSet { - /** The parent map */ - protected final AbstractHashedMap parent; - - protected KeySet(AbstractHashedMap parent) { - super(); - this.parent = parent; - } - - public int size() { - return parent.size(); - } - - public void clear() { - parent.clear(); - } - - public boolean contains(Object key) { - return parent.containsKey(key); - } - - public boolean remove(Object key) { - boolean result = parent.containsKey(key); - parent.remove(key); - return result; - } - - public Iterator iterator() { - return parent.createKeySetIterator(); - } - } - - /** - * KeySet iterator. - */ - protected static class KeySetIterator extends EntrySetIterator { - - protected KeySetIterator(AbstractHashedMap parent) { - super(parent); - } - - public Object next() { - return super.nextEntry().getKey(); - } - } - - //----------------------------------------------------------------------- - /** - * Gets the values view of the map. - * Changes made to the view affect this map. - * To simply iterate through the values, use {@link #mapIterator()}. - * - * @return the values view - */ - public Collection values() { - if (values == null) { - values = new Values(this); - } - return values; - } - - /** - * Creates a values iterator. - * Subclasses can override this to return iterators with different properties. - * - * @return the values iterator - */ - protected Iterator createValuesIterator() { - if (size() == 0) { - return EmptyIterator.INSTANCE; - } - return new ValuesIterator(this); - } - - /** - * Values implementation. - */ - protected static class Values extends AbstractCollection { - /** The parent map */ - protected final AbstractHashedMap parent; - - protected Values(AbstractHashedMap parent) { - super(); - this.parent = parent; - } - - public int size() { - return parent.size(); - } - - public void clear() { - parent.clear(); - } - - public boolean contains(Object value) { - return parent.containsValue(value); - } - - public Iterator iterator() { - return parent.createValuesIterator(); - } - } - - /** - * Values iterator. - */ - protected static class ValuesIterator extends HashIterator { - - protected ValuesIterator(AbstractHashedMap parent) { - super(parent); - } - - public Object next() { - return super.nextEntry().getValue(); - } - } - - //----------------------------------------------------------------------- - /** - * HashEntry used to store the data. - *

- * If you subclass AbstractHashedMap but not HashEntry - * then you will not be able to access the protected fields. - * The entryXxx() methods on AbstractHashedMap exist - * to provide the necessary access. - */ - protected static class HashEntry implements Map.Entry, KeyValue { - /** The next entry in the hash chain */ - protected HashEntry next; - /** The hash code of the key */ - protected int hashCode; - /** The key */ - protected Object key; - /** The value */ - protected Object value; - - protected HashEntry(HashEntry next, int hashCode, Object key, Object value) { - super(); - this.next = next; - this.hashCode = hashCode; - this.key = key; - this.value = value; - } - - public Object getKey() { - return (key == NULL ? null : key); - } - - public Object getValue() { - return value; - } - - public Object setValue(Object value) { - Object old = this.value; - this.value = value; - return old; - } - - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj instanceof Map.Entry == false) { - return false; - } - Map.Entry other = (Map.Entry) obj; - return - (getKey() == null ? other.getKey() == null : getKey().equals(other.getKey())) && - (getValue() == null ? other.getValue() == null : getValue().equals(other.getValue())); - } - - public int hashCode() { - return (getKey() == null ? 0 : getKey().hashCode()) ^ - (getValue() == null ? 0 : getValue().hashCode()); - } - - public String toString() { - return new StringBuffer().append(getKey()).append('=').append(getValue()).toString(); - } - } - - /** - * Base Iterator - */ - protected static abstract class HashIterator implements Iterator { - - /** The parent map */ - protected final AbstractHashedMap parent; - /** The current index into the array of buckets */ - protected int hashIndex; - /** The last returned entry */ - protected HashEntry last; - /** The next entry */ - protected HashEntry next; - /** The modification count expected */ - protected int expectedModCount; - - protected HashIterator(AbstractHashedMap parent) { - super(); - this.parent = parent; - HashEntry[] data = parent.data; - int i = data.length; - HashEntry next = null; - while (i > 0 && next == null) { - next = data[--i]; - } - this.next = next; - this.hashIndex = i; - this.expectedModCount = parent.modCount; - } - - public boolean hasNext() { - return (next != null); - } - - protected HashEntry nextEntry() { - if (parent.modCount != expectedModCount) { - throw new ConcurrentModificationException(); - } - HashEntry newCurrent = next; - if (newCurrent == null) { - throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY); - } - HashEntry[] data = parent.data; - int i = hashIndex; - HashEntry n = newCurrent.next; - while (n == null && i > 0) { - n = data[--i]; - } - next = n; - hashIndex = i; - last = newCurrent; - return newCurrent; - } - - protected HashEntry currentEntry() { - return last; - } - - public void remove() { - if (last == null) { - throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID); - } - if (parent.modCount != expectedModCount) { - throw new ConcurrentModificationException(); - } - parent.remove(last.getKey()); - last = null; - expectedModCount = parent.modCount; - } - - public String toString() { - if (last != null) { - return "Iterator[" + last.getKey() + "=" + last.getValue() + "]"; - } else { - return "Iterator[]"; - } - } - } - - //----------------------------------------------------------------------- - /** - * Writes the map data to the stream. This method must be overridden if a - * subclass must be setup before put() is used. - *

- * Serialization is not one of the JDK's nicest topics. Normal serialization will - * initialise the superclass before the subclass. Sometimes however, this isn't - * what you want, as in this case the put() method on read can be - * affected by subclass state. - *

- * The solution adopted here is to serialize the state data of this class in - * this protected method. This method must be called by the - * writeObject() of the first serializable subclass. - *

- * Subclasses may override if they have a specific field that must be present - * on read before this implementation will work. Generally, the read determines - * what must be serialized here, if anything. - * - * @param out the output stream - */ - protected void doWriteObject(ObjectOutputStream out) throws IOException { - out.writeFloat(loadFactor); - out.writeInt(data.length); - out.writeInt(size); - for (MapIterator it = mapIterator(); it.hasNext();) { - out.writeObject(it.next()); - out.writeObject(it.getValue()); - } - } - - /** - * Reads the map data from the stream. This method must be overridden if a - * subclass must be setup before put() is used. - *

- * Serialization is not one of the JDK's nicest topics. Normal serialization will - * initialise the superclass before the subclass. Sometimes however, this isn't - * what you want, as in this case the put() method on read can be - * affected by subclass state. - *

- * The solution adopted here is to deserialize the state data of this class in - * this protected method. This method must be called by the - * readObject() of the first serializable subclass. - *

- * Subclasses may override if the subclass has a specific field that must be present - * before put() or calculateThreshold() will work correctly. - * - * @param in the input stream - */ - protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - loadFactor = in.readFloat(); - int capacity = in.readInt(); - int size = in.readInt(); - init(); - threshold = calculateThreshold(capacity, loadFactor); - data = new HashEntry[capacity]; - for (int i = 0; i < size; i++) { - Object key = in.readObject(); - Object value = in.readObject(); - put(key, value); - } - } - - //----------------------------------------------------------------------- - /** - * Clones the map without cloning the keys or values. - *

- * To implement clone(), a subclass must implement the - * Cloneable interface and make this method public. - * - * @return a shallow clone - */ - protected Object clone() { - try { - AbstractHashedMap cloned = (AbstractHashedMap) super.clone(); - cloned.data = new HashEntry[data.length]; - cloned.entrySet = null; - cloned.keySet = null; - cloned.values = null; - cloned.modCount = 0; - cloned.size = 0; - cloned.init(); - cloned.putAll(this); - return cloned; - - } catch (CloneNotSupportedException ex) { - return null; // should never happen - } - } - - /** - * Compares this map with another. - * - * @param obj the object to compare to - * @return true if equal - */ - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj instanceof Map == false) { - return false; - } - Map map = (Map) obj; - if (map.size() != size()) { - return false; - } - MapIterator it = mapIterator(); - try { - while (it.hasNext()) { - Object key = it.next(); - Object value = it.getValue(); - if (value == null) { - if (map.get(key) != null || map.containsKey(key) == false) { - return false; - } - } else { - if (value.equals(map.get(key)) == false) { - return false; - } - } - } - } catch (ClassCastException ignored) { - return false; - } catch (NullPointerException ignored) { - return false; - } - return true; - } - - /** - * Gets the standard Map hashCode. - * - * @return the hash code defined in the Map interface - */ - public int hashCode() { - int total = 0; - Iterator it = createEntrySetIterator(); - while (it.hasNext()) { - total += it.next().hashCode(); - } - return total; - } - - /** - * Gets the map as a String. - * - * @return a string version of the map - */ - public String toString() { - if (size() == 0) { - return "{}"; - } - StringBuffer buf = new StringBuffer(32 * size()); - buf.append('{'); - - MapIterator it = mapIterator(); - boolean hasNext = it.hasNext(); - while (hasNext) { - Object key = it.next(); - Object value = it.getValue(); - buf.append(key == this ? "(this Map)" : key) - .append('=') - .append(value == this ? "(this Map)" : value); - - hasNext = it.hasNext(); - if (hasNext) { - buf.append(',').append(' '); - } - } - - buf.append('}'); - return buf.toString(); - } -} diff --git a/app/src/main/java/org/apache/commons/collections/map/AbstractReferenceMap.java b/app/src/main/java/org/apache/commons/collections/map/AbstractReferenceMap.java deleted file mode 100644 index e6b735440..000000000 --- a/app/src/main/java/org/apache/commons/collections/map/AbstractReferenceMap.java +++ /dev/null @@ -1,981 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.map; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.ref.Reference; -import java.lang.ref.ReferenceQueue; -import java.lang.ref.SoftReference; -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; - -import org.apache.commons.collections.MapIterator; -import org.apache.commons.collections.keyvalue.DefaultMapEntry; - -/** - * An abstract implementation of a hash-based map that allows the entries to - * be removed by the garbage collector. - *

- * This class implements all the features necessary for a subclass reference - * hash-based map. Key-value entries are stored in instances of the - * ReferenceEntry class which can be overridden and replaced. - * The iterators can similarly be replaced, without the need to replace the KeySet, - * EntrySet and Values view classes. - *

- * Overridable methods are provided to change the default hashing behaviour, and - * to change how entries are added to and removed from the map. Hopefully, all you - * need for unusual subclasses is here. - *

- * When you construct an AbstractReferenceMap, you can specify what - * kind of references are used to store the map's keys and values. - * If non-hard references are used, then the garbage collector can remove - * mappings if a key or value becomes unreachable, or if the JVM's memory is - * running low. For information on how the different reference types behave, - * see {@link Reference}. - *

- * Different types of references can be specified for keys and values. - * The keys can be configured to be weak but the values hard, - * in which case this class will behave like a - * - * WeakHashMap. However, you can also specify hard keys and - * weak values, or any other combination. The default constructor uses - * hard keys and soft values, providing a memory-sensitive cache. - *

- * This {@link Map} implementation does not allow null elements. - * Attempting to add a null key or value to the map will raise a - * NullPointerException. - *

- * All the available iterators can be reset back to the start by casting to - * ResettableIterator and calling reset(). - *

- * This implementation is not synchronized. - * You can use {@link java.util.Collections#synchronizedMap} to - * provide synchronized access to a ReferenceMap. - * - * @see java.lang.ref.Reference - * @since Commons Collections 3.1 (extracted from ReferenceMap in 3.0) - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Paul Jack - * @author Stephen Colebourne - */ -public abstract class AbstractReferenceMap extends AbstractHashedMap { - - /** Constant indicating that hard references should be used */ - public static final int HARD = 0; - - /** Constant indicating that soft references should be used */ - public static final int SOFT = 1; - - /** Constant indicating that weak references should be used */ - public static final int WEAK = 2; - - /** - * The reference type for keys. Must be HARD, SOFT, WEAK. - * @serial - */ - protected int keyType; - - /** - * The reference type for values. Must be HARD, SOFT, WEAK. - * @serial - */ - protected int valueType; - - /** - * Should the value be automatically purged when the associated key has been collected? - */ - protected boolean purgeValues; - - /** - * ReferenceQueue used to eliminate stale mappings. - * See purge. - */ - private transient ReferenceQueue queue; - - //----------------------------------------------------------------------- - /** - * Constructor used during deserialization. - */ - protected AbstractReferenceMap() { - super(); - } - - /** - * Constructs a new empty map with the specified reference types, - * load factor and initial capacity. - * - * @param keyType the type of reference to use for keys; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param valueType the type of reference to use for values; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param capacity the initial capacity for the map - * @param loadFactor the load factor for the map - * @param purgeValues should the value be automatically purged when the - * key is garbage collected - */ - protected AbstractReferenceMap( - int keyType, int valueType, int capacity, - float loadFactor, boolean purgeValues) { - super(capacity, loadFactor); - verify("keyType", keyType); - verify("valueType", valueType); - this.keyType = keyType; - this.valueType = valueType; - this.purgeValues = purgeValues; - } - - /** - * Initialise this subclass during construction, cloning or deserialization. - */ - protected void init() { - queue = new ReferenceQueue(); - } - - //----------------------------------------------------------------------- - /** - * Checks the type int is a valid value. - * - * @param name the name for error messages - * @param type the type value to check - * @throws IllegalArgumentException if the value if invalid - */ - private static void verify(String name, int type) { - if ((type < HARD) || (type > WEAK)) { - throw new IllegalArgumentException(name + " must be HARD, SOFT, WEAK."); - } - } - - //----------------------------------------------------------------------- - /** - * Gets the size of the map. - * - * @return the size - */ - public int size() { - purgeBeforeRead(); - return super.size(); - } - - /** - * Checks whether the map is currently empty. - * - * @return true if the map is currently size zero - */ - public boolean isEmpty() { - purgeBeforeRead(); - return super.isEmpty(); - } - - /** - * Checks whether the map contains the specified key. - * - * @param key the key to search for - * @return true if the map contains the key - */ - public boolean containsKey(Object key) { - purgeBeforeRead(); - Entry entry = getEntry(key); - if (entry == null) { - return false; - } - return (entry.getValue() != null); - } - - /** - * Checks whether the map contains the specified value. - * - * @param value the value to search for - * @return true if the map contains the value - */ - public boolean containsValue(Object value) { - purgeBeforeRead(); - if (value == null) { - return false; - } - return super.containsValue(value); - } - - /** - * Gets the value mapped to the key specified. - * - * @param key the key - * @return the mapped value, null if no match - */ - public Object get(Object key) { - purgeBeforeRead(); - Entry entry = getEntry(key); - if (entry == null) { - return null; - } - return entry.getValue(); - } - - - /** - * Puts a key-value mapping into this map. - * Neither the key nor the value may be null. - * - * @param key the key to add, must not be null - * @param value the value to add, must not be null - * @return the value previously mapped to this key, null if none - * @throws NullPointerException if either the key or value is null - */ - public Object put(Object key, Object value) { - if (key == null) { - throw new NullPointerException("null keys not allowed"); - } - if (value == null) { - throw new NullPointerException("null values not allowed"); - } - - purgeBeforeWrite(); - return super.put(key, value); - } - - /** - * Removes the specified mapping from this map. - * - * @param key the mapping to remove - * @return the value mapped to the removed key, null if key not in map - */ - public Object remove(Object key) { - if (key == null) { - return null; - } - purgeBeforeWrite(); - return super.remove(key); - } - - /** - * Clears this map. - */ - public void clear() { - super.clear(); - while (queue.poll() != null) {} // drain the queue - } - - //----------------------------------------------------------------------- - /** - * Gets a MapIterator over the reference map. - * The iterator only returns valid key/value pairs. - * - * @return a map iterator - */ - public MapIterator mapIterator() { - return new ReferenceMapIterator(this); - } - - /** - * Returns a set view of this map's entries. - * An iterator returned entry is valid until next() is called again. - * The setValue() method on the toArray entries has no effect. - * - * @return a set view of this map's entries - */ - public Set entrySet() { - if (entrySet == null) { - entrySet = new ReferenceEntrySet(this); - } - return entrySet; - } - - /** - * Returns a set view of this map's keys. - * - * @return a set view of this map's keys - */ - public Set keySet() { - if (keySet == null) { - keySet = new ReferenceKeySet(this); - } - return keySet; - } - - /** - * Returns a collection view of this map's values. - * - * @return a set view of this map's values - */ - public Collection values() { - if (values == null) { - values = new ReferenceValues(this); - } - return values; - } - - //----------------------------------------------------------------------- - /** - * Purges stale mappings from this map before read operations. - *

- * This implementation calls {@link #purge()} to maintain a consistent state. - */ - protected void purgeBeforeRead() { - purge(); - } - - /** - * Purges stale mappings from this map before write operations. - *

- * This implementation calls {@link #purge()} to maintain a consistent state. - */ - protected void purgeBeforeWrite() { - purge(); - } - - /** - * Purges stale mappings from this map. - *

- * Note that this method is not synchronized! Special - * care must be taken if, for instance, you want stale - * mappings to be removed on a periodic basis by some - * background thread. - */ - protected void purge() { - Reference ref = queue.poll(); - while (ref != null) { - purge(ref); - ref = queue.poll(); - } - } - - /** - * Purges the specified reference. - * - * @param ref the reference to purge - */ - protected void purge(Reference ref) { - // The hashCode of the reference is the hashCode of the - // mapping key, even if the reference refers to the - // mapping value... - int hash = ref.hashCode(); - int index = hashIndex(hash, data.length); - HashEntry previous = null; - HashEntry entry = data[index]; - while (entry != null) { - if (((ReferenceEntry) entry).purge(ref)) { - if (previous == null) { - data[index] = entry.next; - } else { - previous.next = entry.next; - } - this.size--; - return; - } - previous = entry; - entry = entry.next; - } - - } - - //----------------------------------------------------------------------- - /** - * Gets the entry mapped to the key specified. - * - * @param key the key - * @return the entry, null if no match - */ - protected HashEntry getEntry(Object key) { - if (key == null) { - return null; - } else { - return super.getEntry(key); - } - } - - /** - * Gets the hash code for a MapEntry. - * Subclasses can override this, for example to use the identityHashCode. - * - * @param key the key to get a hash code for, may be null - * @param value the value to get a hash code for, may be null - * @return the hash code, as per the MapEntry specification - */ - protected int hashEntry(Object key, Object value) { - return (key == null ? 0 : key.hashCode()) ^ - (value == null ? 0 : value.hashCode()); - } - - /** - * Compares two keys, in internal converted form, to see if they are equal. - *

- * This implementation converts the key from the entry to a real reference - * before comparison. - * - * @param key1 the first key to compare passed in from outside - * @param key2 the second key extracted from the entry via entry.key - * @return true if equal - */ - protected boolean isEqualKey(Object key1, Object key2) { - key2 = (keyType > HARD ? ((Reference) key2).get() : key2); - return (key1 == key2 || key1.equals(key2)); - } - - /** - * Creates a ReferenceEntry instead of a HashEntry. - * - * @param next the next entry in sequence - * @param hashCode the hash code to use - * @param key the key to store - * @param value the value to store - * @return the newly created entry - */ - protected HashEntry createEntry(HashEntry next, int hashCode, Object key, Object value) { - return new ReferenceEntry(this, next, hashCode, key, value); - } - - /** - * Creates an entry set iterator. - * - * @return the entrySet iterator - */ - protected Iterator createEntrySetIterator() { - return new ReferenceEntrySetIterator(this); - } - - /** - * Creates an key set iterator. - * - * @return the keySet iterator - */ - protected Iterator createKeySetIterator() { - return new ReferenceKeySetIterator(this); - } - - /** - * Creates an values iterator. - * - * @return the values iterator - */ - protected Iterator createValuesIterator() { - return new ReferenceValuesIterator(this); - } - - //----------------------------------------------------------------------- - /** - * EntrySet implementation. - */ - static class ReferenceEntrySet extends EntrySet { - - protected ReferenceEntrySet(AbstractHashedMap parent) { - super(parent); - } - - public Object[] toArray() { - return toArray(new Object[0]); - } - - public Object[] toArray(Object[] arr) { - // special implementation to handle disappearing entries - ArrayList list = new ArrayList(); - Iterator iterator = iterator(); - while (iterator.hasNext()) { - Entry e = (Entry) iterator.next(); - list.add(new DefaultMapEntry(e.getKey(), e.getValue())); - } - return list.toArray(arr); - } - } - - //----------------------------------------------------------------------- - /** - * KeySet implementation. - */ - static class ReferenceKeySet extends KeySet { - - protected ReferenceKeySet(AbstractHashedMap parent) { - super(parent); - } - - public Object[] toArray() { - return toArray(new Object[0]); - } - - public Object[] toArray(Object[] arr) { - // special implementation to handle disappearing keys - List list = new ArrayList(parent.size()); - for (Iterator it = iterator(); it.hasNext(); ) { - list.add(it.next()); - } - return list.toArray(arr); - } - } - - //----------------------------------------------------------------------- - /** - * Values implementation. - */ - static class ReferenceValues extends Values { - - protected ReferenceValues(AbstractHashedMap parent) { - super(parent); - } - - public Object[] toArray() { - return toArray(new Object[0]); - } - - public Object[] toArray(Object[] arr) { - // special implementation to handle disappearing values - List list = new ArrayList(parent.size()); - for (Iterator it = iterator(); it.hasNext(); ) { - list.add(it.next()); - } - return list.toArray(arr); - } - } - - //----------------------------------------------------------------------- - /** - * A MapEntry implementation for the map. - *

- * If getKey() or getValue() returns null, it means - * the mapping is stale and should be removed. - * - * @since Commons Collections 3.1 - */ - protected static class ReferenceEntry extends HashEntry { - /** The parent map */ - protected final AbstractReferenceMap parent; - - /** - * Creates a new entry object for the ReferenceMap. - * - * @param parent the parent map - * @param next the next entry in the hash bucket - * @param hashCode the hash code of the key - * @param key the key - * @param value the value - */ - public ReferenceEntry(AbstractReferenceMap parent, HashEntry next, int hashCode, Object key, Object value) { - super(next, hashCode, null, null); - this.parent = parent; - this.key = toReference(parent.keyType, key, hashCode); - this.value = toReference(parent.valueType, value, hashCode); // the key hashCode is passed in deliberately - } - - /** - * Gets the key from the entry. - * This method dereferences weak and soft keys and thus may return null. - * - * @return the key, which may be null if it was garbage collected - */ - public Object getKey() { - return (parent.keyType > HARD) ? ((Reference) key).get() : key; - } - - /** - * Gets the value from the entry. - * This method dereferences weak and soft value and thus may return null. - * - * @return the value, which may be null if it was garbage collected - */ - public Object getValue() { - return (parent.valueType > HARD) ? ((Reference) value).get() : value; - } - - /** - * Sets the value of the entry. - * - * @param obj the object to store - * @return the previous value - */ - public Object setValue(Object obj) { - Object old = getValue(); - if (parent.valueType > HARD) { - ((Reference)value).clear(); - } - value = toReference(parent.valueType, obj, hashCode); - return old; - } - - /** - * Compares this map entry to another. - *

- * This implementation uses isEqualKey and - * isEqualValue on the main map for comparison. - * - * @param obj the other map entry to compare to - * @return true if equal, false if not - */ - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (obj instanceof Map.Entry == false) { - return false; - } - - Map.Entry entry = (Map.Entry)obj; - Object entryKey = entry.getKey(); // convert to hard reference - Object entryValue = entry.getValue(); // convert to hard reference - if ((entryKey == null) || (entryValue == null)) { - return false; - } - // compare using map methods, aiding identity subclass - // note that key is direct access and value is via method - return parent.isEqualKey(entryKey, key) && - parent.isEqualValue(entryValue, getValue()); - } - - /** - * Gets the hashcode of the entry using temporary hard references. - *

- * This implementation uses hashEntry on the main map. - * - * @return the hashcode of the entry - */ - public int hashCode() { - return parent.hashEntry(getKey(), getValue()); - } - - /** - * Constructs a reference of the given type to the given referent. - * The reference is registered with the queue for later purging. - * - * @param type HARD, SOFT or WEAK - * @param referent the object to refer to - * @param hash the hash code of the key of the mapping; - * this number might be different from referent.hashCode() if - * the referent represents a value and not a key - */ - protected Object toReference(int type, Object referent, int hash) { - switch (type) { - case HARD: return referent; - case SOFT: return new SoftRef(hash, referent, parent.queue); - case WEAK: return new WeakRef(hash, referent, parent.queue); - default: throw new Error(); - } - } - - /** - * Purges the specified reference - * @param ref the reference to purge - * @return true or false - */ - boolean purge(Reference ref) { - boolean r = (parent.keyType > HARD) && (key == ref); - r = r || ((parent.valueType > HARD) && (value == ref)); - if (r) { - if (parent.keyType > HARD) { - ((Reference)key).clear(); - } - if (parent.valueType > HARD) { - ((Reference)value).clear(); - } else if (parent.purgeValues) { - value = null; - } - } - return r; - } - - /** - * Gets the next entry in the bucket. - * - * @return the next entry in the bucket - */ - protected ReferenceEntry next() { - return (ReferenceEntry) next; - } - } - - //----------------------------------------------------------------------- - /** - * The EntrySet iterator. - */ - static class ReferenceEntrySetIterator implements Iterator { - /** The parent map */ - final AbstractReferenceMap parent; - - // These fields keep track of where we are in the table. - int index; - ReferenceEntry entry; - ReferenceEntry previous; - - // These Object fields provide hard references to the - // current and next entry; this assures that if hasNext() - // returns true, next() will actually return a valid element. - Object nextKey, nextValue; - Object currentKey, currentValue; - - int expectedModCount; - - public ReferenceEntrySetIterator(AbstractReferenceMap parent) { - super(); - this.parent = parent; - index = (parent.size() != 0 ? parent.data.length : 0); - // have to do this here! size() invocation above - // may have altered the modCount. - expectedModCount = parent.modCount; - } - - public boolean hasNext() { - checkMod(); - while (nextNull()) { - ReferenceEntry e = entry; - int i = index; - while ((e == null) && (i > 0)) { - i--; - e = (ReferenceEntry) parent.data[i]; - } - entry = e; - index = i; - if (e == null) { - currentKey = null; - currentValue = null; - return false; - } - nextKey = e.getKey(); - nextValue = e.getValue(); - if (nextNull()) { - entry = entry.next(); - } - } - return true; - } - - private void checkMod() { - if (parent.modCount != expectedModCount) { - throw new ConcurrentModificationException(); - } - } - - private boolean nextNull() { - return (nextKey == null) || (nextValue == null); - } - - protected ReferenceEntry nextEntry() { - checkMod(); - if (nextNull() && !hasNext()) { - throw new NoSuchElementException(); - } - previous = entry; - entry = entry.next(); - currentKey = nextKey; - currentValue = nextValue; - nextKey = null; - nextValue = null; - return previous; - } - - protected ReferenceEntry currentEntry() { - checkMod(); - return previous; - } - - public Object next() { - return nextEntry(); - } - - public void remove() { - checkMod(); - if (previous == null) { - throw new IllegalStateException(); - } - parent.remove(currentKey); - previous = null; - currentKey = null; - currentValue = null; - expectedModCount = parent.modCount; - } - } - - /** - * The keySet iterator. - */ - static class ReferenceKeySetIterator extends ReferenceEntrySetIterator { - - ReferenceKeySetIterator(AbstractReferenceMap parent) { - super(parent); - } - - public Object next() { - return nextEntry().getKey(); - } - } - - /** - * The values iterator. - */ - static class ReferenceValuesIterator extends ReferenceEntrySetIterator { - - ReferenceValuesIterator(AbstractReferenceMap parent) { - super(parent); - } - - public Object next() { - return nextEntry().getValue(); - } - } - - /** - * The MapIterator implementation. - */ - static class ReferenceMapIterator extends ReferenceEntrySetIterator implements MapIterator { - - protected ReferenceMapIterator(AbstractReferenceMap parent) { - super(parent); - } - - public Object next() { - return nextEntry().getKey(); - } - - public Object getKey() { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID); - } - return current.getKey(); - } - - public Object getValue() { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.GETVALUE_INVALID); - } - return current.getValue(); - } - - public Object setValue(Object value) { - HashEntry current = currentEntry(); - if (current == null) { - throw new IllegalStateException(AbstractHashedMap.SETVALUE_INVALID); - } - return current.setValue(value); - } - } - - //----------------------------------------------------------------------- - // These two classes store the hashCode of the key of - // of the mapping, so that after they're dequeued a quick - // lookup of the bucket in the table can occur. - - /** - * A soft reference holder. - */ - static class SoftRef extends SoftReference { - /** the hashCode of the key (even if the reference points to a value) */ - private int hash; - - public SoftRef(int hash, Object r, ReferenceQueue q) { - super(r, q); - this.hash = hash; - } - - public int hashCode() { - return hash; - } - } - - /** - * A weak reference holder. - */ - static class WeakRef extends WeakReference { - /** the hashCode of the key (even if the reference points to a value) */ - private int hash; - - public WeakRef(int hash, Object r, ReferenceQueue q) { - super(r, q); - this.hash = hash; - } - - public int hashCode() { - return hash; - } - } - - //----------------------------------------------------------------------- - /** - * Replaces the superclass method to store the state of this class. - *

- * Serialization is not one of the JDK's nicest topics. Normal serialization will - * initialise the superclass before the subclass. Sometimes however, this isn't - * what you want, as in this case the put() method on read can be - * affected by subclass state. - *

- * The solution adopted here is to serialize the state data of this class in - * this protected method. This method must be called by the - * writeObject() of the first serializable subclass. - *

- * Subclasses may override if they have a specific field that must be present - * on read before this implementation will work. Generally, the read determines - * what must be serialized here, if anything. - * - * @param out the output stream - */ - protected void doWriteObject(ObjectOutputStream out) throws IOException { - out.writeInt(keyType); - out.writeInt(valueType); - out.writeBoolean(purgeValues); - out.writeFloat(loadFactor); - out.writeInt(data.length); - for (MapIterator it = mapIterator(); it.hasNext();) { - out.writeObject(it.next()); - out.writeObject(it.getValue()); - } - out.writeObject(null); // null terminate map - // do not call super.doWriteObject() as code there doesn't work for reference map - } - - /** - * Replaces the superclassm method to read the state of this class. - *

- * Serialization is not one of the JDK's nicest topics. Normal serialization will - * initialise the superclass before the subclass. Sometimes however, this isn't - * what you want, as in this case the put() method on read can be - * affected by subclass state. - *

- * The solution adopted here is to deserialize the state data of this class in - * this protected method. This method must be called by the - * readObject() of the first serializable subclass. - *

- * Subclasses may override if the subclass has a specific field that must be present - * before put() or calculateThreshold() will work correctly. - * - * @param in the input stream - */ - protected void doReadObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - this.keyType = in.readInt(); - this.valueType = in.readInt(); - this.purgeValues = in.readBoolean(); - this.loadFactor = in.readFloat(); - int capacity = in.readInt(); - init(); - data = new HashEntry[capacity]; - while (true) { - Object key = in.readObject(); - if (key == null) { - break; - } - Object value = in.readObject(); - put(key, value); - } - threshold = calculateThreshold(data.length, loadFactor); - // do not call super.doReadObject() as code there doesn't work for reference map - } - -} diff --git a/app/src/main/java/org/apache/commons/collections/map/ReferenceMap.java b/app/src/main/java/org/apache/commons/collections/map/ReferenceMap.java deleted file mode 100644 index 5808decd1..000000000 --- a/app/src/main/java/org/apache/commons/collections/map/ReferenceMap.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.collections.map; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -/** - * A Map implementation that allows mappings to be - * removed by the garbage collector. - *

- * When you construct a ReferenceMap, you can specify what kind - * of references are used to store the map's keys and values. - * If non-hard references are used, then the garbage collector can remove - * mappings if a key or value becomes unreachable, or if the JVM's memory is - * running low. For information on how the different reference types behave, - * see {@link java.lang.ref.Reference Reference}. - *

- * Different types of references can be specified for keys and values. - * The keys can be configured to be weak but the values hard, - * in which case this class will behave like a - * - * WeakHashMap. However, you can also specify hard keys and - * weak values, or any other combination. The default constructor uses - * hard keys and soft values, providing a memory-sensitive cache. - *

- * This map is similar to - * {@link org.apache.commons.collections.map.ReferenceIdentityMap ReferenceIdentityMap}. - * It differs in that keys and values in this class are compared using equals(). - *

- * This {@link java.util.Map Map} implementation does not allow null elements. - * Attempting to add a null key or value to the map will raise a NullPointerException. - *

- * This implementation is not synchronized. - * You can use {@link java.util.Collections#synchronizedMap} to - * provide synchronized access to a ReferenceMap. - * Remember that synchronization will not stop the garbage collecter removing entries. - *

- * All the available iterators can be reset back to the start by casting to - * ResettableIterator and calling reset(). - *

- * Note that ReferenceMap is not synchronized and is not thread-safe. - * If you wish to use this map from multiple threads concurrently, you must use - * appropriate synchronization. The simplest approach is to wrap this map - * using {@link java.util.Collections#synchronizedMap}. This class may throw - * exceptions when accessed by concurrent threads without synchronization. - *

- * NOTE: As from Commons Collections 3.1 this map extends AbstractReferenceMap - * (previously it extended AbstractMap). As a result, the implementation is now - * extensible and provides a MapIterator. - * - * @see java.lang.ref.Reference - * - * @since Commons Collections 3.0 (previously in main package v2.1) - * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ - * - * @author Paul Jack - * @author Stephen Colebourne - */ -public class ReferenceMap extends AbstractReferenceMap implements Serializable { - - /** Serialization version */ - private static final long serialVersionUID = 1555089888138299607L; - - /** - * Constructs a new ReferenceMap that will - * use hard references to keys and soft references to values. - */ - public ReferenceMap() { - super(HARD, SOFT, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false); - } - - /** - * Constructs a new ReferenceMap that will - * use the specified types of references. - * - * @param keyType the type of reference to use for keys; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param valueType the type of reference to use for values; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - */ - public ReferenceMap(int keyType, int valueType) { - super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, false); - } - - /** - * Constructs a new ReferenceMap that will - * use the specified types of references. - * - * @param keyType the type of reference to use for keys; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param valueType the type of reference to use for values; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param purgeValues should the value be automatically purged when the - * key is garbage collected - */ - public ReferenceMap(int keyType, int valueType, boolean purgeValues) { - super(keyType, valueType, DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, purgeValues); - } - - /** - * Constructs a new ReferenceMap with the - * specified reference types, load factor and initial - * capacity. - * - * @param keyType the type of reference to use for keys; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param valueType the type of reference to use for values; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param capacity the initial capacity for the map - * @param loadFactor the load factor for the map - */ - public ReferenceMap(int keyType, int valueType, int capacity, float loadFactor) { - super(keyType, valueType, capacity, loadFactor, false); - } - - /** - * Constructs a new ReferenceMap with the - * specified reference types, load factor and initial - * capacity. - * - * @param keyType the type of reference to use for keys; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param valueType the type of reference to use for values; - * must be {@link #HARD}, {@link #SOFT}, {@link #WEAK} - * @param capacity the initial capacity for the map - * @param loadFactor the load factor for the map - * @param purgeValues should the value be automatically purged when the - * key is garbage collected - */ - public ReferenceMap(int keyType, int valueType, int capacity, - float loadFactor, boolean purgeValues) { - super(keyType, valueType, capacity, loadFactor, purgeValues); - } - - //----------------------------------------------------------------------- - /** - * Write the map out using a custom routine. - */ - private void writeObject(ObjectOutputStream out) throws IOException { - out.defaultWriteObject(); - doWriteObject(out); - } - - /** - * Read the map in using a custom routine. - */ - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - in.defaultReadObject(); - doReadObject(in); - } - -} diff --git a/app/src/main/jni/argon2/argon2_jni.c b/app/src/main/jni/argon2/argon2_jni.c index 4c41605c4..2f7c91b30 100644 --- a/app/src/main/jni/argon2/argon2_jni.c +++ b/app/src/main/jni/argon2/argon2_jni.c @@ -5,7 +5,7 @@ * * KeePass DX 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 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * KeePass DX is distributed in the hope that it will be useful, @@ -129,7 +129,7 @@ void throwExceptionF(JNIEnv *env, jclass exception, const char *format, ...) { #define NB_BLOCKSIZE 1024 JNIEXPORT jbyteArray -JNICALL Java_com_keepassdroid_crypto_keyDerivation_Argon2Native_nTransformMasterKey(JNIEnv *env, +JNICALL Java_com_kunzisoft_keepass_crypto_keyDerivation_Argon2Native_nTransformMasterKey(JNIEnv *env, jobject this, jbyteArray password, jbyteArray salt, jint parallelism, jlong memory, jlong iterations, jbyteArray secretKey, jbyteArray associatedData, jlong version) { diff --git a/app/src/main/jni/final_key/kpd_jni.c b/app/src/main/jni/final_key/kpd_jni.c index a74164681..0de0d72d2 100644 --- a/app/src/main/jni/final_key/kpd_jni.c +++ b/app/src/main/jni/final_key/kpd_jni.c @@ -118,7 +118,7 @@ JNIEXPORT void JNICALL JNI_OnUnload( JavaVM *vm, void *reserved ) { return; } -JNIEXPORT jlong JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nInit(JNIEnv *env, jobject this, jboolean encrypting, jbyteArray key, jbyteArray iv) { +JNIEXPORT jlong JNICALL Java_com_kunzisoft_keepass_crypto_NativeAESCipherSpi_nInit(JNIEnv *env, jobject this, jboolean encrypting, jbyteArray key, jbyteArray iv) { uint8_t ckey[32]; aes_state *state; jint key_len = (*env)->GetArrayLength(env, key); @@ -150,7 +150,7 @@ JNIEXPORT jlong JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nInit(JN return (jlong)state; } -JNIEXPORT void JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nCleanup(JNIEnv *env, jclass this, jlong state) { +JNIEXPORT void JNICALL Java_com_kunzisoft_keepass_crypto_NativeAESCipherSpi_nCleanup(JNIEnv *env, jclass this, jlong state) { free((void *)state); } @@ -163,7 +163,7 @@ JNIEXPORT void JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nCleanup( not a full block. */ -JNIEXPORT jint JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nUpdate(JNIEnv *env, jobject this, +JNIEXPORT jint JNICALL Java_com_kunzisoft_keepass_crypto_NativeAESCipherSpi_nUpdate(JNIEnv *env, jobject this, jlong state, jbyteArray input, jint inputOffset, jint inputLen, jbyteArray output, jint outputOffset, jint outputSize) { int aes_ret; uint32_t outLen, bytes2cache, cryptLen; @@ -258,7 +258,7 @@ JNIEXPORT jint JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nUpdate(J outputSize must be at least 32 for encryption since the buffer may contain >= 1 full block outputSize must be at least 16 for decryption */ -JNIEXPORT jint JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nFinal(JNIEnv *env, jobject this, +JNIEXPORT jint JNICALL Java_com_kunzisoft_keepass_crypto_NativeAESCipherSpi_nFinal(JNIEnv *env, jobject this, jlong state, jboolean doPadding, jbyteArray output, jint outputOffset, jint outputSize) { int i; uint32_t padValue, paddedCacheLen; @@ -361,7 +361,7 @@ JNIEXPORT jint JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nFinal(JN } } -JNIEXPORT jint JNICALL Java_com_keepassdroid_crypto_NativeAESCipherSpi_nGetCacheSize(JNIEnv* env, jobject this, jlong state) { +JNIEXPORT jint JNICALL Java_com_kunzisoft_keepass_crypto_NativeAESCipherSpi_nGetCacheSize(JNIEnv* env, jobject this, jlong state) { aes_state *c_state; c_state = (aes_state *)state; @@ -438,7 +438,7 @@ void *generate_key_material(void *arg) { return (void *)flip; } -JNIEXPORT jbyteArray JNICALL Java_com_keepassdroid_crypto_finalkey_NativeFinalKey_nTransformMasterKey(JNIEnv *env, jobject this, jbyteArray seed, jbyteArray key, jlong rounds) { +JNIEXPORT jbyteArray JNICALL Java_com_kunzisoft_keepass_crypto_finalkey_NativeFinalKey_nTransformMasterKey(JNIEnv *env, jobject this, jbyteArray seed, jbyteArray key, jlong rounds) { master_key mk; uint32_t flip; pthread_t t1, t2; diff --git a/app/src/main/res/drawable-hdpi/ic64.png b/app/src/main/res/drawable-hdpi/ic64.png index f7f573863..4d896d0a1 100644 Binary files a/app/src/main/res/drawable-hdpi/ic64.png and b/app/src/main/res/drawable-hdpi/ic64.png differ diff --git a/app/src/main/res/drawable-ldpi/ic64.png b/app/src/main/res/drawable-ldpi/ic64.png index 5d8aa999e..2a22d9b5f 100644 Binary files a/app/src/main/res/drawable-ldpi/ic64.png and b/app/src/main/res/drawable-ldpi/ic64.png differ diff --git a/app/src/main/res/drawable/ic64.png b/app/src/main/res/drawable/ic64.png index 5dd1edf29..0472df7bf 100644 Binary files a/app/src/main/res/drawable/ic64.png and b/app/src/main/res/drawable/ic64.png differ diff --git a/app/src/main/res/drawable/ic_file_upload_white_24dp.xml b/app/src/main/res/drawable/ic_file_upload_white_24dp.xml deleted file mode 100644 index e90605c08..000000000 --- a/app/src/main/res/drawable/ic_file_upload_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_launch_white_24dp.xml b/app/src/main/res/drawable/ic_launch_white_24dp.xml new file mode 100644 index 000000000..d8c992306 --- /dev/null +++ b/app/src/main/res/drawable/ic_launch_white_24dp.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/layout/browser_install.xml b/app/src/main/res/layout/browser_install.xml index 21c95df98..628fa502d 100644 --- a/app/src/main/res/layout/browser_install.xml +++ b/app/src/main/res/layout/browser_install.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/entry_edit.xml b/app/src/main/res/layout/entry_edit.xml index a23e5d553..8fad275ac 100644 --- a/app/src/main/res/layout/entry_edit.xml +++ b/app/src/main/res/layout/entry_edit.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/entry_edit_new_field.xml b/app/src/main/res/layout/entry_edit_new_field.xml index 1caa4f198..f6f43e784 100644 --- a/app/src/main/res/layout/entry_edit_new_field.xml +++ b/app/src/main/res/layout/entry_edit_new_field.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/entry_new_field.xml b/app/src/main/res/layout/entry_new_field.xml index d132c60b7..23e00f740 100644 --- a/app/src/main/res/layout/entry_new_field.xml +++ b/app/src/main/res/layout/entry_new_field.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/entry_view.xml b/app/src/main/res/layout/entry_view.xml index a2b655271..6050566ab 100644 --- a/app/src/main/res/layout/entry_view.xml +++ b/app/src/main/res/layout/entry_view.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -65,20 +65,10 @@ android:fillViewport="true" android:scrollbarStyle="insideOverlay"> - - - \ No newline at end of file diff --git a/app/src/main/res/layout/entry_view_contents.xml b/app/src/main/res/layout/entry_view_contents.xml index 4a78dd091..e311814c6 100644 --- a/app/src/main/res/layout/entry_view_contents.xml +++ b/app/src/main/res/layout/entry_view_contents.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/file_row.xml b/app/src/main/res/layout/file_row.xml index cda488e3a..a44cc4288 100644 --- a/app/src/main/res/layout/file_row.xml +++ b/app/src/main/res/layout/file_row.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/file_selection.xml b/app/src/main/res/layout/file_selection.xml index 9ad3490bb..2e779bc9d 100644 --- a/app/src/main/res/layout/file_selection.xml +++ b/app/src/main/res/layout/file_selection.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -45,7 +45,7 @@ app:contentScrim="?attr/colorPrimary" app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> - diff --git a/app/src/main/res/layout/file_selection_filename.xml b/app/src/main/res/layout/file_selection_filename.xml index 2a13e822c..95453f9a8 100644 --- a/app/src/main/res/layout/file_selection_filename.xml +++ b/app/src/main/res/layout/file_selection_filename.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/generate_password.xml b/app/src/main/res/layout/generate_password.xml index 54799ba28..7a7bbb39f 100644 --- a/app/src/main/res/layout/generate_password.xml +++ b/app/src/main/res/layout/generate_password.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/group_edit.xml b/app/src/main/res/layout/group_edit.xml index c96207858..cc0a714bd 100644 --- a/app/src/main/res/layout/group_edit.xml +++ b/app/src/main/res/layout/group_edit.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/group_header.xml b/app/src/main/res/layout/group_header.xml index 20eccbca6..7b59acf09 100644 --- a/app/src/main/res/layout/group_header.xml +++ b/app/src/main/res/layout/group_header.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/icon.xml b/app/src/main/res/layout/icon.xml index a0f49d71e..d3b4bc816 100644 --- a/app/src/main/res/layout/icon.xml +++ b/app/src/main/res/layout/icon.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -17,27 +17,12 @@ You should have received a copy of the GNU General Public License along with KeePass DX. If not, see . --> - - - - - - + android:layout_gravity="center" + android:layout_margin="32dp" + android:src="@drawable/ic99_blank"> + diff --git a/app/src/main/res/layout/icon_picker.xml b/app/src/main/res/layout/icon_picker.xml index 88b378536..570cc5e01 100644 --- a/app/src/main/res/layout/icon_picker.xml +++ b/app/src/main/res/layout/icon_picker.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -19,11 +19,13 @@ --> + android:stretchMode="spacingWidthUniform"> diff --git a/app/src/main/res/layout/list_nodes.xml b/app/src/main/res/layout/list_nodes.xml index 4cbe9e661..540f4408f 100644 --- a/app/src/main/res/layout/list_nodes.xml +++ b/app/src/main/res/layout/list_nodes.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/list_nodes_entry.xml b/app/src/main/res/layout/list_nodes_entry.xml index df85a7509..00ff2b6ac 100644 --- a/app/src/main/res/layout/list_nodes_entry.xml +++ b/app/src/main/res/layout/list_nodes_entry.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/list_nodes_group.xml b/app/src/main/res/layout/list_nodes_group.xml index ee5d01933..f14abbfa5 100644 --- a/app/src/main/res/layout/list_nodes_group.xml +++ b/app/src/main/res/layout/list_nodes_group.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/layout/list_nodes_with_add_button.xml b/app/src/main/res/layout/list_nodes_with_add_button.xml index b85baf97f..aeaf77f06 100644 --- a/app/src/main/res/layout/list_nodes_with_add_button.xml +++ b/app/src/main/res/layout/list_nodes_with_add_button.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -51,7 +51,7 @@ app:popupTheme="?attr/toolbarPopupAppearance" android:elevation="4dp" tools:targetApi="lollipop"> - - + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/pref_dialog_input_text_explanation.xml b/app/src/main/res/layout/pref_dialog_input_text_explanation.xml new file mode 100644 index 000000000..e89af7974 --- /dev/null +++ b/app/src/main/res/layout/pref_dialog_input_text_explanation.xml @@ -0,0 +1,40 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/pref_dialog_rounds.xml b/app/src/main/res/layout/pref_dialog_rounds.xml index d8fc1096f..7c91ecc46 100644 --- a/app/src/main/res/layout/pref_dialog_rounds.xml +++ b/app/src/main/res/layout/pref_dialog_rounds.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,15 +27,14 @@ android:importantForAutofill="noExcludeDescendants" tools:targetApi="o"> + style="@style/KeepassDXStyle.TextAppearance.SmallTitle"/> + android:text="@string/sort_last_modify_time"/> + android:text="@string/sort_last_access_time"/> \ No newline at end of file diff --git a/app/src/main/res/menu/entry.xml b/app/src/main/res/menu/entry.xml index 33c4266d3..b768c098b 100644 --- a/app/src/main/res/menu/entry.xml +++ b/app/src/main/res/menu/entry.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,9 +24,14 @@ android:title="@string/menu_showpass" android:orderInCategory="21" app:showAsAction="always" /> - + diff --git a/app/src/main/res/menu/fingerprint.xml b/app/src/main/res/menu/fingerprint.xml index 34606fb2b..41958198d 100644 --- a/app/src/main/res/menu/fingerprint.xml +++ b/app/src/main/res/menu/fingerprint.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/menu/search.xml b/app/src/main/res/menu/search.xml index b157ed1e0..c7a33cc77 100644 --- a/app/src/main/res/menu/search.xml +++ b/app/src/main/res/menu/search.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/menu/tree.xml b/app/src/main/res/menu/tree.xml index 1aabbf1a0..947540434 100644 --- a/app/src/main/res/menu/tree.xml +++ b/app/src/main/res/menu/tree.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index eb65f3f68..7f9e9df97 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Accepta Afegeix entrada Afegeix grup - Algoritme + Algoritme Temps d\'espera de l\'aplicació Temps abans de bloquejar la base de dades quan l\'applicació està inactiva. Aplicació @@ -44,7 +44,7 @@ Desencriptant continguts de la base de dades… Utilitza aquesta com a base de dades per defecte Dígits - KeePass DX \u00A9 %1$d Kunzisoft ve SENSE CAP MENA DE GARANTIA; Això és programari lliure, i pots redistribuïr-lo sota els termes de la llicència GPL versió 2 o posterior. + KeePass DX \u00A9 %1$d Kunzisoft ve SENSE CAP MENA DE GARANTIA; Això és programari lliure, i pots redistribuïr-lo sota els termes de la llicència GPL versió 3 o posterior. Introdueix el nom de la base de dades: Accedida Cancel·la @@ -126,7 +126,7 @@ Rijndael (AES) Arrel Passades d\'encriptació - Més passades d\'encriptació dónen protecció adicional contra atacs de força bruta, però poden alentir molt carregar i guardar la base de dades. + Més passades d\'encriptació dónen protecció adicional contra atacs de força bruta, però poden alentir molt carregar i guardar la base de dades. passades Guardant la base de dades… Espai diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 234ac1ddf..2f5040a8e 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Přijat Přidat záznam Přidat skupinu - Algoritmus + Algoritmus Časový limit aplikace Čas před zamknutím databáze, když je aplikace neaktivní. Aplikace @@ -48,7 +48,7 @@ Dešifruji obsah databáze… Použít jako výchozí databázi Čísla - KeePass DX \u00A9 %1$d Kunzisoft dodáván BEZ JAKÉKOLIV ZÁRUKY; Toto je free software zdarma, a je možná jeho redistribuce pod podmínkou licence GPL verze 2 nebo novější. + KeePass DX \u00A9 %1$d Kunzisoft dodáván BEZ JAKÉKOLIV ZÁRUKY; Toto je free software zdarma, a je možná jeho redistribuce pod podmínkou licence GPL verze 3 nebo novější. Zadejte názvev souboru databáze: Poslední přístup Storno @@ -142,7 +142,7 @@ Rijndael (AES) Kořen Počet zašifrování - Vyšší počet opakování šifrování zvýší bezpečnost proti hrubému útoku, ale může výrazně zpomalit načítání a ukládání. + Vyšší počet opakování šifrování zvýší bezpečnost proti hrubému útoku, ale může výrazně zpomalit načítání a ukládání. opakování Ukládám databázi… Místo diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 526c6ac24..02cd08081 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ Accepter Tilføj post Tilføj gruppe - Algoritme + Algoritme Applikations timeout Tid før databasen låses, når applikationen er inaktiv. Applikation @@ -47,7 +47,7 @@ Dekrypterer databaseindhold… Brug denne database som standard Cifre - KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later. + KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later. Angiv navn på databasefil: Senest åbnet Annuller @@ -141,7 +141,7 @@ Rijndael (AES) Root Krypterings-gentagelser - Højere krypterings-gentagelser giver øget beskyttelse imod brute-force angreb, men kan påvirke læsnings- og skrivehastigheden betydentligt. + Højere krypterings-gentagelser giver øget beskyttelse imod brute-force angreb, men kan påvirke læsnings- og skrivehastigheden betydentligt. gentagelser Gemmer database… Mellemrum diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 239337398..d40329906 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -30,7 +30,7 @@ Eintrag hinzufügen Gruppe hinzufügen Text hinzufügen - Algorithmus + Algorithmus Anwendungssperre Bei inaktiver Anwendung wird die Datenbank nach Ablauf der eingestellten Zeit automatisch gesperrt. Anwendung @@ -51,7 +51,7 @@ Entschlüsselung der Datenbankinhalte\u2026 Als Standard-Datenbank benutzen Zahlen - KeePass DX \u00A9 %1$d Kunzisoft. Alle Rechte vorbehalten. Die Nutzung der Software erfolgt auf eigene Verantwortung und ohne jegliche Garantie. Die Applikation ist kostenlos und wird unter den Bedingungen der GNU GPL Version 2 (oder später) verbreitet und lizenziert. + KeePass DX \u00A9 %1$d Kunzisoft. Alle Rechte vorbehalten. Die Nutzung der Software erfolgt auf eigene Verantwortung und ohne jegliche Garantie. Die Applikation ist kostenlos und wird unter den Bedingungen der GNU GPL Version 3 (oder später) verbreitet und lizenziert. Dateinamen der Datenbank eingeben: Letzter Zugriff Abbrechen @@ -147,11 +147,11 @@ Rijndael (AES) Start Schlüsseltransformationen - Je höher die Anzahl der Schlüsseltransformationen, desto besser ist der Schutz gegen Wörterbuch- oder Brute-Force-Angriffe. Allerdings dauert dann auch das Laden und Speichern der Datenbank entsprechend länger. + Je höher die Anzahl der Schlüsseltransformationen, desto besser ist der Schutz gegen Wörterbuch- oder Brute-Force-Angriffe. Allerdings dauert dann auch das Laden und Speichern der Datenbank entsprechend länger. Schlüsseltransformationen Datenbank reparieren Schlüsseltransformationen vor Datenbankkorruption - Falls ihre Datenbank von KeepassDroid version 2.2.0.0 bis 2.2.0.6 beschädigt wurde, können Sie die Anzahl der Schlüsseltransformationen welche verwendet wurden eingeben um ihre Datenbank wieder zu öffnen. + Falls ihre Datenbank beschädigt wurde, können Sie die Anzahl der Schlüsseltransformationen welche verwendet wurden eingeben um ihre Datenbank wieder zu öffnen. Speichere Datenbank\u2026 Leerzeichen Suchen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index a2eecac24..06e1df004 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ Αποδοχή Προσθήκη εγγραφής Προσθήκη ομάδας - Αλγόριθμος + Αλγόριθμος Χρονικό όριο εφαρμογής Ο χρόνος προτού κλειδωθεί η βάση δεδομένων όταν η εφαρμογή είναι ανενεργή. Εφαρμογή @@ -45,7 +45,7 @@ Αποκρυπτογράφηση περιεχομένων βάσης δεδομένων… Χρήση αυτής της βάσης ως προεπιλεγμένη Ψηφία - KeePass DX \u00A9 %1$d Kunzisoft χωρίς ΚΑΜΙΑ ΑΠΟΛΥΤΩΣ ΕΓΓΥΗΣΗ. Το παρόν είναι δωρεάν λογισμικό και είστε ευπρόσδεκτοι να το διαμοιράσετε υπό τις συνθήκες της ΙΕΛ έκδοσης 2 ή μεταγενέστερης. + KeePass DX \u00A9 %1$d Kunzisoft χωρίς ΚΑΜΙΑ ΑΠΟΛΥΤΩΣ ΕΓΓΥΗΣΗ. Το παρόν είναι δωρεάν λογισμικό και είστε ευπρόσδεκτοι να το διαμοιράσετε υπό τις συνθήκες της ΙΕΛ έκδοσης 3 ή μεταγενέστερης. Εισαγωγή ονόματος βάσης δεδομένων: Προσπελάσθηκε Ακύρωση @@ -139,7 +139,7 @@ Rijndael (AES) Ριζικός Κατάλογος Κύκλοι Κρυπτογράφησης - Μεγαλύτεροι κύκλοι κρυπτογράφησης παρέχουν πρόσθετη προστασία ενάντια σε επιθέσεις brute force, αλλά μπορεί να επιβραδύνει πολύ την φόρτωση και την αποθήκευση. + Μεγαλύτεροι κύκλοι κρυπτογράφησης παρέχουν πρόσθετη προστασία ενάντια σε επιθέσεις brute force, αλλά μπορεί να επιβραδύνει πολύ την φόρτωση και την αποθήκευση. κύκλοι Αποθήκευση βάσης… Κενό diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 91b3bcb41..2c9e71c04 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -5,7 +5,7 @@ This file is part of KeePass DX. KeePass DX 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 2 of the License, or +the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ Spanish translation by José I. Paños. Updated by David García-Abad (23-09-201 Aceptar Añadir entrada Añadir grupo - Algoritmo + Algoritmo Tiempo de espera de aplicación Tiempo hasta bloquear la base de datos cuando la aplicación está inacttiva. Aplicación @@ -43,7 +43,7 @@ Spanish translation by José I. Paños. Updated by David García-Abad (23-09-201 Descifrando el contenido de la base de datos… Utilice esto como base de datos por defecto Dígitos - KeePass DX \u00A9 %1$d Kunzisoft NO TIENE TOTAL GARANTÍA; Este es software libre, y puedes redristribuirlo bajo las condiciones de la licencia GPL version 2 o posterior. + KeePass DX \u00A9 %1$d Kunzisoft NO TIENE TOTAL GARANTÍA; Este es software libre, y puedes redristribuirlo bajo las condiciones de la licencia GPL version 3 o posterior. Introduzca el nombre del archivo de base de datos: Acceso Cancelar @@ -127,7 +127,7 @@ Spanish translation by José I. Paños. Updated by David García-Abad (23-09-201 Rijndael (AES) Raíz Pasadas de Cifrado - Un alto número de pasadas de cifrado proporciona protección adicional contra ataques de fuerza bruta, pero puede ralentizar mucho el cargado y el guardado. + Un alto número de pasadas de cifrado proporciona protección adicional contra ataques de fuerza bruta, pero puede ralentizar mucho el cargado y el guardado. pasadas Guardando base de datos… Espacio diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index 7d855d30f..9cd4f69df 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ Onartu Sarrera gehitu Taldea gehitu - Algoritmoa + Algoritmoa Aplikazioa itzaltzeko denbora Denbora datubasea blokeatu baino lehenago aplikazioa erabili gabe dagoenean Aplikazioa @@ -139,7 +139,7 @@ Rijndael (AES) Root Enkriptatzeko Rondak - Enkriptatzeko ronda gehiago indar gordineko atakeen kontrako babes gehiago ematen dute, baina kargatzea eta gordetzea moteldu dezakete modu nabarmenean. + Enkriptatzeko ronda gehiago indar gordineko atakeen kontrako babes gehiago ematen dute, baina kargatzea eta gordetzea moteldu dezakete modu nabarmenean. rondak Datubasea gordetzen… Lekua diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 21328bab1..ff579713c 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -24,7 +24,7 @@ Hyväksy Lisää uusi salasanatietue Lisää ryhmä - Algoritmi + Algoritmi Ohjelman aikakatkaisu Aika, jonka jälkeen KeePass lukitaan jos se on ollut toimeton. Ohjelma @@ -45,7 +45,7 @@ Puretaan tietokannan salausta… Käytä tätä oletustietokantana Numerot - KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later. + KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later. Anna tietokannan tiedostonimi: Käytetty Peruuta @@ -137,7 +137,7 @@ Rijndael (AES) Juuri Salauskierroksia - Suurempi kierrosten määrä parantaa suojausta raa\'alla voimalla tehdyiltä murtoyrityksiltä, mutta voi todella hidastaa lataamista ja tallentamista. + Suurempi kierrosten määrä parantaa suojausta raa\'alla voimalla tehdyiltä murtoyrityksiltä, mutta voi todella hidastaa lataamista ja tallentamista. kierroksia Tallennetaan tietokantaa… Tila diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index bad7f2c1a..088a2004e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Ajouter une entrée Ajouter un groupe Ajouter une chaîne - Algorithme + Algorithme Application timeout Temps avant le verrouillage de la base de données lorsque l\'application est inactive. Application @@ -52,7 +52,7 @@ Déchiffrement du contenu de la base de données… Utiliser comme base de données par défaut Nombres - KeePass DX \u00A9 %1$d Kunzisoft n\'offre ABSOLUMENT AUCUNE GARANTIE; il s\'agit d\'un logiciel libre, vous pouvez le redistribuer sous les conditions de la licence GPL v2 ou ultérieure. + KeePass DX \u00A9 %1$d Kunzisoft n\'offre ABSOLUMENT AUCUNE GARANTIE; il s\'agit d\'un logiciel libre, vous pouvez le redistribuer sous les conditions de la licence GPL v3 ou ultérieure. Dernier accès Annuler Commentaires @@ -150,12 +150,12 @@ Effacer Rijndael (AES) Racine - Niveau du chiffrement - Un niveau de chiffrement supérieur assure une protection supplémentaire contre les attaques de force brute, mais peut considérablement ralentir l\'ouverture et l\'enregistrement. + Tours de transformation + Un niveau de chiffrement supérieur assure une protection supplémentaire contre les attaques de force brute, mais peut considérablement ralentir l\'ouverture et l\'enregistrement. niveaux Résolution de la base de données Clé de niveau de chiffrement avant corruption - Si votre base de données a été corrompue par KeePassDroid version 2.2.0.0 à 2.2.0.6, entrez le niveau de chiffrement utilisé précédemment et cela vous permettra d\'ouvrir votre base. + Si votre base de données a été corrompue, entrez le nombre de tours utilisés précédemment pour essayer d\'ouvrir votre base de données. Enregistrement de la base de données… Espace Rechercher @@ -247,6 +247,9 @@ Autoriser la copie du mot de passe dans le presse-papiers. ATTENTION : désactiver cette fonctionnalité peut engendrer une impossibilité d\'ouvrir ou sauvegarder les bases de données Lien du fichier Kdbx à ouvrir + Nom de la base de données + Description de la base de données + Version de la base de données Réinitialiser les écrans d\'éducation Mettre en surbrillance les éléments pour apprendre le fonctionnement de l\'application diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 308dc96a1..d317fc275 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -5,7 +5,7 @@ This file is part of KeePassDroid. KeePassDroid 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePassDroid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,7 +21,7 @@ Elfogadás Bejegyzés hozzáadása Csoport hozzáadása - Algoritmus + Algoritmus Alkalmazás időkorlátja Beállíthatja, mennyi idő után kerüljön lezárásra az adatbázis Alkalmazás @@ -42,7 +42,7 @@ Adatbázis tartalmának dekódolása… Adatbázis beállítása alapértelmezettként Számok - KeePass DX \u00A9 %1$d Kunzisoft. Ehhez a programhoz SEMMILYEN GARANCIA NEM JÁR; Ez egy szabad szoftver, GNU General Public License v2 vagy későbbi verziójának feltételei mellett terjeszthető, illetve módosítható. Fordította: Eversmann + KeePass DX \u00A9 %1$d Kunzisoft. Ehhez a programhoz SEMMILYEN GARANCIA NEM JÁR; Ez egy szabad szoftver, GNU General Public License v3 vagy későbbi verziójának feltételei mellett terjeszthető, illetve módosítható. Fordította: Eversmann Adja meg az adatbázis fájlnevét: Utolsó hozzáférés Mégsem @@ -137,7 +137,7 @@ Rijndael (AES) Gyökérkönyvár Titkosítási menetek száma - A titkosítási menetek számának növelésével extra védelemet kaphat a brute force támadások ellen, ugyanakkor jelentősen lassíthatja az adatbázis betöltését vagy mentését. + A titkosítási menetek számának növelésével extra védelemet kaphat a brute force támadások ellen, ugyanakkor jelentősen lassíthatja az adatbázis betöltését vagy mentését. Menetek száma Adatbázis mentése… Szóköz diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e6d53cb68..067d3f571 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Accetto Aggiungi voce Aggiungi gruppo - Algoritmo + Algoritmo Scadenza applicazione Tempo prima che venga bloccato il database quando l\'applicazione è inattiva. Applicazione @@ -44,7 +44,7 @@ Decodifica contenuto database… Usa come database predefinito Cifre - KeePass DX \u00A9 %1$d Kunzisoft viene distribuito ASSOLUTAMENTE con NESSUNA GARANZIA; Si tratta di software libero, e sei invitato a distribuirlo sotto le condizioni della licenza GPL versione 2 o superiore. + KeePass DX \u00A9 %1$d Kunzisoft viene distribuito ASSOLUTAMENTE con NESSUNA GARANZIA; Si tratta di software libero, e sei invitato a distribuirlo sotto le condizioni della licenza GPL versione 3 o superiore. Inserisci il nome file del database: Ultimo accesso Annulla @@ -126,7 +126,7 @@ Rijndael (AES) Principale Livello cifratura - Un livello di cifratura elevato fornisce una protezione maggiore contro attacchi di tipo "forza brutta", ma può veramente rallentare il caricamento e il salvataggio. + Un livello di cifratura elevato fornisce una protezione maggiore contro attacchi di tipo "forza brutta", ma può veramente rallentare il caricamento e il salvataggio. livello Salvataggio database… Spazio diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 53eb3f87b..24097bc28 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -25,7 +25,7 @@ קבל הוסף ערך הוסף קבוצה - אלגוריתם + אלגוריתם פסק זמן ליישום זמן לפני נעילת מסד הנתונים כאשר היישום לא פעיל. יישום @@ -136,7 +136,7 @@ שמור קובץ מפתח הסר סיבובי הצפנה - מספר סיבובי הצפנה גבוה יותר מספר הגה טובה יותר נגד התקפות, אבל יכול להעלות בהרבה את זמן הטעינה והשמירה. + מספר סיבובי הצפנה גבוה יותר מספר הגה טובה יותר נגד התקפות, אבל יכול להעלות בהרבה את זמן הטעינה והשמירה. סיבובים שומר מסד נתונים… גודל diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 1078b06c8..d636425ec 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ 決定 エントリーを追加 グループを追加 - アルゴリズム + アルゴリズム アプリケーション タイムアウト KeePassがこの時間非アクティブだった場合、データベースをロックします。 アプリケーション @@ -41,7 +41,7 @@ データベースを解析中… このデータベースを次回以降も利用する 数字 - KeePass DX \u00A9 %1$d Kunzisoft によって作られたフリーソフトウェアであり、無保証です。GPLバージョン2以上の条件下でこれを再頒布することができます。 + KeePass DX \u00A9 %1$d Kunzisoft によって作られたフリーソフトウェアであり、無保証です。GPLバージョン3以上の条件下でこれを再頒布することができます。 データベースファイル: 最終アクセス日 キャンセル @@ -123,7 +123,7 @@ Rijndael (AES) Root 暗号化レベル - 暗号化レベルを高く設定するとブルートフォース(総当り)攻撃に強くなりますが、保存や読込に時間が掛かります。 + 暗号化レベルを高く設定するとブルートフォース(総当り)攻撃に強くなりますが、保存や読込に時間が掛かります。 レベル データベースを保存中… 半角スペース diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index d44b2b4e8..0f307735a 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -10,7 +10,7 @@ Pridėti įrašą Pridėti grupę Pridėti eilutę - Algortimas + Algortimas Laikas, per kurį yra užrakinama duomenų bazė po neveiklumo programėlėje. Programėlė Programėlės nustatymai diff --git a/app/src/main/res/values-lv/strings.xml b/app/src/main/res/values-lv/strings.xml index 8cfba1d82..c2812aa4d 100644 --- a/app/src/main/res/values-lv/strings.xml +++ b/app/src/main/res/values-lv/strings.xml @@ -6,7 +6,7 @@ Pieņemt Jauns ieraksts Jauna grupa - Algoritms + Algoritms Pielikuma taimauts Bloķēšanas taimauts, kad programma nav aktīva. Programma @@ -117,7 +117,7 @@ Rijndael (AES) Root Šifrēšanas līmeņi - Augstākā līmeņa šifrēšana sniedz lielāku aizsardzību, bet palēnina darbības ar datu bāzēm. + Augstākā līmeņa šifrēšana sniedz lielāku aizsardzību, bet palēnina darbības ar datu bāzēm. līmeņi Datu bāzes saglabāšana… Atstarpe diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index f78cc0aa1..f79dd0e92 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ Aanvaarden Record toevoegen Groep toevoegen - Algoritme + Algoritme Applicatietimeout Tijd tot het vergrendelen van de database bij inactiviteit. Applicatie @@ -43,7 +43,7 @@ Databaseinhoud wordt ontcijferd… Gebruik dit als mijn standaard database Cijfers - KeePass DX \u00A9 %1$d Kunzisoft biedt GEEN ENKELE GARANTIE; Dit is vrije software, u mag deze software verspreiden onder de voorwaarden van de GPL versie 2 of recenter. + KeePass DX \u00A9 %1$d Kunzisoft biedt GEEN ENKELE GARANTIE; Dit is vrije software, u mag deze software verspreiden onder de voorwaarden van de GPL versie 3 of recenter. Geef de databasebestandsnaam: Laatst benaderd Annuleren @@ -125,7 +125,7 @@ Rijndael (AES) Top Encryptie-cycli - Een hoger aantal encryptie-cycli geeft bijkomende bescherming tegen brute-force aanvallen, maar kan het laden en opslaan sterk vertragen. + Een hoger aantal encryptie-cycli geeft bijkomende bescherming tegen brute-force aanvallen, maar kan het laden en opslaan sterk vertragen. cycli Database wordt opgeslagen… Ruimte diff --git a/app/src/main/res/values-nn/strings.xml b/app/src/main/res/values-nn/strings.xml index 585921af6..441b02c0c 100644 --- a/app/src/main/res/values-nn/strings.xml +++ b/app/src/main/res/values-nn/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ Godta Legg til post Legg til gruppe - Algoritme + Algoritme Programtidsavbrot Tid før databasen blir låst når programmet ikkje er i bruk. Program @@ -41,7 +41,7 @@ Dekrypterer databasen … Standarddatabasen Tal - KeePass DX \u00A9 %1$d Kunzisoft kjem med INGEN SOM HELST GARANTI. Dette er eit fritt program. Du er velkomen til å redistribuera det i samsvar med vilkåra til GPL utgåve 2 eller nyare. + KeePass DX \u00A9 %1$d Kunzisoft kjem med INGEN SOM HELST GARANTI. Dette er eit fritt program. Du er velkomen til å redistribuera det i samsvar med vilkåra til GPL utgåve 3 eller nyare. Skriv filnamnet til databasen: Brukt Avbryt @@ -123,7 +123,7 @@ Rijndael (AES) Rot Krypteringsomgangar - Fleire krypteringsomgangar gjev tilleggsvern mot rå makt-åtak, men kan òg gjera lasting og lagring mykje tregare. + Fleire krypteringsomgangar gjev tilleggsvern mot rå makt-åtak, men kan òg gjera lasting og lagring mykje tregare. omgangar Lagrar databasen … Mellomrom diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 869020235..2f3117fef 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -5,7 +5,7 @@ This file is part of KeePass DX. KeePass DX 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 2 of the License, or +the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -23,7 +23,7 @@ along with KeePass DX. If not, see . Akceptuj Dodaj wpis Dodaj grupę - Algorytm + Algorytm Czas wygaśnięcia aplikacji Czas do zablokowania bazy danych przy bezczynności aplikacji. Aplikacja @@ -123,7 +123,7 @@ along with KeePass DX. If not, see . Rijndael (AES) Root Złożoność szyfrowania - Większa złożoność szyfrowania zapewnia dodatkowe zabezpieczenie przed atakiem brute force, ale może spowolnić wczytywanie i zapisywanie bazy danych. + Większa złożoność szyfrowania zapewnia dodatkowe zabezpieczenie przed atakiem brute force, ale może spowolnić wczytywanie i zapisywanie bazy danych. Kluczowe rundy szyfrowania przed zniszczeniem Jeśli twoja baza danych została uszkodzona przez KeePassDroid w wersji 2.2.0.0 do 2.2.0.6, wprowadź liczbę rund użytych poprzednio, a to pozwoli ci otworzyć twoją bazę danych. złożoność diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 36ba9bdb0..b596cd355 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Aceitar Adicionar entrada Adicionar grupo - Algoritmo + Algoritmo Tempo limite para o aplicativo Tempo até que o banco de dados seja travado quando o aplicativo estiver inativo. Aplicação @@ -44,7 +44,7 @@ Decifrando conteúdo do banco de dados… Usar este banco de dados como padrão Digitos - KeePass DX \u00A9 %1$d Kunzisoft vem com ABSOLUTAMENTE NENHUMA GARANTIA; Este é um software livre, e você está convidado a redistribui-lo sob as condições da GPL versão 2 ou posterior. + KeePass DX \u00A9 %1$d Kunzisoft vem com ABSOLUTAMENTE NENHUMA GARANTIA; Este é um software livre, e você está convidado a redistribui-lo sob as condições da GPL versão 3 ou posterior. Digite o nome do arquivo de banco de dados: Acessado Cancelar @@ -126,7 +126,7 @@ Rijndael (AES) Raiz Rodadas de criptografia - Maior número de rodadas de criptografia adiciona mais proteção contra ataques de força bruta, porém pode tornar o processo de carregar e salvar mais lentos. + Maior número de rodadas de criptografia adiciona mais proteção contra ataques de força bruta, porém pode tornar o processo de carregar e salvar mais lentos. rodadas Salvando banco de dados… Spaço diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 6e7026835..97df802ec 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,7 @@ Adicionar entrada Adicionar grupo Adicionar linha - Algoritmo + Algoritmo Tempo de espera da aplicação Tempo antes do bloqueio da base de dados quando a aplicação está inativa. Aplicação @@ -48,7 +48,7 @@ A desencriptar conteúdo da base de dados… Utilizar esta base de dados como predefinida Dígitos - KeePass DX \u00A9 %1$d Kunzisoft vem com ABSOLUTAMENTE NENHUMA GARANTIA; Este software é livre, e pode redistribui-lo conforme as condições da licença GPL versão 2 ou superior. + KeePass DX \u00A9 %1$d Kunzisoft vem com ABSOLUTAMENTE NENHUMA GARANTIA; Este software é livre, e pode redistribui-lo conforme as condições da licença GPL versão 3 ou superior. Introduza o nome do ficheiro da base de dados: Acedido Cancelar @@ -144,7 +144,7 @@ Rijndael (AES) Raiz Rondas de encriptação - Rondas de encriptação altas providenciam proteção adicional contra ataques de força bruta, mas podem atrasar o tempo de carregamento e armazenamento. + Rondas de encriptação altas providenciam proteção adicional contra ataques de força bruta, mas podem atrasar o tempo de carregamento e armazenamento. rondas A guardar base de dados… Espaço diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 48257582b..c19a601d4 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -24,7 +24,7 @@ Принять Новая запись Новая группа - Алгоритм + Алгоритм Блокировка базы Задержка блокировки при бездействии Программа @@ -45,7 +45,7 @@ Расшифровка базы… По умолчанию Цифры 0…9 - KeePass DX \u00A9 %1$d Kunzisoft Программа предоставляется БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. Распространяется свободно по лицензии GPL v2 или новее + KeePass DX \u00A9 %1$d Kunzisoft Программа предоставляется БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ. Распространяется свободно по лицензии GPL v3 или новее Путь к базе KeePass: Доступ Отмена @@ -139,7 +139,7 @@ Rijndael (AES) База Проходы шифрования - Больше проходов – выше стойкость базы к подбору пароля, но медленнее открытие и сохранение + Больше проходов – выше стойкость базы к подбору пароля, но медленнее открытие и сохранение Проходы до поломки базы Если база была повреждена в KeePassDroid 2.2.0.0–2.2.0.6, введите ранее используемое количество проходов шифрования, чтобы открыть её проходы diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index 6feddbe33..24d17df7e 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ Prijať Pridať Záznam Pridať Skupinu - Algoritmus + Algoritmus Časový limit aplikácie. Čas pred uzamknutím databázy, ak je aplikácia neaktívna. Applikácia @@ -41,7 +41,7 @@ Dešifrujem obsah databázy… Použiť toto ako predvolenú databázu Číslice - KeePass DX \u00A9 %1$d Kunzisoft použitie Absolútne bez Záruky; Toto je free software, a môžete ho používať pod GPL ver. 2 alebo vyššie. + KeePass DX \u00A9 %1$d Kunzisoft použitie Absolútne bez Záruky; Toto je free software, a môžete ho používať pod GPL ver. 3 alebo vyššie. Vložte názov Databázy: Pristupované Zrušiť @@ -123,7 +123,7 @@ Rijndael (AES) Root Šifrovacie opakovania - Vyššie opakovania šifrovania dávajú vyššiu ochranu proti útokom hrubou silou, ale môžu spomaliť načítavanie a ukladanie. + Vyššie opakovania šifrovania dávajú vyššiu ochranu proti útokom hrubou silou, ale môžu spomaliť načítavanie a ukladanie. opakovania Ukladám databázu… Miesto diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 0ce0750e6..f1918843e 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -26,7 +26,7 @@ OK Ny post Ny grupp - Algoritm + Algoritm Tidsgräns för applikation Tid innan låsning när applikationen är inaktiv. Applikation @@ -47,7 +47,7 @@ Dekrypterar databasinnehåll… Använda denna databasen som standard Siffror - KeePass DX \u00A9 %1$d Kunzisoft kommer HELT UTAN GARANTIER; Detta är fri programvara och du är välkommen att distribuera den utifrån villkoren i GPL version 2 eller senare. + KeePass DX \u00A9 %1$d Kunzisoft kommer HELT UTAN GARANTIER; Detta är fri programvara och du är välkommen att distribuera den utifrån villkoren i GPL version 3 eller senare. Ange databasnamn: Senast använd Avbryt @@ -136,7 +136,7 @@ Rijndael (AES) Root Krypteringsrundor - Högre antal krypteringsrundor ger ytterligare skydd mot "brute force"-attacker, men kan göra att ladda och spara går betydligt långsammare. + Högre antal krypteringsrundor ger ytterligare skydd mot "brute force"-attacker, men kan göra att ladda och spara går betydligt långsammare. rundor Sparar databas… Mellanslag diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 8cde99584..eb8f8a8b3 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ Прийняти Додати запис Додати групу - Алгоритм + Алгоритм Тайм-аут програми Час перед закриттям бази даних, коли програма є неактивною. Програма @@ -41,7 +41,7 @@ Розшифрування змісту бази даних… Використовувати як мою типову базу даних Цифри - KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later. + KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later. Введіть ім’я бази даних: Доступ Відміна @@ -123,7 +123,7 @@ Rijndael (AES) Корінь Циклів шифрування - Велика кількість циклів шифрування забезпечує додатковий захист від грубих атак, але може дійсно уповільнити завантаження та захист. + Велика кількість циклів шифрування забезпечує додатковий захист від грубих атак, але може дійсно уповільнити завантаження та захист. цикли Збереження бази даних… Пропуск diff --git a/app/src/main/res/values-v19/donottranslate.xml b/app/src/main/res/values-v19/donottranslate.xml index 2f802c520..05331e78c 100644 --- a/app/src/main/res/values-v19/donottranslate.xml +++ b/app/src/main/res/values-v19/donottranslate.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/values-v23/donottranslate.xml b/app/src/main/res/values-v23/donottranslate.xml index 10e970345..2e3d62eec 100644 --- a/app/src/main/res/values-v23/donottranslate.xml +++ b/app/src/main/res/values-v23/donottranslate.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 064876c5e..498cc3281 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ 接受 添加条目 添加群组 - 算法 + 算法 应用程序超时 应用程序处于非活动时锁定数据库。 应用程序 @@ -41,7 +41,7 @@ 解密数据库内容中… 使用这做为我的默认数据库 数字 - KeePass DX \u00A9 %1$d Kunzisoft;软件不带有绝对担保;是自由软件,您可在遵循GPL 2或者更高版本的情况下重新发布。中文简繁体翻译:wangkf@gmail.com + KeePass DX \u00A9 %1$d Kunzisoft;软件不带有绝对担保;是自由软件,您可在遵循GPL 3或者更高版本的情况下重新发布。中文简繁体翻译:wangkf@gmail.com 输入数据库名: 访问时间 取消 @@ -120,7 +120,7 @@ Rijndael加密(AES) Root 加密次数 - 更高级的加密次数对暴力攻击能提供额外保护,但也会增加加载和保存的时间。 + 更高级的加密次数对暴力攻击能提供额外保护,但也会增加加载和保存的时间。 次数 正在保存数据库… 空格 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3ddafe26a..7df785401 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -24,7 +24,7 @@ 接受 添加條目 添加群組 - 演算法 + 演算法 應用程式超時 應用程式處於非活動時鎖定資料庫。 應用程式 @@ -41,7 +41,7 @@ 解密資料庫內容中… 使用這做為我的默認資料庫 數字 - KeePass DX \u00A9 %1$d Kunzisoft;軟體不帶有絕對擔保;是自由軟體,您可在遵循GPL 2或者更高版本的情況下重新發佈。中文簡繁體翻譯:wangkf@gmail.com + KeePass DX \u00A9 %1$d Kunzisoft;軟體不帶有絕對擔保;是自由軟體,您可在遵循GPL 3或者更高版本的情況下重新發佈。中文簡繁體翻譯:wangkf@gmail.com 輸入資料庫名: 訪問時間 取消 @@ -120,7 +120,7 @@ Rijndael加密(AES) Root 加密次數 - 更高級的加密次數對暴力攻擊能提供額外保護,但也會增加載入和保存的時間。 + 更高級的加密次數對暴力攻擊能提供額外保護,但也會增加載入和保存的時間。 次數 正在保存資料庫… 空格 diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index fdffe19e4..bd93afdab 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -29,7 +29,7 @@ - - + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 843c178bf..927c365f4 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/values/donottranslate.xml b/app/src/main/res/values/donottranslate.xml index c1e5a1aad..a2ea1d010 100644 --- a/app/src/main/res/values/donottranslate.xml +++ b/app/src/main/res/values/donottranslate.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -34,13 +34,15 @@ 64 - algorithm + algorithm + key_derivation_function_key app app_timeout_key clip_timeout_key db - rounds + transform_rounds_key roundsFix + 100000 keyfile maskpass omitbackup @@ -54,7 +56,6 @@ sort_recycle_bin_bottom_key timeout_key storage_access_framework_key - 100000 setting_style_key clipboard_notifications_key lock_database_screen_off_key @@ -67,6 +68,10 @@ monospace_font_extra_fields_enable_key auto_open_file_uri_key allow_copy_password_key + database_general_key + database_name_key + database_description_key + database_version_key relaunch_education_screens_key education_select_db_key education_group_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d5f8906ab..c43a4cd12 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -27,7 +27,9 @@ Add entry Add group Add string - Algorithm + Encryption + Encryption Algorithm + Key Derivation Function Application timeout Time before locking database when the application is inactive. Application @@ -50,7 +52,7 @@ Decrypting database contents… Use this as my default database Digits - KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 2 or later. + KeePass DX \u00A9 %1$d Kunzisoft comes with ABSOLUTELY NO WARRANTY; This is free software, and you are welcome to redistribute it under the conditions of the GPL version 3 or later. Accessed Cancel Comments @@ -150,11 +152,11 @@ Remove Rijndael (AES) Root - Encryption Rounds - Higher encryption rounds provide additional protection against brute force attacks, but can really slow down loading and saving. + Transform Rounds + Higher encryption rounds provide additional protection against brute force attacks, but can really slow down loading and saving. Fix of database Key encryption rounds before corruption - If your database was corrupted by KeePassDroid version 2.2.0.0 to 2.2.0.6, enter the number of rounds used previously and this will allow you to open your database. + If your database was corrupted, enter the number of rounds used previously to try to open your database. rounds Saving database… Space @@ -173,6 +175,7 @@ Search Search results Twofish + ChaCha20 Underline Unsupported database version. Upper-case @@ -248,6 +251,9 @@ Allow the copy of the password to the clipboard. WARNING : disabling this feature may result in an inability to open or save the databases Link of the Kdbx file to open + Database name + Database description + Database version Reset education screens Highlight the elements to learn how the application works diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index c1973e6ca..f6982df94 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/xml/app_preferences.xml b/app/src/main/res/xml/app_preferences.xml index 5d0207f5b..5a5eb1d07 100644 --- a/app/src/main/res/xml/app_preferences.xml +++ b/app/src/main/res/xml/app_preferences.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/xml/backup.xml b/app/src/main/res/xml/backup.xml index 083e3d792..8879030c6 100644 --- a/app/src/main/res/xml/backup.xml +++ b/app/src/main/res/xml/backup.xml @@ -6,7 +6,7 @@ KeePassDroid 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePassDroid is distributed in the hope that it will be useful, diff --git a/app/src/main/res/xml/dataset_service.xml b/app/src/main/res/xml/dataset_service.xml index fa744c875..d073a2399 100644 --- a/app/src/main/res/xml/dataset_service.xml +++ b/app/src/main/res/xml/dataset_service.xml @@ -19,4 +19,4 @@ Attributes for the AutoFill service that tell the framework what will act as the Settings Activity. This is pointed to in the service's meta-data in the application's manifest. --> \ No newline at end of file + android:settingsActivity="com.kunzisoft.keepass.settings.SettingsAutofillActivity" /> \ No newline at end of file diff --git a/app/src/main/res/xml/db_preferences.xml b/app/src/main/res/xml/db_preferences.xml index 6dda405e5..8fc725e6b 100644 --- a/app/src/main/res/xml/db_preferences.xml +++ b/app/src/main/res/xml/db_preferences.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -17,31 +17,57 @@ You should have received a copy of the GNU General Public License along with KeePass DX. If not, see . --> - + - + - - + android:title="@string/database_name_title" + android:positiveButtonText="@string/entry_save" + android:negativeButtonText="@string/entry_cancel"/> + + + + + + + + + + + diff --git a/app/src/main/res/xml/form_filling_preferences.xml b/app/src/main/res/xml/form_filling_preferences.xml index 94bfcae58..8fc8c25ab 100644 --- a/app/src/main/res/xml/form_filling_preferences.xml +++ b/app/src/main/res/xml/form_filling_preferences.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index eac083893..08b0cb2a9 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, @@ -41,11 +41,11 @@ android:title="@string/menu_db_settings" android:icon="@drawable/ic_data_usage_prefs_24dp" android:persistent="false" /> - diff --git a/app/src/main/res/xml/searchable.xml b/app/src/main/res/xml/searchable.xml index 28e81ffbf..8ea140dce 100644 --- a/app/src/main/res/xml/searchable.xml +++ b/app/src/main/res/xml/searchable.xml @@ -6,7 +6,7 @@ KeePass DX 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 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KeePass DX is distributed in the hope that it will be useful, diff --git a/art/ic64_classic_replacement.svg b/art/ic64_classic_replacement.svg new file mode 100644 index 000000000..ea96a4875 --- /dev/null +++ b/art/ic64_classic_replacement.svg @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/fastlane/metadata/android/en-US/changelogs/8.txt b/fastlane/metadata/android/en-US/changelogs/8.txt index 5f4af5f1b..399bae894 100644 --- a/fastlane/metadata/android/en-US/changelogs/8.txt +++ b/fastlane/metadata/android/en-US/changelogs/8.txt @@ -1,7 +1,8 @@ * Hide custom entries protected * Best management of field references (https://keepass.info/help/base/fieldrefs.html) - * Change default settings + * Change database / default settings * Add Autofill for search + * Add sorting by last access and by creation time * Rebuild custom entries * Refactor old code * Fix bugs \ No newline at end of file diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index 5432ea828..4363f331b 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,15 +1,16 @@ -If you want a light material design Keepass client to manage keys and passwords in secure database, you're in the right place ! +Multi-format KeePass manager, the application allows to create keys and passwords in a secure way by integrating perfectly with the Android design standards. Features : * Create database files / entries and groups - * Support for .kdb and .kdbx files (version 1 to 4) - * Open database, copy username / password, open URI / URL + * Support for .kdb and .kdbx files (version 1 to 4) with AES - Twofish - ChaCha20 - Argon2 algorithm + * Compatible with the majority of alternative programs (KeePass, KeePassX, KeePass XC...) + * Allows fast copy of fields and opening of URI / URL * Fingerprint for fast unlocking * Material design with themes - * AutoFill and Integration (Development in progress) + * AutoFill and Integration * Precise management of settings Keepass DX is opensource and ad-free. You can donate for a better service and a quick development of your features. -Any issue : https://github.com/Kunzisoft/KeePassDX/issues \ No newline at end of file +Any issue : https://github.com/Kunzisoft/KeePassDX/issues diff --git a/fastlane/metadata/android/fr-FR/changelogs/8.txt b/fastlane/metadata/android/fr-FR/changelogs/8.txt index 857c0b99e..3f12e6741 100644 --- a/fastlane/metadata/android/fr-FR/changelogs/8.txt +++ b/fastlane/metadata/android/fr-FR/changelogs/8.txt @@ -1,7 +1,8 @@ * Cache pour les entrées protégées customisées * Meilleure gestion des références de champs (https://keepass.info/help/base/fieldrefs.html) - * Changement des paramètres par defaut + * Changement des paramètres de base de données / par defaut * Ajout du remplissage automatique pour la recherche + * Ajout des tris par dernier accès et par temps de création * Reconstruction des entrées customisées * Refactorisation du vieux code * Correction de bugs \ No newline at end of file diff --git a/fastlane/metadata/android/fr-FR/full_description.txt b/fastlane/metadata/android/fr-FR/full_description.txt index 4b2fb4179..3ca1a2bf1 100644 --- a/fastlane/metadata/android/fr-FR/full_description.txt +++ b/fastlane/metadata/android/fr-FR/full_description.txt @@ -1,15 +1,16 @@ -Si vous voulez un client Keepass material design pour gérer vos clés et mots de passe dans une base de données sécurisée, vous êtes au bon endroit ! +Gestionnaire KeePass multiformats, l'application permet de créer des clés et mots de passe de manière sécurisée en s'intégrant parfaitement aux normes de design Android. Fonctionnalités : - * Création de fichiers de base de données / entrées et groupes - * Support des fichiers .kdb et .kdbx (version 1 à 4) - * Ouverture de la base de données, copie du nom d'utilisateur / mot de passe, ouverture des URI / URL - * Empreinte digitale pour déblocage rapide + * Création de bases de données / entrées et groupes + * Support des fichiers .kdb et .kdbx (version 1 à 4) avec algorithme AES - Twofish - ChaCha20 - Argon2 + * Compatible avec la majorité des programmes alternatifs (KeePass, KeePassX, KeePass XC...) + * Permet la copie rapide de champs et l'ouverture d'URI /URL + * Empreintes digitales pour un déblocage rapide des bases * Material design avec thèmes - * AutoFill et Intégration (Développement en cours) + * Remplissage automatique de champs * Gestion précise des paramètres Keepass DX est opensource et sans publicité. Vous pouvez faire un don pour un meilleur service et un développement rapide de vos fonctionnalités. -Vous avez un bug : https://github.com/Kunzisoft/KeePassDX/issues \ No newline at end of file +Vous avez un bug : https://github.com/Kunzisoft/KeePassDX/issues diff --git a/gplv3.md b/gplv3.md new file mode 100644 index 000000000..7bdad759f --- /dev/null +++ b/gplv3.md @@ -0,0 +1,636 @@ +# GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +## Preamble + +The GNU General Public License is a free, copyleft license for software and +other kinds of works. + +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program--to make sure it remains free software for all its users. +We, the Free Software Foundation, use the GNU General Public License for most +of our software; it applies also to any other work released this way by its +authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can do +these things. + +To protect your rights, we need to prevent others from denying you these rights +or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify it: +responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for +a fee, you must pass on to the recipients the same freedoms that you received. +You must make sure that they, too, receive or can get the source code. And you +must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: + + 1. assert copyright on the software, and + 2. offer you this License giving you legal permission to copy, distribute + and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that +there is no warranty for this free software. For both users' and authors' sake, +the GPL requires that modified versions be marked as changed, so that their +problems will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. This +is fundamentally incompatible with the aim of protecting users' freedom to +change the software. The systematic pattern of such abuse occurs in the area of +products for individuals to use, which is precisely where it is most +unacceptable. Therefore, we have designed this version of the GPL to prohibit +the practice for those products. If such problems arise substantially in other +domains, we stand ready to extend this provision to those domains in future +versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on +general-purpose computers, but in those that do, we wish to avoid the special +danger that patents applied to a free program could make it effectively +proprietary. To prevent this, the GPL assures that patents cannot be used to +render the program non-free. + +The precise terms and conditions for copying, distribution and modification +follow. + +## TERMS AND CONDITIONS + +### 0. Definitions. + +*This License* refers to version 3 of the GNU General Public License. + +*Copyright* also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. + +*The Program* refers to any copyrightable work licensed under this License. +Each licensee is addressed as *you*. *Licensees* and *recipients* may be +individuals or organizations. + +To *modify* a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact copy. +The resulting work is called a *modified version* of the earlier work or a work +*based on* the earlier work. + +A *covered work* means either the unmodified Program or a work based on the +Program. + +To *propagate* a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under applicable +copyright law, except executing it on a computer or modifying a private copy. +Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. + +To *convey* a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer +network, with no transfer of a copy, is not conveying. + +An interactive user interface displays *Appropriate Legal Notices* to the +extent that it includes a convenient and prominently visible feature that + + 1. displays an appropriate copyright notice, and + 2. tells the user that there is no warranty for the work (except to the + extent that warranties are provided), that licensees may convey the work + under this License, and how to view a copy of this License. + +If the interface presents a list of user commands or options, such as a menu, a +prominent item in the list meets this criterion. + +### 1. Source Code. + +The *source code* for a work means the preferred form of the work for making +modifications to it. *Object code* means any non-source form of a work. + +A *Standard Interface* means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces specified +for a particular programming language, one that is widely used among developers +working in that language. + +The *System Libraries* of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only +to enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code +form. A *Major Component*, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on +which the executable work runs, or a compiler used to produce the work, or an +object code interpreter used to run it. + +The *Corresponding Source* for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work's System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with source +files for the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, such as +by intimate data communication or control flow between those subprograms and +other parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +### 2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on +the Program, and are irrevocable provided the stated conditions are met. This +License explicitly affirms your unlimited permission to run the unmodified +Program. The output from running a covered work is covered by this License only +if the output, given its content, constitutes a covered work. This License +acknowledges your rights of fair use or other equivalent, as provided by +copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all +material for which you do not control copyright. Those thus making or running +the covered works for you must do so exclusively on your behalf, under your +direction and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes it +unnecessary. + +### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure +under any applicable law fulfilling obligations under article 11 of the WIPO +copyright treaty adopted on 20 December 1996, or similar laws prohibiting or +restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention is +effected by exercising rights under this License with respect to the covered +work, and you disclaim any intention to limit operation or modification of the +work as a means of enforcing, against the work's users, your or third parties' +legal rights to forbid circumvention of technological measures. + +### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, +in any medium, provided that you conspicuously and appropriately publish on +each copy an appropriate copyright notice; keep intact all notices stating that +this License and any non-permissive terms added in accord with section 7 apply +to the code; keep intact all notices of the absence of any warranty; and give +all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may +offer support or warranty protection for a fee. + +### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it +from the Program, in the form of source code under the terms of section 4, +provided that you also meet all of these conditions: + + - a) The work must carry prominent notices stating that you modified it, and + giving a relevant date. + - b) The work must carry prominent notices stating that it is released under + this License and any conditions added under section 7. This requirement + modifies the requirement in section 4 to *keep intact all notices*. + - c) You must license the entire work, as a whole, under this License to + anyone who comes into possession of a copy. This License will therefore + apply, along with any applicable section 7 additional terms, to the whole + of the work, and all its parts, regardless of how they are packaged. This + License gives no permission to license the work in any other way, but it + does not invalidate such permission if you have separately received it. + - d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your work need + not make them do so. + +A compilation of a covered work with other separate and independent works, +which are not by their nature extensions of the covered work, and which are not +combined with it such as to form a larger program, in or on a volume of a +storage or distribution medium, is called an *aggregate* if the compilation and +its resulting copyright are not used to limit the access or legal rights of the +compilation's users beyond what the individual works permit. Inclusion of a +covered work in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 +and 5, provided that you also convey the machine-readable Corresponding Source +under the terms of this License, in one of these ways: + + - a) Convey the object code in, or embodied in, a physical product (including + a physical distribution medium), accompanied by the Corresponding Source + fixed on a durable physical medium customarily used for software + interchange. + - b) Convey the object code in, or embodied in, a physical product (including + a physical distribution medium), accompanied by a written offer, valid for + at least three years and valid for as long as you offer spare parts or + customer support for that product model, to give anyone who possesses the + object code either + 1. a copy of the Corresponding Source for all the software in the product + that is covered by this License, on a durable physical medium + customarily used for software interchange, for a price no more than your + reasonable cost of physically performing this conveying of source, or + 2. access to copy the Corresponding Source from a network server at no + charge. + - c) Convey individual copies of the object code with a copy of the written + offer to provide the Corresponding Source. This alternative is allowed only + occasionally and noncommercially, and only if you received the object code + with such an offer, in accord with subsection 6b. + - d) Convey the object code by offering access from a designated place + (gratis or for a charge), and offer equivalent access to the Corresponding + Source in the same way through the same place at no further charge. You + need not require recipients to copy the Corresponding Source along with the + object code. If the place to copy the object code is a network server, the + Corresponding Source may be on a different server operated by you or a + third party) that supports equivalent copying facilities, provided you + maintain clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the Corresponding + Source, you remain obligated to ensure that it is available for as long as + needed to satisfy these requirements. + - e) Convey the object code using peer-to-peer transmission, provided you + inform other peers where the object code and Corresponding Source of the + work are being offered to the general public at no charge under subsection + 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A *User Product* is either + + 1. a *consumer product*, which means any tangible personal property which is + normally used for personal, family, or household purposes, or + 2. anything designed or sold for incorporation into a dwelling. + +In determining whether a product is a consumer product, doubtful cases shall be +resolved in favor of coverage. For a particular product received by a +particular user, *normally used* refers to a typical or common use of that +class of product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected to use, +the product. A product is a consumer product regardless of whether the product +has substantial commercial, industrial or non-consumer uses, unless such uses +represent the only significant mode of use of the product. + +*Installation Information* for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified +version of its Corresponding Source. The information must suffice to ensure +that the continued functioning of the modified object code is in no case +prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as part of a +transaction in which the right of possession and use of the User Product is +transferred to the recipient in perpetuity or for a fixed term (regardless of +how the transaction is characterized), the Corresponding Source conveyed under +this section must be accompanied by the Installation Information. But this +requirement does not apply if neither you nor any third party retains the +ability to install modified object code on the User Product (for example, the +work has been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord +with this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require +no special password or key for unpacking, reading or copying. + +### 7. Additional Terms. + +*Additional permissions* are terms that supplement the terms of this License by +making exceptions from one or more of its conditions. Additional permissions +that are applicable to the entire Program shall be treated as though they were +included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may +be used separately under those permissions, but the entire Program remains +governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when +you modify the work.) You may place additional permissions on material, added +by you to a covered work, for which you have or can give appropriate copyright +permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + + - a) Disclaiming warranty or limiting liability differently from the terms of + sections 15 and 16 of this License; or + - b) Requiring preservation of specified reasonable legal notices or author + attributions in that material or in the Appropriate Legal Notices displayed + by works containing it; or + - c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in reasonable + ways as different from the original version; or + - d) Limiting the use for publicity purposes of names of licensors or authors + of the material; or + - e) Declining to grant rights under trademark law for use of some trade + names, trademarks, or service marks; or + - f) Requiring indemnification of licensors and authors of that material by + anyone who conveys the material (or modified versions of it) with + contractual assumptions of liability to the recipient, for any liability + that these contractual assumptions directly impose on those licensors and + authors. + +All other non-permissive additional terms are considered *further restrictions* +within the meaning of section 10. If the Program as you received it, or any +part of it, contains a notice stating that it is governed by this License along +with a term that is a further restriction, you may remove that term. If a +license document contains a further restriction but permits relicensing or +conveying under this License, you may add to a covered work material governed +by the terms of that license document, provided that the further restriction +does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, +in the relevant source files, a statement of the additional terms that apply to +those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements +apply either way. + +### 8. Termination. + +You may not propagate or modify a covered work except as expressly provided +under this License. Any attempt otherwise to propagate or modify it is void, +and will automatically terminate your rights under this License (including any +patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated + + - a) provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and + - b) permanently, if the copyright holder fails to notify you of the + violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation +of this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses +of parties who have received copies or rights from you under this License. If +your rights have been terminated and not permanently reinstated, you do not +qualify to receive new licenses for the same material under section 10. + +### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy +of the Program. Ancillary propagation of a covered work occurring solely as a +consequence of using peer-to-peer transmission to receive a copy likewise does +not require acceptance. However, nothing other than this License grants you +permission to propagate or modify any covered work. These actions infringe +copyright if you do not accept this License. Therefore, by modifying or +propagating a covered work, you indicate your acceptance of this License to do +so. + +### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a +license from the original licensors, to run, modify and propagate that work, +subject to this License. You are not responsible for enforcing compliance by +third parties with this License. + +An *entity transaction* is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered work +results from an entity transaction, each party to that transaction who receives +a copy of the work also receives whatever licenses to the work the party's +predecessor in interest had or could give under the previous paragraph, plus a +right to possession of the Corresponding Source of the work from the +predecessor in interest, if the predecessor has it or can get it with +reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights +granted or affirmed under this License. For example, you may not impose a +license fee, royalty, or other charge for exercise of rights granted under this +License, and you may not initiate litigation (including a cross-claim or +counterclaim in a lawsuit) alleging that any patent claim is infringed by +making, using, selling, offering for sale, or importing the Program or any +portion of it. + +### 11. Patents. + +A *contributor* is a copyright holder who authorizes use under this License of +the Program or a work on which the Program is based. The work thus licensed is +called the contributor's *contributor version*. + +A contributor's *essential patent claims* are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that would +be infringed only as a consequence of further modification of the contributor +version. For purposes of this definition, *control* includes the right to grant +patent sublicenses in a manner consistent with the requirements of this +License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor's essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. + +In the following three paragraphs, a *patent license* is any express agreement +or commitment, however denominated, not to enforce a patent (such as an express +permission to practice a patent or covenant not to sue for patent +infringement). To *grant* such a patent license to a party means to make such +an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available +network server or other readily accessible means, then you must either + + 1. cause the Corresponding Source to be so available, or + 2. arrange to deprive yourself of the benefit of the patent license for this + particular work, or + 3. arrange, in a manner consistent with the requirements of this License, to + extend the patent license to downstream recipients. + +*Knowingly relying* means you have actual knowledge that, but for the patent +license, your conveying the covered work in a country, or your recipient's use +of the covered work in a country, would infringe one or more identifiable +patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing +them to use, propagate, modify or convey a specific copy of the covered work, +then the patent license you grant is automatically extended to all recipients +of the covered work and works based on it. + +A patent license is *discriminatory* if it does not include within the scope of +its coverage, prohibits the exercise of, or is conditioned on the non-exercise +of one or more of the rights that are specifically granted under this License. +You may not convey a covered work if you are a party to an arrangement with a +third party that is in the business of distributing software, under which you +make payment to the third party based on the extent of your activity of +conveying the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory patent +license + + - a) in connection with copies of the covered work conveyed by you (or copies + made from those copies), or + - b) primarily for and in connection with specific products or compilations + that contain the covered work, unless you entered into that arrangement, or + that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to +you under applicable patent law. + +### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not excuse +you from the conditions of this License. If you cannot convey a covered work so +as to satisfy simultaneously your obligations under this License and any other +pertinent obligations, then as a consequence you may not convey it at all. For +example, if you agree to terms that obligate you to collect a royalty for +further conveying from those to whom you convey the Program, the only way you +could satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to +link or combine any covered work with a work licensed under version 3 of the +GNU Affero General Public License into a single combined work, and to convey +the resulting work. The terms of this License will continue to apply to the +part which is the covered work, but the special requirements of the GNU Affero +General Public License, section 13, concerning interaction through a network +will apply to the combination as such. + +### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies +that a certain numbered version of the GNU General Public License *or any later +version* applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by +the Free Software Foundation. If the Program does not specify a version number +of the GNU General Public License, you may choose any version ever published by +the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the +GNU General Public License can be used, that proxy's public statement of +acceptance of a version permanently authorizes you to choose that version for +the Program. + +Later license versions may give you additional or different permissions. +However, no additional obligations are imposed on any author or copyright +holder as a result of your choosing to follow a later version. + +### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE +LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE +PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot +be given local legal effect according to their terms, reviewing courts shall +apply local law that most closely approximates an absolute waiver of all civil +liability in connection with the Program, unless a warranty or assumption of +liability accompanies a copy of the Program in return for a fee. + +## END OF TERMS AND CONDITIONS ### + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion +of warranty; and each file should have at least the *copyright* line and a +pointer to where the full notice is found. + + KeePass DX, Android KeePass Manager + Copyright (C) 2018 Jeremy JAMET / Kunzisoft + + This program 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. + + This program 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 this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like +this when it starts in an interactive mode: + + KeePass DX Copyright (C) 2018 Jeremy JAMET / Kunzisoft + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w` and `show c` should show the appropriate +parts of the General Public License. Of course, your program's commands might +be different; for a GUI interface, you would use an *about box*. + +You should also get your employer (if you work as a programmer) or school, if +any, to sign a *copyright disclaimer* for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Lesser General Public License instead +of this License. But first, please read +[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). \ No newline at end of file diff --git a/local/KeePass_feature.png b/local/KeePass_feature.png deleted file mode 100644 index f9498e7cf..000000000 Binary files a/local/KeePass_feature.png and /dev/null differ diff --git a/local/KeePass_promo.png b/local/KeePass_promo.png deleted file mode 100644 index 608a33c6f..000000000 Binary files a/local/KeePass_promo.png and /dev/null differ diff --git a/local/amazon-scale.png b/local/amazon-scale.png deleted file mode 100644 index 86b00fbc4..000000000 Binary files a/local/amazon-scale.png and /dev/null differ diff --git a/local/favicon.ico b/local/favicon.ico deleted file mode 100644 index 7f940136e..000000000 Binary files a/local/favicon.ico and /dev/null differ diff --git a/local/hdpi.psd b/local/hdpi.psd deleted file mode 100644 index a581a3705..000000000 Binary files a/local/hdpi.psd and /dev/null differ diff --git a/local/high-res-icon.png b/local/high-res-icon.png deleted file mode 100644 index 7f1fe996b..000000000 Binary files a/local/high-res-icon.png and /dev/null differ diff --git a/local/high-res-icon.xcf b/local/high-res-icon.xcf deleted file mode 100644 index 554a082a6..000000000 Binary files a/local/high-res-icon.xcf and /dev/null differ diff --git a/local/ldpi.psd b/local/ldpi.psd deleted file mode 100644 index 77af57788..000000000 Binary files a/local/ldpi.psd and /dev/null differ diff --git a/local/mdpi.psd b/local/mdpi.psd deleted file mode 100644 index 5545ad30d..000000000 Binary files a/local/mdpi.psd and /dev/null differ