Browse Source

提交1.0.8版本,改成androidx版本

yanyi 5 years ago
parent
commit
35695eda32

+ 35 - 18
README.md

@@ -1,38 +1,54 @@
 # BindView
 ## BindView注解封装
-### 使用方法
+## 使用
 
-module 下添加
+### 根目录下build.gradle添加Maven地址
 ~~~
-implementation 'com.yanyi.benyanyi:viewbind:1.0.7'
+repositories {
+        maven {
+            url "http://maven.yanyi.online:8081/nexus/content/repositories/mylove/"
+        }
+    }
+~~~
+### module 下添加
+~~~
+implementation 'com.yanyi.benyanyi:BindView:1.0.8'
 ~~~
-### 使用方法
 
-在Activity中添加
+或者
+~~~
+<dependency>
+  <groupId>com.yanyi.benyanyi</groupId>
+  <artifactId>BindView</artifactId>
+  <version>1.0.8</version>
+  <type>aar</type>
+</dependency>
+~~~
+### 在Activity中添加
 ~~~
 ViewBind.bind(this);
 ~~~
-在Fragment中添加
+### 在Fragment中添加
 ~~~
 ViewBind.bind(view, this);
 ~~~
-单view中绑定
+### 单view中绑定
 ~~~
-ViewBind.bind(view);
+### ViewBind.bind(view);
 ~~~
-在Dialog中添加
+### 在Dialog中添加
 ~~~
 ViewBind.bind(this)
 ~~~
-绑定id
- ~~~
+### 绑定id
+~~~
 @BindView(R.id.xxx)
- ~~~
- 绑定string中对应字符
- ~~~
- @BindString(R.string.xxx)
- ~~~
-添加点击方法
+~~~
+### 绑定string中对应字符
+~~~
+@BindString(R.string.xxx)
+~~~
+### 添加点击方法
 ~~~
 @OnClick({R.id.xxx, R.id.xxx}, isDoubleClick = true, isCheckNet = true, netErrorMsg = "网络错误")
 isDoubleClick 是否可以重复点击判断,默认为false,短时间重复点击有点击事件反应
@@ -40,6 +56,7 @@ isCheckNet 点击事件网络监听,默认为false,点击事件时不判断
 netErrorMsg 网络状态报错提醒,isCheckNet为关闭状态时无反应,默认为“网络错误”,可以自己自定义提醒的值
  ~~~
 ### 更新记录
+* 2020-05-18 更新1.0.8版本,将android support转成androidx支持,并将Maven库存放到个人服务器上
 * 2020-05-07 更新1.0.7版本,添加在自定义dialog中使用注解
 * 2020-04-15 更新1.0.6版本,去除ClickNet注解,将ClickNet注解功能添加至OnClick,并添加能否短时间重复点击判断,添加BindString注解
 * 2019-06-26 更新1.0.4版本,去除重复方法
@@ -47,7 +64,7 @@ netErrorMsg 网络状态报错提醒,isCheckNet为关闭状态时无反应,
 * 2019-05-29 提交1.0.1版本,优化一些已知细节
 * 2018-12-26 提交1.0.0版本
 
-<br/>
+---
 若在使用过程中出现什么问题,可以联系作者<br/>
 作者:演绎<br/>
 QQ:1541612424<br/>

+ 6 - 6
app/build.gradle

@@ -1,14 +1,14 @@
 apply plugin: 'com.android.application'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion 29
     defaultConfig {
         applicationId "com.mylove.bindviewlib"
         minSdkVersion 15
-        targetSdkVersion 28
+        targetSdkVersion 29
         versionCode 1
         versionName "1.0"
-        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     }
     buildTypes {
         debug {
@@ -24,10 +24,10 @@ android {
 
 dependencies {
     implementation fileTree(include: ['*.jar'], dir: 'libs')
-    implementation 'com.android.support:appcompat-v7:28.0.0'
+    implementation 'androidx.appcompat:appcompat:1.0.0'
     testImplementation 'junit:junit:4.12'
-    androidTestImplementation 'com.android.support.test:runner:1.0.2'
-    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
 //    implementation project(':viewbind')
     implementation 'com.yanyi.benyanyi:viewbind:1.0.7'
 }

+ 2 - 2
app/src/androidTest/java/com/mylove/bindviewlib/ExampleInstrumentedTest.java

@@ -1,8 +1,8 @@
 package com.mylove.bindviewlib;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;

+ 2 - 2
app/src/main/java/com/mylove/bindviewlib/IndexActivity.java

@@ -1,8 +1,8 @@
 package com.mylove.bindviewlib;
 
 import android.os.Bundle;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
 import android.util.Log;
 import android.widget.TextView;
 

+ 1 - 1
app/src/main/java/com/mylove/bindviewlib/TestDialog.java

@@ -3,7 +3,7 @@ package com.mylove.bindviewlib;
 import android.app.Dialog;
 import android.content.Context;
 import android.os.Bundle;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
 import android.view.View;
 import android.widget.Button;
 import android.widget.Toast;

+ 3 - 1
build.gradle

@@ -5,11 +5,12 @@ buildscript {
     repositories {
         google()
         jcenter()
+        maven{ url 'http://maven.yanyi.online:8081/nexus/content/repositories/mylove/'}
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:3.2.1'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
-        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.3'
+//        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.3'
         
 
         // NOTE: Do not place your application dependencies here; they belong
@@ -21,6 +22,7 @@ allprojects {
     repositories {
         google()
         jcenter()
+        maven{ url 'http://maven.yanyi.online:8081/nexus/content/repositories/mylove/'}
         //解决中文乱码问题
         tasks.withType(Javadoc) { //兼容中文
             options.addStringOption('Xdoclint:none', '-quiet')

+ 2 - 0
gradle.properties

@@ -6,6 +6,8 @@
 # http://www.gradle.org/docs/current/userguide/build_environment.html
 # Specifies the JVM arguments used for the daemon process.
 # The setting is particularly useful for tweaking memory settings.
+android.enableJetifier=true
+android.useAndroidX=true
 org.gradle.jvmargs=-Xmx1536m
 # When configured, Gradle will run in incubating parallel mode.
 # This option should only be used with decoupled projects. More details, visit

+ 15 - 67
viewbind/bintrayUpload.gradle

@@ -1,80 +1,28 @@
-// 这里添加下面两行代码。
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
+apply plugin: 'maven-publish'
+apply plugin: 'maven'
 
-// 定义两个链接,下面会用到。
-def siteUrl = 'http://www.yanyis.space/yanyi/bindviewlib' // 项目主页。
-def gitUrl = 'http://www.yanyis.space/yanyi/bindviewlib.git' // Git仓库的url。
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: properties.getProperty("POM_URL")) {
+                authentication(userName: properties.getProperty("nexus.user"), password: properties.getProperty("nexus.password"))
+            }
 
-group = "com.yanyi.benyanyi"// 唯一包名,比如compile 'com.ansen.http:okhttpencapsulation:1.0.1'中的com.ansen.http就是这里配置的。
-version = "1.0.7"//项目引用的版本号,比如compile 'com.ansen.http:okhttpencapsulation:1.0.1'中的1.0.1就是这里配置的。
-install {
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom {
-            project {
-                packaging 'jar'
-                // Add your description here
-                name 'android 注解'
-                url siteUrl
-                // Set your license
+            pom.groupId = properties.getProperty("POM_GROUP_ID")
+            pom.artifactId = properties.getProperty("POM_ATRIFACT_ID")
+            pom.version = properties.getProperty("POM_VERSION")
+
+            pom.project {
                 licenses {
                     license {
                         name 'The Apache Software License, Version 2.0'
                         url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                     }
                 }
-                developers {
-                    developer {
-                        id 'benyanyi'     //填写的一些基本信息
-                        name 'benyanyi'
-                        email 'git@yanyi.red'
-                    }
-                }
-                scm {
-                    connection gitUrl
-                    developerConnection gitUrl
-                    url siteUrl
-                }
             }
         }
     }
 }
-task sourcesJar(type: Jar) {
-    from android.sourceSets.main.java.srcDirs
-    classifier = 'sources'
-}
-task javadoc(type: Javadoc) {
-    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
-}
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = properties.getProperty("bintray.user")
-    key = properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = "BindView"
-        name = "BindView"   //发布到JCenter上的项目名字
-        websiteUrl = siteUrl
-        vcsUrl = gitUrl
-        licenses = ["Apache-2.0"]
-        publish = true
-    }
-}
-javadoc { //jav doc采用utf-8编码否则会报“GBK的不可映射字符”错误
-    options{
-        encoding "UTF-8"
-        charSet 'UTF-8'
-    }
-}
 //gradlew bintrayUpload    terminal中输入

+ 6 - 6
viewbind/build.gradle

@@ -1,16 +1,16 @@
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 28
+    compileSdkVersion 29
 
 
     defaultConfig {
         minSdkVersion 15
-        targetSdkVersion 28
+        targetSdkVersion 29
         versionCode 1
         versionName "1.0"
 
-        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 
     }
 
@@ -28,9 +28,9 @@ android {
 dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
 
-    implementation 'com.android.support:appcompat-v7:28.0.0'
+    implementation 'androidx.appcompat:appcompat:1.0.0'
     testImplementation 'junit:junit:4.12'
-    androidTestImplementation 'com.android.support.test:runner:1.0.2'
-    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
 }
 apply from: 'bintrayUpload.gradle'

+ 2 - 2
viewbind/src/androidTest/java/com/mylove/viewbind/ExampleInstrumentedTest.java

@@ -1,8 +1,8 @@
 package com.mylove.viewbind;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;

+ 1 - 1
viewbind/src/main/java/com/benyanyi/viewbind/annotation/BindString.java

@@ -1,6 +1,6 @@
 package com.benyanyi.viewbind.annotation;
 
-import android.support.annotation.StringRes;
+import androidx.annotation.StringRes;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;

+ 1 - 1
viewbind/src/main/java/com/benyanyi/viewbind/annotation/BindView.java

@@ -1,6 +1,6 @@
 package com.benyanyi.viewbind.annotation;
 
-import android.support.annotation.IdRes;
+import androidx.annotation.IdRes;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;

+ 3 - 2
viewbind/src/main/java/com/benyanyi/viewbind/init/ViewInit.java

@@ -2,10 +2,11 @@ package com.benyanyi.viewbind.init;
 
 import android.app.Activity;
 import android.app.Dialog;
-import android.support.annotation.IdRes;
-import android.support.annotation.StringRes;
 import android.view.View;
 
+import androidx.annotation.IdRes;
+import androidx.annotation.StringRes;
+
 /**
  * @author BenYanYi
  * @date 2018/12/26 09:28

+ 0 - 1
viewbind/src/main/java/com/benyanyi/viewbind/inject/ViewInject.java

@@ -86,7 +86,6 @@ public class ViewInject {
             }
         }
     }
-//    Mac⁩ ▸ ⁨应用程序⁩ ▸ ⁨Android Studio⁩ ▸ ⁨Contents⁩ ▸ ⁨gradle⁩
 //    #Gradle
 //    export GRADLE_HOME=/Applications/Android\ Studio.app/Contents/gradle/gradle-4.1
 //    export PATH=$PATH:$GRADLE_HOME/bin