e 6 years ago
parent
commit
83518a9da4

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

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

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

133
     @Override
133
     @Override
134
     public void downLoadPic(String url, int size, int position, final DetialContract.DownloadListener downloadListener) {
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
         switch (size){
144
         switch (size){
139
 
145
 
140
             case 0:
146
             case 0:

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

374
 
374
 
375
                 if(size==2){
375
                 if(size==2){
376
                     try {
376
                     try {
377
-                        Thread.sleep(50);
377
+                        Thread.sleep(10);
378
                     } catch (InterruptedException e) {
378
                     } catch (InterruptedException e) {
379
                         e.printStackTrace();
379
                         e.printStackTrace();
380
                     }
380
                     }

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

4
 import android.graphics.Color;
4
 import android.graphics.Color;
5
 import android.os.Bundle;
5
 import android.os.Bundle;
6
 import android.support.v4.app.FragmentActivity;
6
 import android.support.v4.app.FragmentActivity;
7
+import android.widget.ImageView;
7
 import android.widget.LinearLayout;
8
 import android.widget.LinearLayout;
8
 import android.widget.TextView;
9
 import android.widget.TextView;
9
 import android.widget.Toast;
10
 import android.widget.Toast;
10
 
11
 
11
 import com.bumptech.glide.Glide;
12
 import com.bumptech.glide.Glide;
13
+import com.kuxuan.moneynote.MyApplication;
12
 import com.kuxuan.moneynote.R;
14
 import com.kuxuan.moneynote.R;
13
 import com.kuxuan.moneynote.base.BaseFragmentActivity;
15
 import com.kuxuan.moneynote.base.BaseFragmentActivity;
14
 import com.kuxuan.moneynote.base.mvpbase.MVPFragment;
16
 import com.kuxuan.moneynote.base.mvpbase.MVPFragment;
17
 import com.kuxuan.moneynote.json.BillJson;
19
 import com.kuxuan.moneynote.json.BillJson;
18
 import com.kuxuan.moneynote.json.HeadImg;
20
 import com.kuxuan.moneynote.json.HeadImg;
19
 import com.kuxuan.moneynote.json.MineJson;
21
 import com.kuxuan.moneynote.json.MineJson;
22
+import com.kuxuan.moneynote.json.netbody.SkinBean;
20
 import com.kuxuan.moneynote.ui.activitys.AboutActivity;
23
 import com.kuxuan.moneynote.ui.activitys.AboutActivity;
21
 import com.kuxuan.moneynote.ui.activitys.alarm.AlarmActivity;
24
 import com.kuxuan.moneynote.ui.activitys.alarm.AlarmActivity;
22
 import com.kuxuan.moneynote.ui.activitys.bill.BillActivity;
25
 import com.kuxuan.moneynote.ui.activitys.bill.BillActivity;
33
 import com.kuxuan.moneynote.ui.activitys.person.PersonActivity;
36
 import com.kuxuan.moneynote.ui.activitys.person.PersonActivity;
34
 import com.kuxuan.moneynote.ui.activitys.score.UserScoreActivity;
37
 import com.kuxuan.moneynote.ui.activitys.score.UserScoreActivity;
35
 import com.kuxuan.moneynote.ui.weight.MyToast;
38
 import com.kuxuan.moneynote.ui.weight.MyToast;
39
+import com.kuxuan.moneynote.utils.GlideUtil;
36
 import com.kuxuan.moneynote.utils.LoginStatusUtil;
40
 import com.kuxuan.moneynote.utils.LoginStatusUtil;
37
 import com.kuxuan.moneynote.utils.NetWorkUtil;
41
 import com.kuxuan.moneynote.utils.NetWorkUtil;
38
 import com.kuxuan.moneynote.utils.SPUtil;
42
 import com.kuxuan.moneynote.utils.SPUtil;
53
 import org.greenrobot.eventbus.Subscribe;
57
 import org.greenrobot.eventbus.Subscribe;
54
 import org.greenrobot.eventbus.ThreadMode;
58
 import org.greenrobot.eventbus.ThreadMode;
55
 
59
 
60
+import java.io.File;
56
 import java.lang.ref.WeakReference;
61
 import java.lang.ref.WeakReference;
57
 import java.util.ArrayList;
62
 import java.util.ArrayList;
58
 import java.util.Calendar;
63
 import java.util.Calendar;
209
     @Override
214
     @Override
210
     public void initView() {
215
     public void initView() {
211
         EventBus.getDefault().register(this);
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
         cal = Calendar.getInstance();
227
         cal = Calendar.getInstance();
213
         activity = (BaseFragmentActivity) getActivity();
228
         activity = (BaseFragmentActivity) getActivity();
214
         mShareListener = new CustomShareListener(getActivity());
229
         mShareListener = new CustomShareListener(getActivity());
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
     }
24
     }
25
 
25
 
26
     public static void setImageWithNoCache(Context context, File file, ImageView imageView){
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
      >
17
      >
18
         <ImageView
18
         <ImageView
19
             android:id="@+id/iv_banner"
19
             android:id="@+id/iv_banner"
20
+            android:scaleType="fitXY"
20
             android:layout_width="match_parent"
21
             android:layout_width="match_parent"
21
             android:layout_height="match_parent"
22
             android:layout_height="match_parent"
22
-            android:background="@drawable/home_background"
23
+            android:src="@drawable/home_background"
23
             />
24
             />
24
 
25
 
25
         <com.zhy.autolayout.AutoRelativeLayout
26
         <com.zhy.autolayout.AutoRelativeLayout

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

10
         android:layout_height="wrap_content"
10
         android:layout_height="wrap_content"
11
         android:orientation="vertical">
11
         android:orientation="vertical">
12
 
12
 
13
-        <LinearLayout
13
+        <RelativeLayout
14
             android:id="@+id/head_lin"
14
             android:id="@+id/head_lin"
15
             android:layout_width="match_parent"
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
             android:orientation="vertical"
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
             <de.hdodenhof.circleimageview.CircleImageView
28
             <de.hdodenhof.circleimageview.CircleImageView
26
                 android:id="@+id/im_portrait"
29
                 android:id="@+id/im_portrait"
27
                 android:layout_width="@dimen/len_56"
30
                 android:layout_width="@dimen/len_56"
28
                 android:layout_height="@dimen/len_56"
31
                 android:layout_height="@dimen/len_56"
32
+                android:layout_marginTop="@dimen/len_48"
29
                 android:contentDescription="@string/app_name"
33
                 android:contentDescription="@string/app_name"
34
+                android:layout_centerHorizontal="true"
30
                 android:src="@drawable/im_portrait" />
35
                 android:src="@drawable/im_portrait" />
31
 
36
 
32
             <TextView
37
             <TextView
33
                 android:id="@+id/name"
38
                 android:id="@+id/name"
39
+                android:layout_below="@+id/im_portrait"
34
                 android:layout_width="wrap_content"
40
                 android:layout_width="wrap_content"
35
                 android:layout_height="wrap_content"
41
                 android:layout_height="wrap_content"
36
                 android:layout_marginTop="@dimen/len_8"
42
                 android:layout_marginTop="@dimen/len_8"
43
+                android:layout_centerHorizontal="true"
37
                 android:text="@string/no_login"
44
                 android:text="@string/no_login"
38
                 android:textColor="@color/first_text"
45
                 android:textColor="@color/first_text"
39
                 android:textSize="@dimen/len_14" />
46
                 android:textSize="@dimen/len_14" />
40
-        </LinearLayout>
41
-
47
+        </RelativeLayout>
42
 
48
 
43
         <LinearLayout
49
         <LinearLayout
44
             android:visibility="gone"
50
             android:visibility="gone"