e 6 yıl önce
ebeveyn
işleme
f89ca0e1a1

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/api/ApiHelper.java

@@ -40,7 +40,7 @@ public class ApiHelper {
40 40
     public ApiHelper buildRetrofit() {
41 41
         mRetrofit = new Retrofit.Builder()
42 42
                 .client(mHttpClient)
43
-                .baseUrl("http://baidu.com")
43
+                .baseUrl("http://182.92.118.1:8090")
44 44
                 .build();
45 45
         return this;
46 46
     }

+ 3 - 2
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialContract.java

@@ -10,6 +10,7 @@ import com.kuxuan.moneynote.base.mvpbase.BasePresent;
10 10
 import com.kuxuan.moneynote.base.mvpbase.BaseView;
11 11
 import com.kuxuan.moneynote.json.TypeDataJson;
12 12
 import com.kuxuan.moneynote.json.UserAllBillJson;
13
+import com.kuxuan.moneynote.json.netbody.RES;
13 14
 import com.kuxuan.moneynote.json.netbody.SkinBean;
14 15
 import com.kuxuan.moneynote.listener.MVPListener;
15 16
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
@@ -62,7 +63,7 @@ public interface DetialContract {
62 63
 
63 64
         void showSkinData(SkinBean skinBean);
64 65
 
65
-        void showDownLoad(int positon,View background,ProgressBar progressBar,int current);
66
+        void showDownLoad(RES res, int size, int positon, View background, ProgressBar progressBar, int current);
66 67
 
67 68
     }
68 69
 
@@ -110,7 +111,7 @@ public interface DetialContract {
110 111
         abstract void InitPopWindow();
111 112
 
112 113
 
113
-        abstract void downLoadPic(View background,ProgressBar progressBar, String url, int size, int position);
114
+        abstract void downLoadPic(RES res,View background,ProgressBar progressBar, String url, int size, int position);
114 115
 
115 116
     }
116 117
 

+ 36 - 21
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialFragment.java

@@ -338,24 +338,6 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
338 338
 
339 339
     }
340 340
 
341
-    @Override
342
-    public void showDownLoad(int position,final View background,final ProgressBar progressBar, final int current) {
343
-
344
-        progressBar.setProgress(current);
345
-
346
-        if(current==100) {
347
-
348
-            handler.post(new Runnable() {
349
-                @Override
350
-                public void run() {
351
-                    background.setVisibility(View.GONE);
352
-                    progressBar.setVisibility(View.GONE);
353
-                }
354
-            });
355
-
356
-            SkinUtil.markDownload(position);
357
-        }
358
-    }
359 341
 
360 342
 
361 343
     @Subscribe(threadMode = ThreadMode.MAIN)
@@ -397,6 +379,37 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
397 379
     PopupWindow popupWindow;
398 380
     Handler handler;
399 381
 
382
+
383
+
384
+
385
+    @Override
386
+    public void showDownLoad(RES res,int size,int position,final View background,final ProgressBar progressBar, final int current) {
387
+
388
+        if(size<2) {
389
+            size ++;
390
+            if(size==1) {
391
+                mPresenter.downLoadPic(res, background, progressBar, res.getMine_banner(), size, position);
392
+            }else if(size==2) {
393
+                mPresenter.downLoadPic(res, background, progressBar, res.getBanner(), size, position);
394
+            }
395
+            }
396
+        if(size==2) {
397
+            progressBar.setProgress(current);
398
+            if (current == 100) {
399
+                handler.post(new Runnable() {
400
+                    @Override
401
+                    public void run() {
402
+                        background.setVisibility(View.GONE);
403
+                        progressBar.setVisibility(View.GONE);
404
+                    }
405
+                });
406
+
407
+                SkinUtil.markDownload(position);
408
+            }
409
+        }
410
+
411
+    }
412
+
400 413
     private void showPopWindow() {
401 414
 
402 415
 
@@ -442,9 +455,11 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
442 455
                         progressBar.setVisibility(View.VISIBLE);
443 456
                     }
444 457
                      RES res = (RES) adapter.getData().get(position);
445
-                     mPresenter.downLoadPic(background,progressBar,res.getBanner(),2,position);
446
-                     mPresenter.downLoadPic(background,progressBar,res.getPreview_img(),0,position);
447
-                     mPresenter.downLoadPic(background,progressBar,res.getMine_banner(),1,position);
458
+
459
+                     mPresenter.downLoadPic(res,background,progressBar,res.getPreview_img(),0,position);
460
+//
461
+//                     mPresenter.downLoadPic(background,progressBar,res.getBanner(),2,position);
462
+
448 463
                 }else {
449 464
                     SPUtil.putAndApply(getContext(), Constant.Skin.CHECKED, position);
450 465
                     adapter.notifyDataSetChanged();

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialModel.java

@@ -157,7 +157,7 @@ public class DetialModel implements DetialContract.DetialModel {
157 157
         }
158 158
 
159 159
         if (TextUtils.isEmpty(mVideoPath)) {
160
-            Log.e(TAG, "downloadVideo: 存储路径为空");
160
+            Log.e(TAG, "存储路径为空");
161 161
             return;
162 162
         }
163 163
 

+ 6 - 7
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialPresent.java

@@ -18,6 +18,7 @@ import com.kuxuan.moneynote.json.TimeJson;
18 18
 import com.kuxuan.moneynote.json.TypeDataJson;
19 19
 import com.kuxuan.moneynote.json.UserAllBillJson;
20 20
 import com.kuxuan.moneynote.json.YearData;
21
+import com.kuxuan.moneynote.json.netbody.RES;
21 22
 import com.kuxuan.moneynote.json.netbody.SkinBean;
22 23
 import com.kuxuan.moneynote.listener.MVPListener;
23 24
 import com.kuxuan.moneynote.ui.adapter.DetialAdapter;
@@ -357,21 +358,19 @@ public class DetialPresent extends DetialContract.DetialPresent implements View.
357 358
     }
358 359
 
359 360
     @Override
360
-    void downLoadPic(final View background, final ProgressBar progressBar, String url, final int size, final int position) {
361
+    void downLoadPic(final RES res, final View background, final ProgressBar progressBar, String url, final int size, final int position) {
361 362
 
362 363
 
363 364
         mModel.downLoadPic(url, size, position, new DetialContract.DownloadListener() {
364 365
             @Override
365 366
             public void onStart() {
366 367
 
367
-                Log.e("allence","开始了");
368 368
 
369 369
             }
370 370
 
371 371
             @Override
372 372
             public void onProgress(int currentLength) {
373 373
 
374
-                Log.e("allence","进度"+currentLength);
375 374
 
376 375
                 if(size==2){
377 376
                     try {
@@ -379,16 +378,16 @@ public class DetialPresent extends DetialContract.DetialPresent implements View.
379 378
                     } catch (InterruptedException e) {
380 379
                         e.printStackTrace();
381 380
                     }
382
-                    view.showDownLoad(position,background,progressBar,currentLength);
381
+                    view.showDownLoad(res,size,position,background,progressBar,currentLength);
383 382
                 }
384 383
 
385 384
             }
386 385
 
387 386
             @Override
388 387
             public void onFinish(String localPath) {
389
-
390
-                Log.e("allence","结束了");
391
-
388
+                if(size!=2) {
389
+                    view.showDownLoad(res, size, position, background, progressBar,0);
390
+                }
392 391
             }
393 392
 
394 393
             @Override