">
                    android:layout_width="29dp"
95 120
                    android:layout_height="18dp"
96
                    android:layout_alignBottom="@+id/detail_zhan_pic"
97 121
                    android:layout_alignEnd="@+id/detail_zhan_pic"
98 122
                    android:layout_alignRight="@+id/detail_zhan_pic"
123
                    android:layout_alignBottom="@+id/detail_zhan_pic"
99 124
                    android:background="@drawable/bg_yinying531"
100 125
                    android:gravity="center"
101 126
                    android:text="0"
@ -107,36 +132,36 @@
107 132
                    android:layout_width="wrap_content"
108 133
                    android:layout_height="wrap_content"
109 134
                    android:layout_alignTop="@+id/detail_zhan_pic"
110
                    android:layout_toRightOf="@+id/detail_zhan_pic"
111 135
                    android:layout_marginLeft="12dp"
112
                    android:paddingRight="15dp"
136
                    android:layout_toRightOf="@+id/detail_zhan_pic"
137
                    android:ellipsize="end"
113 138
                    android:gravity="left"
114 139
                    android:maxLines="3"
115
                    android:ellipsize="end"
140
                    android:paddingRight="15dp"
116 141
                    android:text=""
117
                    android:textSize="14sp"
118
                    android:textColor="@color/ui_62"/>
142
                    android:textColor="@color/ui_62"
143
                    android:textSize="14sp" />
119 144
120 145
                <TextView
121 146
                    android:id="@+id/detail_zhan_distance"
122 147
                    android:layout_width="wrap_content"
123 148
                    android:layout_height="wrap_content"
124 149
                    android:layout_alignBottom="@+id/detail_zhan_pic"
125
                    android:layout_toRightOf="@+id/detail_zhan_pic"
126 150
                    android:layout_marginLeft="12dp"
127
                    android:textSize="13sp"
128
                    android:textColor="@color/ui_68"
151
                    android:layout_toRightOf="@+id/detail_zhan_pic"
129 152
                    android:drawableLeft="@drawable/icon_window_distance"
130 153
                    android:drawablePadding="5dp"
154
                    android:text="17.2km"
155
                    android:textColor="@color/ui_68"
131 156
132
                    android:text="17.2km"/>
157
                    android:textSize="13sp" />
133 158
            </RelativeLayout>
134 159
135 160
            <View
136 161
                android:layout_width="match_parent"
137 162
                android:layout_height="0.5dp"
138
                android:background="#dddddd"
139
                android:layout_marginLeft="15dp" />
163
                android:layout_marginLeft="15dp"
164
                android:background="#dddddd" />
140 165
141 166
            <LinearLayout
142 167
                android:layout_width="match_parent"
@ -145,22 +170,22 @@
145 170
146 171
                <RelativeLayout
147 172
                    android:layout_width="0dp"
148
                    android:layout_weight="1"
149
                    android:layout_height="match_parent">
173
                    android:layout_height="match_parent"
174
                    android:layout_weight="1">
150 175
151 176
                    <LinearLayout
152 177
                        android:layout_width="wrap_content"
153 178
                        android:layout_height="wrap_content"
154
                        android:orientation="horizontal"
155
                        android:layout_centerInParent="true">
179
                        android:layout_centerInParent="true"
180
                        android:orientation="horizontal">
156 181
157 182
                        <TextView
158 183
                            android:layout_width="wrap_content"
159 184
                            android:layout_height="wrap_content"
160 185
                            android:layout_gravity="center"
161
                            android:textSize="12sp"
186
                            android:text="快充"
162 187
                            android:textColor="@color/ui_68"
163
                            android:text="快充"/>
188
                            android:textSize="12sp" />
164 189
165 190
                        <TextView
166 191
                            android:id="@+id/detail_fast_num"
@ -168,9 +193,9 @@
168 193
                            android:layout_height="wrap_content"
169 194
                            android:layout_gravity="center"
170 195
                            android:layout_marginLeft="13dp"
171
                            android:textSize="21sp"
196
                            android:text=""
172 197
                            android:textColor="@color/ui_62"
173
                            android:text=""/>
198
                            android:textSize="21sp" />
174 199
175 200
                        <TextView
176 201
                            android:id="@+id/detail_fastable"
@ -178,10 +203,10 @@
178 203
                            android:layout_height="wrap_content"
179 204
                            android:layout_gravity="center"
180 205
                            android:layout_marginLeft="24dp"
181
                            android:textSize="12sp"
182
                            android:textColor="@color/ui_68"
183 206
                            android:text="空闲"
184
                            android:visibility="visible"/>
207
                            android:textColor="@color/ui_68"
208
                            android:textSize="12sp"
209
                            android:visibility="visible" />
185 210
186 211
                        <TextView
187 212
                            android:id="@+id/detail_fastable_num"
@ -189,10 +214,10 @@
189 214
                            android:layout_height="wrap_content"
190 215
                            android:layout_gravity="center"
191 216
                            android:layout_marginLeft="13dp"
192
                            android:textSize="21sp"
193
                            android:textColor="@color/ui_62"
194 217
                            android:text=""
195
                            android:visibility="visible"/>
218
                            android:textColor="@color/ui_62"
219
                            android:textSize="21sp"
220
                            android:visibility="visible" />
196 221
197 222
198 223
                    </LinearLayout>
@ -202,27 +227,27 @@
202 227
                <View
203 228
                    android:layout_width="0.5dp"
204 229
                    android:layout_height="18dp"
205
                    android:background="#dddddd"
206
                    android:layout_gravity="center"/>
230
                    android:layout_gravity="center"
231
                    android:background="#dddddd" />
207 232
208 233
                <RelativeLayout
209 234
                    android:layout_width="0dp"
210
                    android:layout_weight="1"
211
                    android:layout_height="match_parent">
235
                    android:layout_height="match_parent"
236
                    android:layout_weight="1">
212 237
213 238
                    <LinearLayout
214 239
                        android:layout_width="wrap_content"
215 240
                        android:layout_height="wrap_content"
216
                        android:orientation="horizontal"
217
                        android:layout_centerInParent="true">
241
                        android:layout_centerInParent="true"
242
                        android:orientation="horizontal">
218 243
219 244
                        <TextView
220 245
                            android:layout_width="wrap_content"
221 246
                            android:layout_height="wrap_content"
222 247
                            android:layout_gravity="center"
223
                            android:textSize="12sp"
248
                            android:text="慢充"
224 249
                            android:textColor="@color/ui_68"
225
                            android:text="慢充"/>
250
                            android:textSize="12sp" />
226 251
227 252
                        <TextView
228 253
                            android:id="@+id/detail_slow_num"
@ -230,9 +255,9 @@
230 255
                            android:layout_height="wrap_content"
231 256
                            android:layout_gravity="center"
232 257
                            android:layout_marginLeft="13dp"
233
                            android:textSize="21sp"
258
                            android:text=""
234 259
                            android:textColor="@color/ui_62"
235
                            android:text=""/>
260
                            android:textSize="21sp" />
236 261
237 262
                        <TextView
238 263
                            android:id="@+id/detail_slowable"
@ -240,10 +265,10 @@
240 265
                            android:layout_height="wrap_content"
241 266
                            android:layout_gravity="center"
242 267
                            android:layout_marginLeft="24dp"
243
                            android:textSize="12sp"
244
                            android:textColor="@color/ui_68"
245 268
                            android:text="空闲"
246
                            android:visibility="visible"/>
269
                            android:textColor="@color/ui_68"
270
                            android:textSize="12sp"
271
                            android:visibility="visible" />
247 272
248 273
                        <TextView
249 274
                            android:id="@+id/detail_slowable_num"
@ -251,10 +276,10 @@
251 276
                            android:layout_height="wrap_content"
252 277
                            android:layout_gravity="center"
253 278
                            android:layout_marginLeft="13dp"
254
                            android:textSize="21sp"
255
                            android:textColor="@color/ui_62"
256 279
                            android:text=""
257
                            android:visibility="visible"/>
280
                            android:textColor="@color/ui_62"
281
                            android:textSize="21sp"
282
                            android:visibility="visible" />
258 283
259 284
                    </LinearLayout>
260 285
@ -265,7 +290,7 @@
265 290
            <View
266 291
                android:layout_width="match_parent"
267 292
                android:layout_height="10dp"
268
                android:background="@color/ui_f4"/>
293
                android:background="@color/ui_f4" />
269 294
270 295
            <RelativeLayout
271 296
                android:layout_width="match_parent"
@ -288,10 +313,10 @@
288 313
                    android:id="@+id/detail_cost"
289 314
                    android:layout_width="wrap_content"
290 315
                    android:layout_height="wrap_content"
291
                    android:layout_alignParentBottom="true"
292 316
                    android:layout_alignParentLeft="true"
293
                    android:layout_marginBottom="15dp"
317
                    android:layout_alignParentBottom="true"
294 318
                    android:layout_marginLeft="15dp"
319
                    android:layout_marginBottom="15dp"
295 320
                    android:drawablePadding="11dp"
296 321
                    android:text=""
297 322
                    android:textColor="@color/ui_62"
@ -323,8 +348,8 @@
323 348
            <View
324 349
                android:layout_width="match_parent"
325 350
                android:layout_height="0.5dp"
326
                android:background="#dddddd"
327
                android:layout_marginLeft="15dp" />
351
                android:layout_marginLeft="15dp"
352
                android:background="#dddddd" />
328 353
329 354
            <LinearLayout
330 355
                android:layout_width="match_parent"
@ -356,13 +381,13 @@
356 381
                            android:layout_width="wrap_content"
357 382
                            android:layout_height="wrap_content"
358 383
                            android:layout_alignParentRight="true"
359
                            android:layout_toRightOf="@+id/tv1"
360 384
                            android:layout_marginLeft="20dp"
385
                            android:layout_toRightOf="@+id/tv1"
361 386
                            android:gravity="right"
362
                            cb:align="right"
363 387
                            android:text=""
364 388
                            android:textColor="@color/ui_65"
365
                            android:textSize="14sp" />
389
                            android:textSize="14sp"
390
                            cb:align="right" />
366 391
367 392
                    </RelativeLayout>
368 393
@ -492,15 +517,15 @@
492 517
                        android:id="@+id/detail_park_cost"
493 518
                        android:layout_width="wrap_content"
494 519
                        android:layout_height="wrap_content"
520
                        android:layout_alignParentTop="true"
495 521
                        android:layout_alignParentRight="true"
522
                        android:layout_marginLeft="20dp"
496 523
                        android:layout_toRightOf="@+id/tv2"
497 524
                        android:gravity="right"
498
                        android:layout_marginLeft="20dp"
499
                        android:layout_alignParentTop="true"
500 525
                        android:text=""
501
                        cb:align="right"
502 526
                        android:textColor="@color/ui_65"
503
                        android:textSize="14sp" />
527
                        android:textSize="14sp"
528
                        cb:align="right" />
504 529
505 530
                </RelativeLayout>
506 531
@ -522,15 +547,15 @@
522 547
                        android:id="@+id/detail_time"
523 548
                        android:layout_width="wrap_content"
524 549
                        android:layout_height="wrap_content"
550
                        android:layout_alignParentTop="true"
525 551
                        android:layout_alignParentRight="true"
552
                        android:layout_marginLeft="20dp"
526 553
                        android:layout_toRightOf="@+id/tv3"
527 554
                        android:gravity="right"
528
                        android:layout_marginLeft="20dp"
529
                        android:layout_alignParentTop="true"
530 555
                        android:text=""
531
                        cb:align="right"
532 556
                        android:textColor="@color/ui_65"
533
                        android:textSize="14sp" />
557
                        android:textSize="14sp"
558
                        cb:align="right" />
534 559
535 560
                </RelativeLayout>
536 561
@ -539,7 +564,7 @@
539 564
            <View
540 565
                android:layout_width="match_parent"
541 566
                android:layout_height="10dp"
542
                android:background="@color/ui_f4"/>
567
                android:background="@color/ui_f4" />
543 568
544 569
            <LinearLayout
545 570
                android:layout_width="match_parent"
@ -550,31 +575,31 @@
550 575
                    android:id="@+id/tv_today_num"
551 576
                    android:layout_width="wrap_content"
552 577
                    android:layout_height="wrap_content"
553
                    android:layout_alignParentTop="true"
554 578
                    android:layout_alignParentLeft="true"
579
                    android:layout_alignParentTop="true"
555 580
                    android:layout_marginLeft="15dp"
556 581
                    android:layout_marginTop="15dp"
557
                    android:drawablePadding="11dp"
558 582
                    android:drawableLeft="@drawable/icon_detail_chargelist"
583
                    android:drawablePadding="11dp"
559 584
                    android:text="充电记录"
560
                    android:textSize="15sp"
561
                    android:textColor="@color/ui_62"/>
585
                    android:textColor="@color/ui_62"
586
                    android:textSize="15sp" />
562 587
563 588
                <com.github.mikephil.charting.charts.CombinedChart
564 589
                    android:id="@+id/chart1"
565 590
                    android:layout_width="match_parent"
566
                    android:layout_marginTop="10dp"
591
                    android:layout_height="150dp"
567 592
                    android:layout_marginLeft="16dp"
568
                    android:layout_marginRight="16dp"
569
                    android:layout_height="150dp" />
593
                    android:layout_marginTop="10dp"
594
                    android:layout_marginRight="16dp" />
570 595
571 596
                <RelativeLayout
572 597
                    android:layout_width="match_parent"
573 598
                    android:layout_height="wrap_content"
574 599
                    android:layout_marginLeft="15dp"
575 600
                    android:layout_marginRight="15dp"
576
                    android:paddingBottom="15dp"
577
                    android:paddingTop="15dp">
601
                    android:paddingTop="15dp"
602
                    android:paddingBottom="15dp">
578 603
579 604
                    <TextView
580 605
                        android:id="@+id/detail_list_num"
@ -582,32 +607,30 @@
582 607
                        android:layout_height="wrap_content"
583 608
                        android:layout_alignParentLeft="true"
584 609
                        android:text="已有-位车主发布车型记录"
585
                        android:textSize="14sp"
586
                        android:textColor="@color/ui_65"/>
610
                        android:textColor="@color/ui_65"
611
                        android:textSize="14sp" />
587 612
588 613
                    <TextView
589 614
                        android:id="@+id/detail_charging_enter"
590 615
                        android:layout_width="wrap_content"
591 616
                        android:layout_height="wrap_content"
592 617
                        android:layout_alignParentRight="true"
593
                        android:text="前往查看"
594 618
                        android:drawableRight="@drawable/icon_charging_more"
595 619
                        android:drawablePadding="4dp"
596
                        android:textSize="14sp"
597
                        android:textColor="@color/lvse"/>
620
                        android:text="前往查看"
621
                        android:textColor="@color/lvse"
622
                        android:textSize="14sp" />
598 623
599 624
                </RelativeLayout>
600 625
601 626
602
603
604 627
            </LinearLayout>
605 628
606 629
            <View
607 630
                android:id="@+id/detail_view"
608 631
                android:layout_width="match_parent"
609 632
                android:layout_height="10dp"
610
                android:background="@color/ui_f4"/>
633
                android:background="@color/ui_f4" />
611 634
612 635
            <LinearLayout
613 636
                android:id="@+id/detail_claimer_remark"
@ -618,27 +641,27 @@
618 641
                <TextView
619 642
                    android:layout_width="wrap_content"
620 643
                    android:layout_height="wrap_content"
621
                    android:layout_alignParentTop="true"
622 644
                    android:layout_alignParentLeft="true"
645
                    android:layout_alignParentTop="true"
623 646
                    android:layout_marginLeft="15dp"
624 647
                    android:layout_marginTop="15dp"
625 648
                    android:drawableLeft="@drawable/icon_detail_remark"
626 649
                    android:drawablePadding="11dp"
627 650
                    android:text="备注"
628
                    android:textSize="15sp"
629
                    android:textColor="@color/ui_62"/>
651
                    android:textColor="@color/ui_62"
652
                    android:textSize="15sp" />
630 653
631 654
                <me.codeboy.android.aligntextview.AlignTextView
632 655
                    android:id="@+id/detail_remark"
633 656
                    android:layout_width="wrap_content"
634 657
                    android:layout_height="wrap_content"
635
                    android:layout_marginRight="15dp"
636
                    android:layout_marginTop="8dp"
637 658
                    android:layout_marginLeft="42dp"
659
                    android:layout_marginTop="8dp"
660
                    android:layout_marginRight="15dp"
638 661
                    android:layout_marginBottom="15dp"
639 662
                    android:text=""
640
                    android:textSize="14sp"
641
                    android:textColor="@color/ui_65"/>
663
                    android:textColor="@color/ui_65"
664
                    android:textSize="14sp" />
642 665
643 666
644 667
            </LinearLayout>
@ -646,7 +669,7 @@
646 669
            <View
647 670
                android:layout_width="match_parent"
648 671
                android:layout_height="10dp"
649
                android:background="@color/ui_f4"/>
672
                android:background="@color/ui_f4" />
650 673
651 674
            <RelativeLayout
652 675
                android:id="@+id/rl_new_comment"
@ -670,11 +693,11 @@
670 693
                <TextView
671 694
                    android:layout_width="wrap_content"
672 695
                    android:layout_height="wrap_content"
673
                    android:layout_alignParentRight="true"
674 696
                    android:layout_alignTop="@+id/tv_new"
675
                    android:text="查看所有评论"
697
                    android:layout_alignParentRight="true"
676 698
                    android:drawableRight="@drawable/icon_detail_more"
677 699
                    android:drawablePadding="5dp"
700
                    android:text="查看所有评论"
678 701
                    android:textColor="@color/ui_68"
679 702
                    android:textSize="14sp" />
680 703
@ -682,9 +705,9 @@
682 705
                    android:id="@+id/rl_icon"
683 706
                    android:layout_width="35dp"
684 707
                    android:layout_height="35dp"
685
                    android:layout_alignParentLeft="true"
686
                    android:layout_alignParentStart="true"
687 708
                    android:layout_below="@+id/tv_new"
709
                    android:layout_alignParentStart="true"
710
                    android:layout_alignParentLeft="true"
688 711
                    android:layout_gravity="center_vertical"
689 712
                    android:layout_marginTop="10dp">
690 713
@ -699,14 +722,13 @@
699 722
                        android:id="@+id/iv_level_img"
700 723
                        android:layout_width="15dp"
701 724
                        android:layout_height="15dp"
702
                        android:layout_alignParentBottom="true"
703
                        android:layout_alignParentRight="true"/>
725
                        android:layout_alignParentRight="true"
726
                        android:layout_alignParentBottom="true" />
704 727
705 728
706 729
                </RelativeLayout>
707 730
708 731
709
710 732
                <TextView
711 733
                    android:id="@+id/tv_new_name"
712 734
                    android:layout_width="wrap_content"
@ -739,8 +761,8 @@
739 761
                    android:id="@+id/iv_new_pingfen"
740 762
                    android:layout_width="wrap_content"
741 763
                    android:layout_height="wrap_content"
742
                    android:layout_alignParentRight="true"
743 764
                    android:layout_alignTop="@+id/tv_new_name"
765
                    android:layout_alignParentRight="true"
744 766
                    android:layout_gravity="center_vertical"
745 767
                    android:src="@drawable/icon_5xing"
746 768
                    android:textAppearance="?android:attr/textAppearanceSmall" />
@ -749,11 +771,11 @@
749 771
                    android:id="@+id/tv_new_comment"
750 772
                    android:layout_width="wrap_content"
751 773
                    android:layout_height="wrap_content"
752
                    android:layout_alignLeft="@+id/tv_new_name"
753
                    android:layout_alignStart="@+id/tv_new_name"
754 774
                    android:layout_below="@+id/tv_new_name"
755
                    android:layout_marginRight="15dp"
775
                    android:layout_alignStart="@+id/tv_new_name"
776
                    android:layout_alignLeft="@+id/tv_new_name"
756 777
                    android:layout_marginTop="10dp"
778
                    android:layout_marginRight="15dp"
757 779
                    android:text=""
758 780
                    android:textAppearance="?android:attr/textAppearanceSmall"
759 781
                    android:textSize="15sp"
@ -763,32 +785,32 @@
763 785
                    android:id="@+id/id_flowlayout_activity"
764 786
                    android:layout_width="fill_parent"
765 787
                    android:layout_height="wrap_content"
766
                    android:layout_alignLeft="@+id/tv_new_comment"
767 788
                    android:layout_below="@+id/tv_new_comment"
789
                    android:layout_alignLeft="@+id/tv_new_comment"
768 790
                    android:layout_marginTop="10dp"
769 791
                    zhy:max_select="-1">
770 792
771 793
                </com.zhy.view.flowlayout.TagFlowLayout>
772 794
773 795
                <ImageView
796
                    android:id="@+id/iv_commentPic"
774 797
                    android:layout_width="65dp"
775 798
                    android:layout_height="65dp"
776
                    android:id="@+id/iv_commentPic"
777
                    android:layout_marginTop="10dp"
778 799
                    android:layout_below="@+id/id_flowlayout_activity"
779 800
                    android:layout_alignLeft="@+id/tv_new_comment"
801
                    android:layout_marginTop="10dp"
780 802
                    android:scaleType="centerCrop"
781
                    android:visibility="gone"/>
803
                    android:visibility="gone" />
782 804
783 805
                <TextView
784 806
                    android:id="@+id/tv_new_time"
785 807
                    android:layout_width="wrap_content"
786 808
                    android:layout_height="wrap_content"
787
                    android:layout_alignLeft="@+id/tv_new_comment"
788
                    android:layout_alignStart="@+id/tv_new_comment"
789 809
                    android:layout_below="@+id/iv_commentPic"
790
                    android:layout_marginBottom="8dp"
810
                    android:layout_alignStart="@+id/tv_new_comment"
811
                    android:layout_alignLeft="@+id/tv_new_comment"
791 812
                    android:layout_marginTop="10dp"
813
                    android:layout_marginBottom="8dp"
792 814
                    android:text="15分钟前"
793 815
                    android:textAppearance="?android:attr/textAppearanceSmall"
794 816
                    android:textColor="@color/ui_68"

完成排行榜功能 · bdd557e9bf - Gogs: Go Git Service
ソースを参照

完成排行榜功能

hy 4 年 前
コミット
bdd557e9bf

+ 3 - 1
app/src/main/java/com/electric/chargingpile/activity/RankingListActivity.java

@ -16,7 +16,9 @@ import com.electric.chargingpile.data.RankinglistRefreshEvent;
16 16
import com.electric.chargingpile.fragment.MonthListFragment;
17 17
import com.electric.chargingpile.fragment.TotalListFragment;
18 18
import com.electric.chargingpile.util.BarColorUtil;
19
19
/**
20
 * 总榜
21
 * */
20 22
public class RankingListActivity extends FragmentActivity implements View.OnClickListener {
21 23
    private ViewPager viewPager;
22 24
    private RelativeLayout rl_monthList, rl_totalList;

+ 21 - 6
app/src/main/java/com/electric/chargingpile/adapter/QuarterAdapter.java

@ -15,6 +15,8 @@ import com.electric.chargingpile.R;
15 15
import org.jetbrains.annotations.NotNull;
16 16
17 17
import java.util.ArrayList;
18
import java.util.Calendar;
19
import java.util.Date;
18 20
19 21
public class QuarterAdapter extends RecyclerView.Adapter<QuarterAdapter.ViewHolder> {
20 22
    private Context mContext=null;
@ -26,10 +28,23 @@ public class QuarterAdapter extends RecyclerView.Adapter<QuarterAdapter.ViewHold
26 28
27 29
    public QuarterAdapter(Context mContext) {
28 30
        this.mContext = mContext;
29
        mDatas.add("一季度");
30
        mDatas.add("二季度");
31
        mDatas.add("三季度");
32
        mDatas.add("季度");
31
        Calendar cal =Calendar.getInstance();
32
        int month = cal.get(Calendar.MONTH) + 1;
33
        if (month>=1 && month <=3){
34
            mDatas.add("季度");
35
            mDatas.add("二季度");
36
            mDatas.add("三季度");
37
            mDatas.add("四季度");
38
        }else if (month>= 4 && month <=6){
39
            mDatas.add("一季度");
40
        }else if (month>= 7 && month <=9){
41
            mDatas.add("一季度");
42
            mDatas.add("二季度");
43
        }else if (month>=10 && month <=12){
44
            mDatas.add("一季度");
45
            mDatas.add("二季度");
46
            mDatas.add("三季度");
47
        }
33 48
    }
34 49
35 50
    public ItemOnClick getItemOnClick() {
@ -59,7 +74,7 @@ public class QuarterAdapter extends RecyclerView.Adapter<QuarterAdapter.ViewHold
59 74
        holder.mTextView.setOnClickListener(v->{
60 75
            if (mItemOnClick!=null){
61 76
                mSelectPostion=position;
62
                mItemOnClick.onClick(position);
77
                mItemOnClick.onClick(position,mDatas.get(position));
63 78
                notifyDataSetChanged();
64 79
            }
65 80
        });
@ -81,6 +96,6 @@ public class QuarterAdapter extends RecyclerView.Adapter<QuarterAdapter.ViewHold
81 96
    }
82 97
83 98
    public interface ItemOnClick{
84
        void onClick(int posistion);
99
        void onClick(int posistion,String name);
85 100
    }
86 101
}

+ 16 - 9
app/src/main/java/com/electric/chargingpile/fragment/MonthListFragment.java

@ -4,6 +4,8 @@ import android.app.Activity;
4 4
import android.content.Intent;
5 5
import android.os.Bundle;
6 6
import androidx.fragment.app.Fragment;
7
8
import android.util.Log;
7 9
import android.view.LayoutInflater;
8 10
import android.view.View;
9 11
import android.view.ViewGroup;
@ -39,7 +41,9 @@ import java.net.URLEncoder;
39 41
import java.util.ArrayList;
40 42
41 43
import okhttp3.Call;
42
44
/**
45
 * 月榜
46
 * */
43 47
public class MonthListFragment extends Fragment {
44 48
    private TextView tv_month_name, tv_month_ranking, tv_month_charge, tv_notice, tv_ranking_zanwu;
45 49
    private CircleImageView iv_icon;
@ -94,7 +98,7 @@ public class MonthListFragment extends Fragment {
94 98
        }
95 99
96 100
//        Log.e("111",MainApplication.url+"/zhannew/basic/web/index.php/ranking/index?user_id="+MainApplication.userId+"&token="+URLEncoder.encode(token));
97
        OkHttpUtils.get().url(MainApplication.url + "/zhannew/basic/web/index.php/ranking/index")
101
        OkHttpUtils.get().url(MainApplication.url + "/zhannew/basic/web/index.php/ranking/month")
98 102
                .addParams("user_id", MainApplication.userId)
99 103
                .addParams("token", URLEncoder.encode(token))
100 104
                .addParams("phone", MainApplication.userPhone)
@ -118,12 +122,15 @@ public class MonthListFragment extends Fragment {
118 122
                        if (code.equals("200")) {
119 123
                            //当月该用户充电数据
120 124
                            String data = JsonUtils.getKeyResult(response, "data");
121
                            String current_total = JsonUtils.getKeyResult(data, "current_total");
122
                            String power = JsonUtils.getKeyResult(current_total, "power");
123
                            String nickname = JsonUtils.getKeyResult(current_total, "nickname");
124
                            String tel = JsonUtils.getKeyResult(current_total, "tel");
125
                            String sort = JsonUtils.getKeyResult(current_total, "sort");
126
                            String userpic = JsonUtils.getKeyResult(current_total, "userpic");
125
                            String own = JsonUtils.getKeyResult(response, "own");
126
127
                            String user_id = JsonUtils.getKeyResult(own, "user_id");
128
                            String power = JsonUtils.getKeyResult(own, "power");
129
                            String nickname = JsonUtils.getKeyResult(own, "nickname");
130
                            String tel = JsonUtils.getKeyResult(own, "tel");
131
                            String sort = JsonUtils.getKeyResult(own, "sort");
132
                            String userpic = JsonUtils.getKeyResult(own, "userpic");
133
127 134
                            if (power.equals("") && nickname.equals("") && tel.equals("") && sort.equals("") && userpic.equals("")) {
128 135
                                tv_no_login.setVisibility(View.VISIBLE);
129 136
                                tv_login.setVisibility(View.VISIBLE);
@ -176,7 +183,7 @@ public class MonthListFragment extends Fragment {
176 183
                            JSONArray jsonArray = null;
177 184
                            try {
178 185
                                jsonObjj = new JSONObject(data);
179
                                jsonArray = jsonObjj.getJSONArray("current_data");
186
                                jsonArray = jsonObjj.getJSONArray("month");
180 187
                            } catch (JSONException e) {
181 188
                                e.printStackTrace();
182 189
                            }

+ 73 - 62
app/src/main/java/com/electric/chargingpile/fragment/TotalListFragment.java

@ -22,6 +22,7 @@ import android.widget.RelativeLayout;
22 22
import android.widget.TextView;
23 23
import android.widget.Toast;
24 24
25
import com.alibaba.fastjson.JSON;
25 26
import com.blankj.utilcode.util.SizeUtils;
26 27
import com.blankj.utilcode.util.Utils;
27 28
import com.electric.chargingpile.R;
@ -60,6 +61,7 @@ public class TotalListFragment extends Fragment implements View.OnClickListener
60 61
    private RelativeLayout rl_totalList;
61 62
    private LinearLayout layoutQuarter;
62 63
    private PopupWindow mPopupWindow;
64
    private String mQuarter="1";
63 65
64 66
    @Override
65 67
    public void onCreate(Bundle savedInstanceState) {
@ -104,10 +106,11 @@ public class TotalListFragment extends Fragment implements View.OnClickListener
104 106
        } catch (Exception e) {
105 107
            e.printStackTrace();
106 108
        }
107
        OkHttpUtils.get().url(MainApplication.url + "/zhannew/basic/web/index.php/ranking/index")
109
        OkHttpUtils.get().url(MainApplication.url + "/zhannew/basic/web/index.php/ranking/quarter")
108 110
                .addParams("user_id", MainApplication.userId)
109 111
                .addParams("token", URLEncoder.encode(token))
110 112
                .addParams("phone", MainApplication.userPhone)
113
                .addParams("quarter", mQuarter)
111 114
                .addParams("password", URLEncoder.encode(MainApplication.userPassword))
112 115
                .build()
113 116
                .execute(new StringCallback() {
@ -118,74 +121,82 @@ public class TotalListFragment extends Fragment implements View.OnClickListener
118 121
119 122
                    @Override
120 123
                    public void onResponse(String response) {
121
//                        Log.e("response==",response);
124
//                        Log.e("response==",response);,
122 125
                        String code = JsonUtils.getKeyResult(response, "code");
126
123 127
                        if (code.equals("200")) {
124 128
                            //总计该用户充电数据
125 129
                            String data = JsonUtils.getKeyResult(response, "data");
126
                            String current_total = JsonUtils.getKeyResult(data, "user_total");
127
                            String power = JsonUtils.getKeyResult(current_total, "power");
128
                            String nickname = JsonUtils.getKeyResult(current_total, "nickname");
129
                            String tel = JsonUtils.getKeyResult(current_total, "tel");
130
                            String sort = JsonUtils.getKeyResult(current_total, "sort");
131
                            String userpic = JsonUtils.getKeyResult(current_total, "userpic");
132
                            if (power.equals("") && nickname.equals("") && tel.equals("") && sort.equals("") && userpic.equals("")) {
133
                                tv_no_login.setVisibility(View.VISIBLE);
134
                                tv_login.setVisibility(View.VISIBLE);
135
                                rl_totalList.setOnClickListener(new View.OnClickListener() {
136
                                    @Override
137
                                    public void onClick(View v) {
138
                                        if (!MainApplication.isLogin()) {
139
                                            startActivity(new Intent(getContext(), LoginActivity.class));
140
                                        }
141
142
                                    }
143
                                });
144
                                ll_ranking.setVisibility(View.GONE);
145
                                tv_total_charge.setVisibility(View.GONE);
146
                                tv_total_name.setVisibility(View.GONE);
147
                                tv_ranking_zanwu.setVisibility(View.GONE);
148
                            } else {
149
                                tv_no_login.setVisibility(View.GONE);
150
                                tv_login.setVisibility(View.GONE);
151
                                ll_ranking.setVisibility(View.VISIBLE);
152
                                tv_total_charge.setVisibility(View.VISIBLE);
153
                                tv_total_name.setVisibility(View.VISIBLE);
154
                                tv_ranking_zanwu.setVisibility(View.VISIBLE);
155
                                if (nickname.equals("")) {
156
                                    tv_total_name.setText(Util.handlePhoneComment(tel));
157
                                } else {
158
                                    tv_total_name.setText(nickname);
159
                                }
160
                                if (sort.equals("0")) {
161
                                    tv_ranking_zanwu.setVisibility(View.VISIBLE);
162
                                    ll_ranking.setVisibility(View.GONE);
163
164
                                } else {
165
                                    tv_ranking_zanwu.setVisibility(View.GONE);
166
                                    ll_ranking.setVisibility(View.VISIBLE);
167
                                    tv_total_ranking.setText(sort);
168
                                }
169
                                tv_total_charge.setText(power + "度");
170
//                                PicassoUtil.loadingNetImage(getActivity(), "http://cdz.d1ev.com/zhannew/uploadfile/" + userpic
171
//                                        , iv_icon);
172
                                Picasso.with(MainApplication.context)
173
                                        .load(MainApplication.pic_url + userpic)
174
                                        .error(R.drawable.icon_user1118)
175
                                        .placeholder(R.drawable.icon_user1118)
176
                                        .into(iv_icon);
177
                            }
130
//                            String current_total = JsonUtils.getKeyResult(data, "user_total");
131
//                            String power = JsonUtils.getKeyResult(current_total, "power");
132
//                            String nickname = JsonUtils.getKeyResult(current_total, "nickname");
133
//                            String tel = JsonUtils.getKeyResult(current_total, "tel");
134
//                            String sort = JsonUtils.getKeyResult(current_total, "sort");
135
//                            String userpic = JsonUtils.getKeyResult(current_total, "userpic");
136
//                            if (power.equals("") && nickname.equals("") && tel.equals("") && sort.equals("") && userpic.equals("")) {
137
//                                tv_no_login.setVisibility(View.VISIBLE);
138
//                                tv_login.setVisibility(View.VISIBLE);
139
//                                rl_totalList.setOnClickListener(new View.OnClickListener() {
140
//                                    @Override
141
//                                    public void onClick(View v) {
142
//                                        if (!MainApplication.isLogin()) {
143
//                                            startActivity(new Intent(getContext(), LoginActivity.class));
144
//                                        }
145
//
146
//                                    }
147
//                                });
148
//                                ll_ranking.setVisibility(View.GONE);
149
//                                tv_total_charge.setVisibility(View.GONE);
150
//                                tv_total_name.setVisibility(View.GONE);
151
//                                tv_ranking_zanwu.setVisibility(View.GONE);
152
//                            } else {
153
//                                tv_no_login.setVisibility(View.GONE);
154
//                                tv_login.setVisibility(View.GONE);
155
//                                ll_ranking.setVisibility(View.VISIBLE);
156
//                                tv_total_charge.setVisibility(View.VISIBLE);
157
//                                tv_total_name.setVisibility(View.VISIBLE);
158
//                                tv_ranking_zanwu.setVisibility(View.VISIBLE);
159
//                                if (nickname.equals("")) {
160
//                                    tv_total_name.setText(Util.handlePhoneComment(tel));
161
//                                } else {
162
//                                    tv_total_name.setText(nickname);
163
//                                }
164
//                                if (sort.equals("0")) {
165
//                                    tv_ranking_zanwu.setVisibility(View.VISIBLE);
166
//                                    ll_ranking.setVisibility(View.GONE);
167
//
168
//                                } else {
169
//                                    tv_ranking_zanwu.setVisibility(View.GONE);
170
//                                    ll_ranking.setVisibility(View.VISIBLE);
171
//                                    tv_total_ranking.setText(sort);
172
//                                }
173
//                                tv_total_charge.setText(power + "度");
174
////                                PicassoUtil.loadingNetImage(getActivity(), "http://cdz.d1ev.com/zhannew/uploadfile/" + userpic
175
////                                        , iv_icon);
176
//                                Picasso.with(MainApplication.context)
177
//                                        .load(MainApplication.pic_url + userpic)
178
//                                        .error(R.drawable.icon_user1118)
179
//                                        .placeholder(R.drawable.icon_user1118)
180
//                                        .into(iv_icon);
181
//                            }
178 182
                            //当月充电排行
183
//                            ArrayList<JSONObject> datas = new ArrayList<JSONObject>();
184
//                            JSONObject jsonObjj = null;
185
//                            JSONArray jsonArray = null;
186
//                            try {
187
//                                jsonObjj = new JSONObject(data);
188
//                                jsonArray = jsonObjj.getJSONArray("total_data");
189
//                            } catch (JSONException e) {
190
//                                e.printStackTrace();
191
//                            }
192
//                            datas.clear();
179 193
                            ArrayList<JSONObject> datas = new ArrayList<JSONObject>();
180
                            JSONObject jsonObjj = null;
181
                            JSONArray jsonArray = null;
194
                            JSONArray jsonArray= null;
182 195
                            try {
183
                                jsonObjj = new JSONObject(data);
184
                                jsonArray = jsonObjj.getJSONArray("total_data");
196
                                jsonArray = new JSONArray(data);
185 197
                            } catch (JSONException e) {
186 198
                                e.printStackTrace();
187 199
                            }
188
                            datas.clear();
189 200
                            for (int j = 0; j < jsonArray.length(); j++) {
190 201
                                JSONObject jsonObject4 = (JSONObject) jsonArray
191 202
                                        .opt(j);
@ -236,9 +247,9 @@ public class TotalListFragment extends Fragment implements View.OnClickListener
236 247
        RecyclerView recyclerView = rootView.findViewById(R.id.recyclerView);
237 248
        recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
238 249
        QuarterAdapter adapter = new QuarterAdapter(requireContext());
239
        adapter.setItemOnClick(posistion -> {
240
            //TODO
241
            Toast.makeText(requireContext(), ""+posistion, Toast.LENGTH_SHORT).show();
250
        adapter.setItemOnClick((posistion,name) -> {
251
            mQuarter=String.valueOf(posistion+1);
252
            getData(null);
242 253
            mPopupWindow.dismiss();
243 254
        });
244 255

+ 32 - 21
app/src/main/res/layout/fragment_total_list.xml

@ -9,32 +9,43 @@
9 9
10 10
11 11
    <LinearLayout
12
        android:id="@+id/layoutQuarter"
13
        android:layout_marginBottom="15dp"
14
        android:layout_marginStart="12dp"
15
        android:layout_marginEnd="12dp"
16
        android:layout_marginTop="15dp"
17
        android:layout_width="wrap_content"
12
        android:background="@color/white"
13
        android:layout_width="match_parent"
18 14
        android:layout_height="wrap_content">
19
        <TextView
20
            android:layout_width="wrap_content"
21
            android:layout_height="wrap_content"
22
            android:text="当年季度筛选"
23
            android:textColor="@color/color_green_style1"
24
            android:textSize="14sp"
25
            />
26
        <TextView
27
            android:layout_gravity="center_vertical"
28
            android:layout_marginStart="4dp"
15
        <LinearLayout
16
            android:id="@+id/layoutQuarter"
17
            android:layout_marginBottom="15dp"
18
            android:layout_marginStart="12dp"
19
            android:layout_marginEnd="12dp"
20
            android:layout_marginTop="15dp"
29 21
            android:layout_width="wrap_content"
30
            android:layout_height="wrap_content"
31
            android:text="▼"
32
            android:textColor="@color/color_green_style1"
33
            android:textSize="8dp"
34
            />
22
            android:layout_height="wrap_content">
23
            <TextView
24
                android:id="@+id/selectQuarter"
25
                android:layout_width="wrap_content"
26
                android:layout_height="wrap_content"
27
                android:text="当年季度筛选"
28
                android:textColor="@color/color_green_style1"
29
                android:textSize="14sp"
30
                />
31
            <TextView
32
                android:layout_gravity="center_vertical"
33
                android:layout_marginStart="4dp"
34
                android:layout_width="wrap_content"
35
                android:layout_height="wrap_content"
36
                android:text="▼"
37
                android:textColor="@color/color_green_style1"
38
                android:textSize="8dp"
39
                />
40
35 41
42
        </LinearLayout>
36 43
37 44
    </LinearLayout>
45
    <View
46
        android:layout_width="match_parent"
47
        android:layout_height="0.5dp"
48
        android:background="@color/ui_line"/>
38 49
39 50
    <RelativeLayout
40 51
        android:id="@+id/rl_totalList"