Quellcode durchsuchen

提交rxjava修改

皇甫睿欣 vor 7 Jahren
Ursprung
Commit
4f24fd8b96

+ 3 - 6
laraver-core/src/main/java/com/kuxuan/laraver/net/callback/RequestCallbacks.java

@@ -63,12 +63,9 @@ public final class RequestCallbacks implements Callback<String> {
63 63
 
64 64
     private void stopLoading() {
65 65
         if (LOADER_STYLE != null) {
66
-            HANDLER.postDelayed(new Runnable() {
67
-                @Override
68
-                public void run() {
69
-                    LaraverLoader.stopLoading();
70
-                }
71
-            }, 1000);
66
+
67
+            LaraverLoader.stopLoading();
68
+
72 69
         }
73 70
     }
74 71
 

+ 40 - 0
laraver-core/src/main/java/com/kuxuan/laraver/net/callback/RxCallBack.java

@@ -0,0 +1,40 @@
1
+package com.kuxuan.laraver.net.callback;
2
+
3
+import android.widget.Toast;
4
+
5
+import com.kuxuan.laraver.app.Laraver;
6
+import com.kuxuan.laraver.ui.LaraverLoader;
7
+import com.kuxuan.laraver.ui.LoaderStyle;
8
+
9
+import io.reactivex.Observer;
10
+import io.reactivex.disposables.Disposable;
11
+
12
+/**
13
+ *
14
+ * @author huangfuruixin
15
+ * @date 2017/12/13
16
+ */
17
+
18
+public class RxCallBack implements Observer<String> {
19
+
20
+    @Override
21
+    public void onSubscribe(Disposable d) {
22
+
23
+    }
24
+
25
+    @Override
26
+    public void onNext(String s) {
27
+
28
+    }
29
+
30
+    @Override
31
+    public void onError(Throwable e) {
32
+        Toast.makeText(Laraver.getApplicationContext(),e.getMessage() , Toast.LENGTH_SHORT).show();
33
+    }
34
+
35
+    @Override
36
+    public void onComplete() {
37
+
38
+        LaraverLoader.stopLoading();
39
+    }
40
+}