e 6 years ago
parent
commit
f89ca0e1a1

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

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

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

10
 import com.kuxuan.moneynote.base.mvpbase.BaseView;
10
 import com.kuxuan.moneynote.base.mvpbase.BaseView;
11
 import com.kuxuan.moneynote.json.TypeDataJson;
11
 import com.kuxuan.moneynote.json.TypeDataJson;
12
 import com.kuxuan.moneynote.json.UserAllBillJson;
12
 import com.kuxuan.moneynote.json.UserAllBillJson;
13
+import com.kuxuan.moneynote.json.netbody.RES;
13
 import com.kuxuan.moneynote.json.netbody.SkinBean;
14
 import com.kuxuan.moneynote.json.netbody.SkinBean;
14
 import com.kuxuan.moneynote.listener.MVPListener;
15
 import com.kuxuan.moneynote.listener.MVPListener;
15
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
16
 import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
62
 
63
 
63
         void showSkinData(SkinBean skinBean);
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
         abstract void InitPopWindow();
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
 
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
     @Subscribe(threadMode = ThreadMode.MAIN)
343
     @Subscribe(threadMode = ThreadMode.MAIN)
397
     PopupWindow popupWindow;
379
     PopupWindow popupWindow;
398
     Handler handler;
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
     private void showPopWindow() {
413
     private void showPopWindow() {
401
 
414
 
402
 
415
 
442
                         progressBar.setVisibility(View.VISIBLE);
455
                         progressBar.setVisibility(View.VISIBLE);
443
                     }
456
                     }
444
                      RES res = (RES) adapter.getData().get(position);
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
                 }else {
463
                 }else {
449
                     SPUtil.putAndApply(getContext(), Constant.Skin.CHECKED, position);
464
                     SPUtil.putAndApply(getContext(), Constant.Skin.CHECKED, position);
450
                     adapter.notifyDataSetChanged();
465
                     adapter.notifyDataSetChanged();

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

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

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

18
 import com.kuxuan.moneynote.json.TypeDataJson;
18
 import com.kuxuan.moneynote.json.TypeDataJson;
19
 import com.kuxuan.moneynote.json.UserAllBillJson;
19
 import com.kuxuan.moneynote.json.UserAllBillJson;
20
 import com.kuxuan.moneynote.json.YearData;
20
 import com.kuxuan.moneynote.json.YearData;
21
+import com.kuxuan.moneynote.json.netbody.RES;
21
 import com.kuxuan.moneynote.json.netbody.SkinBean;
22
 import com.kuxuan.moneynote.json.netbody.SkinBean;
22
 import com.kuxuan.moneynote.listener.MVPListener;
23
 import com.kuxuan.moneynote.listener.MVPListener;
23
 import com.kuxuan.moneynote.ui.adapter.DetialAdapter;
24
 import com.kuxuan.moneynote.ui.adapter.DetialAdapter;
357
     }
358
     }
358
 
359
 
359
     @Override
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
         mModel.downLoadPic(url, size, position, new DetialContract.DownloadListener() {
364
         mModel.downLoadPic(url, size, position, new DetialContract.DownloadListener() {
364
             @Override
365
             @Override
365
             public void onStart() {
366
             public void onStart() {
366
 
367
 
367
-                Log.e("allence","开始了");
368
 
368
 
369
             }
369
             }
370
 
370
 
371
             @Override
371
             @Override
372
             public void onProgress(int currentLength) {
372
             public void onProgress(int currentLength) {
373
 
373
 
374
-                Log.e("allence","进度"+currentLength);
375
 
374
 
376
                 if(size==2){
375
                 if(size==2){
377
                     try {
376
                     try {
379
                     } catch (InterruptedException e) {
378
                     } catch (InterruptedException e) {
380
                         e.printStackTrace();
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
             @Override
386
             @Override
388
             public void onFinish(String localPath) {
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
             @Override
393
             @Override