Skip to content

Commit 385989f

Browse files
committed
add jcenter
1 parent 1bdd5a9 commit 385989f

8 files changed

Lines changed: 125 additions & 45 deletions

File tree

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# CodeEditText
22
验证码,密码输入框,文本支持明文和密码及透明三种形式展示,背景支持下划线,填充色块,边框,透明四种
33

4+
5+
## jcenter 引入
6+
7+
```
8+
implementation 'com.lwj.fork:CodeEditText:1.0.0'
9+
10+
```
11+
12+
413
## 原理
514
>> 继承EditText,测量宽高后,根据每块间距、EditText的宽度以及可输入最大长度计算出每块区域的left top right bottom
615
@@ -48,6 +57,12 @@ none | 什么都不绘制,空白
4857
text | 明文
4958
password | 密码圆点展示
5059

60+
## 代码混淆
61+
62+
```
63+
-keep class com.lwjfork.code.** { *;}
64+
```
65+
5166
## 效果图
5267

5368

app/build.gradle

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
apply plugin: 'com.android.application'
2-
2+
def SLVersion = rootProject.ext.supportLibVersion
33
android {
4-
compileSdkVersion 28
4+
compileSdkVersion rootProject.ext.compileSdkVersion
5+
buildToolsVersion rootProject.ext.buildToolsVersion
6+
7+
58
defaultConfig {
6-
applicationId "com.lwjfork.example"
7-
minSdkVersion 15
8-
targetSdkVersion 28
9+
minSdkVersion rootProject.ext.minSdkVersion
10+
targetSdkVersion rootProject.ext.targetSdkVersion
911
versionCode 1
1012
versionName "1.0"
13+
1114
}
15+
1216
buildTypes {
1317
release {
1418
minifyEnabled false
1519
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1620
}
1721
}
22+
23+
lintOptions {
24+
abortOnError false
25+
}
26+
1827
}
1928

29+
2030
dependencies {
21-
implementation fileTree(include: ['*.jar'], dir: 'libs')
22-
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
23-
implementation project(':library')
31+
compile fileTree(include: ['*.jar'], dir: 'libs')
32+
implementation "com.android.support:appcompat-v7:$SLVersion"
33+
implementation 'com.lwj.fork:CodeEditText:1.0.0'
34+
// implementation project(':CodeEditText')
2435
}

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
android:orientation="vertical">
1414

1515

16-
<EditText
17-
android:layout_width="match_parent"
18-
android:layout_height="100dp"
19-
android:inputType="number"
20-
/>
21-
22-
2316
<com.lwjfork.code.CodeEditText
2417
android:layout_width="match_parent"
2518
android:layout_height="50dp"

build.gradle

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
4+
def gradleVersion = "$DEFAULT_GRADLE_VERSION";
5+
File propertiesFile = file('local.properties');
6+
if (propertiesFile.exists()) {
7+
Properties localProperties = new Properties()
8+
def stream = project.rootProject.file('local.properties').newDataInputStream()
9+
localProperties.load(stream)
10+
def localGradleVersion = localProperties.getProperty('LOCAL_GRADLE_VERSION')
11+
if (localGradleVersion != null) {
12+
gradleVersion = localGradleVersion;
13+
}
14+
15+
stream.close();
16+
}
517
repositories {
6-
google()
718
jcenter()
19+
google()
820
}
921
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.2.1'
11-
12-
13-
// NOTE: Do not place your application dependencies here; they belong
14-
// in the individual module build.gradle files
22+
classpath "com.android.tools.build:gradle:$gradleVersion"
23+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
24+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
1525
}
1626
}
1727

1828
allprojects {
1929
repositories {
20-
google()
2130
jcenter()
31+
maven {url 'https://dl.bintray.com/lwjfork/maven/'}
2232
}
2333
}
24-
25-
task clean(type: Delete) {
26-
delete rootProject.buildDir
34+
tasks.withType(Javadoc) {
35+
options.addStringOption('Xdoclint:none', '-quiet')
36+
options.addStringOption('encoding', 'UTF-8')
37+
options.addStringOption('charSet ', 'UTF-8')
38+
options{
39+
encoding "UTF-8"
40+
charSet 'UTF-8'
41+
links "http://docs.oracle.com/javase/7/docs/api"
42+
}
2743
}
44+
45+
ext {
46+
compileSdkVersion = 28
47+
buildToolsVersion = "26.0.2"
48+
minSdkVersion = 14
49+
targetSdkVersion = 25
50+
supportLibVersion = "25.0.1"
51+
}

gradle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ org.gradle.jvmargs=-Xmx1536m
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1313
# org.gradle.parallel=true
14-
15-
14+
DEFAULT_GRADLE_VERSION=3.0.1

library/build.gradle

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,68 @@
11
apply plugin: 'com.android.library'
2-
2+
def SLVersion = rootProject.ext.supportLibVersion
33
android {
4-
compileSdkVersion 28
5-
4+
compileSdkVersion rootProject.ext.compileSdkVersion
5+
buildToolsVersion rootProject.ext.buildToolsVersion
66

77

88
defaultConfig {
9-
minSdkVersion 15
10-
targetSdkVersion 28
9+
minSdkVersion rootProject.ext.minSdkVersion
10+
targetSdkVersion rootProject.ext.targetSdkVersion
1111
versionCode 1
12-
versionName "1.0"
13-
14-
12+
versionName version
1513
}
16-
1714
buildTypes {
1815
release {
1916
minifyEnabled false
2017
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2118
}
19+
20+
}
21+
lintOptions {
22+
abortOnError false
23+
}
24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
2227
}
2328

29+
dexOptions {
30+
javaMaxHeapSize "8g"
31+
}
2432
}
2533

2634
dependencies {
2735
implementation fileTree(dir: 'libs', include: ['*.jar'])
28-
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
36+
compileOnly "com.android.support:appcompat-v7:$SLVersion"
2937
}
38+
39+
// 这里改成groupId , 比如com.android.support
40+
rootProject.ext.PROJ_GROUP = "com.lwj.fork"
41+
// 这里改成开发者id , 比如
42+
rootProject.ext.DEVELOPER_ID = "lwjfork"
43+
// 这里改成开发者名字 , 比如android
44+
rootProject.ext.DEVELOPER_NAME = "lwjfork"
45+
// 这里改成开发者邮箱,比如[email]someone@android.com[/email]
46+
rootProject.ext.DEVELOPER_EMAIL = "lwjfork@gmail.com"
47+
// 用户名
48+
rootProject.ext.BINTRAY_USER = "lwjfork"
49+
// 这里改成库版本 , 比如22.2.0
50+
rootProject.ext.PROJ_VERSION = "1.0.0"
51+
// 这里改成库名字 , 比如appcompat
52+
rootProject.ext.PROJ_NAME = "CodeEditText"
53+
// 这里改成github地址 , 比如https:github.com/android/appcompat
54+
rootProject.ext.PROJ_WEBSITEURL = "https://github.com/lwjfork/CodeEditText"
55+
// 这里改成issue地址 ,
56+
//比如https:github.com/android/appcompat/issues
57+
rootProject.ext.PROJ_ISSUEURL = "https://github.com/lwjfork/CodeEditText/issues"
58+
// 这里改成版本控制地主 ,
59+
// 比如https:github.com/android/appcompat.git
60+
rootProject.ext.PROJ_VCSURL = "https://github.com/lwjfork/CodeEditText.git"
61+
// 这里改成库的描述信息
62+
rootProject.ext.PROJ_DESCRIPTION = "Password Verify Code"
63+
// 这里改成库的标示 , 比如appcompat - v7
64+
rootProject.ext.PROJ_ARTIFACTID = "CodeEditText"
65+
66+
67+
68+
apply from: "https://raw.githubusercontent.com/lwjfork/scriptlib/master/gradle/bintray.gradle"

library/src/main/java/com/lwjfork/code/CodeEditText.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ public interface OnTextChangedListener {
359359
void onCodeChanged(CharSequence changeText);
360360

361361
/**
362-
* 输入完成
362+
* input complete
363363
*/
364364
void onInputCompleted(CharSequence text);
365365
}
366366

367367
/**
368-
* 监听文本变化,并更改UI
368+
* update UI
369369
*
370370
* @param text
371371
* @param start
@@ -411,7 +411,7 @@ protected void onDetachedFromWindow() {
411411
}
412412

413413
/**
414-
* 销毁Bitmap
414+
* bitmap recycle
415415
*
416416
* @param bitmap
417417
*/
@@ -422,7 +422,7 @@ private void recycleBitmap(Bitmap bitmap) {
422422
}
423423

424424
/**
425-
* 清空所有数据
425+
* clear Text
426426
*/
427427
public void clearContent() {
428428
getEditableText().clear();
@@ -579,7 +579,6 @@ public void setCursorColor(@ColorInt int cursorColor) {
579579
}
580580

581581
/**
582-
* @return
583582
* @see BlockShape
584583
*/
585584
public int getBlockShape() {
@@ -612,15 +611,13 @@ public void setCodeShape(int blockShape) {
612611
}
613612

614613
/**
615-
* @return
616614
* @see CodeInputType
617615
*/
618616
public int getCodeInputType() {
619617
return textDrawer.getCodeInputType();
620618
}
621619

622620
/**
623-
* @return
624621
* @see CodeInputType
625622
*/
626623
public void setCodeInputType(int codeInputType) {

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
include ':app', ':library'
2+
def submoduleProject = project(':library')
3+
submoduleProject.name = 'CodeEditText'

0 commit comments

Comments
 (0)