Skip to content

Commit d97ec65

Browse files
committed
更新版本库和支持库,增加新工具类,去除权限引用,改为使用者自己添加所需权限
1 parent be3c6ae commit d97ec65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3087
-76
lines changed

.idea/caches/build_file_checksums.ser

591 Bytes
Binary file not shown.

.idea/codeStyles/Project.xml

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CommonUtil/build.gradle

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ apply plugin: 'com.android.library'
22
//-------------------------上传到jcenter-----------------------
33
apply plugin: 'com.github.dcendents.android-maven'
44
apply plugin: 'com.jfrog.bintray'
5-
version = "1.0.0"//提交到仓库中的版本号
5+
version = "1.0.2"//提交到仓库中的版本号
66
//-------------------------上传到jcenter-----------------------
77

88
android {
9-
compileSdkVersion 25
10-
buildToolsVersion "25.0.3"
9+
compileSdkVersion 28
10+
buildToolsVersion "28.0.3"
1111

1212
defaultConfig {
13-
minSdkVersion 12
14-
targetSdkVersion 25
13+
minSdkVersion 15
14+
targetSdkVersion 28
1515
versionCode 1
1616
versionName "1.0"
1717

@@ -24,38 +24,44 @@ android {
2424
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2525
}
2626
}
27+
lintOptions {
28+
checkReleaseBuilds false
29+
abortOnError false
30+
}
31+
2732
}
2833

2934
dependencies {
30-
final SUPPORT_VERSION = '25.3.1'
31-
compile fileTree(include: ['*.jar'], dir: 'libs')
32-
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
35+
// final SUPPORT_VERSION = '25.3.1'
36+
final SUPPORT_VERSION = '28.0.0'
37+
implementation fileTree(include: ['*.jar'], dir: 'libs')
38+
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
3339
exclude group: 'com.android.support', module: 'support-annotations'
3440
})
3541
// compile 'com.android.support:appcompat-v7:25.3.1'
36-
compile "com.android.support:appcompat-v7:$SUPPORT_VERSION"
37-
compile "com.android.support:design:$SUPPORT_VERSION"
38-
testCompile 'junit:junit:4.12'
39-
42+
implementation "com.android.support:appcompat-v7:$SUPPORT_VERSION"
43+
implementation "com.android.support:design:$SUPPORT_VERSION"
44+
testImplementation 'junit:junit:4.12'
4045
//Fresco图片加载
41-
compile 'com.facebook.fresco:fresco:1.3.0'
46+
implementation 'com.facebook.fresco:fresco:1.3.0'
4247
//Picasso图片加载
43-
compile 'com.squareup.picasso:picasso:2.5.2'
48+
implementation 'com.squareup.picasso:picasso:2.5.2'
4449
//Glide图片加载
45-
compile 'com.github.bumptech.glide:glide:3.7.0'
50+
implementation 'com.github.bumptech.glide:glide:3.7.0'
4651
//KLog
4752
// compile 'com.github.zhaokaiqiang.klog:library:1.5.0'
48-
4953
//编码工具类用到
50-
compile files('libs/BASE64Decoder.jar')
54+
implementation files('libs/BASE64Decoder.jar')
5155
//Webservice网络工具类用到
52-
compile files('libs/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar')
56+
implementation files('libs/ksoap2-android-assembly-3.3.0-jar-with-dependencies.jar')
57+
//gson
58+
implementation 'com.google.code.gson:gson:2.8.6'
5359
}
5460
//-------------------------上传到jcenter-----------------------
5561

5662
def siteUrl = 'https://github.com/caijin199410/CommonUtil.git' // 项目的主页 这个是说明,可随便填
5763
def gitUrl = 'https://github.com/caijin199410/CommonUtil.git' // Git仓库的url 这个是说明,可随便填
58-
group = "com.abrahamcaijin.comonutil" // 这里是groupId ,必须填写 一般填你唯一的包名
64+
group = "com.abrahamcaijin.commonutil" // 这里是groupId ,必须填写 一般填你唯一的包名
5965

6066
install {
6167
repositories.mavenInstaller {
@@ -99,11 +105,13 @@ task javadoc(type: Javadoc) {
99105
charSet 'UTF-8'
100106
author true
101107
version true
108+
failOnError false
102109
links "http://docs.oracle.com/javase/7/docs/api"
103110
}
104111
source = android.sourceSets.main.java.srcDirs
105112
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
106113
}
114+
107115
task javadocJar(type: Jar, dependsOn: javadoc) {
108116
classifier = 'javadoc'
109117
from javadoc.destinationDir

CommonUtil/local.properties

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## This file is automatically generated by Android Studio.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must *NOT* be checked into Version Control Systems,
5+
# as it contains information specific to your local configuration.
6+
#
7+
# Location of the SDK. This is only used by Gradle.
8+
# For customization when using a Version Control System, please read the
9+
# header note.
10+
#Fri Apr 28 10:28:40 CST 2017
11+
ndk.dir=D\:\\android-sdk-windows\\ndk-bundle
12+
sdk.dir=D\:\\android-sdk-windows
13+
#username就是你刚才注册的时候写的用户名,注意不是邮箱,
14+
#paikey是这个网站给你生成的一个apikey,怎么找到它呢,看下面的图
15+
bintray.user=caijinabraham
16+
bintray.apikey=046a2f35fd2cc5a6fc4f09d7c212a5d3dd436acd
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
11
<manifest xmlns:android = "http://schemas.android.com/apk/res/android"
22
package = "com.jingewenku.abrahamcaijin.commonutil">
3-
4-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
5-
6-
<application
7-
android:allowBackup = "true"
8-
android:label = "@string/app_name"
9-
android:supportsRtl = "true">
10-
11-
</application>
12-
133
</manifest>

CommonUtil/src/main/java/com/jingewenku/abrahamcaijin/commonutil/AndroidVersionUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,8 @@ public static boolean isM(){
119119
public static boolean is(){
120120
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
121121
}
122+
123+
// public static boolean isO(){
124+
// return VERSION.SDK_INT >= Build.VERSION_CODES.o
125+
// }
122126
}

CommonUtil/src/main/java/com/jingewenku/abrahamcaijin/commonutil/AppFileMgr.java

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ public static long getFileSize(File file) {
103103
return size;
104104
}
105105

106-
107-
108106
/**
109107
* 将File写入到指定路径下
110108
* @param bitmap
@@ -143,10 +141,6 @@ public static void saveFileToSdcard(Bitmap bitmap, String path){
143141
}
144142
}
145143

146-
147-
148-
149-
150144
/**
151145
* 检查文件是否存在(有时间戳)
152146
* @param path 路径
@@ -196,9 +190,7 @@ public static File getCacheFile(String imageUri) {
196190
AppLogMessageMgr.i("AppFileMgr-->>getCacheFile:", "获取Sdcard指定目录下缓存文件成功!");
197191
return cacheFile;
198192
}
199-
200-
201-
193+
202194
/**
203195
* 获取文件名称
204196
* @param path
@@ -254,8 +246,7 @@ public static void writeFileToSdCard(String fileContent, String fileName) {
254246
AppLogMessageMgr.e("AppFileMgr-->>writeFileToSdCard:","该SdCard不存在或不永许读写操作,写入失败!");
255247
}
256248
}
257-
258-
249+
259250
/**
260251
* 将InputStream写入SdCard指定目录下
261252
* @param path SdCard下路径
@@ -297,7 +288,6 @@ public File writeInputStreamToSdCard(String path, String fileName, InputStream i
297288
return file;
298289
}
299290

300-
301291
/**
302292
* 从SdCard中读取文件内容
303293
* @param cacheFileName
@@ -324,8 +314,6 @@ public static String readFileFromSdCard(String cacheFileName) {
324314
return fileContentStr;
325315
}
326316

327-
328-
329317
/**
330318
* 创建文件夹(默认首先在SdCard中创建文件夹,如SdCard不存在, 则在手机中创建文件夹)
331319
* @param context
@@ -358,7 +346,6 @@ public static String getRootFilePath(Context context, String path) {
358346
}
359347
}
360348

361-
362349
/**
363350
* 获取SD卡剩余空间的大小(SD卡剩余空间的大小(单位:byte))
364351
* @return long
@@ -928,8 +915,26 @@ else if(file.isDirectory())
928915
}
929916
return DELETE_FALG;
930917
}
931-
932-
918+
919+
/**
920+
*
921+
* @param closeables
922+
*/
923+
public static void closeIO(Closeable... closeables) {
924+
if (null == closeables || closeables.length <= 0) {
925+
return;
926+
}
927+
for (Closeable cb : closeables) {
928+
try {
929+
if (null == cb) {
930+
continue;
931+
}
932+
cb.close();
933+
} catch (IOException e) {
934+
e.printStackTrace();
935+
}
936+
}
937+
}
933938

934939

935940

0 commit comments

Comments
 (0)