上传maven

This commit is contained in:
吃苹果的猫
2017-11-02 15:18:07 +08:00
parent 3f839b803b
commit c58c0b2ceb
6 changed files with 246 additions and 12 deletions

View File

@@ -0,0 +1,36 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
<option name="TOP_LEVEL_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="INNER_CLASS_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="METHOD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
</value>
</option>
<option name="FIELD_OPTIONS">
<value>
<option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
<option name="REQUIRED_TAGS" value="" />
</value>
</option>
<option name="IGNORE_DEPRECATED" value="false" />
<option name="IGNORE_JAVADOC_PERIOD" value="true" />
<option name="IGNORE_DUPLICATED_THROWS" value="false" />
<option name="IGNORE_POINT_TO_ITSELF" value="false" />
<option name="myAdditionalJavadocTags" value="package,filename,date" />
</inspection_tool>
</profile>
</component>

View File

@@ -8,8 +8,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

View File

@@ -2,12 +2,25 @@ package com.jyn.vcview.simple;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.jyn.vcview.VerificationCodeView;
public class MainActivity extends AppCompatActivity {
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VerificationCodeView verificationcodeview = findViewById(R.id.verificationcodeview);
textView = findViewById(R.id.text);
verificationcodeview.setOnCodeFinishListener(new VerificationCodeView.OnCodeFinishListener() {
@Override
public void onComplete(String content) {
textView.setText(content);
}
});
}
}

View File

@@ -4,17 +4,28 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.jyn.vcview.simple.MainActivity">
<com.jyn.vcview.VerificationCodeView
android:id="@+id/verificationcodeview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:gravity="center"
android:orientation="horizontal"
app:vcv_et_bg="@drawable/et_login_code"
app:vcv_et_cursor="@drawable/et_cursor"
app:vcv_et_inputType="text"
app:vcv_et_number="6"
app:vcv_et_inputType="number"
app:vcv_et_number="4"
app:vcv_et_text_color="@android:color/black"
app:vcv_et_text_size="6sp" />
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:textSize="20sp" />
</LinearLayout>

View File

@@ -3,8 +3,6 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
@@ -32,3 +30,116 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
//项目主页--项目的GitHub地址
def siteUrl = 'https://github.com/jiaoyaning/VerificationCodeView'
//项目的git地址
def gitUrl = 'https://github.com/jiaoyaning/VerificationCodeView.git'
//发布到JCenter上的项目名字compile引用时的第2部分项目名
def libName = "verificationcodeview"
//compile引用时的第1部分
group = "com.jyn.verificationcodeview"
// 版本号,//compile引用时的最后部分项目名下次更新是只需要更改版本号即可
version = "1.0.0"
//生成源文件
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
//生成Javadoc文档
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
//文档打包成jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
//拷贝javadoc文件
task copyDoc(type: Copy) {
from "${buildDir}/docs/"
into "docs"
}
//上传到JCenter所需要的源码文件
artifacts {
archives javadocJar
archives sourcesJar
}
//OM.xml文件
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
//项目描述,自由填写
name 'A square VerificationCodeView on Android'
url siteUrl
licenses {
license {
//开源协议
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
//开发者的个人信息,根据个人信息填写
id 'jyn'
name 'jiaoyaning1210'
email 'jiaoyaning1210@gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
//上传到JCenter
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user") //读取 local.properties 文件里面的 bintray.user
key = properties.getProperty("bintray.apikey") //读取 local.properties 文件里面的 bintray.apikey
configurations = ['archives']
pkg {
//这里的repo值必须要和你创建Maven仓库的时候的名字一样我们前面创建的就是maven
repo = "maven"
//发布到JCenter上的项目名字
name = libName
//项目描述
desc = 'A square VerificationCodeView on Android'
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
javadoc {
options {
//如果你的项目里面有中文注释的话必须将格式设置为UTF-8不然会出现乱码
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
}
}

View File

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
@@ -20,10 +19,10 @@ import android.widget.TextView;
import java.lang.reflect.Field;
/**
* @author jiaoyaning
* @package com.b2cf.nonghe.widget
* @filename VerificationCodeView
* @date 2017/10/31
* jiaoyaning
* com.b2cf.nonghe.widget
* VerificationCodeView
* 2017/10/31
*/
public class VerificationCodeView extends LinearLayout implements TextWatcher, View.OnKeyListener, View.OnFocusChangeListener {
@@ -63,6 +62,70 @@ public class VerificationCodeView extends LinearLayout implements TextWatcher, V
private int mCursorDrawable;
public OnCodeFinishListener getOnCodeFinishListener() {
return onCodeFinishListener;
}
public void setOnCodeFinishListener(OnCodeFinishListener onCodeFinishListener) {
this.onCodeFinishListener = onCodeFinishListener;
}
public int getmEtNumber() {
return mEtNumber;
}
public void setmEtNumber(int mEtNumber) {
this.mEtNumber = mEtNumber;
}
public VCInputType getmEtInputType() {
return mEtInputType;
}
public void setmEtInputType(VCInputType mEtInputType) {
this.mEtInputType = mEtInputType;
}
public int getmEtWidth() {
return mEtWidth;
}
public void setmEtWidth(int mEtWidth) {
this.mEtWidth = mEtWidth;
}
public int getmEtTextColor() {
return mEtTextColor;
}
public void setmEtTextColor(int mEtTextColor) {
this.mEtTextColor = mEtTextColor;
}
public float getmEtTextSize() {
return mEtTextSize;
}
public void setmEtTextSize(float mEtTextSize) {
this.mEtTextSize = mEtTextSize;
}
public int getmEtTextBg() {
return mEtTextBg;
}
public void setmEtTextBg(int mEtTextBg) {
this.mEtTextBg = mEtTextBg;
}
public int getmCursorDrawable() {
return mCursorDrawable;
}
public void setmCursorDrawable(int mCursorDrawable) {
this.mCursorDrawable = mCursorDrawable;
}
public enum VCInputType {
NUMBER,
NUMBERPASSWORD,
@@ -70,7 +133,7 @@ public class VerificationCodeView extends LinearLayout implements TextWatcher, V
TEXTPASSWORD,
}
public VerificationCodeView(Context context, @Nullable AttributeSet attrs) {
public VerificationCodeView(Context context, AttributeSet attrs) {
super(context, attrs);
this.mContext = context;
@SuppressLint({"Recycle", "CustomViewStyleable"})