├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── smartown │ │ └── wechatpwd │ │ ├── CodeActivity.java │ │ └── MainActivity.java │ └── res │ ├── drawable │ ├── button.xml │ └── edit_background.xml │ ├── layout │ ├── activity_code.xml │ └── activity_main.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-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── codeView ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── smartown │ │ └── codeView │ │ ├── CodeView.java │ │ ├── KeyboardView.java │ │ └── Util.java │ └── res │ ├── drawable-xhdpi │ ├── img_kb_delete.png │ └── img_kb_hide.png │ ├── drawable │ └── keyboard_background.xml │ ├── layout │ └── layout_pwd_keyboard.xml │ └── values │ ├── attrs.xml │ ├── strings.xml │ └── styles.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── wechat.png ├── 密码.gif └── 明文.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /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, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "{}" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright 2017 Smartown 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### GitHub(提供demo及library源码) 2 | > [https://github.com/smartown/WeChatPwd](https://github.com/smartown/WeChatPwd) 3 | 4 | ### 项目简介 5 | > 仿微信支付密码输入控件,包含数字密码输入键盘和密码显示控件两部分 6 | 7 | ### 实现功能 8 | - 密码显示控件(CodeView),开放部分属性,可自定义显示效果 9 | 10 | //密码长度,默认6位 11 | private int length; 12 | //描边颜色,默认#E1E1E1 13 | private int borderColor; 14 | //描边宽度,默认1px 15 | private float borderWidth; 16 | //分割线颜色,默认#E1E1E1 17 | private int dividerColor; 18 | //分割线宽度,默认1px 19 | private float dividerWidth; 20 | //默认文本,在XML设置后可预览效果 21 | private String code; 22 | //密码点颜色,默认#000000 23 | private int codeColor; 24 | //密码点半径,默认8dp 25 | private float pointRadius; 26 | //显示明文时的文字大小,默认unitWidth/2 27 | private float textSize; 28 | //显示类型,支持密码、明文,默认明文 29 | private int showType; 30 | 31 | - 具体实现详见[GitHub](https://github.com/smartown/WeChatPwd)源码 32 | 33 | ### 效果展示 34 | 微信|密码输入|明文输入 35 | ---|---|--- 36 | ![wechat](http://upload-images.jianshu.io/upload_images/1951791-43b55f04abd72bb9.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/438)|![密码.gif](./image/密码.gif)|![明文.gif](./image/明文.gif) 37 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.smartown.wechatpwd" 8 | minSdkVersion 9 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile project(':codeView') 23 | } 24 | -------------------------------------------------------------------------------- /app/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 D:\Develop\Tools\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 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/smartown/wechatpwd/CodeActivity.java: -------------------------------------------------------------------------------- 1 | package com.smartown.wechatpwd; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.View; 8 | 9 | import com.smartown.codeView.CodeView; 10 | import com.smartown.codeView.KeyboardView; 11 | 12 | /** 13 | * Author:https://github.com/kungfubrother 14 | * Date:2017/1/7 20:47 15 | * Description: 16 | */ 17 | public class CodeActivity extends Activity { 18 | 19 | public static void inputSmsCode(Activity activity, int length) { 20 | input(activity, CodeView.SHOW_TYPE_WORD, length); 21 | } 22 | 23 | public static void inputPassword(Activity activity, int length) { 24 | input(activity, CodeView.SHOW_TYPE_PASSWORD, length); 25 | } 26 | 27 | public static void input(Activity activity, int showType, int length) { 28 | Intent intent = new Intent(activity, CodeActivity.class); 29 | intent.putExtra("showType", showType); 30 | intent.putExtra("length", length); 31 | activity.startActivity(intent); 32 | } 33 | 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setContentView(R.layout.activity_code); 38 | final KeyboardView keyboardView = (KeyboardView) findViewById(R.id.password_input); 39 | CodeView codeView = (CodeView) findViewById(R.id.password_view); 40 | codeView.setShowType(getIntent().getIntExtra("showType", CodeView.SHOW_TYPE_WORD)); 41 | codeView.setLength(getIntent().getIntExtra("length", 6)); 42 | keyboardView.setCodeView(codeView); 43 | codeView.setOnClickListener(new View.OnClickListener() { 44 | @Override 45 | public void onClick(View v) { 46 | keyboardView.show(); 47 | } 48 | }); 49 | codeView.setListener(new CodeView.Listener() { 50 | @Override 51 | public void onValueChanged(String value) { 52 | // TODO: 2017/2/5 内容发生变化 53 | } 54 | 55 | @Override 56 | public void onComplete(String value) { 57 | // TODO: 2017/2/5 输入完成 58 | } 59 | }); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/smartown/wechatpwd/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.smartown.wechatpwd; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | /** 8 | * Author:https://github.com/kungfubrother 9 | */ 10 | public class MainActivity extends Activity implements View.OnClickListener { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | findViewById(R.id.main_wechat).setOnClickListener(this); 17 | findViewById(R.id.main_sms).setOnClickListener(this); 18 | } 19 | 20 | @Override 21 | public void onClick(View v) { 22 | switch (v.getId()) { 23 | case R.id.main_wechat: 24 | CodeActivity.inputPassword(this, 6); 25 | break; 26 | case R.id.main_sms: 27 | CodeActivity.inputSmsCode(this, 6); 28 | break; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/button.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/edit_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_code.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 20 | 21 | 30 | 31 | 32 | 33 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 19 | 20 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WeChatPwd 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /codeView/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /codeView/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:25.1.1' 23 | } 24 | -------------------------------------------------------------------------------- /codeView/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 D:\Develop\Tools\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 | -------------------------------------------------------------------------------- /codeView/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /codeView/src/main/java/com/smartown/codeView/CodeView.java: -------------------------------------------------------------------------------- 1 | package com.smartown.codeView; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.util.AttributeSet; 9 | import android.view.View; 10 | 11 | /** 12 | * Author:https://github.com/kungfubrother 13 | * Date:2017/1/7 20:12 14 | * Description:密码显示控件 15 | */ 16 | public class CodeView extends View { 17 | 18 | public final static int SHOW_TYPE_WORD = 1; 19 | public final static int SHOW_TYPE_PASSWORD = 2; 20 | 21 | //密码长度,默认6位 22 | private int length; 23 | //描边颜色,默认#E1E1E1 24 | private int borderColor; 25 | //描边宽度,默认1px 26 | private float borderWidth; 27 | //分割线颜色,默认#E1E1E1 28 | private int dividerColor; 29 | //分割线宽度,默认1px 30 | private float dividerWidth; 31 | //默认文本,在XML设置后可预览效果 32 | private String code; 33 | //密码点颜色,默认#000000 34 | private int codeColor; 35 | //密码点半径,默认8dp 36 | private float pointRadius; 37 | //显示明文时的文字大小,默认unitWidth/2 38 | private float textSize; 39 | //显示类型,支持密码、明文,默认明文 40 | private int showType; 41 | 42 | private float unitWidth; 43 | private Paint paint; 44 | private Listener listener; 45 | 46 | public CodeView(Context context) { 47 | super(context); 48 | init(null); 49 | } 50 | 51 | public CodeView(Context context, AttributeSet attrs) { 52 | super(context, attrs); 53 | init(attrs); 54 | } 55 | 56 | @Override 57 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 58 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 59 | //根据宽度来计算单元格大小(高度) 60 | float width = getMeasuredWidth(); 61 | //宽度-左右边宽-中间分割线宽度 62 | unitWidth = (width - (2 * borderWidth) - ((length - 1) * dividerWidth)) / length; 63 | if (textSize == 0) { 64 | textSize = unitWidth / 2; 65 | } 66 | setMeasuredDimension((int) width, (int) (unitWidth + (2 * borderWidth))); 67 | } 68 | 69 | private void init(AttributeSet attrs) { 70 | paint = new Paint(); 71 | paint.setAntiAlias(true); 72 | paint.setTextAlign(Paint.Align.CENTER); 73 | if (attrs == null) { 74 | length = 6; 75 | borderColor = Color.parseColor("#E1E1E1"); 76 | borderWidth = 1; 77 | dividerColor = Color.parseColor("#E1E1E1"); 78 | dividerWidth = 1; 79 | code = ""; 80 | codeColor = Color.parseColor("#000000"); 81 | pointRadius = Util.dpToPx(getContext(), 8); 82 | showType = SHOW_TYPE_WORD; 83 | textSize = 0; 84 | } else { 85 | TypedArray typedArray = getResources().obtainAttributes(attrs, R.styleable.CodeView); 86 | length = typedArray.getInt(R.styleable.CodeView_length, 6); 87 | borderColor = typedArray.getColor(R.styleable.CodeView_borderColor, Color.parseColor("#E1E1E1")); 88 | borderWidth = typedArray.getDimensionPixelSize(R.styleable.CodeView_borderWidth, 1); 89 | dividerColor = typedArray.getColor(R.styleable.CodeView_dividerColor, Color.parseColor("#E1E1E1")); 90 | dividerWidth = typedArray.getDimensionPixelSize(R.styleable.CodeView_dividerWidth, 1); 91 | code = typedArray.getString(R.styleable.CodeView_code); 92 | if (code == null) { 93 | code = ""; 94 | } 95 | codeColor = typedArray.getColor(R.styleable.CodeView_codeColor, Color.parseColor("#000000")); 96 | pointRadius = typedArray.getDimensionPixelSize(R.styleable.CodeView_pointRadius, Util.dpToPx(getContext(), 8)); 97 | showType = typedArray.getInt(R.styleable.CodeView_showType, SHOW_TYPE_WORD); 98 | textSize = typedArray.getDimensionPixelSize(R.styleable.CodeView_textSize, 0); 99 | } 100 | } 101 | 102 | @Override 103 | protected void onDraw(Canvas canvas) { 104 | super.onDraw(canvas); 105 | drawDivider(canvas); 106 | drawBorder(canvas); 107 | switch (showType) { 108 | case SHOW_TYPE_PASSWORD: 109 | drawPoint(canvas); 110 | break; 111 | default: 112 | drawValue(canvas); 113 | break; 114 | } 115 | } 116 | 117 | /** 118 | * 描边 119 | */ 120 | private void drawBorder(Canvas canvas) { 121 | if (borderWidth > 0) { 122 | paint.setColor(borderColor); 123 | canvas.drawRect(0, 0, getWidth(), borderWidth, paint); 124 | canvas.drawRect(0, getHeight() - borderWidth, getWidth(), getHeight(), paint); 125 | canvas.drawRect(0, 0, borderWidth, getHeight(), paint); 126 | canvas.drawRect(getWidth() - borderWidth, 0, getWidth(), getHeight(), paint); 127 | } 128 | } 129 | 130 | /** 131 | * 画分割线 132 | */ 133 | private void drawDivider(Canvas canvas) { 134 | if (dividerWidth > 0) { 135 | paint.setColor(dividerColor); 136 | for (int i = 0; i < length - 1; i++) { 137 | final float left = unitWidth * (i + 1) + dividerWidth * i + borderWidth; 138 | canvas.drawRect(left, 0, left + dividerWidth, getHeight(), paint); 139 | } 140 | } 141 | } 142 | 143 | /** 144 | * 画输入文字 145 | */ 146 | private void drawValue(Canvas canvas) { 147 | if (pointRadius > 0) { 148 | paint.setColor(codeColor); 149 | paint.setTextSize(textSize); 150 | for (int i = 0; i < code.length(); i++) { 151 | final float left = unitWidth * i + dividerWidth * i + borderWidth; 152 | canvas.drawText(code.charAt(i) + "", 153 | left + unitWidth / 2, 154 | Util.getTextBaseLine(0, getHeight(), paint), 155 | paint); 156 | } 157 | } 158 | } 159 | 160 | /** 161 | * 画密码点 162 | */ 163 | private void drawPoint(Canvas canvas) { 164 | if (pointRadius > 0) { 165 | paint.setColor(codeColor); 166 | for (int i = 0; i < code.length(); i++) { 167 | final float left = unitWidth * i + dividerWidth * i + borderWidth; 168 | canvas.drawCircle(left + unitWidth / 2, getHeight() / 2, pointRadius, paint); 169 | } 170 | } 171 | } 172 | 173 | public void input(String number) { 174 | if (code.length() < length) { 175 | code += number; 176 | if (listener != null) { 177 | listener.onValueChanged(code); 178 | if (code.length() == length) { 179 | listener.onComplete(code); 180 | } 181 | } 182 | invalidate(); 183 | } 184 | } 185 | 186 | public void delete() { 187 | if (code.length() > 0) { 188 | code = code.substring(0, code.length() - 1); 189 | if (listener != null) { 190 | listener.onValueChanged(code); 191 | } 192 | invalidate(); 193 | } 194 | } 195 | 196 | public int getLength() { 197 | return length; 198 | } 199 | 200 | public void setLength(int length) { 201 | this.length = length; 202 | invalidate(); 203 | } 204 | 205 | public int getBorderColor() { 206 | return borderColor; 207 | } 208 | 209 | public void setBorderColor(int borderColor) { 210 | this.borderColor = borderColor; 211 | invalidate(); 212 | } 213 | 214 | public float getBorderWidth() { 215 | return borderWidth; 216 | } 217 | 218 | public void setBorderWidth(float borderWidth) { 219 | this.borderWidth = borderWidth; 220 | invalidate(); 221 | } 222 | 223 | public int getDividerColor() { 224 | return dividerColor; 225 | } 226 | 227 | public void setDividerColor(int dividerColor) { 228 | this.dividerColor = dividerColor; 229 | invalidate(); 230 | } 231 | 232 | public float getDividerWidth() { 233 | return dividerWidth; 234 | } 235 | 236 | public void setDividerWidth(float dividerWidth) { 237 | this.dividerWidth = dividerWidth; 238 | invalidate(); 239 | } 240 | 241 | public String getCode() { 242 | return code; 243 | } 244 | 245 | public void setCode(String code) { 246 | this.code = code; 247 | invalidate(); 248 | } 249 | 250 | public int getCodeColor() { 251 | return codeColor; 252 | } 253 | 254 | public void setCodeColor(int codeColor) { 255 | this.codeColor = codeColor; 256 | invalidate(); 257 | } 258 | 259 | public float getPointRadius() { 260 | return pointRadius; 261 | } 262 | 263 | public void setPointRadius(float pointRadius) { 264 | this.pointRadius = pointRadius; 265 | invalidate(); 266 | } 267 | 268 | public float getTextSize() { 269 | return textSize; 270 | } 271 | 272 | public void setTextSize(float textSize) { 273 | this.textSize = textSize; 274 | invalidate(); 275 | } 276 | 277 | public int getShowType() { 278 | return showType; 279 | } 280 | 281 | public void setShowType(int showType) { 282 | this.showType = showType; 283 | invalidate(); 284 | } 285 | 286 | public void setListener(Listener listener) { 287 | this.listener = listener; 288 | } 289 | 290 | public interface Listener { 291 | 292 | public void onValueChanged(String value); 293 | 294 | public void onComplete(String value); 295 | 296 | } 297 | 298 | } 299 | -------------------------------------------------------------------------------- /codeView/src/main/java/com/smartown/codeView/KeyboardView.java: -------------------------------------------------------------------------------- 1 | package com.smartown.codeView; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.widget.FrameLayout; 8 | 9 | /** 10 | * Author:https://github.com/kungfubrother 11 | * Date:2017/1/7 21:39 12 | * Description:数字输入键盘 13 | */ 14 | public class KeyboardView extends FrameLayout implements View.OnClickListener { 15 | 16 | private CodeView codeView; 17 | private Listener listener; 18 | 19 | public KeyboardView(Context context) { 20 | super(context); 21 | init(); 22 | } 23 | 24 | public KeyboardView(Context context, AttributeSet attrs) { 25 | super(context, attrs); 26 | init(); 27 | } 28 | 29 | public void setCodeView(CodeView codeView) { 30 | this.codeView = codeView; 31 | } 32 | 33 | private void init() { 34 | View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_pwd_keyboard, null); 35 | view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); 36 | addView(view); 37 | view.findViewById(R.id.keyboard_0).setOnClickListener(this); 38 | view.findViewById(R.id.keyboard_1).setOnClickListener(this); 39 | view.findViewById(R.id.keyboard_2).setOnClickListener(this); 40 | view.findViewById(R.id.keyboard_3).setOnClickListener(this); 41 | view.findViewById(R.id.keyboard_4).setOnClickListener(this); 42 | view.findViewById(R.id.keyboard_5).setOnClickListener(this); 43 | view.findViewById(R.id.keyboard_6).setOnClickListener(this); 44 | view.findViewById(R.id.keyboard_7).setOnClickListener(this); 45 | view.findViewById(R.id.keyboard_8).setOnClickListener(this); 46 | view.findViewById(R.id.keyboard_9).setOnClickListener(this); 47 | view.findViewById(R.id.keyboard_hide).setOnClickListener(this); 48 | view.findViewById(R.id.keyboard_delete).setOnClickListener(this); 49 | } 50 | 51 | public void hide() { 52 | setVisibility(GONE); 53 | } 54 | 55 | public void show() { 56 | setVisibility(VISIBLE); 57 | } 58 | 59 | public void setListener(Listener listener) { 60 | this.listener = listener; 61 | } 62 | 63 | @Override 64 | public void onClick(View v) { 65 | final String tag = (String) v.getTag(); 66 | if (tag != null) { 67 | switch (tag) { 68 | case "hide": 69 | hide(); 70 | break; 71 | case "delete": 72 | if (codeView != null) { 73 | codeView.delete(); 74 | } 75 | if (listener != null) { 76 | listener.onDelete(); 77 | } 78 | break; 79 | default: 80 | if (codeView != null) { 81 | codeView.input(tag); 82 | } 83 | if (listener != null) { 84 | listener.onInput(tag); 85 | } 86 | break; 87 | } 88 | } 89 | } 90 | 91 | public interface Listener { 92 | 93 | public void onInput(String s); 94 | 95 | public void onDelete(); 96 | 97 | } 98 | 99 | } 100 | -------------------------------------------------------------------------------- /codeView/src/main/java/com/smartown/codeView/Util.java: -------------------------------------------------------------------------------- 1 | package com.smartown.codeView; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | 6 | /** 7 | * Author:https://github.com/kungfubrother 8 | * Date:2017/1/7 20:24 9 | * Description:工具类 10 | */ 11 | public class Util { 12 | 13 | /** 14 | * DP转PX 15 | */ 16 | public static int dpToPx(Context context, float dpSize) { 17 | return (int) (context.getResources().getDisplayMetrics().density * dpSize); 18 | } 19 | 20 | /** 21 | * @param backgroundTop 22 | * @param backgroundBottom 23 | * @param paint 24 | * @return paint绘制居中文字时,获取文本底部坐标 25 | */ 26 | public static float getTextBaseLine(float backgroundTop, float backgroundBottom, Paint paint) { 27 | final Paint.FontMetrics fontMetrics = paint.getFontMetrics(); 28 | return (backgroundTop + backgroundBottom - fontMetrics.bottom - fontMetrics.top) / 2; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /codeView/src/main/res/drawable-xhdpi/img_kb_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/codeView/src/main/res/drawable-xhdpi/img_kb_delete.png -------------------------------------------------------------------------------- /codeView/src/main/res/drawable-xhdpi/img_kb_hide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/codeView/src/main/res/drawable-xhdpi/img_kb_hide.png -------------------------------------------------------------------------------- /codeView/src/main/res/drawable/keyboard_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /codeView/src/main/res/layout/layout_pwd_keyboard.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 20 | 21 | 26 | 27 | 35 | 36 | 39 | 40 | 48 | 49 | 52 | 53 | 61 | 62 | 63 | 64 | 67 | 68 | 73 | 74 | 82 | 83 | 86 | 87 | 95 | 96 | 99 | 100 | 108 | 109 | 110 | 111 | 114 | 115 | 120 | 121 | 129 | 130 | 133 | 134 | 142 | 143 | 146 | 147 | 155 | 156 | 157 | 158 | 161 | 162 | 167 | 168 | 172 | 173 | 176 | 177 | 185 | 186 | 189 | 190 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /codeView/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /codeView/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PasswordView 3 | #80000000 4 | 5 | -------------------------------------------------------------------------------- /codeView/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 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-2.14.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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /image/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/image/wechat.png -------------------------------------------------------------------------------- /image/密码.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/image/密码.gif -------------------------------------------------------------------------------- /image/明文.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiaoowuu/WeChatPwd/84fb0984999f67d4113939f07219c456cb8e0b47/image/明文.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', 'codeView' 2 | --------------------------------------------------------------------------------