├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── CONTRIBUTING.md ├── LICENSE ├── README-en.md ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── scut │ │ └── carson_ho │ │ └── superedittext │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── scut │ │ │ └── carson_ho │ │ │ └── superedittext │ │ │ └── MainActivity.java │ └── res │ │ ├── drawable │ │ ├── back.png │ │ ├── cursortest.xml │ │ ├── password_click.png │ │ └── password_unclick.png │ │ ├── layout │ │ └── activity_main.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 │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── scut │ └── carson_ho │ └── superedittext │ └── ExampleUnitTest.java ├── build.gradle ├── diy_view ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── scut │ │ └── carson_ho │ │ └── diy_view │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── scut │ │ │ └── carson_ho │ │ │ └── diy_view │ │ │ └── SuperEditText.java │ └── res │ │ ├── drawable │ │ ├── cursor.xml │ │ ├── delete.png │ │ ├── delete_click.png │ │ ├── ic_left_click.png │ │ └── ic_left_unclick.png │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── scut │ └── carson_ho │ └── diy_view │ └── ExampleUnitTest.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── 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 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Android 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 66 | 1.8 67 | 68 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guide 2 | - First,Thank you for your attention to this project. 3 | - Any bug, doc, examples and suggestion is appreciated. Here are some suggestions for you to create Pull Requests or open Issues. 4 | 5 | 6 | 7 | ## 1. Branches Description 8 | - master branch:the latest (pre-)release branch. 9 | - develop branch:the stable developing branch.  10 | >1. [Github Release](https://help.github.com/articles/creating-releases/) is used to publish a (pre-)release version to master branch. 11 | >2. It's RECOMMENDED to commit bugfix or feature PR to develop. 12 | 13 | - {action}/{description} branch:The branch for a developing or bugfix *. 14 | >DO NOT commit any PR to such a branch. 15 | 16 | 17 | ## 2. Branch Management 18 | 19 | >master 20 | ↑ 21 | develop <--- PR(bugfix/typo/3rd-PR) 22 | ↑ PR 23 | {type}/{description} 24 | 25 | 26 | 27 | ## 3. Branch Name 28 | 29 | ``` 30 | {action}/{description} 31 | 32 | // 1. {action}: 33 | // feature: used for developing a new feature. 34 | // bugfix: used for fixing bugs. 35 | // 2. for example: feature/add_new_condition 36 | ``` 37 | 38 | ## 4. Commit Log 39 | ``` 40 | {action} {description} 41 | ``` 42 | 43 | - {action} 44 | 1. add 45 | 2. update or bugfix 46 | 3. remove 47 | ... 48 | 49 | - {description}:It's ***RECOMMENDED*** to close issue with syntax #123, see [the doc](https://help.github.com/articles/closing-issues-via-commit-messages/) for more detail. 50 | >It's useful for responding issues and release flow. 51 | 52 | - for example 53 | 54 | ``` 55 | add new condition 56 | fix #123, make compatible to recyclervew 25.2.0 57 | remove abc 58 | ``` 59 | 60 | ## 5. Issue 61 | - Please apply a proper label to an issue. 62 | - Suggested to use English. 63 | - Provide sufficient instructions to be able to reproduce the issue and make the issues clear. Such as phone model, system version, sdk version, crash logs and screen captures. 64 | 65 | 66 | ## 6. Pull Request And Contributor License Agreement 67 | - In order to contribute code to Kawaii_LoadingView, you (or the legal entity you represent) must sign the Contributor License Agreement (CLA). 68 | - For CLA assistant service works properly, please make sure you have added email address that your commits linked to GitHub account. 69 | 70 | ### 7. Code Style Guide 71 | - Java:Use [Google Java Style](https://google.github.io/styleguide/javaguide.html) as basic guidelines of java code. 72 | - Android:Follow [AOSP Code Style](https://source.android.com/source/code-style.html) for rest of android related code style. 73 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 何家成 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 all 13 | 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 THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README-en.md: -------------------------------------------------------------------------------- 1 | # Super_EditText 2 | >[中文文档](https://github.com/Carson-Ho/SuperEditText/blob/master/README.md) 3 | - Author:Carson_Ho 4 | - Summary 5 | 6 | 7 | 8 | 9 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-022edc10b8a9c22b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 10 | 11 | 12 | 13 | ## 1. Introduction 14 | a simple & useful Android DIY View for EditText 15 | >[Carson_Ho的Github地址:Super_EditText](https://github.com/Carson-Ho/SuperEditText) 16 | 17 | ![效果图](http://upload-images.jianshu.io/upload_images/944365-10b970da9048907f.gif?imageMogr2/auto-orient/strip) 18 | 19 | 20 | ## 2. Application Scenarios 21 | Batch delete & High Diy style 22 | 23 | 24 | 25 | ## 3. Feature 26 | - Fresh & concise style 27 | - Easy to use 28 | - Secondary Programming costs are low 29 | 30 | ## 4. Usage 31 | 32 | ##### Step 1:Import Library 33 | There are two ways to import Library: 34 | 35 | - 1. For Gradle 36 | *build.Gradle* 37 | 38 | ``` 39 | dependencies { 40 | compile 'com.carson_ho:Super_EditText:1.0.0' 41 | } 42 | ``` 43 | 44 | - 2. For Maven 45 | *pom.xml* 46 | ``` 47 | 48 | com.carson_ho 49 | Super_EditText 50 | 1.0.0 51 | pom 52 | 53 | ``` 54 | 55 | 56 | ##### Step 2:Set Animation Attributes 57 | - Attributes Description: 58 | 59 | 60 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-baa414ba395a85f6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 61 | 62 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-622a93d4c1ffcebd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 63 | 64 | 65 | - Use examples 66 | 67 | *activity_main.xml* 68 | ``` 69 | 96 | ``` 97 | 98 | 99 | *cursortest.xml* 100 | ``` 101 | 102 | 104 | 105 | 106 | 107 | 108 | 109 | ``` 110 | 111 | ## 5. Complete Demo 112 | [Carson_Ho的Github地址:Super_EditText](https://github.com/Carson-Ho/SuperEditText) 113 | 114 | 115 | ![效果图](http://upload-images.jianshu.io/upload_images/944365-10b970da9048907f.gif?imageMogr2/auto-orient/strip) 116 | 117 | 118 | 119 | ## 6. Source code analysis 120 | [Android Diy View:SuperEditText Source code analysis ](http://www.jianshu.com/p/99d9dc5bcffc) 121 | 122 | 123 | 124 | ## 7. LICENSE 125 | Super_EditText is available under the MIT license. 126 | 127 | 128 | 129 | ## 8. Contribute 130 | Before you open an issue or create a pull request, please read [Contributing Guide](https://github.com/Carson-Ho/SuperEditText/blob/master/CONTRIBUTING.md) first. 131 | 132 | 133 | 134 | ## 9. Release 135 | 2017-08-14 v1.0.0 :finish basic function 136 | 137 | 138 | 139 | # About the author 140 | - ID:Carson_Ho 141 | - 简介:CSDN签约作者、简书推荐作者、稀土掘金专栏作者 142 | - E - mail:[carson.ho@foxmail.com](mailto:carson.ho@foxmail.com) 143 | - Github:[https://github.com/Carson-Ho](https://github.com/Carson-Ho) 144 | - CSDN:[http://blog.csdn.net/carson_ho](http://blog.csdn.net/carson_ho) 145 | - 简书:[http://www.jianshu.com/u/383970bef0a0](http://www.jianshu.com/u/383970bef0a0) 146 | - 稀土掘金:[https://juejin.im/user/58d4d9781b69e6006ba65edc](https://juejin.im/user/58d4d9781b69e6006ba65edc) 147 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SuperEditText 2 | > Click to see [English Document](https://github.com/Carson-Ho/SuperEditText/blob/master/README-en.md) 3 | - 作者:Carson_Ho 4 | - 概述 5 | 6 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-ff40bf46370cd596.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 7 | 8 | 9 | **注:关于该开源项目的意见 & 建议可在Issue上提出。欢迎 Star !** 10 | 11 | ## 1. 简介 12 | 一款 **简单 & 好用**的 `SuperEditText`控件 13 | >Github地址:[Super_EditText](https://github.com/Carson-Ho/SuperEditText) 14 | 15 | ![效果图](http://upload-images.jianshu.io/upload_images/944365-10b970da9048907f.gif?imageMogr2/auto-orient/strip) 16 | 17 | 18 | 19 | ## 2. 功能介绍 20 | ### 2.1 需求场景 21 | 对于 `EditText`来说,一般的需求有: 22 | - 方便用户因出现输入错误而进行2次输入 23 | - 标识用户正在填写项 24 | - 根据具体场景增加一定的`UI`元素 25 | 26 | ### 2.2 功能需求 27 | 根据需求场景,得出`EditText`需要具备的功能如下: 28 | - 一键删除 29 | - 丰富的自定义样式:左侧图标、删除功能图标、分割线 & 光标 样式变化。具体如下图: 30 | 31 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-153064dd032afe4d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 32 | 33 | **注:该样式的设置是系统自带的 `API` 所不具备的** 34 | 35 | - 功能列表 36 | 37 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-399c5869b7adb090.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 38 | 39 | ### 2.3 功能示意 40 | 41 | ![效果图](http://upload-images.jianshu.io/upload_images/944365-10b970da9048907f.gif?imageMogr2/auto-orient/strip) 42 | 43 | 44 | # 3. 特点 45 | 对比市面上`EditText`控件,该控件[Super_EditText](https://github.com/Carson-Ho/SuperEditText) 的特点是: 46 | 47 | ### 3.1 功能实用 48 | - 一键删除功能 在需求中非常常见,现将其封装后更加方便使用 49 | - 可自定义样式程度高(比自带的强大 & 方便),不复杂却能满足一般的`EditText`使用需求 50 | >可自定义样式如下:(注:该样式的设置是系统自带的 `API` 所不具备的) 51 | 52 | 53 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-153064dd032afe4d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 54 | 55 | 56 | ### 3.2 使用简单 57 | 仅需要简单的`xml`属性配置 58 | >下面1节会详细介绍其使用方法 59 | 60 | ### 3.3 二次开发成本低 61 | - 本项目已在 `Github`上开源:[Super_EditText](https://github.com/Carson-Ho/SuperEditText) 62 | - 具备详细的源码分析文档:[Android自定义View:手把手教你做一款简单实用的SuperEditText(一键删除&自定义样式)](http://www.jianshu.com/p/99d9dc5bcffc) 63 | 64 | 所以,在其上做二次开发 & 定制化成本非常低。 65 | 66 | 67 | # 4. 具体使用 68 | 该款[Super_EditText](https://github.com/Carson-Ho/SuperEditText)使用非常简单,仅需2步: 69 | 70 | ### 步骤1:导入控件库 71 | 主要有 `Gradle` & `Maven` 2种方式: 72 | 73 | - 方式1:`Gradle`引入依赖 74 | *build.Gradle* 75 | 76 | ``` 77 | dependencies { 78 | compile 'com.carson_ho:Super_EditText:1.0.0' 79 | } 80 | ``` 81 | 82 | - 方式2:`Maven`引入依赖 83 | *pom.xml* 84 | ``` 85 | 86 | com.carson_ho 87 | Super_EditText 88 | 1.0.0 89 | pom 90 | 91 | ``` 92 | 93 | 94 | ### 步骤2:设置动画属性 95 | - 属性说明 96 | 97 | 98 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-baa414ba395a85f6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 99 | 100 | 101 | - 具体属性设置 102 | 103 | 104 | ![示意图](http://upload-images.jianshu.io/upload_images/944365-622a93d4c1ffcebd.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 105 | 106 | 107 | 108 | - 使用示例 109 | 在`XML`文件中进行设置 110 | *activity_main.xml* 111 | ``` 112 | 139 | ``` 140 | 141 | 142 | *cursortest.xml* 143 | ``` 144 | 145 | 147 | 148 | 149 | 150 | 151 | 152 | ``` 153 | 154 | 155 | 156 | 157 | # 5. 完整Demo地址 158 | [Carson_Ho的Github地址:Super_EditText](https://github.com/Carson-Ho/SuperEditText) 159 | 160 | ![效果图](http://upload-images.jianshu.io/upload_images/944365-10b970da9048907f.gif?imageMogr2/auto-orient/strip) 161 | 162 | 163 | 164 | ## 6. 源码解析 165 | 具体请看文章[Android自定义View:手把手教你做一款简单实用的SuperEditText(一键删除&自定义样式)](http://www.jianshu.com/p/99d9dc5bcffc) 166 | 167 | 168 | 169 | ## 7. 开源协议 170 | 171 | `Super_EditText` 遵循 `MIT` 开源协议 172 | 173 | 174 | ## 8. 贡献代码 175 | - 具体请看:[贡献代码说明](https://github.com/Carson-Ho/SuperEditText/blob/master/CONTRIBUTING.md) 176 | - 关于该开源项目的意见 & 建议可在`Issue`上提出。欢迎 Star ! 177 | 178 | 179 | 180 | ## 9. 版本说明 181 | 2017-08-14 v1.0.0 :完成一键删除 & 自定义样式 182 | 183 | 184 | 185 | # 关于作者 186 | - ID:Carson_Ho 187 | - 简介:CSDN签约作者、简书推荐作者、稀土掘金专栏作者 188 | - E - mail:[carson.ho@foxmail.com](mailto:carson.ho@foxmail.com) 189 | - Github:[https://github.com/Carson-Ho](https://github.com/Carson-Ho) 190 | - CSDN:[http://blog.csdn.net/carson_ho](http://blog.csdn.net/carson_ho) 191 | - 简书:[http://www.jianshu.com/u/383970bef0a0](http://www.jianshu.com/u/383970bef0a0) 192 | - 稀土掘金:[https://juejin.im/user/58d4d9781b69e6006ba65edc](https://juejin.im/user/58d4d9781b69e6006ba65edc) 193 | -------------------------------------------------------------------------------- /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 "scut.carson_ho.superedittext" 8 | minSdkVersion 19 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:25.3.1' 28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 29 | testCompile 'junit:junit:4.12' 30 | compile project(':diy_view') 31 | } 32 | -------------------------------------------------------------------------------- /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 /Users/Carson_Ho/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/scut/carson_ho/superedittext/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.superedittext; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("scut.carson_ho.superedittext", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/scut/carson_ho/superedittext/MainActivity.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.superedittext; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/drawable/back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/cursortest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/password_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/drawable/password_click.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/password_unclick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/drawable/password_unclick.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 17 | 18 | 44 | 45 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #9b9b9b 7 | #1296db 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SuperEditText 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/test/java/scut/carson_ho/superedittext/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.superedittext; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /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.3.1' 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 | -------------------------------------------------------------------------------- /diy_view/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /diy_view/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | 7 | defaultConfig { 8 | minSdkVersion 19 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | compile fileTree(dir: 'libs', include: ['*.jar']) 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 27 | exclude group: 'com.android.support', module: 'support-annotations' 28 | }) 29 | compile 'com.android.support:appcompat-v7:25.3.1' 30 | testCompile 'junit:junit:4.12' 31 | } 32 | -------------------------------------------------------------------------------- /diy_view/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/Carson_Ho/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /diy_view/src/androidTest/java/scut/carson_ho/diy_view/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.diy_view; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("scut.carson_ho.diy_view.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /diy_view/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /diy_view/src/main/java/scut/carson_ho/diy_view/SuperEditText.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.diy_view; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.graphics.Rect; 8 | import android.graphics.drawable.Drawable; 9 | import android.support.v7.widget.AppCompatEditText; 10 | import android.util.AttributeSet; 11 | import android.view.MotionEvent; 12 | import android.widget.TextView; 13 | 14 | import java.lang.reflect.Field; 15 | 16 | /** 17 | * Created by Carson_Ho on 17/8/4. 18 | */ 19 | 20 | public class SuperEditText extends AppCompatEditText { 21 | 22 | /* 23 | * 定义属性变量 24 | * */ 25 | private Paint mPaint; // 画笔 26 | 27 | private int ic_deleteResID; // 删除图标 资源ID 28 | private Drawable ic_delete; // 删除图标 29 | private int delete_x,delete_y,delete_width,delete_height; // 删除图标起点(x,y)、删除图标宽、高(px) 30 | 31 | private int ic_left_clickResID,ic_left_unclickResID; // 左侧图标 资源ID(点击 & 无点击) 32 | private Drawable ic_left_click,ic_left_unclick; // 左侧图标(点击 & 未点击) 33 | private int left_x,left_y,left_width,left_height; // 左侧图标起点(x,y)、左侧图标宽、高(px) 34 | 35 | private int cursor; // 光标 36 | 37 | // 分割线变量 38 | private int lineColor_click,lineColor_unclick;// 点击时 & 未点击颜色 39 | private int color; 40 | private int linePosition; 41 | 42 | 43 | public SuperEditText(Context context) { 44 | super(context); 45 | 46 | } 47 | 48 | public SuperEditText(Context context, AttributeSet attrs) { 49 | super(context, attrs); 50 | init(context, attrs); 51 | } 52 | 53 | public SuperEditText(Context context, AttributeSet attrs, int defStyleAttr) { 54 | super(context, attrs, defStyleAttr); 55 | init(context, attrs); 56 | } 57 | 58 | /** 59 | * 步骤1:初始化属性 60 | */ 61 | 62 | private void init(Context context, AttributeSet attrs) { 63 | 64 | // 获取控件资源 65 | TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SuperEditText); 66 | 67 | /** 68 | * 初始化左侧图标(点击 & 未点击) 69 | */ 70 | 71 | // a. 点击状态的左侧图标 72 | // 1. 获取资源ID 73 | ic_left_clickResID = typedArray.getResourceId(R.styleable.SuperEditText_ic_left_click, R.drawable.ic_left_click); 74 | // 2. 根据资源ID获取图标资源(转化成Drawable对象) 75 | ic_left_click = getResources().getDrawable(ic_left_clickResID); 76 | // 3. 设置图标大小 77 | // 起点(x,y)、宽= left_width、高 = left_height 78 | left_x = typedArray.getInteger(R.styleable.SuperEditText_left_x, 0); 79 | left_y = typedArray.getInteger(R.styleable.SuperEditText_left_y, 0); 80 | left_width = typedArray.getInteger(R.styleable.SuperEditText_left_width, 60); 81 | left_height = typedArray.getInteger(R.styleable.SuperEditText_left_height, 60); 82 | 83 | ic_left_click.setBounds(left_x, left_y,left_width, left_height); 84 | // Drawable.setBounds(x,y,width,height) = 设置Drawable的初始位置、宽和高等信息 85 | // x = 组件在容器X轴上的起点、y = 组件在容器Y轴上的起点、width=组件的长度、height = 组件的高度 86 | 87 | // b. 未点击状态的左侧图标 88 | // 1. 获取资源ID 89 | ic_left_unclickResID = typedArray.getResourceId(R.styleable.SuperEditText_ic_left_unclick, R.drawable.ic_left_unclick); 90 | // 2. 根据资源ID获取图标资源(转化成Drawable对象) 91 | // 3. 设置图标大小(此处默认左侧图标点解 & 未点击状态的大小相同) 92 | ic_left_unclick = getResources().getDrawable(ic_left_unclickResID); 93 | ic_left_unclick.setBounds(left_x, left_y,left_width, left_height); 94 | 95 | 96 | /** 97 | * 初始化删除图标 98 | */ 99 | 100 | // 1. 获取资源ID 101 | ic_deleteResID = typedArray.getResourceId(R.styleable.SuperEditText_ic_delete,R.drawable.delete); 102 | // 2. 根据资源ID获取图标资源(转化成Drawable对象) 103 | ic_delete = getResources().getDrawable(ic_deleteResID); 104 | // 3. 设置图标大小 105 | // 起点(x,y)、宽= left_width、高 = left_height 106 | delete_x = typedArray.getInteger(R.styleable.SuperEditText_delete_x, 0); 107 | delete_y = typedArray.getInteger(R.styleable.SuperEditText_delete_y, 0); 108 | delete_width = typedArray.getInteger(R.styleable.SuperEditText_delete_width, 60); 109 | delete_height = typedArray.getInteger(R.styleable.SuperEditText_delete_height, 60); 110 | ic_delete.setBounds(delete_x, delete_y, delete_width, delete_height); 111 | 112 | /** 113 | * 设置EditText左侧 & 右侧的图片(初始状态仅有左侧图片)) 114 | */ 115 | setCompoundDrawables( ic_left_unclick, null, 116 | null, null); 117 | 118 | // setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom)介绍 119 | // 作用:在EditText上、下、左、右设置图标(相当于android:drawableLeft="" android:drawableRight="") 120 | // 备注:传入的Drawable对象必须已经setBounds(x,y,width,height),即必须设置过初始位置、宽和高等信息 121 | // x:组件在容器X轴上的起点 y:组件在容器Y轴上的起点 width:组件的长度 height:组件的高度 122 | // 若不想在某个地方显示,则设置为null 123 | 124 | // 另外一个相似的方法:setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom) 125 | // 作用:在EditText上、下、左、右设置图标 126 | // 与setCompoundDrawables的区别:setCompoundDrawablesWithIntrinsicBounds()传入的Drawable的宽高=固有宽高(自动通过getIntrinsicWidth()& getIntrinsicHeight()获取) 127 | // 不需要设置setBounds(x,y,width,height) 128 | 129 | /** 130 | * 初始化光标(颜色 & 粗细) 131 | */ 132 | // 原理:通过 反射机制 动态设置光标 133 | // 1. 获取资源ID 134 | cursor = typedArray.getResourceId(R.styleable.SuperEditText_cursor, R.drawable.cursor); 135 | try { 136 | 137 | // 2. 通过反射 获取光标属性 138 | Field f = TextView.class.getDeclaredField("mCursorDrawableRes"); 139 | f.setAccessible(true); 140 | // 3. 传入资源ID 141 | f.set(this, cursor); 142 | 143 | } catch (Exception e) { 144 | e.printStackTrace(); 145 | } 146 | 147 | /** 148 | * 初始化分割线(颜色、粗细、位置) 149 | */ 150 | // 1. 设置画笔 151 | mPaint = new Paint(); 152 | mPaint.setStrokeWidth(2.0f); // 分割线粗细 153 | 154 | // 2. 设置分割线颜色(使用十六进制代码,如#333、#8e8e8e) 155 | int lineColorClick_default = context.getResources().getColor(R.color.lineColor_click); // 默认 = 蓝色#1296db 156 | int lineColorunClick_default = context.getResources().getColor(R.color.lineColor_unclick); // 默认 = 灰色#9b9b9b 157 | lineColor_click = typedArray.getColor(R.styleable.SuperEditText_lineColor_click, lineColorClick_default); 158 | lineColor_unclick = typedArray.getColor(R.styleable.SuperEditText_lineColor_unclick, lineColorunClick_default); 159 | color = lineColor_unclick; 160 | 161 | mPaint.setColor(lineColor_unclick); // 分割线默认颜色 = 灰色 162 | setTextColor(color); // 字体默认颜色 = 灰色 163 | 164 | // 3. 分割线位置 165 | linePosition = typedArray.getInteger(R.styleable.SuperEditText_linePosition, 1); 166 | // 消除自带下划线 167 | setBackground(null); 168 | 169 | 170 | } 171 | 172 | /** 173 | * 复写EditText本身的方法:onTextChanged() 174 | * 调用时刻:当输入框内容变化时 175 | */ 176 | @Override 177 | protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { 178 | super.onTextChanged(text, start, lengthBefore, lengthAfter); 179 | setDeleteIconVisible(hasFocus() && text.length() > 0,hasFocus()); 180 | // hasFocus()返回是否获得EditTEXT的焦点,即是否选中 181 | // setDeleteIconVisible() = 根据传入的是否选中 & 是否有输入来判断是否显示删除图标->>关注1 182 | } 183 | 184 | /** 185 | * 复写EditText本身的方法:onFocusChanged() 186 | * 调用时刻:焦点发生变化时 187 | */ 188 | @Override 189 | protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { 190 | super.onFocusChanged(focused, direction, previouslyFocusedRect); 191 | setDeleteIconVisible(focused && length() > 0,focused); 192 | // focused = 是否获得焦点 193 | // 同样根据setDeleteIconVisible()判断是否要显示删除图标->>关注1 194 | } 195 | 196 | 197 | /** 198 | * 作用:对删除图标区域设置为"点击 即 清空搜索框内容" 199 | * 原理:当手指抬起的位置在删除图标的区域,即视为点击了删除图标 = 清空搜索框内容 200 | */ 201 | @Override 202 | public boolean onTouchEvent(MotionEvent event) { 203 | 204 | // 原理:当手指抬起的位置在删除图标的区域,即视为点击了删除图标 = 清空搜索框内容 205 | switch (event.getAction()) { 206 | // 判断动作 = 手指抬起时 207 | case MotionEvent.ACTION_UP: 208 | Drawable drawable = ic_delete; 209 | 210 | if (drawable != null && event.getX() <= (getWidth() - getPaddingRight()) 211 | && event.getX() >= (getWidth() - getPaddingRight() - drawable.getBounds().width())) { 212 | 213 | // 判断条件说明 214 | // event.getX() :抬起时的位置坐标 215 | // getWidth():控件的宽度 216 | // getPaddingRight():删除图标图标右边缘至EditText控件右边缘的距离 217 | // 即:getWidth() - getPaddingRight() = 删除图标的右边缘坐标 = X1 218 | // getWidth() - getPaddingRight() - drawable.getBounds().width() = 删除图标左边缘的坐标 = X2 219 | // 所以X1与X2之间的区域 = 删除图标的区域 220 | // 当手指抬起的位置在删除图标的区域(X2= 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /diy_view/src/main/res/drawable/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/diy_view/src/main/res/drawable/delete.png -------------------------------------------------------------------------------- /diy_view/src/main/res/drawable/delete_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/diy_view/src/main/res/drawable/delete_click.png -------------------------------------------------------------------------------- /diy_view/src/main/res/drawable/ic_left_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/diy_view/src/main/res/drawable/ic_left_click.png -------------------------------------------------------------------------------- /diy_view/src/main/res/drawable/ic_left_unclick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/diy_view/src/main/res/drawable/ic_left_unclick.png -------------------------------------------------------------------------------- /diy_view/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /diy_view/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #FF4081 7 | #000000 8 | #1296db 9 | #9b9b9b 10 | 11 | -------------------------------------------------------------------------------- /diy_view/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DIY_View 3 | 4 | -------------------------------------------------------------------------------- /diy_view/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /diy_view/src/test/java/scut/carson_ho/diy_view/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package scut.carson_ho.diy_view; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /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/Carson-Ho/SuperEditText/53bdf21a202e66414e23fbabc3ef06f4b6393de5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 04 15:20:17 CST 2017 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-3.3-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 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':diy_view' 2 | --------------------------------------------------------------------------------