admin
2020-07-14 41b23417cd62af3cd77b695a2b03446243431fc1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
package com.yeshi.ec.rebate.myapplication.ui.main;
 
import android.Manifest;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.LinearLayoutCompat;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.RelativeSizeSpan;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebChromeClient;
import android.webkit.WebViewClient;
import android.widget.BaseAdapter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
 
import com.alibaba.baichuan.android.trade.AlibcTrade;
import com.alibaba.baichuan.android.trade.model.AlibcShowParams;
import com.alibaba.baichuan.android.trade.model.OpenType;
import com.alibaba.baichuan.android.trade.page.AlibcBasePage;
import com.alibaba.baichuan.android.trade.page.AlibcMyCartsPage;
import com.alibaba.baichuan.trade.biz.AlibcConstants;
import com.alibaba.baichuan.trade.biz.login.AlibcLogin;
import com.alibaba.baichuan.trade.biz.login.AlibcLoginCallback;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.display.CircleBitmapDisplayer;
import com.umeng.analytics.MobclickAgent;
import com.viewpagerindicator.CirclePageIndicator;
import com.wpc.library.RetainViewFragment;
import com.wpc.library.okhttp.OkHttpUtils;
import com.wpc.library.util.common.DimenUtils;
import com.wpc.library.util.common.StringUtils;
import com.wpc.library.widget.MyGridView;
import com.wpc.library.widget.RatioLayout;
import com.wpc.library.widget.ScListerScrollView;
import com.yeshi.ec.rebate.myapplication.BasicTextHttpResponseHandler;
import com.yeshi.ec.rebate.myapplication.BuXinConstant;
import com.yeshi.ec.rebate.myapplication.R;
import com.yeshi.ec.rebate.myapplication.ShoppingApi;
import com.yeshi.ec.rebate.myapplication.callBack.GeneralCallback;
import com.yeshi.ec.rebate.myapplication.callBack.MiDuoTradeCallback;
import com.yeshi.ec.rebate.myapplication.callBack.PermissionInterface;
import com.yeshi.ec.rebate.myapplication.entity.HomeBanner;
import com.yeshi.ec.rebate.myapplication.entity.UserInfo;
import com.yeshi.ec.rebate.myapplication.entity.user.MineRewardStatistic;
import com.yeshi.ec.rebate.myapplication.entity.user.UserDialogVO;
import com.yeshi.ec.rebate.myapplication.entity.user.UserInviteLevel;
import com.yeshi.ec.rebate.myapplication.entity.user.VIPUpgradedNotify;
import com.yeshi.ec.rebate.myapplication.ui.dialog.UserTearcherNotifyDialog;
import com.yeshi.ec.rebate.myapplication.ui.dialog.VipUpgradedDialog;
import com.yeshi.ec.rebate.myapplication.ui.goldtask.GoldTaskActivity;
import com.yeshi.ec.rebate.myapplication.ui.invite.ShareBrowserActivity;
import com.yeshi.ec.rebate.myapplication.ui.message.AppMailActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.CapitalActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.Collect28Activity;
import com.yeshi.ec.rebate.myapplication.ui.mine.LoginSelectActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.MyInfoActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.MyPlayerListActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.OrderActivity33;
import com.yeshi.ec.rebate.myapplication.ui.mine.OrderAppealActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.PromotionRedenvelopeActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.RewardStatisticsOrderActivity33;
import com.yeshi.ec.rebate.myapplication.ui.mine.SelectionStoreHouseActivity31;
import com.yeshi.ec.rebate.myapplication.ui.mine.SettingActivity;
import com.yeshi.ec.rebate.myapplication.ui.mine.ShareHistoryActivity31;
import com.yeshi.ec.rebate.myapplication.ui.mine.WelfareCenterActivity;
import com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityJD;
import com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityPDD;
import com.yeshi.ec.rebate.myapplication.ui.recommend.GoodsDetailActivityTB;
import com.yeshi.ec.rebate.myapplication.ui.recommend.RecommendTopAdapter2;
import com.yeshi.ec.rebate.myapplication.updateApp.UpdateApp;
import com.yeshi.ec.rebate.myapplication.util.JumpActivityUtil;
import com.yeshi.ec.rebate.myapplication.util.KeFuUtil;
import com.yeshi.ec.rebate.myapplication.util.PermissionHelper;
import com.yeshi.ec.rebate.myapplication.util.RecordImageTextVideo;
import com.yeshi.ec.rebate.myapplication.util.SystemParamsUtil;
import com.yeshi.ec.rebate.myapplication.util.Toast_Dialog;
import com.yeshi.ec.rebate.myapplication.util.ToolUtil;
import com.yeshi.ec.rebate.myapplication.util.Tools;
import com.yeshi.ec.rebate.myapplication.util.ui.MineFunctionsManager;
import com.yeshi.ec.rebate.myapplication.util.umengCustomEvent.UserCustomEvent;
import com.yeshi.ec.rebate.myapplication.util.user.LoginAndInviteStatusUtil;
import com.yeshi.ec.rebate.myapplication.util.user.UserUtil;
import com.yeshi.ec.rebate.myapplication.util.zxing.common.Constant;
 
import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;
 
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
 
import static android.content.Context.MODE_PRIVATE;
 
/**
 * Created by weikou2015 on 2017/2/20.
 */
 
public class MineFragment extends RetainViewFragment implements View.OnClickListener, PermissionInterface {
    private TextView tv_user_num,
            tv_share_reward_hint, tv_fanli_reward_hint;
    private ImageView iv_portrait;
    private TextView tv_nickName, tv_mine_login;
 
    //用户昵称与邀请码
    private LinearLayout ll_nick_name_vip;
 
    private TextView tv_balance;
    private FrameLayout fl_reward_today, fl_reward_yestoday, fl_reward_current_month, fl_reward_last_month;
    private ImageView fl_reward_today_ic, fl_reward_yestoday_ic, fl_reward_current_month_ic, fl_reward_last_month_ic;
    private TextView tv_reward_today, tv_reward_yestoday, tv_reward_current_month, tv_reward_last_month;
    private TextView tv_share_estimate_reward, tv_fanli_reward;
 
    private LinearLayout ll_count;
    private RelativeLayout ll_title_face;
    private LinearLayout ll_title;
    private ScListerScrollView sv_mine;
    private DisplayImageOptions options;
 
    private LinearLayoutCompat tv_user_numlayout;//开启通知
    private int clickState = 0;
 
    private long lastTime = 0;
 
    private String TYPE = "mine";
    private TextView tv_notice_content;
    private LinearLayout ll_notice;
    private ImageView iv_close;//通知关闭
 
    private int REQUEST_CODE_SCAN = 111;
    private Toast_Dialog toast_dialog;// 弹窗提示
 
    private String trolleyType = "";
 
    private UpdateApp app;//更新
    //热门活动
    private RatioLayout vp_recommend_ratio;
    private ViewPager vp_banner;
    private CirclePageIndicator indicator_category;
    private ImageView vp_close;
 
    //会员升级提醒
    private ImageView iv_icon;
    private TextView tv_vip_upgrade_content, tv_vip_upgrade;
 
 
    //专属邀请码申请
    private LinearLayout ll_special_invitecode_apply;
 
    //云发单
    private LinearLayout ll_send_order;
 
    String tag1 = "help/getAppPageNotification";
    String tag2 = "integral/getTaskList";
    String tag3 = "integral/getNotReceived";
    String tag4 = "customer/getuserinfoNew";
    String tag5 = "order/countBonus";
    String tag6 = "config/getUserConfig";
 
    private String platformRuleLink;//平台规则
 
 
    private String vipLink = null;
 
    private MineFunctionsManager mineFunctionsManager;
 
    @Override
    public int getContentResource() {
        return R.layout.fragment_mine;
    }
 
    @Override
    public void onCreateView(View contentView, Bundle savedInstanceState) {
        mineFunctionsManager = new MineFunctionsManager(getContext());
        String inviteCode = UserUtil.getInviteCode(getContext(), null);
        init(contentView);
        listener(contentView);
        app = new UpdateApp(getActivity(), getResources().getString(R.string.update_key));
        mPermissionsChecker = new PermissionHelper(getActivity(), this);
    }
 
    private void init(View contentView) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getActivity().getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
            //设置状态栏文字颜色及图标为深色
//            getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        }
        //设置状态栏文字颜色及图标为深色
        getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        this.options = new DisplayImageOptions.Builder()
                .showImageForEmptyUri(R.drawable.ic_default_portrait)
                .showImageOnFail(R.drawable.ic_default_portrait)
                .showImageOnLoading(R.drawable.ic_default_portrait)
                .resetViewBeforeLoading(true)
                .cacheInMemory(true)
                .cacheOnDisk(true)
                .imageScaleType(ImageScaleType.EXACTLY)
                .considerExifParams(true)
                .displayer(new CircleBitmapDisplayer(300))
                .build();
        tv_user_num = contentView.findViewById(R.id.tv_user_num);
        iv_portrait = contentView.findViewById(R.id.iv_portrait);
        tv_nickName = contentView.findViewById(R.id.tv_nickname);
        tv_mine_login = contentView.findViewById(R.id.tv_mine_login);
 
        ll_count = contentView.findViewById(R.id.ll_count);
        tv_balance = contentView.findViewById(R.id.tv_balance);
        ll_title_face = contentView.findViewById(R.id.ll_title_face);
        ll_title = contentView.findViewById(R.id.ll_title);
        ll_title_face.setVisibility(View.INVISIBLE);
        ll_title.setVisibility(View.VISIBLE);
        sv_mine = contentView.findViewById(R.id.sv_mine);
        tv_notice_content = contentView.findViewById(R.id.tv_notice_content);
        ll_notice = contentView.findViewById(R.id.ll_notice);
        iv_close = contentView.findViewById(R.id.iv_close);
        fl_reward_today = contentView.findViewById(R.id.fl_reward_today);
        fl_reward_yestoday = contentView.findViewById(R.id.fl_reward_yestoday);
        fl_reward_current_month = contentView.findViewById(R.id.fl_reward_current_month);
        fl_reward_last_month = contentView.findViewById(R.id.fl_reward_last_month);
        fl_reward_today_ic = contentView.findViewById(R.id.fl_reward_today_ic);
        fl_reward_yestoday_ic = contentView.findViewById(R.id.fl_reward_yestoday_ic);
        fl_reward_current_month_ic = contentView.findViewById(R.id.fl_reward_current_month_ic);
        fl_reward_last_month_ic = contentView.findViewById(R.id.fl_reward_last_month_ic);
        tv_reward_today = contentView.findViewById(R.id.tv_reward_today);
        tv_reward_yestoday = contentView.findViewById(R.id.tv_reward_yestoday);
        tv_reward_current_month = contentView.findViewById(R.id.tv_reward_current_month);
        tv_reward_last_month = contentView.findViewById(R.id.tv_reward_last_month);
        tv_share_estimate_reward = contentView.findViewById(R.id.tv_share_estimate_reward);
 
 
        tv_fanli_reward = contentView.findViewById(R.id.tv_fanli_reward);
 
        tv_share_reward_hint = contentView.findViewById(R.id.tv_share_reward_hint);
        tv_fanli_reward_hint = contentView.findViewById(R.id.tv_fanli_reward_hint);
 
 
        tv_user_numlayout = contentView.findViewById(R.id.tv_user_numlayout);
        vp_recommend_ratio = contentView.findViewById(R.id.vp_doings_ratio);
        vp_banner = contentView.findViewById(R.id.vp_recommend);
        indicator_category = contentView.findViewById(R.id.indicator_recommend);
        vp_close = contentView.findViewById(R.id.vp_close);
        ll_nick_name_vip = contentView.findViewById(R.id.ll_nick_name_vip);
 
        iv_icon = contentView.findViewById(R.id.iv_icon);
        tv_vip_upgrade_content = contentView.findViewById(R.id.tv_vip_upgrade_content);
        tv_vip_upgrade = contentView.findViewById(R.id.tv_vip_upgrade);
 
 
        ll_special_invitecode_apply = contentView.findViewById(R.id.ll_special_invitecode_apply);
 
        ll_send_order = contentView.findViewById(R.id.ll_send_order);
 
        getAppPageNotification();
 
        toast_dialog = new Toast_Dialog(tv_user_num.getContext());
 
        /******************热门活动************/
        vp_banner.setCurrentItem(0, true);
        bannerAdapter = new RecommendTopAdapter2(mBanners, getActivity(), true);
        vp_banner.setAdapter(bannerAdapter);
        indicator_category.setViewPager(vp_banner);
        //设置功能
        FunctionsAdapter adapter = new FunctionsAdapter(getContext(), getFunctions());
        MyGridView gv = contentView.findViewById(R.id.gv_functions);
        gv.setAdapter(adapter);
    }
 
    private List<Functions> getFunctions() {
        List<Functions> list = new ArrayList<>();
        list.add(new Functions("收藏", R.drawable.icon_mine_collect, "jumpCollect"));
        list.add(new Functions("足迹", R.drawable.icon_mine_footmark, "jumpFootMark"));
        list.add(new Functions("转链", R.drawable.icon_mine_convert_link, "jumpConvertLink"));
        list.add(new Functions("规范", R.drawable.icon_mine_rule, "jumpPlatformRule"));
        list.add(new Functions("客服", R.drawable.icon_mine_kefu, "jumpKeFu"));
        list.add(new Functions("设置", R.drawable.icon_mine_settings, "jumpSettings"));
        return list;
    }
 
    private RecommendTopAdapter2 bannerAdapter;
 
    private Runnable mAutoScroller = new Runnable() {
 
        @Override
        public void run() {
            if (vp_banner != null) {
                PagerAdapter adapter = vp_banner.getAdapter();
                if (adapter != null && adapter.getCount() != 0) {
                    vp_banner.setCurrentItem((vp_banner.getCurrentItem() + 1)
                            % adapter.getCount(), true);
                }
                vp_banner.postDelayed(this, 5000);
            }
        }
    };
 
    private LinearLayout ll_balance;//余额布局
 
    private LinearLayout ll_share_reward;
    private LinearLayout ll_fanli;
 
    private void listener(View contentView) {
        ll_balance = contentView.findViewById(R.id.ll_balance);
        ll_balance.setOnClickListener(this);
        contentView.findViewById(R.id.ll_share_history).setOnClickListener(this);
        contentView.findViewById(R.id.ll_order).setOnClickListener(this);
        contentView.findViewById(R.id.ll_find_order).setOnClickListener(this);
        contentView.findViewById(R.id.ll_send_order).setOnClickListener(this);
 
        tv_nickName.setOnClickListener(this);
        tv_mine_login.setOnClickListener(this);
        ll_share_reward = contentView.findViewById(R.id.ll_share_reward);
        ll_fanli = contentView.findViewById(R.id.ll_fanli);
 
 
        ll_share_reward.setOnClickListener(this);
        ll_fanli.setOnClickListener(this);
 
 
        iv_portrait.setOnClickListener(this);
        fl_reward_today.setOnClickListener(this);
        fl_reward_yestoday.setOnClickListener(this);
        fl_reward_current_month.setOnClickListener(this);
        fl_reward_last_month.setOnClickListener(this);
        tv_user_num.setOnClickListener(this);
        vp_close.setOnClickListener(this);//关闭热门广告
        ll_special_invitecode_apply.setOnClickListener(this);
        sv_mine.setOnScollChangedListener(new ScListerScrollView.OnScollChangedListener() {
            @Override
            public void onScrollChanged(ScListerScrollView scrollView, int x, int y, int oldx, int oldy) {
                if (y > 0 && y < DimenUtils.dip2px(tv_nickName.getContext(), 40)) {
                    if (oldy > y) {
                        ll_title.setVisibility(View.VISIBLE);
                    } else {
                        ll_title.setVisibility(View.INVISIBLE);
                    }
                    ll_title_face.setVisibility(View.VISIBLE);
                    float alpha = (y + 0.0f) / DimenUtils.dip2px(tv_nickName.getContext(), 40);
//                    Log.e("mResult", "" + y + "---" + oldy);
                    ll_title_face.setAlpha(alpha);
                } else {
                    ll_title_face.setAlpha(1);
                    if (y == 0) {
                        ll_title.setVisibility(View.VISIBLE);
                        ll_title_face.setVisibility(View.INVISIBLE);
                    } else {
                        ll_title.setVisibility(View.INVISIBLE);
                        ll_title_face.setVisibility(View.VISIBLE);
                    }
                }
            }
        });
    }
 
    @Override
    public void onResume() {
        super.onResume();
        getUserConfig();
        MobclickAgent.onPageStart("我的");
        SharedPreferences sp = tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE);
        if (sp.getBoolean("isLogin", false)) {
            tv_user_numlayout.setVisibility(View.VISIBLE);
            tv_user_num.setVisibility(View.VISIBLE);
            ll_nick_name_vip.setVisibility(View.VISIBLE);
            tv_nickName.setVisibility(View.VISIBLE);
            tv_mine_login.setVisibility(View.GONE);
            String uid = sp.getString("uid", "0");
            if (lastTime > 0 && (System.currentTimeMillis() - lastTime > 30 * 1000)) {
                clickState = 0;
            }
            if (!uid.equalsIgnoreCase("0")) {
                String userInfo = sp.getString("userinfo", "");
                if (!StringUtils.isEmpty(userInfo)) {
                    try {
                        JSONObject jsonObject = new JSONObject(userInfo);
                        showInfo(jsonObject);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
                String rewardInfo = sp.getString("estimatereward", "");
                if (!StringUtils.isEmpty(rewardInfo)) {
                    try {
                        JSONObject jsonObject = new JSONObject(rewardInfo);
                        showRewardInfo(jsonObject);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
                getUserInfo(uid);
            }
        } else {
            noLogin();
        }
        vp_banner.postDelayed(mAutoScroller, 2000);
    }
 
    /**
     * 展示用户信息
     */
    private void showInfo(JSONObject jsonObject) {
        if (jsonObject.optJSONObject("data") == null) {
            return;
        }
        JSONObject data = jsonObject.optJSONObject("data");
        Gson gson = new GsonBuilder().serializeNulls().create();
        UserInfo info = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("user").toString(), new TypeToken<UserInfo>() {
        }.getType());
        if (info == null) {
            return;
        }
        ImageLoader.getInstance().displayImage(info.getPortrait(), iv_portrait, options);
        tv_nickName.setText(info.getNickName());
 
 
        String balance = "¥ " + info.getMyHongBao();
        Spannable span = new SpannableString(balance);
        span.setSpan(new RelativeSizeSpan(1.5f), 1, balance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        tv_balance.setText(span);
        tv_user_num.setText("ID:" + info.getId());
    }
 
    /**
     * 展示奖金信息
     */
    private void showRewardInfo(JSONObject jsonObject) {
 
        JSONObject data = jsonObject.optJSONObject("data");
        final MineRewardStatistic statistic = new Gson().fromJson(data.toString(), MineRewardStatistic.class);
 
        tv_share_estimate_reward.setText("¥ " + statistic.getShareMoney());
        tv_fanli_reward.setText("¥ " + statistic.getSelfMoney());
    }
 
    private void clearRewardInfo() {
        tv_share_estimate_reward.setText("¥ 0.00");
        tv_fanli_reward.setText("¥ 0.00");
    }
 
    private void noLogin() {
        tv_user_numlayout.setVisibility(View.GONE);
        tv_user_num.setVisibility(View.GONE);
        ll_nick_name_vip.setVisibility(View.GONE);
        tv_nickName.setVisibility(View.GONE);
        tv_mine_login.setVisibility(View.VISIBLE);
        tv_mine_login.setText("登录");
        tv_user_num.setText("");
//        tv_mine_invite.setText("邀请激活");
        String balance = "¥ 0.00";
        Spannable span = new SpannableString(balance);
        span.setSpan(new RelativeSizeSpan(1.5f), 2, balance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        tv_balance.setText(span);
        ImageLoader.getInstance().displayImage("drawable://" + R.drawable.ic_mine_default_portrait, iv_portrait, options);
        ll_special_invitecode_apply.setVisibility(View.GONE);
        clearRewardInfo();
    }
 
    /***小黄条*/
    private void getAppPageNotification() {
        ShoppingApi.getAppPageNotification(tv_nickName.getContext(), TYPE, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                ToolUtil.setAppPageNotification(ll_notice, tv_notice_content, iv_close, jsonObject);
            }
        });
    }
 
    private void tbLogin() {
        final AlibcLogin alibcLogin = AlibcLogin.getInstance();
        if (!alibcLogin.isLogin()) {
            alibcLogin.showLogin(new AlibcLoginCallback() {
 
                @Override
                public void onSuccess(int i, String s, String s1) {
                    bindInfo();
                }
 
                @Override
                public void onFailure(int code, String msg) {
                    Toast.makeText(tv_nickName.getContext(), "登录失败,请稍候再试",
                            Toast.LENGTH_LONG).show();
                    clickState = 0;
                    MobclickAgent.reportError(tv_nickName.getContext(), "MineFragment---sscode:" + code + "---msg:" + msg);
                }
            });
        } else {
            bindInfo();
        }
    }
 
    private PermissionHelper mPermissionsChecker; // 权限检测器
 
    /**
     * 权限请求码
     *
     * @return
     */
    @Override
    public int getPermissionsRequestCode() {
        return 1001;
    }
 
    /**
     * 请求权限
     *
     * @return
     */
    @Override
    public String[] getPermissions() {
        return new String[]{Manifest.permission.CAMERA};
    }
 
    /**
     * 权限请求成功
     */
    @Override
    public void requestPermissionsSuccess() {
    }
 
    /**
     * 权限请求失败
     */
    @Override
    public void requestPermissionsFail() {
//        Toast.makeText(this, "你以拒绝权限", Toast.LENGTH_SHORT).show();
    }
 
    /**
     * 请求权限结果
     *
     * @param requestCode
     * @param permissions
     * @param grantResults
     */
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (mPermissionsChecker.requestPermissionsResult(requestCode, permissions, grantResults)) {
            //权限请求结果,并已经处理了该回调
            return;
        }
    }
 
    private int rewardState = 1;
 
    private String getRewardStateDesc(int state) {
        switch (state) {
            case 1:
                return "今日预估";
            case 2:
                return "昨日预估";
            case 3:
                return "本月预估";
            case 4:
                return "上月";
        }
        return "";
    }
 
 
    private void initMoneyStatisticName() {
        tv_share_reward_hint.setText("佣金");
        tv_fanli_reward_hint.setText("返利");
    }
 
    @Override
    public void onClick(View v) {
        final SharedPreferences sp = getActivity().getSharedPreferences("user", Context.MODE_PRIVATE);
        boolean isLogin = sp.getBoolean("isLogin", false);
        clickState = 0;
        switch (v.getId()) {
            case R.id.vp_close:
                //热门活动
//                SharedPreferences.Editor editor = sp.edit();
//                editor.putBoolean("popular", false);
//                editor.apply();
                vp_recommend_ratio.setVisibility(View.GONE);
                break;
            case R.id.tv_user_num:
                break;
 
            case R.id.tv_nickname:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                if (!isLogin) {//登录淘宝
//                    loginHint();
                    UserUtil.jumpLogin(tv_nickName.getContext());
                } else {
                    startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class));
                }
                break;
            case R.id.tv_mine_login:
 
                if (!isLogin) {//登录淘宝
                    UserUtil.jumpLogin(tv_nickName.getContext());
                } else {
                    startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class));
                }
                break;
 
            //头像
            case R.id.iv_portrait:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                UserCustomEvent.userMyInfo(ll_notice.getContext());
                if (!isLogin) {//登录
//                    loginHint();
                    clickState = 10;
                    UserUtil.jumpLogin(tv_nickName.getContext());
                } else {
                    startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class));
                }
                break;
 
            case R.id.ll_order://订单
                mineFunctionsManager.jumpOrder();
                break;
            //账户余额
            case R.id.ll_balance:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                UserCustomEvent.userBalance(tv_user_num.getContext());
                if (isLogin) {
                    ll_balance.setEnabled(false);
                    ll_balance.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (!ll_balance.isEnabled()) {
                                OkHttpUtils.getInstance().cancelTag("usermoney/getUserMoneyStatistic");
                                ll_balance.setEnabled(true);
                            }
                        }
                    }, 200);
 
 
                    ShoppingApi.getUserMoneyInfo(getContext(), getContext().getSharedPreferences("user", Context.MODE_PRIVATE).getString("uid", ""), new BasicTextHttpResponseHandler() {
                        @Override
                        public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                            ll_balance.setEnabled(true);
                            Intent intenta = new Intent(tv_nickName.getContext(), CapitalActivity.class);
                            intenta.putExtra("UserMoneyStatistic", jsonObject.toString());
                            startActivity(intenta);
                        }
 
                        @Override
                        public void onFinish() {
                            super.onFinish();
                            ll_balance.setEnabled(true);
                        }
 
                        @Override
                        public void onFailure(int statusCode, Header[] headers, String jsonObject, Throwable e) {
                            super.onFailure(statusCode, headers, jsonObject, e);
                            ll_balance.setEnabled(true);
                            ToolUtil.showToast(getContext(), "网络连接异常,请检测网络设置");
                        }
                    });
                } else {
                    ll_balance.setEnabled(false);
                    clickState = 5;
                    UserUtil.jumpLogin(tv_nickName.getContext());
                    ToolUtil.showToast(getContext(), "请先登录返利联盟账号");
                }
                break;
 
 
            case R.id.fl_reward_today://今日奖金
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                rewardState = 1;
                initMoneyStatisticName();
 
                showRewardStatisticsView();
                getRewardInfo();
                break;
            case R.id.fl_reward_yestoday://昨日奖金
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                rewardState = 2;
                initMoneyStatisticName();
                showRewardStatisticsView();
                getRewardInfo();
                break;
            case R.id.fl_reward_current_month://当月奖金
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                rewardState = 3;
                initMoneyStatisticName();
                showRewardStatisticsView();
                getRewardInfo();
                break;
            case R.id.fl_reward_last_month://上月奖金
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                rewardState = 4;
                initMoneyStatisticName();
                showRewardStatisticsView();
                getRewardInfo();
                break;
            //分享记录
            case R.id.ll_share_history:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                UserCustomEvent.userShareHistory(ll_count.getContext());
                if (isLogin) {
                    Intent intent8 = new Intent(tv_nickName.getContext(), ShareHistoryActivity31.class);
                    startActivity(intent8);
                } else {
                    clickState = 12;
 
                }
                break;
 
 
            case R.id.iv_vip:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                //跳转到vip
                if (userInviteLevel != null && !StringUtils.isEmpty(userInviteLevel.getLink()))
                    startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", userInviteLevel.getLink()));
                break;
 
            case R.id.ll_special_invitecode_apply://专属邀请码申请入口
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                startActivity(new Intent(getContext(), ShareBrowserActivity.class).putExtra("url", SystemParamsUtil.getParam(getContext(), "invite_code_apply")));
                break;
 
            case R.id.ll_fanli:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                if (isLogin) {
                    Intent intent115 = new Intent(tv_nickName.getContext(), RewardStatisticsOrderActivity33.class);
                    intent115.putExtra("type", 1 + "");
                    intent115.putExtra("title", getRewardStateDesc(rewardState) + "自购返利");
 
                    intent115.putExtra("needCount", true);
                    intent115.putExtra("dateType", rewardState);
                    startActivity(intent115);
                } else {
                    UserUtil.jumpLogin(tv_nickName.getContext());
                    Toast.makeText(tv_nickName.getContext(), String.format("请先登录%s账号", getResources().getString(R.string.app_name)), Toast.LENGTH_LONG).show();
                }
                break;
 
            case R.id.ll_share_reward:
                if (!LoginAndInviteStatusUtil.acessNext(getContext(), UserUtil.getUid(getContext()) + "", true))
                    return;
                if (isLogin) {
                    Intent intent5 = new Intent(tv_nickName.getContext(), RewardStatisticsOrderActivity33.class);
                    intent5.putExtra("type", 2 + "");
                    intent5.putExtra("title", getRewardStateDesc(rewardState) + "分享奖金");
                    intent5.putExtra("needCount", true);
                    intent5.putExtra("dateType", rewardState);
                    startActivity(intent5);
                } else {
                    clickState = 13;
                    UserUtil.jumpLogin(tv_nickName.getContext());
                }
                break;
            case R.id.ll_find_order:
                mineFunctionsManager.jumpFindOrder();
                break;
            case R.id.ll_send_order:
                mineFunctionsManager.jumpCloud();
                break;
 
            default:
                break;
        }
    }
 
 
    private void bindInfo() {
        if (clickState == 1) {
            if (!StringUtils.isEmpty(trolleyType) && trolleyType.equalsIgnoreCase("baichuan")) {
                if (Tools.isTaobaoAvilible(ll_notice.getContext()) == 0) {
//                            startActivity(new Intent(ll_novice.getContext(), ShoppingTrolleyActivity.class));
                    AlibcShowParams alibcShowParams = new AlibcShowParams();
                    alibcShowParams.setOpenType(OpenType.Native);
                    Map<String, String> exParams = new HashMap<>();
                    exParams.put(AlibcConstants.ISV_CODE, "appisvcode");
                    exParams.put("alibaba", "阿里巴巴");//自定义参数部分,可任意增删改
 
                    AlibcBasePage alibcBasePage = new AlibcMyCartsPage();
//                    AlibcTrade.show(getActivity(), alibcBasePage, alibcShowParams, null, null, new MiDuoTradeCallback(""));
                    jumpNoLink(alibcBasePage, alibcShowParams);
                } else {
                    Toast.makeText(tv_nickName.getContext(), "未安装淘宝App,该功能无法使用", Toast.LENGTH_LONG).show();
                }
                clickState = 0;
            } else if (taoBaoCartInfo.getJumpDetail() != null) {
                Intent intent = null;
                if ((!StringUtils.isEmpty(taoBaoCartInfo.getJumpDetail().getActivity()))) {//有 跳转页面 有参数
                    try {
                        intent = new Intent(ll_notice.getContext(),
                                Class.forName(taoBaoCartInfo.getJumpDetail().getActivity()));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    if (taoBaoCartInfo.getParams() != null) {
                        @SuppressWarnings("unchecked")
                        Iterator<String> its = taoBaoCartInfo.getParams().keySet().iterator();
                        while (its.hasNext()) {
                            String key = its.next();
                            String value = taoBaoCartInfo.getParams().getString(key);
                            intent.putExtra(key, value);
                        }
                    }
                    ll_notice.getContext().startActivity(intent);
                }
                clickState = 0;
            }
        }
 
    }
 
    /**
     * 分域显示我的订单,或者全部显示我的订单
     */
    private void showOrder() {
        Intent intent = new Intent(tv_nickName.getContext(), OrderActivity33.class);
        startActivity(intent);
    }
 
    JSONObject moduleState;
    private String invitCode;//邀请码
    private Long bindPhonetime = 0L;
    private Dialog dialog;
    private int redPackLock = 0;//1: 红包功能关闭  0:开启
    private boolean applySpecialInviteCode;//是否可以申请专属邀请码
    private UserInviteLevel userInviteLevel;//用户邀请等级
 
    /****用户信息*/
    private void getUserInfo(final String uid) {
        ShoppingApi.getUserInfo2(tv_nickName.getContext(), uid, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optString("code").equalsIgnoreCase("0")) {
                    JSONObject data = jsonObject.optJSONObject("data");
                    String inviteCode = data.optString("invitCode");
                    UserUtil.setInviteCode(getContext(), uid, inviteCode);
                    vipLink = data.optString("vipLink");
                    moduleState = data.optJSONObject("moduleState");
                    if (mineFunctionsManager != null)
                        mineFunctionsManager.setModuleState(moduleState);
                    applySpecialInviteCode = data.optBoolean("tailor");
                    //专属邀请码是否显示
                    if (applySpecialInviteCode) {
                        ll_special_invitecode_apply.setVisibility(View.VISIBLE);
                    } else
                        ll_special_invitecode_apply.setVisibility(View.GONE);
 
 
                    ll_count.setVisibility(View.VISIBLE);
 
 
                    redPackLock = data.optInt("redPackLock");// 红包功能关闭开启
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    JSONObject inviteLevel = data.optJSONObject("inviteLevel");
                    if (inviteLevel != null) {
                        userInviteLevel = gson.fromJson(inviteLevel.toString(), UserInviteLevel.class);
                    }
                    showInfo(jsonObject);//展示用户个人信息
                    final UserInfo info = gson.fromJson(data.optJSONObject("user").toString(), new TypeToken<UserInfo>() {
                    }.getType());
                    SharedPreferences sp = tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE);
                    SharedPreferences.Editor editor = sp.edit();
                    editor.putBoolean("isLogin", true);
                    editor.putBoolean("isFirstInput", false);
                    editor.putString("uid", info.getId());
                    editor.putString("openid", info.getOpenid());
                    editor.putString("portrait", info.getPortrait());
                    editor.putString("userinfo", jsonObject.toString());
                    if (StringUtils.isEmpty(info.getWxOpenId())) {
                        editor.putBoolean("isWxBind", false);
                    } else {
                        editor.putBoolean("isWxBind", true);
                    }
                    editor.commit();
                    /**bindPhone 绑定手机弹窗*/
                    if (jsonObject.optJSONObject("data").optBoolean("bindPhone", false)) {
                        if (System.currentTimeMillis() - bindPhonetime < 1000) {//小于1秒不进入
                            return;
                        }
                        bindPhonetime = System.currentTimeMillis();
                        dialog = ToolUtil.setGeneralPop(tv_nickName.getContext(), "绑定手机号提醒", "尊敬的用户,为保障你账户中的资金安全,请绑定手机号。"
                                , "去绑定", new GeneralCallback() {
                                    @Override
                                    public void onSuccess() {
                                        user_recordBind(uid);//我的信息-提醒记录
                                        Intent intent = new Intent(tv_nickName.getContext(), LoginSelectActivity.class);
                                        intent.putExtra("uid", info.getId());
                                        intent.putExtra("type", LoginSelectActivity.TYPE_BIND);
                                        startActivity(intent);
                                    }
 
                                    @Override
                                    public void onError() {
                                        user_recordBind(uid);//我的信息-提醒记录
                                    }
                                });
                    }
 
                } else if (jsonObject.optInt("code") == 80001) {
                    if (tv_nickName.getContext().getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) {
                        loginOut();
                        UserUtil.logout(tv_nickName.getContext());
                        noLogin();
                        Toast.makeText(tv_nickName.getContext(), jsonObject.optString("msg"), Toast.LENGTH_SHORT).show();
                    }
                }
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                super.onFailure(statusCode, headers, responseString, throwable);
            }
 
            @Override
            public void onFinish() {
                super.onFinish();
                getRewardInfo();
//                getUserConfig();//获取邀请链接
                if (clickState == 1) {
                    if (!AlibcLogin.getInstance().isLogin()) {
                        tbLogin();
                        return;
                    }
                    clickState = 0;
                    if (!StringUtils.isEmpty(trolleyType) && trolleyType.equalsIgnoreCase("baichuan")) {
                        if (Tools.isTaobaoAvilible(ll_notice.getContext()) == 0) {
//                            Log.e("mResult", "onFinish---淘宝已登录");
//                            startActivity(new Intent(ll_novice.getContext(), ShoppingTrolleyActivity.class));
                            AlibcShowParams alibcShowParams = new AlibcShowParams();
                            alibcShowParams.setOpenType(OpenType.Native);
                            Map<String, String> exParams = new HashMap<>();
                            exParams.put(AlibcConstants.ISV_CODE, "appisvcode");
                            exParams.put("alibaba", "阿里巴巴");//自定义参数部分,可任意增删改
 
                            AlibcBasePage alibcBasePage = new AlibcMyCartsPage();
//                              AlibcTrade.show(getActivity(), alibcBasePage, alibcShowParams, null, null, new MiDuoTradeCallback(""));
                            jumpNoLink(alibcBasePage, alibcShowParams);
                        } else {
                            Toast.makeText(tv_nickName.getContext(), "未安装淘宝App,该功能无法使用", Toast.LENGTH_LONG).show();
                        }
                    } else if (AlibcLogin.getInstance().isLogin() && taoBaoCartInfo.getJumpDetail() != null) {
                        Intent intent = null;
                        if (!StringUtils.isEmpty(taoBaoCartInfo.getJumpDetail().getActivity())) {//有 跳转页面 有参数
                            try {
                                intent = new Intent(ll_notice.getContext(),
                                        Class.forName(taoBaoCartInfo.getJumpDetail().getActivity()));
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            if (taoBaoCartInfo.getParams() != null) {
                                @SuppressWarnings("unchecked")
                                Iterator<String> its = taoBaoCartInfo.getParams().keySet().iterator();
                                while (its.hasNext()) {
                                    String key = its.next();
                                    String value = taoBaoCartInfo.getParams().getString(key);
                                    intent.putExtra(key, value);
                                }
                            }
                            ll_notice.getContext().startActivity(intent);
                        }
                    }
                } else if (clickState == 2) {
                    clickState = 0;
                    showOrder();
                } else if (clickState == 3) {
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), Collect28Activity.class));
                } else if (clickState == 4) {
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), OrderAppealActivity.class));
                } else if (clickState == 5) {
                    clickState = 0;
                    Intent intenta = new Intent(tv_nickName.getContext(), CapitalActivity.class);
                    startActivity(intenta);
                } else if (clickState == 6) {
                    clickState = 0;
                    Intent intent4 = new Intent(tv_nickName.getContext(), SelectionStoreHouseActivity31.class);
                    startActivity(intent4);
                } else if (clickState == 7) {
                    clickState = 0;
                    Intent intent = new Intent(tv_nickName.getContext(), WelfareCenterActivity.class);
                    startActivity(intent);
                } else if (clickState == 9) {
                    clickState = 0;
                    Intent intent = new Intent(tv_nickName.getContext(), MyPlayerListActivity.class);
                    startActivity(intent);
                } else if (clickState == 10) {
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), MyInfoActivity.class));
                } else if (clickState == 11) {
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), AppMailActivity.class));
                } else if (clickState == 12) {
                    clickState = 0;
                    Intent intent5 = new Intent(tv_nickName.getContext(), ShareHistoryActivity31.class);
                    startActivity(intent5);
                } else if (clickState == 13) {
                    clickState = 0;
                    Intent intent = new Intent(tv_nickName.getContext(), SettingActivity.class);
                    startActivity(intent);
                } else if (clickState == 14) {
                    clickState = 0;
                    Intent intent = new Intent(tv_nickName.getContext(), RewardStatisticsOrderActivity33.class);
                    intent.putExtra("title", "团队奖金");
                    intent.putExtra("type", 3 + "");
                    intent.putExtra("needCount", true);
                    intent.putExtra("dateType", rewardState);
                    startActivity(intent);
                } else if (clickState == 16) {
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), OrderAppealActivity.class));
                } else if (clickState == 17) {//推广红包
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), PromotionRedenvelopeActivity.class));
                } else if (clickState == 18) {//金币任务
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), GoldTaskActivity.class));
                } else if (clickState == 19) {//链接转换
                    clickState = 0;
                    startActivity(new Intent(tv_nickName.getContext(), ShareBrowserActivity.class).putExtra("url", convertLinkUrl));
                }
            }
        });
    }
 
    /**
     * 我的信息-提醒记录
     *
     * @param uid
     */
    private void user_recordBind(String uid) {
        ShoppingApi.setRecordBind(tv_nickName.getContext(), uid, null);
    }
 
    /**
     * 退出登录
     */
    private void loginOut() {
        AlibcLogin alibcLogin = AlibcLogin.getInstance();
        alibcLogin.logout(new AlibcLoginCallback() {
 
            @Override
            public void onSuccess(int i, String s, String s1) {
                Toast.makeText(tv_nickName.getContext(), "退出登录成功", Toast.LENGTH_SHORT).show();
            }
 
            @Override
            public void onFailure(int code, String msg) {
            }
        });
    }
 
    /**
     * 获取奖金信息
     */
    private void getRewardInfo() {
        String uid = tv_balance.getContext().getSharedPreferences("user", MODE_PRIVATE).getString("uid", "");
        ShoppingApi.getRewardStatistics(tv_balance.getContext(), uid, rewardState + "", new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optInt("code") == 0) {
//                    tv_share_reward_num.setText(jsonObject.optJSONObject("data").optString("shareCount"));
                    showRewardInfo(jsonObject);
                    if (rewardState == 1) {
                        SharedPreferences sp = tv_mine_login.getContext().getSharedPreferences("user", MODE_PRIVATE);
                        sp.edit().putString("estimatereward", jsonObject.toString()).apply();
                    }
                }
            }
 
            @Override
            public void onFailure(int statusCode, Header[] headers, String responseString, Throwable throwable) {
                super.onFailure(statusCode, headers, responseString, throwable);
            }
        });
    }
 
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        // 扫描二维码/条码回传
        if (requestCode == REQUEST_CODE_SCAN && resultCode == Activity.RESULT_OK) {
            if (data != null) {
                String content = data.getStringExtra(Constant.CODED_CONTENT);
                if (content.contains("taobao://")) {
//                    Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class);
                    Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityTB.class);
                    String id = content.substring(content.indexOf("//") + 2);
                    intent.putExtra("id", id);
                    intent.putExtra("from", "scan");
                    startActivity(intent);
                } else if (content.contains("jd://")) {
//                    Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class);
                    Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityJD.class);
                    String id = content.substring(content.indexOf("//") + 2);
                    intent.putExtra("id", id);
                    intent.putExtra("from", "scan");
                    startActivity(intent);
                } else if (content.contains("pdd://")) {
//                    Intent intent = new Intent(tv_user_num.getContext(), GoodsDetailBrowerActivity.class);
                    Intent intent = new Intent(tv_nickName.getContext(), GoodsDetailActivityPDD.class);
                    String id = content.substring(content.indexOf("//") + 2);
                    intent.putExtra("id", id);
                    intent.putExtra("from", "scan");
                    startActivity(intent);
                } else {
                    Toast.makeText(tv_user_num.getContext(), "并非返利联盟商品二维码", Toast.LENGTH_SHORT).show();
                }
            }
        }
    }
 
    /**
     * 获取购物车跳转方式
     */
    HomeBanner taoBaoCartInfo;
    /*************** banner列表********/
    private List<HomeBanner> mBanners = new ArrayList<>();
 
    private String convertLinkUrl = "";
    private String tearcherLink = "";
    private String cloudSendOrderLink = "";
 
    private UserTearcherNotifyDialog notifyDialog = null;
 
    private VipUpgradedDialog vipUpgradedDialog;
 
    /****************************登录协议*****/
    private void getUserConfig() {
        ShoppingApi.getUserConfig(ll_notice.getContext(), UserUtil.getUid(getContext()), new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optInt("code") == 0) {
                    JSONObject data = jsonObject.optJSONObject("data");
                    Gson gson = new GsonBuilder().serializeNulls().create();
                    taoBaoCartInfo = gson.fromJson(data
                            .optJSONObject("taoBaoCart").toString(), new TypeToken<HomeBanner>() {
                    }.getType());
 
                    convertLinkUrl = data.optString("convertLinkUrl");
                    tearcherLink = data.optString("tearcherLink");
                    cloudSendOrderLink = data.optString("cloudLink");
                    /*************************平台规则******************************/
                    platformRuleLink = data.optString("platformRule");
 
                    if (mineFunctionsManager != null) {
                        mineFunctionsManager.setConvertLink(convertLinkUrl);
                        mineFunctionsManager.setCloudUrl(cloudSendOrderLink);
                        mineFunctionsManager.setpPlateformRule(platformRuleLink);
                    }
 
                    if (StringUtils.isBlank(cloudSendOrderLink)) {
                        ll_send_order.setVisibility(View.GONE);
                    } else {
                        ll_send_order.setVisibility(View.VISIBLE);
                    }
 
                    trolleyType = taoBaoCartInfo.getJumpDetail().getType();
                    /*****************************热门活动*********/
                    List<HomeBanner> list2 = gson.fromJson(
                            data.optJSONArray("banner").toString(),
                            new TypeToken<List<HomeBanner>>() {
                            }.getType());
                    if (list2.size() > 0) {
                        mBanners.clear();
                        mBanners.addAll(list2);
                        bannerAdapter.notifyDataSetChanged();
                    }
                    //热门活动
//                    boolean popular = getContext().getSharedPreferences("user", MODE_PRIVATE)
//                            .getBoolean("popular", true);
                    if (mBanners.size() == 0) { //没有数据 隐藏 轮播
                        vp_recommend_ratio.setVisibility(View.GONE);
                    } else { //有条数据的时候
                        vp_recommend_ratio.setVisibility(View.VISIBLE);
                        if (mBanners.size() > 1) {
                            indicator_category.setVisibility(View.VISIBLE);//轮播小点
                        } else {
                            indicator_category.setVisibility(View.GONE);
                        }
                    }
 
                    /************************弹框*************************/
                    if (data.optJSONObject("dialog") != null) {
                        final UserDialogVO dialogVO = new Gson().fromJson(data.optJSONObject("dialog").toString(), UserDialogVO.class);
 
                        if (notifyDialog == null) {
                            UserTearcherNotifyDialog.Builder builder = new UserTearcherNotifyDialog.Builder(getContext()).setTitle(dialogVO.getTitle()).setMessage(dialogVO.getContent()).setCloseButton(new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    closeDialogNotify(dialogVO.getId(), 0);
                                }
                            }).setPositiveButton(dialogVO.getPositive().getName(), new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    dialog.dismiss();
                                    closeDialogNotify(dialogVO.getId(), 1);
                                    JumpActivityUtil.jumpActivity(getActivity(), dialogVO.getPositive().getJumpDetail(), dialogVO.getPositive().getParams());
                                }
                            });
 
                            if (dialogVO.getNegative() != null) {
                                builder = builder.setNegativeButton(dialogVO.getNegative().getName(), new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        dialog.dismiss();
                                        closeDialogNotify(dialogVO.getId(), 2);
                                        JumpActivityUtil.jumpActivity(getActivity(), dialogVO.getNegative().getJumpDetail(), dialogVO.getNegative().getParams());
                                    }
                                });
                            }
                            notifyDialog = builder.create();
                        }
 
                        synchronized (notifyDialog) {
                            if (!notifyDialog.isShowing()) {
                                notifyDialog.show();
                            }
                        }
                    }
 
                    /************************弹框************************/
 
                    /**************************用户等级升级提醒弹框************************/
 
 
                    /**************************用户等级升级提醒弹框************************/
                    JSONObject vipUpgradedNotify = data.optJSONObject("vipUpgradedNotify");
 
                    if (vipUpgradedNotify != null) {
 
                        final VIPUpgradedNotify notify = new Gson().fromJson(vipUpgradedNotify.toString(), VIPUpgradedNotify.class);
                        if (data.optJSONObject("dialog") == null) {
//                            synchronized (vipUpgradedDialog) {
                            if (vipUpgradedDialog == null)
                                vipUpgradedDialog = new VipUpgradedDialog.Builder(getContext()).setData(notify).setCloseClickListener(new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        ShoppingApi.closeDialogNotify(getContext(), UserUtil.getUid(getContext()), notify.getId(), notify.getSourceId(), 0, null);
                                    }
                                }).setPositiveClickListener(new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        ShoppingApi.closeDialogNotify(getContext(), UserUtil.getUid(getContext()), notify.getId(), notify.getSourceId(), 2, null);
                                    }
                                }).create();
                            if (!vipUpgradedDialog.isShowing())
                                vipUpgradedDialog.show();
                        }
//                        }
                    }
 
 
 
                }
            }
        });
    }
 
 
    private void closeDialogNotify(String id, int type) {
        ShoppingApi.closeDialogNotify(getContext(), UserUtil.getUid(getContext()), id, null, type, null);
    }
 
    /**
     * 奖金选择时间变化对应View的状态变化
     * state==1 今日奖金  2昨日奖金  3本月奖金 4上月奖金
     */
    private void showRewardStatisticsView() {
        fl_reward_today.setBackground(rewardState == 1 ? getResources().getDrawable(R.drawable.shape_mine_share_top)
                : null);
        tv_reward_today.setTextColor(rewardState == 1 ? getResources().getColor(R.color.white) :
                getResources().getColor(R.color.theme));
        fl_reward_today_ic.setVisibility(rewardState == 1 ? View.VISIBLE : View.INVISIBLE);//小箭头
        tv_reward_today.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 1 ? 17 : 15);
 
        fl_reward_yestoday.setBackground(rewardState == 2 ? getResources().getDrawable(R.drawable.shape_mine_share_top)
                : null);
        tv_reward_yestoday.setTextColor(rewardState == 2 ? getResources().getColor(R.color.white) :
                getResources().getColor(R.color.theme));
        fl_reward_yestoday_ic.setVisibility(rewardState == 2 ? View.VISIBLE : View.INVISIBLE);//小箭头
        tv_reward_yestoday.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 2 ? 17 : 15);
 
        fl_reward_current_month.setBackground(rewardState == 3 ? getResources().getDrawable(R.drawable.shape_mine_share_top)
                : null);
        tv_reward_current_month.setTextColor(rewardState == 3 ? getResources().getColor(R.color.white) :
                getResources().getColor(R.color.theme));
        fl_reward_current_month_ic.setVisibility(rewardState == 3 ? View.VISIBLE : View.INVISIBLE);//小箭头
        tv_reward_current_month.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 3 ? 17 : 15);
 
        fl_reward_last_month.setBackground(rewardState == 4 ? getResources().getDrawable(R.drawable.shape_mine_share_top)
                : null);
        tv_reward_last_month.setTextColor(rewardState == 4 ? getResources().getColor(R.color.white) :
                getResources().getColor(R.color.theme));
        fl_reward_last_month_ic.setVisibility(rewardState == 4 ? View.VISIBLE : View.INVISIBLE);//小箭头
        tv_reward_last_month.setTextSize(TypedValue.COMPLEX_UNIT_SP, rewardState == 4 ? 17 : 15);
    }
 
    /**
     * 启动美洽客服
     */
    private void conversation() {
        KeFuUtil.jumpKeFu(tv_user_num.getContext(), "我的");
    }
 
    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPageEnd("我的");
        lastTime = System.currentTimeMillis();
        toast_dialog.dialog_dismiss();
        ll_balance.setEnabled(true);
        OkHttpUtils.getInstance().cancelTag("integral/getTaskList");////请求金币任务列表-关闭请求
        OkHttpUtils.getInstance().cancelTag("integral/getNotReceived"); //请求未领取金币-关闭请求
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
        if (vp_banner != null && mAutoScroller != null)
            vp_banner.removeCallbacks(mAutoScroller);
    }
 
    @Override
    public void onDestroy() {
        super.onDestroy();
        app = null;
        toast_dialog = null;
        OkHttpUtils.getInstance().cancelTag(tag1);
        OkHttpUtils.getInstance().cancelTag(tag2);
        OkHttpUtils.getInstance().cancelTag(tag3);
        OkHttpUtils.getInstance().cancelTag(tag4);
        OkHttpUtils.getInstance().cancelTag(tag5);
        OkHttpUtils.getInstance().cancelTag(tag6);
        OkHttpUtils.getInstance().cancelTag("integral/getTaskList");////请求金币任务列表-关闭请求
        OkHttpUtils.getInstance().cancelTag("integral/getNotReceived"); //请求未领取金币-关闭请求
        if (dialog != null && dialog.isShowing())
            dialog.dismiss();
        if (vp_banner != null && mAutoScroller != null)
            vp_banner.removeCallbacks(mAutoScroller);
    }
 
    /**
     * 百川非link跳转
     */
    private void jumpNoLink(AlibcBasePage basePage, AlibcShowParams alibcShowParams) {
        AlibcTrade.openByBizCode(getActivity(), basePage, null,
                new WebViewClient(), new WebChromeClient(), "nativeDetail", alibcShowParams,
                null, null, new MiDuoTradeCallback(""));
    }
 
 
    class Functions {
        String name;
        int resourceId;
        String method;
 
        public Functions(String name, int resourceId, String method) {
            this.name = name;
            this.resourceId = resourceId;
            this.method = method;
        }
 
 
    }
 
    class FunctionsAdapter extends BaseAdapter {
        private Context context;
 
        private List<Functions> functionsList;
 
        public FunctionsAdapter(Context context, List<Functions> functionsList) {
            this.context = context;
            this.functionsList = functionsList;
        }
 
        @Override
        public int getCount() {
            return functionsList.size();
        }
 
        @Override
        public Object getItem(int position) {
            return functionsList.get(position);
        }
 
        @Override
        public long getItemId(int position) {
            return position;
        }
 
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final Functions function = functionsList.get(position);
            View v = LayoutInflater.from(context).inflate(R.layout.item_mine_functions, null);
            ImageView iv_icon = v.findViewById(R.id.iv_icon);
            TextView tv_name = v.findViewById(R.id.tv_name);
            iv_icon.setImageResource(function.resourceId);
            tv_name.setText(function.name);
            v.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Class clazz = mineFunctionsManager.getClass();
                    try {
                        Method m1 = clazz.getDeclaredMethod(function.method);
                        m1.invoke(mineFunctionsManager);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            return v;
        }
    }
}