Compare commits
10 Commits
370609c7aa
...
3db397ef2a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3db397ef2a | ||
|
|
d2f0bd3ed4 | ||
|
|
88d66b068e | ||
|
|
9f7dfcd8c3 | ||
|
|
49f205e01b | ||
|
|
c9ac98d09d | ||
|
|
9f90fe7dda | ||
|
|
6e093130a8 | ||
|
|
87fd6b3a1c | ||
|
|
6a2f7a1a85 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,8 +1,7 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/workspace.xml
|
/.idea
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
|
|||||||
22
.idea/compiler.xml
generated
22
.idea/compiler.xml
generated
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<resourceExtensions />
|
|
||||||
<wildcardResourcePatterns>
|
|
||||||
<entry name="!?*.java" />
|
|
||||||
<entry name="!?*.form" />
|
|
||||||
<entry name="!?*.class" />
|
|
||||||
<entry name="!?*.groovy" />
|
|
||||||
<entry name="!?*.scala" />
|
|
||||||
<entry name="!?*.flex" />
|
|
||||||
<entry name="!?*.kt" />
|
|
||||||
<entry name="!?*.clj" />
|
|
||||||
<entry name="!?*.aj" />
|
|
||||||
</wildcardResourcePatterns>
|
|
||||||
<annotationProcessing>
|
|
||||||
<profile default="true" name="Default" enabled="false">
|
|
||||||
<processorPath useClasspath="true" />
|
|
||||||
</profile>
|
|
||||||
</annotationProcessing>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
3
.idea/copyright/profiles_settings.xml
generated
3
.idea/copyright/profiles_settings.xml
generated
@@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
||||||
19
.idea/gradle.xml
generated
19
.idea/gradle.xml
generated
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
<option value="$PROJECT_DIR$/app" />
|
|
||||||
<option value="$PROJECT_DIR$/vcedittext-lib" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
8
.idea/markdown-exported-files.xml
generated
8
.idea/markdown-exported-files.xml
generated
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="MarkdownExportedFiles">
|
|
||||||
<htmlFiles />
|
|
||||||
<imageFiles />
|
|
||||||
<otherFiles />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
71
.idea/markdown-navigator.xml
generated
71
.idea/markdown-navigator.xml
generated
@@ -1,71 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="MarkdownProjectSettings">
|
|
||||||
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true">
|
|
||||||
<PanelProvider>
|
|
||||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
|
|
||||||
</PanelProvider>
|
|
||||||
</PreviewSettings>
|
|
||||||
<ParserSettings gitHubSyntaxChange="false">
|
|
||||||
<PegdownExtensions>
|
|
||||||
<option name="ABBREVIATIONS" value="false" />
|
|
||||||
<option name="ANCHORLINKS" value="true" />
|
|
||||||
<option name="ASIDE" value="false" />
|
|
||||||
<option name="ATXHEADERSPACE" value="true" />
|
|
||||||
<option name="AUTOLINKS" value="true" />
|
|
||||||
<option name="DEFINITIONS" value="false" />
|
|
||||||
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
|
|
||||||
<option name="FENCED_CODE_BLOCKS" value="true" />
|
|
||||||
<option name="FOOTNOTES" value="false" />
|
|
||||||
<option name="HARDWRAPS" value="false" />
|
|
||||||
<option name="INSERTED" value="false" />
|
|
||||||
<option name="QUOTES" value="false" />
|
|
||||||
<option name="RELAXEDHRULES" value="true" />
|
|
||||||
<option name="SMARTS" value="false" />
|
|
||||||
<option name="STRIKETHROUGH" value="true" />
|
|
||||||
<option name="SUBSCRIPT" value="false" />
|
|
||||||
<option name="SUPERSCRIPT" value="false" />
|
|
||||||
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
|
|
||||||
<option name="SUPPRESS_INLINE_HTML" value="false" />
|
|
||||||
<option name="TABLES" value="true" />
|
|
||||||
<option name="TASKLISTITEMS" value="true" />
|
|
||||||
<option name="TOC" value="false" />
|
|
||||||
<option name="WIKILINKS" value="true" />
|
|
||||||
</PegdownExtensions>
|
|
||||||
<ParserOptions>
|
|
||||||
<option name="COMMONMARK_LISTS" value="true" />
|
|
||||||
<option name="DUMMY" value="false" />
|
|
||||||
<option name="EMOJI_SHORTCUTS" value="true" />
|
|
||||||
<option name="FLEXMARK_FRONT_MATTER" value="false" />
|
|
||||||
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
|
|
||||||
<option name="GFM_TABLE_RENDERING" value="true" />
|
|
||||||
<option name="GITBOOK_URL_ENCODING" value="false" />
|
|
||||||
<option name="GITHUB_EMOJI_URL" value="false" />
|
|
||||||
<option name="GITHUB_LISTS" value="false" />
|
|
||||||
<option name="GITHUB_WIKI_LINKS" value="true" />
|
|
||||||
<option name="JEKYLL_FRONT_MATTER" value="false" />
|
|
||||||
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
|
|
||||||
</ParserOptions>
|
|
||||||
</ParserSettings>
|
|
||||||
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
|
|
||||||
<GeneratorProvider>
|
|
||||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
|
|
||||||
</GeneratorProvider>
|
|
||||||
<headerTop />
|
|
||||||
<headerBottom />
|
|
||||||
<bodyTop />
|
|
||||||
<bodyBottom />
|
|
||||||
</HtmlSettings>
|
|
||||||
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
|
|
||||||
<StylesheetProvider>
|
|
||||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
|
|
||||||
</StylesheetProvider>
|
|
||||||
<ScriptProviders />
|
|
||||||
<cssText />
|
|
||||||
</CssSettings>
|
|
||||||
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
|
|
||||||
<LinkMapSettings>
|
|
||||||
<textMaps />
|
|
||||||
</LinkMapSettings>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
3
.idea/markdown-navigator/profiles_settings.xml
generated
3
.idea/markdown-navigator/profiles_settings.xml
generated
@@ -1,3 +0,0 @@
|
|||||||
<component name="MarkdownNavigator.ProfileManager">
|
|
||||||
<settings default="" pdf-export="" />
|
|
||||||
</component>
|
|
||||||
86
.idea/misc.xml
generated
86
.idea/misc.xml
generated
@@ -1,86 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="EntryPointsManager">
|
|
||||||
<entry_points version="2.0" />
|
|
||||||
</component>
|
|
||||||
<component name="NullableNotNullManager">
|
|
||||||
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
|
||||||
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
|
||||||
<option name="myNullables">
|
|
||||||
<value>
|
|
||||||
<list size="4">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
|
||||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
|
||||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="myNotNulls">
|
|
||||||
<value>
|
|
||||||
<list size="4">
|
|
||||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
|
||||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
|
||||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
|
||||||
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
|
||||||
</list>
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Class structureJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Code maturity issuesJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Java</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Java language level migration aidsJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Javadoc issuesJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Performance issuesJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>TestNGJava</id>
|
|
||||||
</State>
|
|
||||||
<State>
|
|
||||||
<id>Threading issuesJava</id>
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>Android</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
|
||||||
<OptionsSetting value="true" id="Add" />
|
|
||||||
<OptionsSetting value="true" id="Remove" />
|
|
||||||
<OptionsSetting value="true" id="Checkout" />
|
|
||||||
<OptionsSetting value="true" id="Update" />
|
|
||||||
<OptionsSetting value="true" id="Status" />
|
|
||||||
<OptionsSetting value="true" id="Edit" />
|
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
13
.idea/modules.xml
generated
13
.idea/modules.xml
generated
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/VercodeEditText.iml" filepath="$PROJECT_DIR$/VercodeEditText.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/VercodeEditText.iml" filepath="$PROJECT_DIR$/VercodeEditText.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/vcedittext-lib/vcedittext-lib.iml" filepath="$PROJECT_DIR$/vcedittext-lib/vcedittext-lib.iml" />
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/vcedittext-lib/vcedittext-lib.iml" filepath="$PROJECT_DIR$/vcedittext-lib/vcedittext-lib.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
12
.idea/runConfigurations.xml
generated
12
.idea/runConfigurations.xml
generated
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RunConfigurationProducerService">
|
|
||||||
<option name="ignoredProducers">
|
|
||||||
<set>
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
12
README-CN.md
12
README-CN.md
@@ -18,6 +18,7 @@
|
|||||||
- [x] **提供输入内容的监听器**
|
- [x] **提供输入内容的监听器**
|
||||||
- [x] **高度自适配**
|
- [x] **高度自适配**
|
||||||
- [x] **属性自定义配置**
|
- [x] **属性自定义配置**
|
||||||
|
- [x] **光标属性自定义**
|
||||||
|
|
||||||
## 版本
|
## 版本
|
||||||
名称|SlideMenuLayout
|
名称|SlideMenuLayout
|
||||||
@@ -43,7 +44,7 @@ repositories {
|
|||||||
```
|
```
|
||||||
第二步,添加至module的build.gradle文件中
|
第二步,添加至module的build.gradle文件中
|
||||||
```gradle
|
```gradle
|
||||||
compile 'com.justkiddingbaby:vercodeedittext:最新版本'
|
'com.justkiddingbaby:vercodeedittext:最新版本'
|
||||||
```
|
```
|
||||||
|
|
||||||
## 属性说明
|
## 属性说明
|
||||||
@@ -55,6 +56,9 @@ compile 'com.justkiddingbaby:vercodeedittext:最新版本'
|
|||||||
[bottomLineNormalColor](/vcedittext-lib/src/main/res/values/attrs.xml)|底线未选中状态下的颜色|reference
|
[bottomLineNormalColor](/vcedittext-lib/src/main/res/values/attrs.xml)|底线未选中状态下的颜色|reference
|
||||||
[bottomLineHeight](/vcedittext-lib/src/main/res/values/attrs.xml)|底线高度|dimension
|
[bottomLineHeight](/vcedittext-lib/src/main/res/values/attrs.xml)|底线高度|dimension
|
||||||
[selectedBackgroundColor](/vcedittext-lib/src/main/res/values/attrs.xml)|选中的背景颜色|reference
|
[selectedBackgroundColor](/vcedittext-lib/src/main/res/values/attrs.xml)|选中的背景颜色|reference
|
||||||
|
[cursorDuration](/vcedittext-lib/src/main/res/values/attrs.xml)|光标闪烁间隔时间|integer
|
||||||
|
[cursorColor](/vcedittext-lib/src/main/res/values/attrs.xml)|光标颜色|integer
|
||||||
|
[cursorWidth](/vcedittext-lib/src/main/res/values/attrs.xml)|光标宽度|integer
|
||||||
|
|
||||||
## 方法说明
|
## 方法说明
|
||||||
返回值|方法|说明
|
返回值|方法|说明
|
||||||
@@ -86,6 +90,12 @@ void|[setOnVerificationCodeChangedListener(OnVerificationCodeChangedListener lis
|
|||||||
```
|
```
|
||||||
|
|
||||||
## 发布历史
|
## 发布历史
|
||||||
|
#### v1.1.0 (2018/11/1)
|
||||||
|
1、添加光标属性的支持.
|
||||||
|
#### v1.0.5(2017/12/5)
|
||||||
|
1、修复在点击控件时候可以遇到的Bug
|
||||||
|
#### v1.0.4(2017/10/14)
|
||||||
|
1、在AndroidManifest.xml中移除label节点.
|
||||||
#### v1.0.3(2017/8/15)
|
#### v1.0.3(2017/8/15)
|
||||||
1、让接口类VerificationAction变为public.
|
1、让接口类VerificationAction变为public.
|
||||||
#### v1.0.2(2017/6/29)
|
#### v1.0.2(2017/6/29)
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -19,6 +19,7 @@ Prevent input overflow.
|
|||||||
- [x] **Provide input value listener**
|
- [x] **Provide input value listener**
|
||||||
- [x] **Layout height is auto adjust**
|
- [x] **Layout height is auto adjust**
|
||||||
- [x] **Attributes can be configured for customization**
|
- [x] **Attributes can be configured for customization**
|
||||||
|
- [x] **Custom cursor style**
|
||||||
|
|
||||||
## Version
|
## Version
|
||||||
name|VercodeEditText
|
name|VercodeEditText
|
||||||
@@ -44,7 +45,7 @@ repositories {
|
|||||||
```
|
```
|
||||||
Second. add to module build.gradle
|
Second. add to module build.gradle
|
||||||
```gradle
|
```gradle
|
||||||
compile 'com.justkiddingbaby:vercodeedittext:the latest version'
|
'com.justkiddingbaby:vercodeedittext:the latest version'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Attributes instruction
|
## Attributes instruction
|
||||||
@@ -56,6 +57,9 @@ attribute|instruction|value
|
|||||||
[bottomLineNormalColor](/vcedittext-lib/src/main/res/values/attrs.xml)|the color of bottom line is normal status|reference
|
[bottomLineNormalColor](/vcedittext-lib/src/main/res/values/attrs.xml)|the color of bottom line is normal status|reference
|
||||||
[bottomLineHeight](/vcedittext-lib/src/main/res/values/attrs.xml)|the height of bottom line|dimension
|
[bottomLineHeight](/vcedittext-lib/src/main/res/values/attrs.xml)|the height of bottom line|dimension
|
||||||
[selectedBackgroundColor](/vcedittext-lib/src/main/res/values/attrs.xml)|the background color of verification code is select status|reference
|
[selectedBackgroundColor](/vcedittext-lib/src/main/res/values/attrs.xml)|the background color of verification code is select status|reference
|
||||||
|
[cursorDuration](/vcedittext-lib/src/main/res/values/attrs.xml)|the duration of cursor blink|integer
|
||||||
|
[cursorColor](/vcedittext-lib/src/main/res/values/attrs.xml)|the color of cursor|integer
|
||||||
|
[cursorWidth](/vcedittext-lib/src/main/res/values/attrs.xml)|the width of cursor|integer
|
||||||
|
|
||||||
## Function instruction
|
## Function instruction
|
||||||
return|function name|instruction
|
return|function name|instruction
|
||||||
@@ -87,6 +91,12 @@ void|[setOnVerificationCodeChangedListener(OnVerificationCodeChangedListener lis
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Release history
|
## Release history
|
||||||
|
#### v1.1.0 (2018/11/1)
|
||||||
|
1、Add cursor support.
|
||||||
|
#### v1.0.5(2017/12/5)
|
||||||
|
1、Fix the bug that could appear when the view is pressed.
|
||||||
|
#### v1.0.4(2017/10/14)
|
||||||
|
1、Remove label element at AndroidManifest.xml.
|
||||||
#### v1.0.3(2017/8/15)
|
#### v1.0.3(2017/8/15)
|
||||||
1、make interface class VerificationAction public.
|
1、make interface class VerificationAction public.
|
||||||
#### v1.0.2(2017/6/29)
|
#### v1.0.2(2017/6/29)
|
||||||
|
|||||||
@@ -7,25 +7,27 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.jkb.vcedittext.VerificationCodeEditText
|
<com.jkb.vcedittext.VerificationCodeEditText
|
||||||
|
android:id="@+id/am_et"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="20dp"
|
android:layout_margin="20dp"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:text="123"
|
android:text="123"
|
||||||
android:id="@+id/am_et"
|
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:textSize="40sp"
|
android:textSize="40sp"
|
||||||
app:bottomLineHeight="2dp"
|
app:bottomLineHeight="2dp"
|
||||||
app:bottomLineNormalColor="@color/gravy_light"
|
app:bottomLineNormalColor="@color/gravy_light"
|
||||||
app:bottomLineSelectedColor="@color/colorAccent"
|
app:bottomLineSelectedColor="@color/colorAccent"
|
||||||
|
app:cursorColor="@android:color/holo_purple"
|
||||||
app:figures="4"
|
app:figures="4"
|
||||||
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
||||||
app:verCodeMargin="10dp" />
|
app:verCodeMargin="10dp"/>
|
||||||
|
|
||||||
<com.jkb.vcedittext.VerificationCodeEditText
|
<com.jkb.vcedittext.VerificationCodeEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="20dp"
|
android:layout_margin="20dp"
|
||||||
|
android:cursorVisible="false"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
android:text="1234"
|
android:text="1234"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
@@ -35,7 +37,7 @@
|
|||||||
app:bottomLineSelectedColor="@color/colorAccent"
|
app:bottomLineSelectedColor="@color/colorAccent"
|
||||||
app:figures="5"
|
app:figures="5"
|
||||||
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
||||||
app:verCodeMargin="10dp" />
|
app:verCodeMargin="10dp"/>
|
||||||
|
|
||||||
<com.jkb.vcedittext.VerificationCodeEditText
|
<com.jkb.vcedittext.VerificationCodeEditText
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -48,8 +50,10 @@
|
|||||||
app:bottomLineHeight="2dp"
|
app:bottomLineHeight="2dp"
|
||||||
app:bottomLineNormalColor="@color/gravy_light"
|
app:bottomLineNormalColor="@color/gravy_light"
|
||||||
app:bottomLineSelectedColor="@color/colorAccent"
|
app:bottomLineSelectedColor="@color/colorAccent"
|
||||||
|
app:cursorColor="@android:color/white"
|
||||||
|
app:cursorWidth="2dp"
|
||||||
app:figures="6"
|
app:figures="6"
|
||||||
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
app:selectedBackgroundColor="@color/colorPrimary_alpha33"
|
||||||
app:verCodeMargin="10dp" />
|
app:verCodeMargin="10dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ ext {
|
|||||||
]
|
]
|
||||||
|
|
||||||
vercode = [
|
vercode = [
|
||||||
publishCode : 4,
|
publishCode : 7,
|
||||||
publishVersion: "1.0.3",
|
publishVersion: "1.1.0",
|
||||||
|
|
||||||
userOrg : 'jkb',
|
userOrg : 'jkb',
|
||||||
groupId : 'com.justkiddingbaby',
|
groupId : 'com.justkiddingbaby',
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
|
||||||
package="com.jkb.vcedittext">
|
package="com.jkb.vcedittext">
|
||||||
|
|
||||||
<application
|
<application>
|
||||||
android:label="@string/app_name">
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
@@ -12,7 +13,12 @@ import android.text.TextWatcher;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,6 +28,7 @@ import android.view.WindowManager;
|
|||||||
|
|
||||||
public class VerificationCodeEditText extends android.support.v7.widget.AppCompatEditText implements
|
public class VerificationCodeEditText extends android.support.v7.widget.AppCompatEditText implements
|
||||||
VerificationAction, TextWatcher {
|
VerificationAction, TextWatcher {
|
||||||
|
private static final int DEFAULT_CURSOR_DURATION = 400;
|
||||||
|
|
||||||
private int mFigures;//需要输入的位数
|
private int mFigures;//需要输入的位数
|
||||||
private int mVerCodeMargin;//验证码之间的间距
|
private int mVerCodeMargin;//验证码之间的间距
|
||||||
@@ -29,6 +36,9 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
private int mBottomNormalColor;//未选中的颜色
|
private int mBottomNormalColor;//未选中的颜色
|
||||||
private float mBottomLineHeight;//底线的高度
|
private float mBottomLineHeight;//底线的高度
|
||||||
private int mSelectedBackgroundColor;//选中的背景颜色
|
private int mSelectedBackgroundColor;//选中的背景颜色
|
||||||
|
private int mCursorWidth;//光标宽度
|
||||||
|
private int mCursorColor;//光标颜色
|
||||||
|
private int mCursorDuration;//光标闪烁间隔
|
||||||
|
|
||||||
private OnVerificationCodeChangedListener onCodeChangedListener;
|
private OnVerificationCodeChangedListener onCodeChangedListener;
|
||||||
private int mCurrentPosition = 0;
|
private int mCurrentPosition = 0;
|
||||||
@@ -37,6 +47,12 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
private Paint mNormalBackgroundPaint;
|
private Paint mNormalBackgroundPaint;
|
||||||
private Paint mBottomSelectedPaint;
|
private Paint mBottomSelectedPaint;
|
||||||
private Paint mBottomNormalPaint;
|
private Paint mBottomNormalPaint;
|
||||||
|
private Paint mCursorPaint;
|
||||||
|
|
||||||
|
// 控制光标闪烁
|
||||||
|
private boolean isCursorShowing;
|
||||||
|
private TimerTask mCursorTimerTask;
|
||||||
|
private Timer mCursorTimer;
|
||||||
|
|
||||||
public VerificationCodeEditText(Context context) {
|
public VerificationCodeEditText(Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -51,6 +67,7 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
initAttrs(attrs);
|
initAttrs(attrs);
|
||||||
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent));//防止出现下划线
|
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent));//防止出现下划线
|
||||||
initPaint();
|
initPaint();
|
||||||
|
initCursorTimer();
|
||||||
setFocusableInTouchMode(true);
|
setFocusableInTouchMode(true);
|
||||||
super.addTextChangedListener(this);
|
super.addTextChangedListener(this);
|
||||||
}
|
}
|
||||||
@@ -70,6 +87,12 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
mBottomNormalPaint.setColor(mBottomNormalColor);
|
mBottomNormalPaint.setColor(mBottomNormalColor);
|
||||||
mBottomSelectedPaint.setStrokeWidth(mBottomLineHeight);
|
mBottomSelectedPaint.setStrokeWidth(mBottomLineHeight);
|
||||||
mBottomNormalPaint.setStrokeWidth(mBottomLineHeight);
|
mBottomNormalPaint.setStrokeWidth(mBottomLineHeight);
|
||||||
|
|
||||||
|
mCursorPaint = new Paint();
|
||||||
|
mCursorPaint.setAntiAlias(true);
|
||||||
|
mCursorPaint.setColor(mCursorColor);
|
||||||
|
mCursorPaint.setStyle(Paint.Style.FILL_AND_STROKE);
|
||||||
|
mCursorPaint.setStrokeWidth(mCursorWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -87,13 +110,46 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
dp2px(5));
|
dp2px(5));
|
||||||
mSelectedBackgroundColor = ta.getColor(R.styleable.VerCodeEditText_selectedBackgroundColor,
|
mSelectedBackgroundColor = ta.getColor(R.styleable.VerCodeEditText_selectedBackgroundColor,
|
||||||
getColor(android.R.color.darker_gray));
|
getColor(android.R.color.darker_gray));
|
||||||
|
mCursorWidth = (int) ta.getDimension(R.styleable.VerCodeEditText_cursorWidth, dp2px(1));
|
||||||
|
mCursorColor = ta.getColor(R.styleable.VerCodeEditText_cursorColor, getColor(android.R.color.darker_gray));
|
||||||
|
mCursorDuration = ta.getInteger(R.styleable.VerCodeEditText_cursorDuration, DEFAULT_CURSOR_DURATION);
|
||||||
ta.recycle();
|
ta.recycle();
|
||||||
|
|
||||||
|
// force LTR because of bug: https://github.com/JustKiddingBaby/VercodeEditText/issues/4
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
setLayoutDirection(LAYOUT_DIRECTION_LTR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initCursorTimer() {
|
||||||
|
mCursorTimerTask = new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 通过光标间歇性显示实现闪烁效果
|
||||||
|
isCursorShowing = !isCursorShowing;
|
||||||
|
postInvalidate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mCursorTimer = new Timer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttachedToWindow() {
|
||||||
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
|
// 启动定时任务,定时刷新实现光标闪烁
|
||||||
|
mCursorTimer.scheduleAtFixedRate(mCursorTimerTask, 0, mCursorDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDetachedFromWindow() {
|
||||||
|
super.onDetachedFromWindow();
|
||||||
|
mCursorTimer.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
final public void setCursorVisible(boolean visible) {
|
final public void setCursorVisible(boolean visible) {
|
||||||
super.setCursorVisible(false);//隐藏光标的显示
|
super.setCursorVisible(visible);//隐藏光标的显示
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,6 +176,17 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
setMeasuredDimension(widthResult, heightResult);
|
setMeasuredDimension(widthResult, heightResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
|
requestFocus();
|
||||||
|
setSelection(getText().length());
|
||||||
|
showKeyBoard(getContext());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.onTouchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
mCurrentPosition = getText().length();
|
mCurrentPosition = getText().length();
|
||||||
@@ -165,6 +232,16 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
}
|
}
|
||||||
canvas.restore();
|
canvas.restore();
|
||||||
}
|
}
|
||||||
|
//绘制光标
|
||||||
|
if (!isCursorShowing && isCursorVisible() && mCurrentPosition < mFigures && hasFocus()) {
|
||||||
|
canvas.save();
|
||||||
|
int startX = mCurrentPosition * (width + mVerCodeMargin) + width / 2;
|
||||||
|
int startY = height / 4;
|
||||||
|
int endX = startX;
|
||||||
|
int endY = height - height / 4;
|
||||||
|
canvas.drawLine(startX, startY, endX, endY, mCursorPaint);
|
||||||
|
canvas.restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -260,4 +337,9 @@ public class VerificationCodeEditText extends android.support.v7.widget.AppCompa
|
|||||||
wm.getDefaultDisplay().getMetrics(metrics);
|
wm.getDefaultDisplay().getMetrics(metrics);
|
||||||
return metrics.widthPixels;
|
return metrics.widthPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showKeyBoard(Context context) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,8 @@
|
|||||||
<attr name="bottomLineNormalColor" format="reference" />
|
<attr name="bottomLineNormalColor" format="reference" />
|
||||||
<attr name="bottomLineHeight" format="dimension" />
|
<attr name="bottomLineHeight" format="dimension" />
|
||||||
<attr name="selectedBackgroundColor" format="reference" />
|
<attr name="selectedBackgroundColor" format="reference" />
|
||||||
|
<attr name="cursorDuration" format="integer" />
|
||||||
|
<attr name="cursorWidth" format="dimension" />
|
||||||
|
<attr name="cursorColor" format="color|reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user