├── .gitignore ├── LICENSE ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── xyz │ │ └── aprildown │ │ └── hmspickerview │ │ └── app │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_main.xml │ └── layout_picker.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── values-night │ └── styles.xml │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── images ├── land.webp └── port.webp ├── library ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── xyz │ │ └── aprildown │ │ └── hmspickerview │ │ ├── HmsPickerView.kt │ │ └── Utils.kt │ └── res │ ├── drawable │ └── hpv_ic_backspace.xml │ ├── layout-land │ └── hpv_content.xml │ ├── layout │ ├── hpv_content.xml │ ├── hpv_digits.xml │ ├── hpv_divider.xml │ ├── hpv_time.xml │ └── hpv_view.xml │ ├── values-ar │ └── strings.xml │ ├── values-de │ └── strings.xml │ ├── values-es │ └── strings.xml │ ├── values-fr │ └── strings.xml │ ├── values-hi │ └── strings.xml │ ├── values-ja │ └── strings.xml │ ├── values-land │ └── dimens.xml │ ├── values-nl │ └── strings.xml │ ├── values-pl │ └── strings.xml │ ├── values-pt │ └── strings.xml │ ├── values-ru │ └── strings.xml │ ├── values-sw600dp-land │ └── dimens.xml │ ├── values-sw600dp │ └── dimens.xml │ ├── values-sw720dp-land │ └── dimens.xml │ ├── values-zh-rCN │ └── strings.xml │ ├── values-zh-rHK │ └── strings.xml │ ├── values-zh-rTW │ └── strings.xml │ └── values │ ├── attrs.xml │ ├── dimens.xml │ ├── public.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/java,linux,macos,gradle,kotlin,windows,android,jetbrains,jetbrains+iml,jetbrains+all,androidstudio 3 | # Edit at https://www.gitignore.io/?templates=java,linux,macos,gradle,kotlin,windows,android,jetbrains,jetbrains+iml,jetbrains+all,androidstudio 4 | 5 | ### Android ### 6 | # Built application files 7 | *.apk 8 | *.ap_ 9 | *.aab 10 | 11 | # Files for the ART/Dalvik VM 12 | *.dex 13 | 14 | # Java class files 15 | *.class 16 | 17 | # Generated files 18 | bin/ 19 | gen/ 20 | out/ 21 | 22 | # Gradle files 23 | .gradle/ 24 | build/ 25 | 26 | # Local configuration file (sdk path, etc) 27 | local.properties 28 | 29 | # Proguard folder generated by Eclipse 30 | proguard/ 31 | 32 | # Log Files 33 | *.log 34 | 35 | # Android Studio Navigation editor temp files 36 | .navigation/ 37 | 38 | # Android Studio captures folder 39 | captures/ 40 | 41 | # IntelliJ 42 | *.iml 43 | .idea/workspace.xml 44 | .idea/tasks.xml 45 | .idea/gradle.xml 46 | .idea/assetWizardSettings.xml 47 | .idea/dictionaries 48 | .idea/libraries 49 | .idea/caches 50 | 51 | # Keystore files 52 | # Uncomment the following lines if you do not want to check your keystore files in. 53 | #*.jks 54 | #*.keystore 55 | 56 | # External native build folder generated in Android Studio 2.2 and later 57 | .externalNativeBuild 58 | 59 | # Google Services (e.g. APIs or Firebase) 60 | google-services.json 61 | 62 | # Freeline 63 | freeline.py 64 | freeline/ 65 | freeline_project_description.json 66 | 67 | # fastlane 68 | fastlane/report.xml 69 | fastlane/Preview.html 70 | fastlane/screenshots 71 | fastlane/test_output 72 | fastlane/readme.md 73 | 74 | ### Android Patch ### 75 | gen-external-apklibs 76 | 77 | ### AndroidStudio ### 78 | # Covers files to be ignored for android development using Android Studio. 79 | 80 | # Built application files 81 | 82 | # Files for the ART/Dalvik VM 83 | 84 | # Java class files 85 | 86 | # Generated files 87 | 88 | # Gradle files 89 | .gradle 90 | 91 | # Signing files 92 | .signing/ 93 | 94 | # Local configuration file (sdk path, etc) 95 | 96 | # Proguard folder generated by Eclipse 97 | 98 | # Log Files 99 | 100 | # Android Studio 101 | /*/build/ 102 | /*/local.properties 103 | /*/out 104 | /*/*/build 105 | /*/*/production 106 | *.ipr 107 | *~ 108 | *.swp 109 | 110 | # Android Patch 111 | 112 | # External native build folder generated in Android Studio 2.2 and later 113 | 114 | # NDK 115 | obj/ 116 | 117 | # IntelliJ IDEA 118 | *.iws 119 | /out/ 120 | 121 | # User-specific configurations 122 | .idea/caches/ 123 | .idea/libraries/ 124 | .idea/shelf/ 125 | .idea/.name 126 | .idea/compiler.xml 127 | .idea/copyright/profiles_settings.xml 128 | .idea/encodings.xml 129 | .idea/misc.xml 130 | .idea/modules.xml 131 | .idea/scopes/scope_settings.xml 132 | .idea/vcs.xml 133 | .idea/jsLibraryMappings.xml 134 | .idea/datasources.xml 135 | .idea/dataSources.ids 136 | .idea/sqlDataSources.xml 137 | .idea/dynamic.xml 138 | .idea/uiDesigner.xml 139 | 140 | # OS-specific files 141 | .DS_Store 142 | .DS_Store? 143 | ._* 144 | .Spotlight-V100 145 | .Trashes 146 | ehthumbs.db 147 | Thumbs.db 148 | 149 | # Legacy Eclipse project files 150 | .classpath 151 | .project 152 | .cproject 153 | .settings/ 154 | 155 | # Mobile Tools for Java (J2ME) 156 | .mtj.tmp/ 157 | 158 | # Package Files # 159 | *.war 160 | *.ear 161 | 162 | # virtual machine crash logs (Reference: http://www.java.com/en/download/help/error_hotspot.xml) 163 | hs_err_pid* 164 | 165 | ## Plugin-specific files: 166 | 167 | # mpeltonen/sbt-idea plugin 168 | .idea_modules/ 169 | 170 | # JIRA plugin 171 | atlassian-ide-plugin.xml 172 | 173 | # Mongo Explorer plugin 174 | .idea/mongoSettings.xml 175 | 176 | # Crashlytics plugin (for Android Studio and IntelliJ) 177 | com_crashlytics_export_strings.xml 178 | crashlytics.properties 179 | crashlytics-build.properties 180 | fabric.properties 181 | 182 | ### AndroidStudio Patch ### 183 | 184 | !/gradle/wrapper/gradle-wrapper.jar 185 | 186 | ### Java ### 187 | # Compiled class file 188 | 189 | # Log file 190 | 191 | # BlueJ files 192 | *.ctxt 193 | 194 | # Mobile Tools for Java (J2ME) 195 | 196 | # Package Files # 197 | *.jar 198 | *.nar 199 | *.zip 200 | *.tar.gz 201 | *.rar 202 | 203 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 204 | 205 | ### JetBrains ### 206 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 207 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 208 | 209 | # User-specific stuff 210 | .idea/**/workspace.xml 211 | .idea/**/tasks.xml 212 | .idea/**/usage.statistics.xml 213 | .idea/**/dictionaries 214 | .idea/**/shelf 215 | 216 | # Generated files 217 | .idea/**/contentModel.xml 218 | 219 | # Sensitive or high-churn files 220 | .idea/**/dataSources/ 221 | .idea/**/dataSources.ids 222 | .idea/**/dataSources.local.xml 223 | .idea/**/sqlDataSources.xml 224 | .idea/**/dynamic.xml 225 | .idea/**/uiDesigner.xml 226 | .idea/**/dbnavigator.xml 227 | 228 | # Gradle 229 | .idea/**/gradle.xml 230 | .idea/**/libraries 231 | 232 | # Gradle and Maven with auto-import 233 | # When using Gradle or Maven with auto-import, you should exclude module files, 234 | # since they will be recreated, and may cause churn. Uncomment if using 235 | # auto-import. 236 | # .idea/modules.xml 237 | # .idea/*.iml 238 | # .idea/modules 239 | 240 | # CMake 241 | cmake-build-*/ 242 | 243 | # Mongo Explorer plugin 244 | .idea/**/mongoSettings.xml 245 | 246 | # File-based project format 247 | 248 | # IntelliJ 249 | 250 | # mpeltonen/sbt-idea plugin 251 | 252 | # JIRA plugin 253 | 254 | # Cursive Clojure plugin 255 | .idea/replstate.xml 256 | 257 | # Crashlytics plugin (for Android Studio and IntelliJ) 258 | 259 | # Editor-based Rest Client 260 | .idea/httpRequests 261 | 262 | # Android studio 3.1+ serialized cache file 263 | .idea/caches/build_file_checksums.ser 264 | 265 | ### JetBrains Patch ### 266 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 267 | 268 | # *.iml 269 | # modules.xml 270 | # .idea/misc.xml 271 | # *.ipr 272 | 273 | # Sonarlint plugin 274 | .idea/sonarlint 275 | 276 | ### JetBrains+all ### 277 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 278 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 279 | 280 | # User-specific stuff 281 | 282 | # Generated files 283 | 284 | # Sensitive or high-churn files 285 | 286 | # Gradle 287 | 288 | # Gradle and Maven with auto-import 289 | # When using Gradle or Maven with auto-import, you should exclude module files, 290 | # since they will be recreated, and may cause churn. Uncomment if using 291 | # auto-import. 292 | # .idea/modules.xml 293 | # .idea/*.iml 294 | # .idea/modules 295 | 296 | # CMake 297 | 298 | # Mongo Explorer plugin 299 | 300 | # File-based project format 301 | 302 | # IntelliJ 303 | 304 | # mpeltonen/sbt-idea plugin 305 | 306 | # JIRA plugin 307 | 308 | # Cursive Clojure plugin 309 | 310 | # Crashlytics plugin (for Android Studio and IntelliJ) 311 | 312 | # Editor-based Rest Client 313 | 314 | # Android studio 3.1+ serialized cache file 315 | 316 | ### JetBrains+all Patch ### 317 | # Ignores the whole .idea folder and all .iml files 318 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 319 | 320 | .idea/ 321 | 322 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 323 | 324 | modules.xml 325 | 326 | ### JetBrains+iml ### 327 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm 328 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 329 | 330 | # User-specific stuff 331 | 332 | # Generated files 333 | 334 | # Sensitive or high-churn files 335 | 336 | # Gradle 337 | 338 | # Gradle and Maven with auto-import 339 | # When using Gradle or Maven with auto-import, you should exclude module files, 340 | # since they will be recreated, and may cause churn. Uncomment if using 341 | # auto-import. 342 | # .idea/modules.xml 343 | # .idea/*.iml 344 | # .idea/modules 345 | 346 | # CMake 347 | 348 | # Mongo Explorer plugin 349 | 350 | # File-based project format 351 | 352 | # IntelliJ 353 | 354 | # mpeltonen/sbt-idea plugin 355 | 356 | # JIRA plugin 357 | 358 | # Cursive Clojure plugin 359 | 360 | # Crashlytics plugin (for Android Studio and IntelliJ) 361 | 362 | # Editor-based Rest Client 363 | 364 | # Android studio 3.1+ serialized cache file 365 | 366 | ### JetBrains+iml Patch ### 367 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 368 | 369 | 370 | ### Kotlin ### 371 | # Compiled class file 372 | 373 | # Log file 374 | 375 | # BlueJ files 376 | 377 | # Mobile Tools for Java (J2ME) 378 | 379 | # Package Files # 380 | 381 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 382 | 383 | ### Linux ### 384 | 385 | # temporary files which can be created if a process still has a handle open of a deleted file 386 | .fuse_hidden* 387 | 388 | # KDE directory preferences 389 | .directory 390 | 391 | # Linux trash folder which might appear on any partition or disk 392 | .Trash-* 393 | 394 | # .nfs files are created when an open file is removed but is still being accessed 395 | .nfs* 396 | 397 | ### macOS ### 398 | # General 399 | .AppleDouble 400 | .LSOverride 401 | 402 | # Icon must end with two \r 403 | Icon 404 | 405 | # Thumbnails 406 | 407 | # Files that might appear in the root of a volume 408 | .DocumentRevisions-V100 409 | .fseventsd 410 | .TemporaryItems 411 | .VolumeIcon.icns 412 | .com.apple.timemachine.donotpresent 413 | 414 | # Directories potentially created on remote AFP share 415 | .AppleDB 416 | .AppleDesktop 417 | Network Trash Folder 418 | Temporary Items 419 | .apdisk 420 | 421 | ### Windows ### 422 | # Windows thumbnail cache files 423 | ehthumbs_vista.db 424 | 425 | # Dump file 426 | *.stackdump 427 | 428 | # Folder config file 429 | [Dd]esktop.ini 430 | 431 | # Recycle Bin used on file shares 432 | $RECYCLE.BIN/ 433 | 434 | # Windows Installer files 435 | *.cab 436 | *.msi 437 | *.msix 438 | *.msm 439 | *.msp 440 | 441 | # Windows shortcuts 442 | *.lnk 443 | 444 | ### Gradle ### 445 | /build/ 446 | 447 | # Ignore Gradle GUI config 448 | gradle-app.setting 449 | 450 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 451 | !gradle-wrapper.jar 452 | 453 | # Cache of project 454 | .gradletasknamecache 455 | 456 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 457 | # gradle/wrapper/gradle-wrapper.properties 458 | 459 | ### Gradle Patch ### 460 | **/build/ 461 | 462 | # End of https://www.gitignore.io/api/java,linux,macos,gradle,kotlin,windows,android,jetbrains,jetbrains+iml,jetbrains+all,androidstudio 463 | 464 | *.aar -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![JitPack](https://jitpack.io/v/DeweyReed/HmsPickerView.svg)](https://jitpack.io/#DeweyReed/HmsPickerView) 2 | [![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-HmsPickerView-green.svg?style=flat )]( https://android-arsenal.com/details/1/7644 ) 3 | 4 | # HmsPickerView 5 | 6 | A beautiful little Android view to pick hours, minutes and seconds. 7 | 8 | Port 9 | Land 10 | 11 | ## Installation 12 | 13 | Step 1. Add it in your root build.gradle at the end of repositories: 14 | 15 | ```Groovy 16 | allprojects { 17 | repositories { 18 | ... 19 | maven { url 'https://jitpack.io' } 20 | } 21 | } 22 | ``` 23 | 24 | Step 2. Add the dependency 25 | 26 | ```Groovy 27 | dependencies { 28 | implementation "com.github.DeweyReed:HmsPickerView:${version}" 29 | } 30 | ``` 31 | 32 | [![](https://jitpack.io/v/DeweyReed/HmsPickerView.svg)](https://jitpack.io/#DeweyReed/HmsPickerView) 33 | 34 | ## Usage 35 | 36 | In the XML: 37 | 38 | ```XML 39 | 43 | ``` 44 | 45 | ```XML 46 | 47 | 48 | 49 | 50 | ``` 51 | 52 | In the code: 53 | 54 | ```Kotlin 55 | fun getHours(): Int 56 | fun setHours(hours: Int) 57 | 58 | fun getMinutes(): Int 59 | fun setMinutes(minutes: Int) 60 | 61 | fun getSeconds(): Int 62 | fun setSeconds(seconds: Int) 63 | 64 | fun getTimeInMillis(): Long 65 | fun setTimeInMillis(time: Long) 66 | 67 | fun setTimeTextSize(@Px textSize: Int) 68 | fun setDigitTextSize(@Px textSize: Int) 69 | 70 | fun setListener(l: HmsPickerView.Listener) 71 | interface Listener { 72 | /** 73 | * Indicates [HmsPickerView] now has an valid input(anything except 00h 00m 00s). 74 | * This methods can be used to allow user to go forward (such as enabling "next" button). 75 | */ 76 | fun onHmsPickerViewHasValidInput(hmsPickerView: HmsPickerView) 77 | 78 | /** 79 | * Indicates [HmsPickerView]'s input becomes 00h 00m 00s. 80 | * This methods can be used to prevent user from going forward(such as disabling "next" button). 81 | */ 82 | fun onHmsPickerViewHasNoInput(hmsPickerView: HmsPickerView) 83 | } 84 | ``` 85 | 86 | ### Use this view in a dialog 87 | 88 | 1. Create a XML file like [this one](https://github.com/DeweyReed/HmsPickerView/blob/master/app/src/main/res/layout/layout_picker.xml#L1). 89 | 1. Wrap it into an AlertDialog like [this one](https://github.com/DeweyReed/HmsPickerView/blob/master/app/src/main/java/xyz/aprildown/hmspickerview/app/MainActivity.kt#L29). 90 | 91 | **🦄 Please star this repo if you like it 🦄** 92 | 93 | ## License 94 | 95 | [LICENSE](./LICENSE) 96 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion compile_sdk 9 | defaultConfig { 10 | applicationId "xyz.aprildown.hmspickerview.app" 11 | minSdkVersion min_sdk 12 | targetSdkVersion target_sdk 13 | versionCode version_code 14 | versionName version_name 15 | vectorDrawables.useSupportLibrary true 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation project(':library') 27 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 28 | implementation "androidx.appcompat:appcompat:$appcompat_version" 29 | 30 | implementation 'com.google.android.material:material:1.1.0' 31 | } 32 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/xyz/aprildown/hmspickerview/app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package xyz.aprildown.hmspickerview.app 2 | 3 | import android.os.Bundle 4 | import android.widget.Toast 5 | import androidx.appcompat.app.AlertDialog 6 | import androidx.appcompat.app.AppCompatActivity 7 | import androidx.appcompat.app.AppCompatDelegate 8 | import com.google.android.material.dialog.MaterialAlertDialogBuilder 9 | import kotlinx.android.synthetic.main.activity_main.* 10 | import xyz.aprildown.hmspickerview.HmsPickerView 11 | 12 | class MainActivity : AppCompatActivity() { 13 | 14 | override fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | setContentView(R.layout.activity_main) 17 | 18 | btnNight.setOnClickListener { 19 | val isNight = 20 | AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES 21 | if (isNight) { 22 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) 23 | } else { 24 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) 25 | } 26 | recreate() 27 | } 28 | 29 | btnDialog.setOnClickListener { 30 | val dialog = MaterialAlertDialogBuilder(this) 31 | .setView(R.layout.layout_picker) 32 | // Because the picker is long, remove vertical insets to make sure the view not get clipped. 33 | .setBackgroundInsetBottom(0) 34 | .setBackgroundInsetTop(0) 35 | .setPositiveButton(android.R.string.ok, null) 36 | .setNegativeButton(android.R.string.cancel, null) 37 | .show() 38 | 39 | val hmsPickerView = dialog.findViewById(R.id.hmsPickerView)!! 40 | dialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(android.R.string.ok)) { _, _ -> 41 | Toast.makeText( 42 | this, "%2dh %2dm %2ds".format( 43 | hmsPickerView.getHours(), 44 | hmsPickerView.getMinutes(), 45 | hmsPickerView.getSeconds() 46 | ), 47 | Toast.LENGTH_SHORT 48 | ).show() 49 | } 50 | } 51 | 52 | hmsPickerView2.run { 53 | setSeconds(12) 54 | setMinutes(30) 55 | setHours(9) 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 17 |