Skip to content

Commit

Permalink
提交到jcenter
Browse files Browse the repository at this point in the history
  • Loading branch information
hupei committed Jul 11, 2016
1 parent 93c4ba5 commit 58b53eb
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 5 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
###二、效果图
![这里写图片描述](http://img.blog.csdn.net/20160708110951092)

###三、使用
###三、引用
- 使用Gradle构建时添加一下依赖即可:
```javascript
compile 'com.mylhyl:zxingscanner:1.1.1'
```
- 也可以运行Gradle命令
![这里写图片描述](http://img.blog.csdn.net/20160711135615587)

###四、使用
直接在`layout xml`使用`ScannerView`即可

```xml
Expand Down Expand Up @@ -77,14 +85,15 @@ switch (type) {

```java
Bitmap bitmap = QREncode.encodeQR(MainActivity.this,
new QREncode.Builder() .setColor(getResources().getColor(R.color.colorPrimary))//二维码颜色
new QREncode.Builder()
.setColor(getResources().getColor(R.color.colorPrimary))//二维码颜色
.setParsedResultType(ParsedResultType.URI)//二维码类型
.setContents("https://github.com/mylhyl")//二维码内容
.build());
imageView.setImageBitmap(bitmap);
```

###、样式设置
###、样式设置
<table class="table table-bordered table-striped table-condensed">
<tr>
<td>方法名</td>
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}

Expand Down
17 changes: 16 additions & 1 deletion zxing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "3.2.2"
versionName version
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
Expand All @@ -21,4 +21,19 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}

lintOptions {
abortOnError false
}

}
version = "3.2.2"

task makeJar(type: Copy) {
def jarName = 'code-' + version + '.jar'
delete 'build/libs/' + jarName
from('build/intermediates/bundles/release/')
into('build/libs/')
include('classes.jar')
rename('classes.jar', jarName)
}
94 changes: 93 additions & 1 deletion zxingscanner/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

android {
compileSdkVersion 23
Expand All @@ -8,14 +10,104 @@ android {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "4.7.6"
versionName version
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
}
def siteUrl = 'https://github.com/mylhyl/Android-Zxing'
def gitUrl = 'https://github.com/mylhyl/Android-Zxing.git'
group = "com.mylhyl"
version = "1.1.1"

install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
artifactId 'zxingscanner'
name 'android zxing style' //添加项目描述
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 'mylhyl'
name 'mylhylAndroid'
email 'hupei132@qq.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
options.encoding = "UTF-8"
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
}
//配置上传bintray相关信息
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
//读取bintray帐号和密码。
//一般的为了保密和安全性,在项目的local.properties文件中添加两行句话即可:
user = properties.getProperty("BINTRAY_USER")
key = properties.getProperty("BINTRAY_KEY")
configurations = ['archives']
pkg {
repo = "maven" //上传的中央仓库名称
name = "zxingscanner" //上传的项目的名字
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true //是否发布
}
}

task makeJar(type: Copy) {
def jarName = 'zxingscanner-' + version + '.jar'
delete 'build/libs/' + jarName
from('build/intermediates/bundles/release/')
into('build/libs/')
include('classes.jar')
rename('classes.jar', jarName)
exclude('test/', 'androidTest/', 'BuildConfig.class', 'R.class')
exclude { it.name.startsWith('R$'); }
}

dependencies {
Expand Down

0 comments on commit 58b53eb

Please sign in to comment.