e 6 年之前
父節點
當前提交
83518a9da4

+ 12 - 6
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialFragment.java

@@ -108,6 +108,16 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
108 108
     public void initView() {
109 109
         EventBus.getDefault().register(this);
110 110
         handler = new Handler();
111
+
112
+        int position = (int) SPUtil.get(getContext(),Constant.Skin.CHECKED,-1);
113
+
114
+        if(position>-1){
115
+            String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/"+"skin";
116
+            File file = new File(fileheader + Constant.Skin.HOMEPICNAME+position+".png");
117
+            GlideUtil.setImageWithNoCache(getContext(),file,iv_banner);
118
+        }
119
+
120
+
111 121
 //        getTitleView(0).setTitle(getString(R.string.app_name));
112 122
 //        getTitleView(0).setTitle("钱多随手记账");
113 123
         activity = (BaseFragmentActivity) getActivity();
@@ -455,10 +465,7 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
455 465
                         progressBar.setVisibility(View.VISIBLE);
456 466
                     }
457 467
                      RES res = (RES) adapter.getData().get(position);
458
-
459 468
                      mPresenter.downLoadPic(res,background,progressBar,res.getPreview_img(),0,position);
460
-//
461
-//                     mPresenter.downLoadPic(background,progressBar,res.getBanner(),2,position);
462 469
 
463 470
                 }else {
464 471
                     SPUtil.putAndApply(getContext(), Constant.Skin.CHECKED, position);
@@ -470,9 +477,7 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
470 477
                     //选中的时候存储颜色
471 478
                     SPUtil.putAndApply(getContext(), Constant.Skin.COLOR_SELECT, "#FF4081" );
472 479
                     EventBus.getDefault().post(mskinBean);
473
-
474 480
                     setBanner(position);
475
-
476 481
                 }
477 482
             }
478 483
         });
@@ -501,6 +506,7 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
501 506
 
502 507
     private void setSkinData() {
503 508
 
509
+        if(skinBean!=null)
504 510
         adapter.setNewData(skinBean.getRes());
505 511
     }
506 512
 
@@ -509,7 +515,7 @@ public class DetialFragment extends MVPFragment<DetialPresent, DetialModel> impl
509 515
     ImageView iv_banner;
510 516
     private void setBanner(int position){
511 517
 
512
-        String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/";
518
+        String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/"+"skin";
513 519
         File file = new File(fileheader + Constant.Skin.HOMEPICNAME+position+".png");
514 520
         GlideUtil.setImageWithNoCache(getContext(),file,iv_banner);
515 521
 

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

@@ -133,8 +133,14 @@ public class DetialModel implements DetialContract.DetialModel {
133 133
     @Override
134 134
     public void downLoadPic(String url, int size, int position, final DetialContract.DownloadListener downloadListener) {
135 135
 
136
-        String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/";
137 136
 
137
+
138
+        String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/"+"skin";
139
+
140
+        File file = new File(fileheader);
141
+        if(!file.exists()){
142
+            file.mkdirs() ;
143
+        }
138 144
         switch (size){
139 145
 
140 146
             case 0:

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

@@ -374,7 +374,7 @@ public class DetialPresent extends DetialContract.DetialPresent implements View.
374 374
 
375 375
                 if(size==2){
376 376
                     try {
377
-                        Thread.sleep(50);
377
+                        Thread.sleep(10);
378 378
                     } catch (InterruptedException e) {
379 379
                         e.printStackTrace();
380 380
                     }

+ 27 - 0
app/src/main/java/com/kuxuan/moneynote/ui/fragments/mine/MineFragment.java

@@ -4,11 +4,13 @@ import android.content.Intent;
4 4
 import android.graphics.Color;
5 5
 import android.os.Bundle;
6 6
 import android.support.v4.app.FragmentActivity;
7
+import android.widget.ImageView;
7 8
 import android.widget.LinearLayout;
8 9
 import android.widget.TextView;
9 10
 import android.widget.Toast;
10 11
 
11 12
 import com.bumptech.glide.Glide;
13
+import com.kuxuan.moneynote.MyApplication;
12 14
 import com.kuxuan.moneynote.R;
13 15
 import com.kuxuan.moneynote.base.BaseFragmentActivity;
14 16
 import com.kuxuan.moneynote.base.mvpbase.MVPFragment;
@@ -17,6 +19,7 @@ import com.kuxuan.moneynote.db.CategoryDaoOperator;
17 19
 import com.kuxuan.moneynote.json.BillJson;
18 20
 import com.kuxuan.moneynote.json.HeadImg;
19 21
 import com.kuxuan.moneynote.json.MineJson;
22
+import com.kuxuan.moneynote.json.netbody.SkinBean;
20 23
 import com.kuxuan.moneynote.ui.activitys.AboutActivity;
21 24
 import com.kuxuan.moneynote.ui.activitys.alarm.AlarmActivity;
22 25
 import com.kuxuan.moneynote.ui.activitys.bill.BillActivity;
@@ -33,6 +36,7 @@ import com.kuxuan.moneynote.ui.activitys.opinion.OptionActivity;
33 36
 import com.kuxuan.moneynote.ui.activitys.person.PersonActivity;
34 37
 import com.kuxuan.moneynote.ui.activitys.score.UserScoreActivity;
35 38
 import com.kuxuan.moneynote.ui.weight.MyToast;
39
+import com.kuxuan.moneynote.utils.GlideUtil;
36 40
 import com.kuxuan.moneynote.utils.LoginStatusUtil;
37 41
 import com.kuxuan.moneynote.utils.NetWorkUtil;
38 42
 import com.kuxuan.moneynote.utils.SPUtil;
@@ -53,6 +57,7 @@ import org.greenrobot.eventbus.EventBus;
53 57
 import org.greenrobot.eventbus.Subscribe;
54 58
 import org.greenrobot.eventbus.ThreadMode;
55 59
 
60
+import java.io.File;
56 61
 import java.lang.ref.WeakReference;
57 62
 import java.util.ArrayList;
58 63
 import java.util.Calendar;
@@ -209,6 +214,16 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
209 214
     @Override
210 215
     public void initView() {
211 216
         EventBus.getDefault().register(this);
217
+
218
+         int position = (int) SPUtil.get(getContext(),Constant.Skin.CHECKED,-1);
219
+         if(position>-1){
220
+             String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/"+"skin";
221
+             File file = new File(fileheader + Constant.Skin.MINE+position+".png");
222
+             GlideUtil.setImageWithNoCache(getContext(),file,iv_mineskin);
223
+         }
224
+
225
+
226
+
212 227
         cal = Calendar.getInstance();
213 228
         activity = (BaseFragmentActivity) getActivity();
214 229
         mShareListener = new CustomShareListener(getActivity());
@@ -423,6 +438,18 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
423 438
     }
424 439
 
425 440
 
441
+    @Bind(R.id.iv_mineskin)
442
+    ImageView iv_mineskin;
443
+    @Subscribe(threadMode = ThreadMode.MAIN)
444
+    public void onMessageEvent5(SkinBean skinBean){
445
+
446
+        String fileheader = MyApplication.getInstance().getApplicationContext().getFilesDir().getPath()+"/"+"skin";
447
+        File file = new File(fileheader + Constant.Skin.MINE+skinBean.getCode()+".png");
448
+        GlideUtil.setImageWithNoCache(getContext(),file,iv_mineskin);
449
+
450
+    }
451
+
452
+
426 453
     /**
427 454
      * 退出
428 455
      *

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/utils/GlideUtil.java

@@ -24,7 +24,7 @@ public class GlideUtil {
24 24
     }
25 25
 
26 26
     public static void setImageWithNoCache(Context context, File file, ImageView imageView){
27
-        Glide.with(context).load(file).diskCacheStrategy(DiskCacheStrategy.ALL).placeholder(R.mipmap.category_custom_selected).error(R.mipmap.category_custom_selected).into(imageView);
27
+        Glide.with(context).load(file).diskCacheStrategy(DiskCacheStrategy.ALL).error(R.mipmap.category_custom_selected).into(imageView);
28 28
     }
29 29
 
30 30
 

+ 2 - 1
app/src/main/res/layout/fragment_detial.xml

@@ -17,9 +17,10 @@
17 17
      >
18 18
         <ImageView
19 19
             android:id="@+id/iv_banner"
20
+            android:scaleType="fitXY"
20 21
             android:layout_width="match_parent"
21 22
             android:layout_height="match_parent"
22
-            android:background="@drawable/home_background"
23
+            android:src="@drawable/home_background"
23 24
             />
24 25
 
25 26
         <com.zhy.autolayout.AutoRelativeLayout

+ 16 - 10
app/src/main/res/layout/fragment_mine.xml

@@ -10,35 +10,41 @@
10 10
         android:layout_height="wrap_content"
11 11
         android:orientation="vertical">
12 12
 
13
-        <LinearLayout
13
+        <RelativeLayout
14 14
             android:id="@+id/head_lin"
15 15
             android:layout_width="match_parent"
16
-            android:layout_height="wrap_content"
17
-            android:layout_alignParentBottom="true"
18
-            android:layout_alignParentEnd="true"
19
-            android:background="@drawable/mine_skin"
20
-            android:gravity="center_horizontal"
16
+            android:layout_height="170dp"
21 17
             android:orientation="vertical"
22
-            android:paddingBottom="@dimen/len_20"
23
-            android:paddingTop="@dimen/len_48">
18
+            >
19
+
20
+            <ImageView
21
+                android:id="@+id/iv_mineskin"
22
+                android:layout_width="match_parent"
23
+                android:layout_height="match_parent"
24
+                android:scaleType="fitXY"
25
+                android:src="@drawable/mine_skin"
26
+                />
24 27
 
25 28
             <de.hdodenhof.circleimageview.CircleImageView
26 29
                 android:id="@+id/im_portrait"
27 30
                 android:layout_width="@dimen/len_56"
28 31
                 android:layout_height="@dimen/len_56"
32
+                android:layout_marginTop="@dimen/len_48"
29 33
                 android:contentDescription="@string/app_name"
34
+                android:layout_centerHorizontal="true"
30 35
                 android:src="@drawable/im_portrait" />
31 36
 
32 37
             <TextView
33 38
                 android:id="@+id/name"
39
+                android:layout_below="@+id/im_portrait"
34 40
                 android:layout_width="wrap_content"
35 41
                 android:layout_height="wrap_content"
36 42
                 android:layout_marginTop="@dimen/len_8"
43
+                android:layout_centerHorizontal="true"
37 44
                 android:text="@string/no_login"
38 45
                 android:textColor="@color/first_text"
39 46
                 android:textSize="@dimen/len_14" />
40
-        </LinearLayout>
41
-
47
+        </RelativeLayout>
42 48
 
43 49
         <LinearLayout
44 50
             android:visibility="gone"