diff --git a/README.md b/README.md
index 6bed161..deeaa68 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
[![pk3f4HO.png](https://s21.ax1x.com/2024/05/30/pk3f4HO.png)](https://imgse.com/i/pk3f4HO)
-### 一个让开发者快速完成上传功能的框架
+### 一个让开发者快速完成上传功能的框架 支持java、kotlin
# 截图
@@ -26,10 +26,10 @@ allprojects {
```groovy
// build.gradle(Module:)
dependencies {
- implementation 'com.github.XJ-Up:quickupload:1.2.0'
+ implementation 'com.github.XJ-Up:quickupload:1.2.1'
}
```
-
+## 具体使用可参考demo[点我](https://github.com/XJ-Up/quickupload/tree/main/app/src/main/java/com/dh/updemo)
# 如何使用
#### 第一步 Application进行初始化配置
@@ -48,16 +48,16 @@ UploadConfiguration.initialize(
```kotlin
-//第一步:构建数据类并继承 UploadObserverBase() ,其中fileName、filePath均为自定义内容
+//第一步:构建数据类并继承 UploadObserverBase()且必须传入uploadId(你觉得任何唯一性的字符串) ,其中fileName、filePath均为自定义内容
data class FileItem(
val fileName: String,
val filePath: String,
-) : UploadObserverBase()
+ override val uploadId: String,
+) : UploadObserverBase(uploadId)
//第二步:创建数据类对象 赋值uploadId 添加至观察者
-fileItem = FileItem(name(Uri.parse(path)), path)
-fileItem?.uploadId = path //根据你的具体情况选择合适的值作为 uploadId
+fileItem = FileItem(name(Uri.parse(path)), path, uploadId)
//添加至观察者
UploadService.observers.add(fileItem)
@@ -107,6 +107,8 @@ fileItem.stopUpload()
#### 第三步 获取上传详情
```kotlin
+//注意: fileItem中已包含对应的数据(uploadStatus, uploadInfo, throwable, serverResponse)
+// 这里的触发只是进行ui更新,详细使用可查看demo
fileItem.refresh { uploadStatus, uploadInfo, throwable, serverResponse ->
when (uploadStatus) {
UploadStatus.DEFAULT -> {
@@ -133,5 +135,5 @@ fileItem.stopUpload()
}
```
#### 如果你没有服务器上传接口,你可以下载服务器demo[点我](https://github.com/XJ-Up/TestServer)搭建自己的测试服务器,来体验quickupload
-#### 具体使用可参考demo
+
diff --git a/app/build.gradle b/app/build.gradle
index ffaf6d1..81760f4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -5,14 +5,14 @@ plugins {
android {
namespace 'com.dh.updemo'
- compileSdk 34
+ compileSdk compilesdk_version
defaultConfig {
applicationId "com.dh.updemo"
- minSdk 21
- targetSdk 34
+ minSdk minsdk_version
+ targetSdk targetsdk_version
versionCode 4
- versionName "1.5.0"
+ versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -36,13 +36,12 @@ android {
}
dependencies {
- implementation 'com.google.android.material:material:1.12.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
- implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
- implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
+ testImplementation 'junit:junit:4.+'
+ androidTestImplementation 'androidx.test.ext:junit:1.1.3'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ implementation 'com.google.android.material:material:1.4.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation project(':quickupload')
-// implementation 'com.github.XJ-Up:quickupload:1.5.0'
+// implementation 'com.github.XJ-Up:quickupload:1.2.1'
}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index bac6168..148eb41 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -24,9 +24,12 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/dh/updemo/FileItem.kt b/app/src/main/java/com/dh/updemo/FileItem.kt
index 6333791..5a4a4c1 100644
--- a/app/src/main/java/com/dh/updemo/FileItem.kt
+++ b/app/src/main/java/com/dh/updemo/FileItem.kt
@@ -11,5 +11,5 @@ import com.dh.quickupload.observer.task.UploadObserverBase
data class FileItem(
val fileName: String,
val filePath: String,
-
-) : UploadObserverBase()
\ No newline at end of file
+ override val uploadId: String,
+) : UploadObserverBase(uploadId)
\ No newline at end of file
diff --git a/app/src/main/java/com/dh/updemo/FilesItem.kt b/app/src/main/java/com/dh/updemo/FilesItem.kt
index fb52f8b..d03fe1c 100644
--- a/app/src/main/java/com/dh/updemo/FilesItem.kt
+++ b/app/src/main/java/com/dh/updemo/FilesItem.kt
@@ -1,6 +1,7 @@
package com.dh.updemo
import com.dh.quickupload.observer.task.UploadObserverBase
+
/**
* 多个地址文件上传示例
* 使用:
@@ -9,5 +10,6 @@ import com.dh.quickupload.observer.task.UploadObserverBase
*/
data class FilesItem(
val fileName: String,
- val filePath: MutableList
-): UploadObserverBase()
+ val filePath: MutableList,
+ override val uploadId: String,
+) : UploadObserverBase(uploadId)
diff --git a/app/src/main/java/com/dh/updemo/MultipleSingleFileUploadsActivity.kt b/app/src/main/java/com/dh/updemo/MultipleSingleFileUploadsActivity.kt
index de232c4..d24f8fd 100644
--- a/app/src/main/java/com/dh/updemo/MultipleSingleFileUploadsActivity.kt
+++ b/app/src/main/java/com/dh/updemo/MultipleSingleFileUploadsActivity.kt
@@ -30,7 +30,7 @@ class MultipleSingleFileUploadsActivity : AppCompatActivity() {
recyclerView = findViewById(R.id.recycler_view)
recyclerView.layoutManager = LinearLayoutManager(this)
-
+ recyclerView.itemAnimator=null
uploadAdapter = UploadAdapter(fileList) {
val uploadStatus = fileList[it].status
@@ -53,6 +53,9 @@ class MultipleSingleFileUploadsActivity : AppCompatActivity() {
recyclerView.adapter = uploadAdapter
findViewById