├── .gitignore
├── LICENSE-GPL
├── LICENSE-MIT
├── README.md
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .classpath
├── .project
├── AndroidManifest.xml
├── build.gradle
├── gradle.properties-example
├── lint.xml
├── project.properties
├── res
│ ├── anim
│ │ ├── cycle_5.xml
│ │ ├── do_nothing.xml
│ │ ├── shake.xml
│ │ └── slide_up.xml
│ ├── drawable-hdpi
│ │ ├── ic_backspace_white_24dp.png
│ │ └── ic_fingerprint_white_24dp.png
│ ├── drawable-mdpi
│ │ ├── ic_backspace_white_24dp.png
│ │ └── ic_fingerprint_white_24dp.png
│ ├── drawable-xhdpi
│ │ ├── ic_backspace_white_24dp.png
│ │ └── ic_fingerprint_white_24dp.png
│ ├── drawable-xxhdpi
│ │ ├── ic_backspace_white_24dp.png
│ │ └── ic_fingerprint_white_24dp.png
│ ├── drawable-xxxhdpi
│ │ ├── ic_backspace_white_24dp.png
│ │ └── ic_fingerprint_white_24dp.png
│ ├── layout-sw600dp
│ │ └── app_passcode_keyboard.xml
│ ├── layout
│ │ └── app_passcode_keyboard.xml
│ ├── values-sw600dp
│ │ └── bools.xml
│ ├── values-xlarge
│ │ └── bools.xml
│ ├── values
│ │ ├── bools.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── xml
│ │ └── passcode_preferences.xml
└── src
│ └── org
│ └── wordpress
│ └── passcodelock
│ ├── AbstractAppLock.java
│ ├── AbstractPasscodeKeyboardActivity.java
│ ├── AppLockManager.java
│ ├── DefaultAppLock.java
│ ├── PasscodeManagePasswordActivity.java
│ ├── PasscodePreferenceFragment.java
│ ├── PasscodePreferenceFragmentCompat.java
│ ├── PasscodeUnlockActivity.java
│ └── StringUtils.java
├── sample
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── org
│ │ └── wordpress
│ │ └── passcodelock
│ │ └── sample
│ │ ├── SampleActivity.java
│ │ ├── SampleApplication.java
│ │ ├── SamplePreferenceActivity.java
│ │ └── SamplePreferenceFragment.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_settings_white_24dp.png
│ ├── drawable-mdpi
│ └── ic_settings_white_24dp.png
│ ├── drawable-nodpi
│ └── img_default.png
│ ├── drawable-v21
│ ├── ic_settings_white_24dp.xml
│ └── img_default.xml
│ ├── drawable-xhdpi
│ └── ic_settings_white_24dp.png
│ ├── drawable-xxhdpi
│ └── ic_settings_white_24dp.png
│ ├── drawable-xxxhdpi
│ └── ic_settings_white_24dp.png
│ ├── drawable
│ └── img_empty.xml
│ ├── layout
│ └── sample_activity.xml
│ ├── menu
│ └── sample.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── preferences.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin
2 | /gen
3 | /library/bin
4 | /library/gen
5 | /library/.project
6 | /library/.classpath
7 | local.properties
8 | .DS_Store
9 |
10 | # generated files
11 | bin/
12 | gen/
13 | build/
14 |
15 | # Intellij project files
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 | .gradle/
21 |
22 | library/gradle.properties
23 |
--------------------------------------------------------------------------------
/LICENSE-GPL:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 | 675 Mass Ave, Cambridge, MA 02139, USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Library General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 | Thus, it is not the intent of this section to claim rights or contest
124 | your rights to work written entirely by you; rather, the intent is to
125 | exercise the right to control the distribution of derivative or
126 | collective works based on the Program.
127 |
128 | In addition, mere aggregation of another work not based on the Program
129 | with the Program (or with a work based on the Program) on a volume of
130 | a storage or distribution medium does not bring the other work under
131 | the scope of this License.
132 |
133 | 3. You may copy and distribute the Program (or a work based on it,
134 | under Section 2) in object code or executable form under the terms of
135 | Sections 1 and 2 above provided that you also do one of the following:
136 |
137 | a) Accompany it with the complete corresponding machine-readable
138 | source code, which must be distributed under the terms of Sections
139 | 1 and 2 above on a medium customarily used for software interchange; or,
140 |
141 | b) Accompany it with a written offer, valid for at least three
142 | years, to give any third party, for a charge no more than your
143 | cost of physically performing source distribution, a complete
144 | machine-readable copy of the corresponding source code, to be
145 | distributed under the terms of Sections 1 and 2 above on a medium
146 | customarily used for software interchange; or,
147 |
148 | c) Accompany it with the information you received as to the offer
149 | to distribute corresponding source code. (This alternative is
150 | allowed only for noncommercial distribution and only if you
151 | received the program in object code or executable form with such
152 | an offer, in accord with Subsection b above.)
153 |
154 | The source code for a work means the preferred form of the work for
155 | making modifications to it. For an executable work, complete source
156 | code means all the source code for all modules it contains, plus any
157 | associated interface definition files, plus the scripts used to
158 | control compilation and installation of the executable. However, as a
159 | special exception, the source code distributed need not include
160 | anything that is normally distributed (in either source or binary
161 | form) with the major components (compiler, kernel, and so on) of the
162 | operating system on which the executable runs, unless that component
163 | itself accompanies the executable.
164 |
165 | If distribution of executable or object code is made by offering
166 | access to copy from a designated place, then offering equivalent
167 | access to copy the source code from the same place counts as
168 | distribution of the source code, even though third parties are not
169 | compelled to copy the source along with the object code.
170 |
171 | 4. You may not copy, modify, sublicense, or distribute the Program
172 | except as expressly provided under this License. Any attempt
173 | otherwise to copy, modify, sublicense or distribute the Program is
174 | void, and will automatically terminate your rights under this License.
175 | However, parties who have received copies, or rights, from you under
176 | this License will not have their licenses terminated so long as such
177 | parties remain in full compliance.
178 |
179 | 5. You are not required to accept this License, since you have not
180 | signed it. However, nothing else grants you permission to modify or
181 | distribute the Program or its derivative works. These actions are
182 | prohibited by law if you do not accept this License. Therefore, by
183 | modifying or distributing the Program (or any work based on the
184 | Program), you indicate your acceptance of this License to do so, and
185 | all its terms and conditions for copying, distributing or modifying
186 | the Program or works based on it.
187 |
188 | 6. Each time you redistribute the Program (or any work based on the
189 | Program), the recipient automatically receives a license from the
190 | original licensor to copy, distribute or modify the Program subject to
191 | these terms and conditions. You may not impose any further
192 | restrictions on the recipients' exercise of the rights granted herein.
193 | You are not responsible for enforcing compliance by third parties to
194 | this License.
195 |
196 | 7. If, as a consequence of a court judgment or allegation of patent
197 | infringement or for any other reason (not limited to patent issues),
198 | conditions are imposed on you (whether by court order, agreement or
199 | otherwise) that contradict the conditions of this License, they do not
200 | excuse you from the conditions of this License. If you cannot
201 | distribute so as to satisfy simultaneously your obligations under this
202 | License and any other pertinent obligations, then as a consequence you
203 | may not distribute the Program at all. For example, if a patent
204 | license would not permit royalty-free redistribution of the Program by
205 | all those who receive copies directly or indirectly through you, then
206 | the only way you could satisfy both it and this License would be to
207 | refrain entirely from distribution of the Program.
208 |
209 | If any portion of this section is held invalid or unenforceable under
210 | any particular circumstance, the balance of the section is intended to
211 | apply and the section as a whole is intended to apply in other
212 | circumstances.
213 |
214 | It is not the purpose of this section to induce you to infringe any
215 | patents or other property right claims or to contest validity of any
216 | such claims; this section has the sole purpose of protecting the
217 | integrity of the free software distribution system, which is
218 | implemented by public license practices. Many people have made
219 | generous contributions to the wide range of software distributed
220 | through that system in reliance on consistent application of that
221 | system; it is up to the author/donor to decide if he or she is willing
222 | to distribute software through any other system and a licensee cannot
223 | impose that choice.
224 |
225 | This section is intended to make thoroughly clear what is believed to
226 | be a consequence of the rest of this License.
227 |
228 | 8. If the distribution and/or use of the Program is restricted in
229 | certain countries either by patents or by copyrighted interfaces, the
230 | original copyright holder who places the Program under this License
231 | may add an explicit geographical distribution limitation excluding
232 | those countries, so that distribution is permitted only in or among
233 | countries not thus excluded. In such case, this License incorporates
234 | the limitation as if written in the body of this License.
235 |
236 | 9. The Free Software Foundation may publish revised and/or new versions
237 | of the General Public License from time to time. Such new versions will
238 | be similar in spirit to the present version, but may differ in detail to
239 | address new problems or concerns.
240 |
241 | Each version is given a distinguishing version number. If the Program
242 | specifies a version number of this License which applies to it and "any
243 | later version", you have the option of following the terms and conditions
244 | either of that version or of any later version published by the Free
245 | Software Foundation. If the Program does not specify a version number of
246 | this License, you may choose any version ever published by the Free Software
247 | Foundation.
248 |
249 | 10. If you wish to incorporate parts of the Program into other free
250 | programs whose distribution conditions are different, write to the author
251 | to ask for permission. For software which is copyrighted by the Free
252 | Software Foundation, write to the Free Software Foundation; we sometimes
253 | make exceptions for this. Our decision will be guided by the two goals
254 | of preserving the free status of all derivatives of our free software and
255 | of promoting the sharing and reuse of software generally.
256 |
257 | NO WARRANTY
258 |
259 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
260 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
261 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
262 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
263 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
264 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
265 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
266 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
267 | REPAIR OR CORRECTION.
268 |
269 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
270 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
271 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
272 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
273 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
274 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
275 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
276 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
277 | POSSIBILITY OF SUCH DAMAGES.
278 |
279 | END OF TERMS AND CONDITIONS
280 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Automattic Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | * * *
2 |
3 | **Not Maintained!**
4 | *This project is no longer being actively maintained. Use at your own risk!*
5 |
6 | * * *
7 |
8 | # App passcode library for Android
9 |
10 | An app passcode protection implementation, which allows user to protect the app with a four digit code.
11 |
12 | Once enabled a four-digit passcode needs to be entered any time your mobile app is launched. This way your app is safe even if your smartphone or tablet falls into the wrong hands.
13 |
14 | **Note: This library doesn't add any extra protection to your data. App data will not be encrypted, the library just adds a pin lock screen that makes the app safe even if your kids put their hands on the device :)**
15 |
16 | ## Example Usage
17 |
18 | Add it as a maven dependency in your build.gradle file. PasscodeLock is hosted on the maven central repository.
19 |
20 | * In your build.gradle:
21 | ```groovy
22 | dependencies {
23 | // use the latest 1.x version
24 | compile 'org.wordpress:passcodelock:1.+'
25 | }
26 | ```
27 | * Edit your `AndroidManifest.xml` and declare the following activities:
28 | ```xml
29 |
33 |
34 |
38 |
39 | ```
40 |
41 | * Add the following line in `onCreate` of your App file:
42 | ```java
43 | AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
44 | ```
45 |
46 | * In your project you need to use `PasscodePreferenceFragment` in your Preference Activity. See [SettingsActivity][2] as a usage reference. Optionally, you may pass an argument that tells it whether or not to inflate its own preferences, this is only needed if you plan on [providing the preferences](https://github.com/wordpress-mobile/WordPress-Android/blob/develop/WordPress/src/main/res/xml/settings.xml#L39) via [PasscodePreferenceFragment#setPreferences](https://github.com/wordpress-mobile/PasscodeLock-Android/blob/develop/library/src/org/wordpress/passcodelock/PasscodePreferenceFragment.java#L50).
47 |
48 | ## Customization
49 |
50 | If you want to customize the pinlock icon, the one available in the unlock screen, override the `passcode_logo.xml` drawable resource.
51 |
52 | ## Hack the library
53 |
54 | * Copy `gradle.properties-example` to `gradle.properties` in the `library/` directory of the project.
55 |
56 | Publish it to bintray:
57 |
58 | ```shell
59 | $ ./gradlew assemble publishToMavenLocal bintrayUpload -PbintrayUser=FIXME -PbintrayKey=FIXME -PdryRun=false
60 | ```
61 |
62 | ## Apps that use this library
63 | - [WordPress for Android][1]
64 |
65 | ## License
66 | Dual licensed under MIT, and GPL.
67 |
68 | [1]: https://github.com/wordpress-mobile/WordPress-Android
69 |
70 | [2]: https://github.com/wordpress-mobile/WordPress-Android/blob/develop/WordPress/src/main/java/org/wordpress/android/ui/prefs/SettingsActivity.java
71 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | repositories {
2 | google()
3 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 22 9:08:50 MDT 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/library/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/library/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | library
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/library/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
9 |
10 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | dependencies {
3 | classpath 'com.android.tools.build:gradle:3.4.2'
4 | classpath 'com.novoda:bintray-release:0.9.1'
5 | }
6 |
7 | repositories {
8 | google()
9 | jcenter()
10 | maven { url 'https://maven.google.com' }
11 | }
12 | }
13 |
14 | apply plugin: 'com.android.library'
15 | apply plugin: 'maven'
16 | apply plugin: 'com.novoda.bintray-release'
17 |
18 | repositories {
19 | google()
20 | jcenter()
21 | maven { url 'https://maven.google.com' }
22 | }
23 |
24 | dependencies {
25 | implementation 'androidx.appcompat:appcompat:1.0.2'
26 | implementation 'androidx.preference:preference:1.0.0'
27 | }
28 |
29 | android {
30 | publishNonDefault true
31 | compileSdkVersion 28
32 | buildToolsVersion "28.0.3"
33 |
34 | defaultConfig {
35 | minSdkVersion 14
36 | targetSdkVersion 28
37 | versionCode 4
38 | versionName "2.0.2"
39 | }
40 |
41 | sourceSets {
42 | main {
43 | manifest.srcFile 'AndroidManifest.xml'
44 | java.srcDirs = ['src']
45 | resources.srcDirs = ['src']
46 | aidl.srcDirs = ['src']
47 | renderscript.srcDirs = ['src']
48 | res.srcDirs = ['res']
49 | assets.srcDirs = ['assets']
50 | }
51 | }
52 | }
53 |
54 | android.buildTypes.all { buildType ->
55 | project.properties.any { property ->
56 | if (property.key.toLowerCase().startsWith("passcodelock.")) {
57 | buildType.buildConfigField "String", property.key.replace("passcodelock.", "").replace(".", "_").toUpperCase(), "\"${property.value}\""
58 | }
59 | }
60 | }
61 |
62 | publish {
63 | userOrg = 'wordpress-mobile'
64 | groupId = 'org.wordpress'
65 | uploadName = 'passcodelock'
66 | artifactId = 'passcodelock'
67 | desc = 'Android library that provides passcode lock to your app'
68 | publishVersion = android.defaultConfig.versionName
69 | licences = ['MIT', 'GPL-2.0']
70 | website = 'https://github.com/wordpress-mobile/PasscodeLock-Android'
71 | dryRun = 'false'
72 | autoPublish = 'true'
73 | }
74 |
--------------------------------------------------------------------------------
/library/gradle.properties-example:
--------------------------------------------------------------------------------
1 | android.enableJetifier=true
2 | android.useAndroidX=true
3 |
4 | passcodelock.password_preference_key=passcode_lock_prefs_password_key
5 | passcodelock.password_enc_secret=5-maggio-2002-Karel-Poborsky
6 | passcodelock.fingerprint_enabled_key=passcode_lock_prefs_fingerprint_enabled_key
7 |
8 | ossrhUsername=hello
9 | ossrhPassword=world
10 |
11 | signing.keyId=byebye
12 | signing.password=secret
13 | signing.secretKeyRingFile=/home/user/secret.gpg
14 |
--------------------------------------------------------------------------------
/library/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/library/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/library/res/anim/cycle_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
18 |
--------------------------------------------------------------------------------
/library/res/anim/do_nothing.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/library/res/anim/shake.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
--------------------------------------------------------------------------------
/library/res/anim/slide_up.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
--------------------------------------------------------------------------------
/library/res/drawable-hdpi/ic_backspace_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-hdpi/ic_backspace_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-hdpi/ic_fingerprint_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-hdpi/ic_fingerprint_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-mdpi/ic_backspace_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-mdpi/ic_backspace_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-mdpi/ic_fingerprint_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-mdpi/ic_fingerprint_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xhdpi/ic_backspace_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xhdpi/ic_backspace_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xhdpi/ic_fingerprint_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xhdpi/ic_fingerprint_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xxhdpi/ic_backspace_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xxhdpi/ic_backspace_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xxhdpi/ic_fingerprint_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xxhdpi/ic_fingerprint_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xxxhdpi/ic_backspace_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xxxhdpi/ic_backspace_white_24dp.png
--------------------------------------------------------------------------------
/library/res/drawable-xxxhdpi/ic_fingerprint_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/library/res/drawable-xxxhdpi/ic_fingerprint_white_24dp.png
--------------------------------------------------------------------------------
/library/res/layout-sw600dp/app_passcode_keyboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
21 |
22 |
23 |
34 |
35 |
50 |
51 |
52 |
60 |
61 |
62 |
70 |
71 |
72 |
73 |
78 |
79 |
84 |
85 |
90 |
91 |
92 |
93 |
94 |
95 |
100 |
101 |
106 |
107 |
112 |
113 |
114 |
115 |
116 |
117 |
122 |
123 |
128 |
129 |
134 |
135 |
136 |
137 |
138 |
139 |
148 |
149 |
150 |
155 |
156 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
--------------------------------------------------------------------------------
/library/res/layout/app_passcode_keyboard.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
26 |
27 |
28 |
35 |
36 |
50 |
51 |
52 |
59 |
60 |
61 |
68 |
69 |
70 |
71 |
76 |
77 |
82 |
83 |
88 |
89 |
90 |
91 |
92 |
93 |
98 |
99 |
104 |
105 |
110 |
111 |
112 |
113 |
114 |
115 |
120 |
121 |
126 |
127 |
132 |
133 |
134 |
135 |
136 |
137 |
148 |
149 |
150 |
155 |
156 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
--------------------------------------------------------------------------------
/library/res/values-sw600dp/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/res/values-xlarge/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/res/values/bools.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | #ff444444
6 | #ff5f5f5f
7 | #ffcccccc
8 | #ffe5e5e5
9 |
10 | @color/gray_e5
11 | @android:color/black
12 | @android:color/black
13 | @color/gray_c
14 | @android:color/white
15 | @color/gray_5f
16 | @color/gray_4
17 | @android:color/black
18 |
19 |
20 |
--------------------------------------------------------------------------------
/library/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 24sp
6 | 1dp
7 | 18dp
8 |
9 |
10 |
--------------------------------------------------------------------------------
/library/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PIN
6 | Manage passcode
7 | Enter your old passcode
8 | Re-enter your passcode
9 | Change passcode
10 | Passcode set
11 | Wrong passcode, please try again.
12 | Passcode lock
13 | Turn passcode off
14 | Turn passcode on
15 |
16 | Enter your passcode
17 |
18 | 0
19 | 1
20 | 2
21 | 3
22 | 4
23 | 5
24 | 6
25 | 7
26 | 8
27 | 9
28 |
29 |
30 | turn_passcode_on_off
31 | change_passcode
32 |
33 | Delete
34 | Fingerprint authentication supported
35 |
36 |
37 |
--------------------------------------------------------------------------------
/library/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
26 |
27 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/library/res/xml/passcode_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/AbstractAppLock.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Application;
5 | import android.os.Build;
6 |
7 | /**
8 | * Interface for AppLock implementations.
9 | *
10 | * There are situations where the AppLock should not be required within an app. Methods for tracking
11 | * exempt {@link android.app.Activity}'s are provided and sub-class implementations are expected to
12 | * comply with requested exemptions.
13 | * @see #isExemptActivity(String)
14 | * @see #setExemptActivities(String[])
15 | * @see #getExemptActivities()
16 | *
17 | * Applications can request a one-time delay in locking the app. This can be useful for activities
18 | * that launch external applications with the expectation that the user will return to the calling
19 | * application shortly.
20 | */
21 | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
22 | public abstract class AbstractAppLock implements Application.ActivityLifecycleCallbacks {
23 | public static final String FINGERPRINT_VERIFICATION_BYPASS = "fingerprint-bypass__";
24 | public static final int DEFAULT_TIMEOUT_S = 2;
25 | public static final int EXTENDED_TIMEOUT_S = 60;
26 |
27 | private int mLockTimeout = DEFAULT_TIMEOUT_S;
28 | private String[] mExemptActivities;
29 |
30 | public boolean isExemptActivity(String name) {
31 | if (name == null) return false;
32 | for (String activityName : getExemptActivities()) {
33 | if (name.equals(activityName)) return true;
34 | }
35 | return false;
36 | }
37 |
38 | public void setExemptActivities(String[] exemptActivities) {
39 | mExemptActivities = exemptActivities;
40 | }
41 |
42 | public String[] getExemptActivities() {
43 | if (mExemptActivities == null) setExemptActivities(new String[0]);
44 | return mExemptActivities;
45 | }
46 |
47 | public void setOneTimeTimeout(int timeout) {
48 | mLockTimeout = timeout;
49 | }
50 |
51 | public int getTimeout() {
52 | return mLockTimeout;
53 | }
54 |
55 | protected boolean isFingerprintPassword(String password) {
56 | return FINGERPRINT_VERIFICATION_BYPASS.equals(password);
57 | }
58 |
59 | /**
60 | * Whether the fingerprint unlocking should be available as option in the unlock screen.
61 | * Default is true, but implementation can override this and make their choice.
62 | *
63 | * Note that this doesn't affect system setting, the device must already have fingerprint unlock
64 | * available and correctly working.
65 | *
66 | * @return true if fingerprint unlock should be enabled on the lock screen
67 | */
68 | public boolean isFingerprintEnabled() {
69 | return true;
70 | }
71 |
72 | // Stub methods to avoid sub-classes to override to many unused methods.
73 | public boolean enableFingerprint() {
74 | return true;
75 | }
76 | public boolean disableFingerprint() {
77 | return false;
78 | }
79 |
80 | public abstract void enable();
81 | public abstract void disable();
82 | public abstract void forcePasswordLock();
83 | public abstract boolean verifyPassword(String password);
84 | public abstract boolean isPasswordLocked();
85 | public abstract boolean setPassword(String password);
86 | }
87 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/AbstractPasscodeKeyboardActivity.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.app.Activity;
4 | import android.content.pm.ActivityInfo;
5 | import android.os.Bundle;
6 | import android.text.InputFilter;
7 | import android.text.Spanned;
8 | import android.view.HapticFeedbackConstants;
9 | import android.view.View;
10 | import android.view.View.OnClickListener;
11 | import android.view.animation.Animation;
12 | import android.view.animation.AnimationUtils;
13 | import android.widget.EditText;
14 | import android.widget.TextView;
15 | import android.widget.Toast;
16 |
17 | import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
18 | import androidx.core.os.CancellationSignal;
19 |
20 | public abstract class AbstractPasscodeKeyboardActivity extends Activity {
21 | public static final String KEY_MESSAGE = "message";
22 |
23 | protected EditText mPinCodeField;
24 | protected InputFilter[] filters = null;
25 | protected TextView topMessage = null;
26 |
27 | protected FingerprintManagerCompat mFingerprintManager;
28 | protected CancellationSignal mCancel;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 |
34 | if (!getResources().getBoolean(R.bool.allow_rotation)) {
35 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
36 | }
37 |
38 | setContentView(R.layout.app_passcode_keyboard);
39 |
40 | topMessage = (TextView) findViewById(R.id.passcodelock_prompt);
41 |
42 | Bundle extras = getIntent().getExtras();
43 | if (extras != null) {
44 | String message = extras.getString(KEY_MESSAGE);
45 | if (message != null) {
46 | topMessage.setText(message);
47 | }
48 | }
49 |
50 | filters = new InputFilter[2];
51 | filters[0]= new InputFilter.LengthFilter(1);
52 | filters[1] = onlyNumber;
53 |
54 | mPinCodeField = (EditText)findViewById(R.id.pin_field);
55 |
56 | //setup the keyboard
57 | findViewById(R.id.button0).setOnClickListener(defaultButtonListener);
58 | findViewById(R.id.button1).setOnClickListener(defaultButtonListener);
59 | findViewById(R.id.button2).setOnClickListener(defaultButtonListener);
60 | findViewById(R.id.button3).setOnClickListener(defaultButtonListener);
61 | findViewById(R.id.button4).setOnClickListener(defaultButtonListener);
62 | findViewById(R.id.button5).setOnClickListener(defaultButtonListener);
63 | findViewById(R.id.button6).setOnClickListener(defaultButtonListener);
64 | findViewById(R.id.button7).setOnClickListener(defaultButtonListener);
65 | findViewById(R.id.button8).setOnClickListener(defaultButtonListener);
66 | findViewById(R.id.button9).setOnClickListener(defaultButtonListener);
67 | findViewById(R.id.button_erase).setOnClickListener(
68 | new OnClickListener() {
69 | @Override
70 | public void onClick(View arg0) {
71 | if (arg0.isHapticFeedbackEnabled()) {
72 | arg0.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
73 | }
74 |
75 | String curText = mPinCodeField.getText().toString();
76 |
77 | if (curText.length() > 0) {
78 | mPinCodeField.setText(curText.substring(0, curText.length() - 1));
79 | mPinCodeField.setSelection(mPinCodeField.length());
80 | }
81 | }
82 | });
83 |
84 | mFingerprintManager = FingerprintManagerCompat.from(this);
85 | }
86 |
87 | @Override
88 | public void onPause() {
89 | super.onPause();
90 |
91 | if (mCancel != null) {
92 | mCancel.cancel();
93 | }
94 | }
95 |
96 | protected AbstractAppLock getAppLock() {
97 | return AppLockManager.getInstance().getAppLock();
98 | }
99 |
100 | private OnClickListener defaultButtonListener = new OnClickListener() {
101 | @Override
102 | public void onClick(View arg0) {
103 | int currentValue = -1;
104 | int id = arg0.getId();
105 | if (id == R.id.button0) {
106 | currentValue = 0;
107 | } else if (id == R.id.button1) {
108 | currentValue = 1;
109 | } else if (id == R.id.button2) {
110 | currentValue = 2;
111 | } else if (id == R.id.button3) {
112 | currentValue = 3;
113 | } else if (id == R.id.button4) {
114 | currentValue = 4;
115 | } else if (id == R.id.button5) {
116 | currentValue = 5;
117 | } else if (id == R.id.button6) {
118 | currentValue = 6;
119 | } else if (id == R.id.button7) {
120 | currentValue = 7;
121 | } else if (id == R.id.button8) {
122 | currentValue = 8;
123 | } else if (id == R.id.button9) {
124 | currentValue = 9;
125 | }
126 |
127 | if (arg0.isHapticFeedbackEnabled()) {
128 | arg0.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
129 | }
130 |
131 | // Add value and move focus.
132 | mPinCodeField.append(String.valueOf(currentValue));
133 | mPinCodeField.setSelection(mPinCodeField.length());
134 |
135 | if (mPinCodeField.length() >= 4) {
136 | onPinLockInserted();
137 | }
138 | }
139 | };
140 |
141 | protected void authenticationSucceeded() {
142 | setResult(RESULT_OK);
143 | finish();
144 | }
145 |
146 | protected void authenticationFailed() {
147 | Thread shake = new Thread() {
148 | public void run() {
149 | Animation shake = AnimationUtils.loadAnimation(AbstractPasscodeKeyboardActivity.this, R.anim.shake);
150 | findViewById(R.id.AppUnlockLinearLayout1).startAnimation(shake);
151 | showPasswordError();
152 | mPinCodeField.setText("");
153 | }
154 | };
155 | runOnUiThread(shake);
156 | }
157 |
158 | protected void showPasswordError(){
159 | Toast.makeText(AbstractPasscodeKeyboardActivity.this, R.string.passcode_wrong_passcode, Toast.LENGTH_SHORT).show();
160 | }
161 |
162 | protected abstract void onPinLockInserted();
163 | protected abstract FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback();
164 |
165 | private InputFilter onlyNumber = new InputFilter() {
166 | @Override
167 | public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
168 | if (source.length() > 1) {
169 | return "";
170 | }
171 |
172 | if (source.length() == 0) {
173 | return null;
174 | }
175 |
176 | try {
177 | int number = Integer.parseInt(source.toString());
178 | if (number >= 0 && number <= 9) {
179 | return String.valueOf(number);
180 | }
181 |
182 | return "";
183 | } catch (NumberFormatException e) {
184 | return "";
185 | }
186 | }
187 | };
188 | }
189 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/AppLockManager.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.app.Application;
4 |
5 | public class AppLockManager {
6 | private static AppLockManager instance;
7 | private AbstractAppLock currentAppLocker;
8 |
9 | public static AppLockManager getInstance() {
10 | if (instance == null) {
11 | instance = new AppLockManager();
12 | }
13 | return instance;
14 | }
15 |
16 | public void enableDefaultAppLockIfAvailable(Application currentApp) {
17 | if (!DefaultAppLock.isSupportedApi()) return;
18 |
19 | if (currentAppLocker != null) {
20 | if (currentAppLocker instanceof DefaultAppLock) {
21 | // A previous default applocker is already in place
22 | // No need to re-enable it
23 | return;
24 | }
25 | // A previous NON-default applockr is in place. Disable it.
26 | currentAppLocker.disable();
27 | }
28 |
29 | currentAppLocker = new DefaultAppLock(currentApp);
30 | currentAppLocker.enable();
31 | }
32 |
33 | public boolean isDefaultLock() {
34 | return getAppLock() != null && getAppLock() instanceof DefaultAppLock;
35 | }
36 |
37 | /**
38 | * @return true when an App lock is available. It could be either a the Default App lock on
39 | * Android-v14 or higher, or a non default App lock
40 | */
41 | public boolean isAppLockFeatureEnabled() {
42 | return getAppLock() != null && (!isDefaultLock() || DefaultAppLock.isSupportedApi());
43 | }
44 |
45 | public void setCurrentAppLock(AbstractAppLock newAppLocker) {
46 | if( currentAppLocker != null ) {
47 | currentAppLocker.disable(); //disable the old applocker if available
48 | }
49 | currentAppLocker = newAppLocker;
50 | }
51 |
52 | public AbstractAppLock getAppLock() {
53 | return currentAppLocker;
54 | }
55 |
56 | public void setExtendedTimeout(){
57 | if (getAppLock() == null) return;
58 | getAppLock().setOneTimeTimeout(AbstractAppLock.EXTENDED_TIMEOUT_S);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/DefaultAppLock.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import java.util.Date;
4 |
5 | import javax.crypto.Cipher;
6 | import javax.crypto.SecretKey;
7 | import javax.crypto.SecretKeyFactory;
8 | import javax.crypto.spec.DESKeySpec;
9 |
10 | import android.app.Activity;
11 | import android.app.Application;
12 | import android.content.Intent;
13 | import android.content.SharedPreferences;
14 | import android.os.Build;
15 | import android.os.Bundle;
16 | import android.preference.PreferenceManager;
17 | import android.text.TextUtils;
18 | import android.util.Base64;
19 |
20 | public class DefaultAppLock extends AbstractAppLock {
21 | public static boolean isSupportedApi() {
22 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH;
23 | }
24 |
25 | private static final String UNLOCK_CLASS_NAME = PasscodeUnlockActivity.class.getName();
26 | private static final String OLD_PASSWORD_SALT = "sadasauidhsuyeuihdahdiauhs";
27 | private static final String OLD_APP_LOCK_PASSWORD_PREF_KEY = "wp_app_lock_password_key";
28 |
29 | private Application mCurrentApp;
30 | private SharedPreferences mSharedPreferences;
31 | private Date mLostFocusDate;
32 |
33 | public DefaultAppLock(Application app) {
34 | super();
35 | mCurrentApp = app;
36 | mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mCurrentApp);
37 | }
38 |
39 | /** {@link PasscodeUnlockActivity} is always exempt. */
40 | @Override
41 | public boolean isExemptActivity(String activityName) {
42 | return UNLOCK_CLASS_NAME.equals(activityName) || super.isExemptActivity(activityName);
43 | }
44 |
45 | @Override
46 | public void onActivityPaused(Activity activity) {
47 | if (!isExemptActivity(activity.getClass().getName())) mLostFocusDate = new Date();
48 | }
49 |
50 | @Override
51 | public void onActivityResumed(Activity activity) {
52 | if (!isExemptActivity(activity.getClass().getName()) && shouldShowUnlockScreen()) {
53 | Intent i = new Intent(activity.getApplicationContext(), PasscodeUnlockActivity.class);
54 | i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
55 | activity.getApplication().startActivity(i);
56 | }
57 | }
58 |
59 | @Override public void onActivityCreated(Activity arg0, Bundle arg1) {}
60 | @Override public void onActivityDestroyed(Activity arg0) {}
61 | @Override public void onActivitySaveInstanceState(Activity arg0, Bundle arg1) {}
62 | @Override public void onActivityStarted(Activity arg0) {}
63 | @Override public void onActivityStopped(Activity arg0) {}
64 |
65 | public void enable() {
66 | if (!isPasswordLocked()) return;
67 | if (isSupportedApi()) {
68 | mCurrentApp.unregisterActivityLifecycleCallbacks(this);
69 | mCurrentApp.registerActivityLifecycleCallbacks(this);
70 | }
71 | }
72 |
73 | public void disable() {
74 | if (isSupportedApi()) {
75 | mCurrentApp.unregisterActivityLifecycleCallbacks(this);
76 | }
77 | }
78 |
79 | public boolean isPasswordLocked() {
80 | return mSharedPreferences.contains(BuildConfig.PASSWORD_PREFERENCE_KEY) ||
81 | mSharedPreferences.contains(OLD_APP_LOCK_PASSWORD_PREF_KEY);
82 | }
83 |
84 | public boolean setPassword(String password) {
85 | removePasswordFromPreferences();
86 | if (TextUtils.isEmpty(password)) {
87 | disable();
88 | } else {
89 | savePasswordToPreferences(password.hashCode());
90 | enable();
91 | }
92 | return true;
93 | }
94 |
95 | @Override
96 | public boolean isFingerprintEnabled() {
97 | return mSharedPreferences.getBoolean(BuildConfig.FINGERPRINT_ENABLED_KEY, true);
98 | }
99 |
100 | @Override
101 | public boolean enableFingerprint() {
102 | mSharedPreferences.edit().putBoolean(BuildConfig.FINGERPRINT_ENABLED_KEY, true).apply();
103 | return true;
104 | }
105 |
106 | @Override
107 | public boolean disableFingerprint() {
108 | mSharedPreferences.edit().putBoolean(BuildConfig.FINGERPRINT_ENABLED_KEY, false).apply();
109 | return true;
110 | }
111 |
112 | public void forcePasswordLock() {
113 | mLostFocusDate = null;
114 | }
115 |
116 | public boolean verifyPassword(String password) {
117 | if (TextUtils.isEmpty(password)) return false;
118 |
119 | // successful fingerprint scan bypasses PIN security
120 | if (isFingerprintPassword(password)) {
121 | mLostFocusDate = new Date();
122 | return true;
123 | }
124 |
125 | String storedPassword = "";
126 | String securePassword = null;
127 | int updatedHash = -1;
128 |
129 | if (mSharedPreferences.contains(OLD_APP_LOCK_PASSWORD_PREF_KEY)) {
130 | // backwards compatibility
131 | storedPassword = getStoredLegacyPassword(OLD_APP_LOCK_PASSWORD_PREF_KEY);
132 | securePassword = legacyPasswordHash(password);
133 | } else if (mSharedPreferences.contains(BuildConfig.PASSWORD_PREFERENCE_KEY)) {
134 | if (shouldUpdatePassword()) {
135 | storedPassword = getStoredLegacyPassword(BuildConfig.PASSWORD_PREFERENCE_KEY);
136 | storedPassword = decryptPassword(storedPassword);
137 | storedPassword = stripSalt(storedPassword);
138 | securePassword = password;
139 | updatedHash = password.hashCode();
140 | } else {
141 | int storedHash = getStoredPassword();
142 | storedPassword = String.valueOf(storedHash);
143 | securePassword = String.valueOf(password.hashCode());
144 | }
145 | }
146 |
147 | if (!storedPassword.equalsIgnoreCase(securePassword)) return false;
148 |
149 | // password security updated, replace stored password with integer hash value
150 | if (updatedHash != -1) {
151 | removePasswordFromPreferences();
152 | savePasswordToPreferences(updatedHash);
153 | }
154 | mLostFocusDate = new Date();
155 | return true;
156 | }
157 |
158 | private String stripSalt(String saltedPassword) {
159 | if (TextUtils.isEmpty(saltedPassword) || saltedPassword.length() < 4) return "";
160 | int middle = saltedPassword.length() / 2;
161 | return saltedPassword.substring(middle - 2, middle + 2);
162 | }
163 |
164 | /** Show the unlock screen if there is a saved password and the timeout period has elapsed. */
165 | private boolean shouldShowUnlockScreen() {
166 | if(!isPasswordLocked()) return false;
167 | if(mLostFocusDate == null) return true;
168 |
169 | int currentTimeOut = getTimeout();
170 | setOneTimeTimeout(DEFAULT_TIMEOUT_S);
171 |
172 | if (timeSinceLocked() < currentTimeOut) return false;
173 | mLostFocusDate = null;
174 | return true;
175 | }
176 |
177 | private int getStoredPassword() {
178 | return mSharedPreferences.getInt(BuildConfig.PASSWORD_PREFERENCE_KEY, -1);
179 | }
180 |
181 | private void savePasswordToPreferences(int password) {
182 | mSharedPreferences.edit().putInt(BuildConfig.PASSWORD_PREFERENCE_KEY, password).apply();
183 | }
184 |
185 | private void removePasswordFromPreferences() {
186 | mSharedPreferences.edit()
187 | .remove(OLD_APP_LOCK_PASSWORD_PREF_KEY)
188 | .remove(BuildConfig.PASSWORD_PREFERENCE_KEY)
189 | .apply();
190 | }
191 |
192 | private int timeSinceLocked() {
193 | return Math.abs((int) ((new Date().getTime() - mLostFocusDate.getTime()) / 1000));
194 | }
195 |
196 | //
197 | // Legacy methods for backwards compatibility of passwords stored using deprecated security
198 | //
199 |
200 | /** Update to hash-based security if password was stored using encryption-based security. */
201 | private boolean shouldUpdatePassword() {
202 | Object storedValue = mSharedPreferences.getAll().get(BuildConfig.PASSWORD_PREFERENCE_KEY);
203 | return storedValue != null && storedValue instanceof String;
204 | }
205 |
206 | private String getStoredLegacyPassword(String key) {
207 | return mSharedPreferences.getString(key, "");
208 | }
209 |
210 | private String legacyPasswordHash(String rawPassword) {
211 | return StringUtils.getMd5Hash(OLD_PASSWORD_SALT + rawPassword + OLD_PASSWORD_SALT);
212 | }
213 |
214 | private String decryptPassword(String encryptedPwd) {
215 | try {
216 | DESKeySpec keySpec = new DESKeySpec(BuildConfig.PASSWORD_ENC_SECRET.getBytes("UTF-8"));
217 | SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
218 | SecretKey key = keyFactory.generateSecret(keySpec);
219 |
220 | byte[] encryptedWithoutB64 = Base64.decode(encryptedPwd, Base64.DEFAULT);
221 | Cipher cipher = Cipher.getInstance("DES");
222 | cipher.init(Cipher.DECRYPT_MODE, key);
223 | byte[] plainTextPwdBytes = cipher.doFinal(encryptedWithoutB64);
224 | return new String(plainTextPwdBytes);
225 | } catch (Exception e) {
226 | }
227 | return encryptedPwd;
228 | }
229 | }
230 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/PasscodeManagePasswordActivity.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
8 | import androidx.core.os.CancellationSignal;
9 |
10 | public class PasscodeManagePasswordActivity extends AbstractPasscodeKeyboardActivity {
11 | public static final String KEY_TYPE = "type";
12 |
13 | private int type = -1;
14 | private String unverifiedPasscode = null;
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 |
20 | Bundle extras = getIntent().getExtras();
21 | if (extras != null) {
22 | type = extras.getInt(KEY_TYPE, -1);
23 | }
24 | }
25 |
26 | @Override
27 | public void onResume() {
28 | super.onResume();
29 |
30 | // Show fingerprint scanner if supported
31 | if (mFingerprintManager.isHardwareDetected() &&
32 | mFingerprintManager.hasEnrolledFingerprints() &&
33 | type == PasscodePreferenceFragment.DISABLE_PASSLOCK) {
34 | mFingerprintManager.authenticate(null, 0, mCancel = new CancellationSignal(), getFingerprintCallback(), null);
35 | View view = findViewById(R.id.image_fingerprint);
36 | view.setVisibility(View.VISIBLE);
37 | }
38 | }
39 |
40 | @Override
41 | protected void onPinLockInserted() {
42 | String passLock = mPinCodeField.getText().toString();
43 | mPinCodeField.setText("");
44 |
45 | switch (type) {
46 | case PasscodePreferenceFragment.DISABLE_PASSLOCK:
47 | if (AppLockManager.getInstance().getAppLock().verifyPassword(passLock)) {
48 | AppLockManager.getInstance().getAppLock().setPassword(null);
49 | authenticationSucceeded();
50 | } else {
51 | authenticationFailed();
52 | }
53 | break;
54 | case PasscodePreferenceFragment.ENABLE_PASSLOCK:
55 | if (unverifiedPasscode == null) {
56 | ((TextView) findViewById(R.id.passcodelock_prompt)).setText(R.string.passcode_re_enter_passcode);
57 | unverifiedPasscode = passLock;
58 | } else {
59 | if (passLock.equals(unverifiedPasscode)) {
60 | AppLockManager.getInstance().getAppLock().setPassword(passLock);
61 | authenticationSucceeded();
62 | } else {
63 | unverifiedPasscode = null;
64 | topMessage.setText(R.string.passcodelock_prompt_message);
65 | authenticationFailed();
66 | }
67 | }
68 | break;
69 | case PasscodePreferenceFragment.CHANGE_PASSWORD:
70 | //verify old password
71 | if (AppLockManager.getInstance().getAppLock().verifyPassword(passLock)) {
72 | topMessage.setText(R.string.passcodelock_prompt_message);
73 | type = PasscodePreferenceFragment.ENABLE_PASSLOCK;
74 | } else {
75 | authenticationFailed();
76 | }
77 | break;
78 | default:
79 | break;
80 | }
81 | }
82 |
83 | @Override
84 | protected FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback() {
85 | return new FingerprintManagerCompat.AuthenticationCallback() {
86 | @Override
87 | public void onAuthenticationError(int errMsgId, CharSequence errString) {
88 | super.onAuthenticationError(errMsgId, errString);
89 | }
90 |
91 | @Override
92 | public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
93 | super.onAuthenticationHelp(helpMsgId, helpString);
94 | }
95 |
96 | @Override
97 | public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
98 | super.onAuthenticationSucceeded(result);
99 | AppLockManager.getInstance().getAppLock().setPassword(null);
100 | authenticationSucceeded();
101 | }
102 |
103 | @Override
104 | public void onAuthenticationFailed() {
105 | super.onAuthenticationFailed();
106 | authenticationFailed();
107 | }
108 | };
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/PasscodePreferenceFragment.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.preference.Preference;
6 | import android.preference.PreferenceFragment;
7 | import android.preference.SwitchPreference;
8 |
9 | public class PasscodePreferenceFragment extends PreferenceFragment
10 | implements Preference.OnPreferenceClickListener, Preference.OnPreferenceChangeListener {
11 | public static final String KEY_SHOULD_INFLATE = "should-inflate";
12 | public static final int ENABLE_PASSLOCK = 0;
13 | public static final int DISABLE_PASSLOCK = 1;
14 | public static final int CHANGE_PASSWORD = 2;
15 |
16 | private Preference mTogglePasscodePreference;
17 | private Preference mChangePasscodePreference;
18 |
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 |
23 | Bundle args = getArguments();
24 |
25 | if (args != null && args.getBoolean(KEY_SHOULD_INFLATE, true)) {
26 | addPreferencesFromResource(R.xml.passcode_preferences);
27 | mTogglePasscodePreference = findPreference(getString(R.string.pref_key_passcode_toggle));
28 | mChangePasscodePreference = findPreference(getString(R.string.pref_key_change_passcode));
29 | }
30 |
31 | refreshPreferenceState();
32 | }
33 |
34 | @Override
35 | public boolean onPreferenceClick(Preference preference) {
36 | String preferenceKey = preference.getKey() != null ? preference.getKey() : "";
37 |
38 | if (preferenceKey.equals(getString(R.string.pref_key_change_passcode))) {
39 | return handleChangePasscodeClick();
40 | }
41 |
42 | return false;
43 | }
44 |
45 | @Override
46 | public boolean onPreferenceChange(Preference preference, Object newValue) {
47 | if (newValue == null) return false;
48 | String preferenceKey = preference.getKey() != null ? preference.getKey() : "";
49 | if (!preferenceKey.equals(getString(R.string.pref_key_passcode_toggle))) {
50 | // Make sure we're updating the correct preference item.
51 | // Actually this check is not even required, since we've one item only that has set the
52 | // OnPreferenceChangeListener.
53 | return false;
54 | }
55 |
56 | Boolean newValueBool = (Boolean) newValue;
57 | boolean oldValue = ((SwitchPreference)mTogglePasscodePreference).isChecked();
58 | if (newValueBool == oldValue) {
59 | // Already updated. Do not call the setup activity.
60 | // This method get called twice if the click is on the row (not on the toggle visual item)
61 | // on devices Pre-Lollip.
62 | return true;
63 | }
64 |
65 | handlePasscodeToggleClick();
66 |
67 | return true;
68 | }
69 |
70 | /**
71 | * When the preferences are nested in a parent apps xml layout the inflated preferences will
72 | * need to be set.
73 | */
74 | public void setPreferences(Preference togglePreference, Preference changePreference) {
75 | mTogglePasscodePreference = togglePreference;
76 | mChangePasscodePreference = changePreference;
77 |
78 | refreshPreferenceState();
79 | }
80 |
81 | /**
82 | * Called when user requests to turn the passlock on or off.
83 | *
84 | * @return
85 | * always true to indicate that the request was handled
86 | */
87 | private boolean handlePasscodeToggleClick() {
88 | int type = AppLockManager.getInstance().getAppLock().isPasswordLocked()
89 | ? DISABLE_PASSLOCK : ENABLE_PASSLOCK;
90 | Intent i = new Intent(getActivity(), PasscodeManagePasswordActivity.class);
91 | i.putExtra(PasscodeManagePasswordActivity.KEY_TYPE, type);
92 | startActivityForResult(i, type);
93 |
94 | return true;
95 | }
96 |
97 | /**
98 | * Called when user requests to change passcode.
99 | *
100 | * @return
101 | * always true to indicate that the request was handled
102 | */
103 | private boolean handleChangePasscodeClick() {
104 | Intent i = new Intent(getActivity(), PasscodeManagePasswordActivity.class);
105 | i.putExtra(PasscodeManagePasswordActivity.KEY_TYPE, CHANGE_PASSWORD);
106 | i.putExtra(AbstractPasscodeKeyboardActivity.KEY_MESSAGE,
107 | getString(R.string.passcode_enter_old_passcode));
108 | startActivityForResult(i, CHANGE_PASSWORD);
109 |
110 | return true;
111 | }
112 |
113 | /**
114 | * Helper method to setup preference properties
115 | */
116 | private void refreshPreferenceState() {
117 | if (mTogglePasscodePreference != null && mChangePasscodePreference != null) {
118 | mChangePasscodePreference.setOnPreferenceClickListener(this);
119 | mTogglePasscodePreference.setOnPreferenceChangeListener(this);
120 |
121 | if (AppLockManager.getInstance().getAppLock().isPasswordLocked()) {
122 | mTogglePasscodePreference.setTitle(R.string.passcode_turn_off);
123 | mChangePasscodePreference.setEnabled(true);
124 | } else {
125 | mTogglePasscodePreference.setTitle(R.string.passcode_turn_on);
126 | mChangePasscodePreference.setEnabled(false);
127 | }
128 | }
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/PasscodePreferenceFragmentCompat.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 |
6 | import androidx.preference.Preference;
7 | import androidx.preference.PreferenceFragmentCompat;
8 |
9 | public class PasscodePreferenceFragmentCompat extends PreferenceFragmentCompat
10 | implements Preference.OnPreferenceClickListener {
11 | public static final String KEY_SHOULD_INFLATE = "should-inflate";
12 | public static final int ENABLE_PASSLOCK = 0;
13 | public static final int DISABLE_PASSLOCK = 1;
14 | public static final int CHANGE_PASSWORD = 2;
15 |
16 | private Preference mTogglePasscodePreference;
17 | private Preference mChangePasscodePreference;
18 |
19 | @Override
20 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
21 | Bundle args = getArguments();
22 |
23 | if (args != null && args.getBoolean(KEY_SHOULD_INFLATE, true)) {
24 | addPreferencesFromResource(R.xml.passcode_preferences);
25 | mTogglePasscodePreference = findPreference(getString(R.string.pref_key_passcode_toggle));
26 | mChangePasscodePreference = findPreference(getString(R.string.pref_key_change_passcode));
27 | }
28 |
29 | refreshPreferenceState();
30 | }
31 |
32 | @Override
33 | public boolean onPreferenceClick(Preference preference) {
34 | String preferenceKey = preference.getKey() != null ? preference.getKey() : "";
35 |
36 | if (preferenceKey.equals(getString(R.string.pref_key_passcode_toggle))) {
37 | return handlePasscodeToggleClick();
38 | } else if (preferenceKey.equals(getString(R.string.pref_key_change_passcode))) {
39 | return handleChangePasscodeClick();
40 | }
41 |
42 | return false;
43 | }
44 |
45 | /**
46 | * When the preferences are nested in a parent apps xml layout the inflated preferences will
47 | * need to be set.
48 | */
49 | public void setPreferences(Preference togglePreference, Preference changePreference) {
50 | mTogglePasscodePreference = togglePreference;
51 | mChangePasscodePreference = changePreference;
52 |
53 | refreshPreferenceState();
54 | }
55 |
56 | /**
57 | * Called when user requests to turn the passlock on or off.
58 | *
59 | * @return
60 | * always true to indicate that the request was handled
61 | */
62 | private boolean handlePasscodeToggleClick() {
63 | int type = AppLockManager.getInstance().getAppLock().isPasswordLocked()
64 | ? DISABLE_PASSLOCK : ENABLE_PASSLOCK;
65 | Intent i = new Intent(getActivity(), PasscodeManagePasswordActivity.class);
66 | i.putExtra(PasscodeManagePasswordActivity.KEY_TYPE, type);
67 | startActivityForResult(i, type);
68 |
69 | return true;
70 | }
71 |
72 | /**
73 | * Called when user requests to change passcode.
74 | *
75 | * @return
76 | * always true to indicate that the request was handled
77 | */
78 | private boolean handleChangePasscodeClick() {
79 | Intent i = new Intent(getActivity(), PasscodeManagePasswordActivity.class);
80 | i.putExtra(PasscodeManagePasswordActivity.KEY_TYPE, CHANGE_PASSWORD);
81 | i.putExtra(AbstractPasscodeKeyboardActivity.KEY_MESSAGE,
82 | getString(R.string.passcode_enter_old_passcode));
83 | startActivityForResult(i, CHANGE_PASSWORD);
84 |
85 | return true;
86 | }
87 |
88 | /**
89 | * Helper method to setup preference properties
90 | */
91 | private void refreshPreferenceState() {
92 | if (mTogglePasscodePreference != null && mChangePasscodePreference != null) {
93 | mTogglePasscodePreference.setOnPreferenceClickListener(this);
94 | mChangePasscodePreference.setOnPreferenceClickListener(this);
95 |
96 | if (AppLockManager.getInstance().getAppLock().isPasswordLocked()) {
97 | mTogglePasscodePreference.setTitle(R.string.passcode_turn_off);
98 | mChangePasscodePreference.setEnabled(true);
99 | } else {
100 | mTogglePasscodePreference.setTitle(R.string.passcode_turn_on);
101 | mChangePasscodePreference.setEnabled(false);
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/PasscodeUnlockActivity.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import android.content.Intent;
4 | import android.view.View;
5 |
6 | import androidx.core.hardware.fingerprint.FingerprintManagerCompat;
7 | import androidx.core.os.CancellationSignal;
8 |
9 | public class PasscodeUnlockActivity extends AbstractPasscodeKeyboardActivity {
10 | @Override
11 | public void onResume() {
12 | super.onResume();
13 |
14 | if (isFingerprintSupportedAndEnabled()) {
15 | mCancel = new CancellationSignal();
16 | mFingerprintManager.authenticate(null, 0, mCancel, getFingerprintCallback(), null);
17 | View view = findViewById(R.id.image_fingerprint);
18 | view.setVisibility(View.VISIBLE);
19 | }
20 | }
21 |
22 | @Override
23 | public void onBackPressed() {
24 | getAppLock().forcePasswordLock();
25 | Intent i = new Intent();
26 | i.setAction(Intent.ACTION_MAIN);
27 | i.addCategory(Intent.CATEGORY_HOME);
28 | startActivity(i);
29 | finish();
30 | }
31 |
32 | @Override
33 | protected void onPinLockInserted() {
34 | String passLock = mPinCodeField.getText().toString();
35 | if (getAppLock().verifyPassword(passLock)) {
36 | authenticationSucceeded();
37 | } else {
38 | authenticationFailed();
39 | }
40 | }
41 |
42 | @Override
43 | protected FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback() {
44 | return new FingerprintManagerCompat.AuthenticationCallback() {
45 | @Override
46 | public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
47 | // without the call to verifyPassword the unlock screen will show multiple times
48 | getAppLock().verifyPassword(AbstractAppLock.FINGERPRINT_VERIFICATION_BYPASS);
49 | authenticationSucceeded();
50 | }
51 |
52 | @Override
53 | public void onAuthenticationFailed() {
54 | authenticationFailed();
55 | }
56 |
57 | @Override public void onAuthenticationError(int errMsgId, CharSequence errString) { }
58 | @Override public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { }
59 | };
60 | }
61 |
62 | private boolean isFingerprintSupportedAndEnabled() {
63 | return mFingerprintManager.isHardwareDetected() &&
64 | mFingerprintManager.hasEnrolledFingerprints() &&
65 | getAppLock().isFingerprintEnabled();
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/library/src/org/wordpress/passcodelock/StringUtils.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock;
2 |
3 | import java.math.BigInteger;
4 | import java.security.MessageDigest;
5 | import java.security.NoSuchAlgorithmException;
6 |
7 | import android.util.Log;
8 |
9 | public class StringUtils {
10 | public static String getMd5Hash(String input) {
11 | try {
12 | MessageDigest md = MessageDigest.getInstance("MD5");
13 | byte[] messageDigest = md.digest(input.getBytes());
14 | BigInteger number = new BigInteger(1, messageDigest);
15 | String md5 = number.toString(16);
16 |
17 | while (md5.length() < 32)
18 | md5 = "0" + md5;
19 |
20 | return md5;
21 | } catch (NoSuchAlgorithmException e) {
22 | Log.e("MD5", e.getLocalizedMessage());
23 | return null;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/sample/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
3 | bin/
4 | gen/
5 | build/
6 |
7 | *.iml
8 | *.ipr
9 | *.iws
10 | .idea/
11 | .gradle/
12 |
--------------------------------------------------------------------------------
/sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "28.0.3"
6 |
7 | buildTypes {
8 | release {
9 | minifyEnabled false
10 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
11 | }
12 | }
13 |
14 | defaultConfig {
15 | applicationId "org.wordpress.passcodelock.sample"
16 | minSdkVersion 14
17 | targetSdkVersion 28
18 | versionCode 1
19 | versionName "1.0"
20 | }
21 | }
22 |
23 | buildscript {
24 | dependencies {
25 | classpath 'com.android.tools.build:gradle:3.4.2'
26 | }
27 |
28 | repositories {
29 | google()
30 | jcenter()
31 | maven { url 'https://maven.google.com' }
32 | }
33 | }
34 |
35 | dependencies {
36 | implementation 'androidx.appcompat:appcompat:1.0.2'
37 | implementation 'androidx.legacy:legacy-support-v4:1.0.0'
38 | implementation project(path: ':library')
39 | }
40 |
41 | repositories {
42 | google()
43 | mavenCentral()
44 | }
45 |
--------------------------------------------------------------------------------
/sample/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Tyler/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/sample/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
35 |
36 |
37 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/wordpress/passcodelock/sample/SampleActivity.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock.sample;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.view.Menu;
6 | import android.view.MenuInflater;
7 | import android.view.MenuItem;
8 |
9 | import androidx.appcompat.app.AppCompatActivity;
10 |
11 | public class SampleActivity extends AppCompatActivity {
12 | @Override
13 | public void onCreate(Bundle savedInstanceState) {
14 | setContentView(R.layout.sample_activity);
15 | super.onCreate(savedInstanceState);
16 | }
17 |
18 | @Override
19 | public boolean onCreateOptionsMenu(Menu menu) {
20 | MenuInflater inflater = getMenuInflater();
21 | inflater.inflate(R.menu.sample, menu);
22 | return super.onCreateOptionsMenu(menu);
23 | }
24 |
25 | @Override
26 | public boolean onOptionsItemSelected(final MenuItem item) {
27 | switch (item.getItemId()) {
28 | case R.id.action_settings:
29 | startActivity(new Intent(SampleActivity.this, SamplePreferenceActivity.class));
30 | return true;
31 | }
32 |
33 | return super.onOptionsItemSelected(item);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/wordpress/passcodelock/sample/SampleApplication.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock.sample;
2 |
3 | import android.app.Application;
4 |
5 | import org.wordpress.passcodelock.AppLockManager;
6 |
7 | public class SampleApplication extends Application {
8 | @Override
9 | public void onCreate() {
10 | super.onCreate();
11 | AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/wordpress/passcodelock/sample/SamplePreferenceActivity.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock.sample;
2 |
3 | import android.app.FragmentManager;
4 | import android.os.Bundle;
5 | import android.preference.Preference;
6 | import android.preference.SwitchPreference;
7 | import android.view.MenuItem;
8 |
9 | import androidx.appcompat.app.ActionBar;
10 | import androidx.appcompat.app.AppCompatActivity;
11 |
12 | import org.wordpress.passcodelock.AppLockManager;
13 | import org.wordpress.passcodelock.PasscodePreferenceFragment;
14 |
15 | public class SamplePreferenceActivity extends AppCompatActivity {
16 | private static final String KEY_PASSCODE_FRAGMENT = "passcode-fragment";
17 | private static final String KEY_PREFERENCE_FRAGMENT = "preference-fragment";
18 |
19 | private PasscodePreferenceFragment mPasscodePreferenceFragment;
20 | private SamplePreferenceFragment mSamplePreferenceFragment;
21 |
22 | @Override
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | ActionBar actionBar = getSupportActionBar();
26 |
27 | if (actionBar != null) {
28 | actionBar.setHomeButtonEnabled(true);
29 | actionBar.setDisplayHomeAsUpEnabled(true);
30 | }
31 |
32 | FragmentManager fragmentManager = getFragmentManager();
33 | mSamplePreferenceFragment = (SamplePreferenceFragment) fragmentManager.findFragmentByTag(KEY_PREFERENCE_FRAGMENT);
34 | mPasscodePreferenceFragment = (PasscodePreferenceFragment) fragmentManager.findFragmentByTag(KEY_PASSCODE_FRAGMENT);
35 |
36 | if (mSamplePreferenceFragment == null || mPasscodePreferenceFragment == null) {
37 | Bundle passcodeArgs = new Bundle();
38 | passcodeArgs.putBoolean(PasscodePreferenceFragment.KEY_SHOULD_INFLATE, false);
39 | mSamplePreferenceFragment = new SamplePreferenceFragment();
40 | mPasscodePreferenceFragment = new PasscodePreferenceFragment();
41 | mPasscodePreferenceFragment.setArguments(passcodeArgs);
42 |
43 | fragmentManager.beginTransaction()
44 | .replace(android.R.id.content, mPasscodePreferenceFragment, KEY_PASSCODE_FRAGMENT)
45 | .add(android.R.id.content, mSamplePreferenceFragment, KEY_PREFERENCE_FRAGMENT)
46 | .commit();
47 | }
48 | }
49 |
50 | @Override
51 | public boolean onOptionsItemSelected(final MenuItem item) {
52 | switch (item.getItemId()) {
53 | case android.R.id.home:
54 | onBackPressed();
55 | return true;
56 | }
57 |
58 | return super.onOptionsItemSelected(item);
59 | }
60 |
61 | @Override
62 | public void onStart() {
63 | super.onStart();
64 |
65 | Preference togglePreference = mSamplePreferenceFragment.findPreference(
66 | getString(org.wordpress.passcodelock.R.string.pref_key_passcode_toggle));
67 | Preference changePreference = mSamplePreferenceFragment.findPreference(
68 | getString(org.wordpress.passcodelock.R.string.pref_key_change_passcode));
69 |
70 | if (togglePreference != null && changePreference != null) {
71 | mPasscodePreferenceFragment.setPreferences(togglePreference, changePreference);
72 | ((SwitchPreference) togglePreference).setChecked(
73 | AppLockManager.getInstance().getAppLock().isPasswordLocked());
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/sample/src/main/java/org/wordpress/passcodelock/sample/SamplePreferenceFragment.java:
--------------------------------------------------------------------------------
1 | package org.wordpress.passcodelock.sample;
2 |
3 | import android.os.Bundle;
4 | import android.preference.PreferenceFragment;
5 |
6 | public class SamplePreferenceFragment extends PreferenceFragment {
7 | @Override
8 | public void onCreate(Bundle savedInstanceState) {
9 | super.onCreate(savedInstanceState);
10 | setRetainInstance(true);
11 | addPreferencesFromResource(R.xml.preferences);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-hdpi/ic_settings_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-hdpi/ic_settings_white_24dp.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-mdpi/ic_settings_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-mdpi/ic_settings_white_24dp.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-nodpi/img_default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-nodpi/img_default.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-v21/ic_settings_white_24dp.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-v21/img_default.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-xhdpi/ic_settings_white_24dp.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-xxhdpi/ic_settings_white_24dp.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wordpress-mobile/PasscodeLock-Android/804db0580e7719a36784b8a7c9751614808246ab/sample/src/main/res/drawable-xxxhdpi/ic_settings_white_24dp.png
--------------------------------------------------------------------------------
/sample/src/main/res/drawable/img_empty.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sample/src/main/res/layout/sample_activity.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/sample/src/main/res/menu/sample.xml:
--------------------------------------------------------------------------------
1 |