Skip to content

Commit

Permalink
升级依赖
Browse files Browse the repository at this point in the history
  • Loading branch information
kymjs committed Jun 27, 2022
1 parent 0d92633 commit 4f89fc5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Readme_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ keyStore.setCertificateEntry("trust", cer);
SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore);
RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.CACHE_FOLDER), new HttpConnectStack(null, sslSocketFactory));
RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.cacheFolder()), new HttpConnectStack(null, sslSocketFactory));
```


Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies {
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.github.kymjs:common:2.0.0'
implementation 'com.github.kymjs:common:2.0.5'
implementation 'com.google.code.gson:gson:2.8.8'
implementation project(':image')
implementation project(':okhttp3')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
import android.os.Looper;
import android.widget.ImageView;

import com.kymjs.common.FileUtils;
import com.kymjs.common.Log;
import com.kymjs.core.bitmap.client.BitmapCore;
import com.kymjs.okhttp3.OkHttpStack;
import com.kymjs.rxvolley.RxVolley;
import com.kymjs.rxvolley.client.HttpCallback;
import com.kymjs.rxvolley.http.RequestQueue;

import java.io.File;
import java.util.Map;

import okhttp3.OkHttpClient;
Expand All @@ -28,7 +26,7 @@ public class ImageLoadTestActivity extends Activity {
public ImageView contentView;

protected void setUp() {
RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.CACHE_FOLDER,
RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.cacheFolder(),
new OkHttpStack(new OkHttpClient())));

callback = new HttpCallback() {
Expand Down Expand Up @@ -117,7 +115,7 @@ public void testBitmapWithLoadImage() {
*/
public void testBitmapWithDiskLoader() {
new BitmapCore.Builder()
.url(FileUtils.getSDCardPath() + File.separator + "request.png")
.url("/sdcard/" + "request.png")
.callback(callback)
.view(contentView)
.loadResId(R.mipmap.ic_launcher)
Expand All @@ -130,7 +128,7 @@ public void testBitmapWithDiskLoader() {
*/
public void testBitmapWithDiskLoader2() {
new BitmapCore.Builder()
.url(FileUtils.getSDCardPath() + File.separator + "request.png")
.url("/sdcard/request.png")
.callback(callback)
.view(contentView)
.loadResId(R.mipmap.ic_launcher)
Expand Down
7 changes: 3 additions & 4 deletions app/src/main/java/com/kymjs/rxvolley/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import androidx.appcompat.app.AppCompatActivity;

import com.google.gson.Gson;
import com.kymjs.common.FileUtils;
import com.kymjs.common.Log;
import com.kymjs.okhttp3.OkHttpStack;
import com.kymjs.rxvolley.RxVolley;
Expand Down Expand Up @@ -39,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.CACHE_FOLDER,
RxVolley.setRequestQueue(RequestQueue.newRequestQueue(RxVolley.cacheFolder(),
new OkHttpStack(new OkHttpClient())));


Expand All @@ -61,7 +60,7 @@ private void testUploadProgress() {

params.put("uid", 863548);
params.put("msg", "睡会");
params.put("img", new File(FileUtils.getSDCardPath() + "/request.png"));
params.put("img", new File("/sdcard/request.png"));
Gson gson = new Gson();

RxVolley.post("http://192.168.1.11/action/api/software_tweet_pub", params,
Expand Down Expand Up @@ -171,7 +170,7 @@ public void onError(Throwable e) {
* 下载
*/
private void download() {
RxVolley.download(FileUtils.getSDCardPath() + "/a.apk",
RxVolley.download("/sdcard/a.apk",
"https://www.oschina.net/uploads/osc-android-app-2.4.apk", new ProgressListener() {
@Override
public void onProgress(long transferredBytes, long totalSize) {
Expand Down
4 changes: 2 additions & 2 deletions image/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ android {
}

dependencies {
implementation 'io.reactivex.rxjava3:rxjava:3.1.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.4'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
// compileOnly 'com.github.kymjs.rxvolley:rxvolley:3.0.0'
compileOnly project(':rxvolley')
implementation 'com.github.kymjs:common:2.0.0'
implementation 'com.github.kymjs:common:2.0.5'
}

apply plugin: 'maven-publish'
Expand Down
4 changes: 2 additions & 2 deletions rxvolley/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ android {
}

dependencies {
implementation 'io.reactivex.rxjava3:rxjava:3.1.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.4'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.github.kymjs:common:2.0.0'
implementation 'com.github.kymjs:common:2.0.5'
implementation 'androidx.appcompat:appcompat:1.3.1'
}

Expand Down
7 changes: 5 additions & 2 deletions rxvolley/src/main/java/com/kymjs/rxvolley/RxVolley.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import android.text.TextUtils;

import com.kymjs.common.ContextTrojan;
import com.kymjs.common.FileUtils;
import com.kymjs.rxvolley.client.FileRequest;
import com.kymjs.rxvolley.client.FormRequest;
Expand Down Expand Up @@ -49,7 +50,9 @@ public class RxVolley {
private RxVolley() {
}

public final static File CACHE_FOLDER = FileUtils.getExternalCacheDir("RxVolley");
public static File cacheFolder() {
return FileUtils.getExternalCacheDir(ContextTrojan.getApplicationContext(), "RxVolley");
}

private static RequestQueue sRequestQueue;

Expand All @@ -58,7 +61,7 @@ private RxVolley() {
*/
public synchronized static RequestQueue getRequestQueue() {
if (sRequestQueue == null) {
sRequestQueue = RequestQueue.newRequestQueue(CACHE_FOLDER);
sRequestQueue = RequestQueue.newRequestQueue(cacheFolder());
}
return sRequestQueue;
}
Expand Down

0 comments on commit 4f89fc5

Please sign in to comment.