16 28
import com.electric.chargingpile.activity.LoginActivity;
17 29
import com.electric.chargingpile.activity.MainMapActivity;
30
import com.electric.chargingpile.adapter.QuarterAdapter;
18 31
import com.electric.chargingpile.adapter.TotalListAdapter;
19 32
import com.electric.chargingpile.application.MainApplication;
20 33
import com.electric.chargingpile.data.MyOtto;
@ -28,6 +41,7 @@ import com.squareup.picasso.Picasso;
28 41
import com.zhy.http.okhttp.OkHttpUtils;
29 42
import com.zhy.http.okhttp.callback.StringCallback;
30 43
44
import org.jetbrains.annotations.NotNull;
31 45
import org.json.JSONArray;
32 46
import org.json.JSONException;
33 47
import org.json.JSONObject;
@ -37,13 +51,15 @@ import java.util.ArrayList;
37 51
38 52
import okhttp3.Call;
39 53
40
public class TotalListFragment extends Fragment {
54
public class TotalListFragment extends Fragment implements View.OnClickListener {
41 55
    private TextView tv_total_name, tv_total_ranking, tv_total_charge, tv_notice, tv_ranking_zanwu;
42 56
    private CircleImageView iv_icon;
43 57
    private ListView lv_total;
44 58
    private LinearLayout ll_ranking;
45 59
    private TextView tv_no_login, tv_login;
46 60
    private RelativeLayout rl_totalList;
61
    private LinearLayout layoutQuarter;
62
    private PopupWindow mPopupWindow;
47 63
48 64
    @Override
49 65
    public void onCreate(Bundle savedInstanceState) {
@ -55,6 +71,7 @@ public class TotalListFragment extends Fragment {
55 71
                             Bundle savedInstanceState) {
56 72
        View view = inflater.inflate(R.layout.fragment_total_list, null);
57 73
        initView(view);
74
        initPopupWindow();
58 75
        MyOtto.getInstance().register(this);
59 76
        getData(null);
60 77
        return view;
@ -72,6 +89,8 @@ public class TotalListFragment extends Fragment {
72 89
        tv_no_login = (TextView) v.findViewById(R.id.tv_no_login);
73 90
        tv_login = (TextView) v.findViewById(R.id.tv_login);
74 91
        rl_totalList = (RelativeLayout) v.findViewById(R.id.rl_totalList);
92
        layoutQuarter = (LinearLayout) v.findViewById(R.id.layoutQuarter);
93
        layoutQuarter.setOnClickListener(this);
75 94
    }
76 95
77 96
    @Subscribe
@ -191,4 +210,38 @@ public class TotalListFragment extends Fragment {
191 210
        super.onDestroy();
192 211
        MyOtto.getInstance().unregister(this);
193 212
    }
213
214
    @Override
215
    public void onClick(View v) {
216
        switch (v.getId()){
217
            case R.id.layoutQuarter:
218
                if (mPopupWindow!=null){
219
                    mPopupWindow.showAsDropDown(layoutQuarter,0, 0, Gravity.BOTTOM);
220
                }
221
                break;
222
        }
223
    }
224
225
    @NotNull
226
    private void initPopupWindow() {
227
        View rootView = LayoutInflater.from(requireContext()).inflate(R.layout.layout_quarter, null, false);
228
        mPopupWindow = new PopupWindow(rootView, SizeUtils.dp2px(92),ViewGroup.LayoutParams.WRAP_CONTENT);
229
        // 设置PopupWindow的背景
230
        mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
231
        // 设置PopupWindow是否能响应外部点击事件
232
        mPopupWindow.setOutsideTouchable(true);
233
        // 设置PopupWindow是否能响应点击事件
234
        mPopupWindow.setTouchable(true);
235
236
        RecyclerView recyclerView = rootView.findViewById(R.id.recyclerView);
237
        recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
238
        QuarterAdapter adapter = new QuarterAdapter(requireContext());
239
        adapter.setItemOnClick(posistion -> {
240
            //TODO
241
            Toast.makeText(requireContext(), ""+posistion, Toast.LENGTH_SHORT).show();
242
            mPopupWindow.dismiss();
243
        });
244
245
        recyclerView.setAdapter(adapter);
246
    }
194 247
}

+ 5 - 0
app/src/main/res/drawable/bg_quarter.xml

@ -0,0 +1,5 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<shape xmlns:android="http://schemas.android.com/apk/res/android">
3
    <corners android:radius="4dp" />
4
    <solid android:color="@color/color_white" />
5
</shape>

+ 25 - 0
app/src/main/res/layout/activity_video_compression.xml

@ -0,0 +1,25 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    android:orientation="vertical"
5
    android:layout_height="match_parent">
6
    <Button
7
        android:id="@+id/openPhoto"
8
        android:text="打开相册"
9
        android:layout_width="wrap_content"
10
        android:layout_height="wrap_content"/>
11
    <Button
12
        android:id="@+id/videoZip"
13
        android:text="压缩视频"
14
        android:layout_width="wrap_content"
15
        android:layout_height="wrap_content"/>
16
    <Button
17
        android:id="@+id/startVideoZip"
18
        android:text="播放压缩后的视频"
19
        android:layout_width="wrap_content"
20
        android:layout_height="wrap_content"/>
21
    <TextView
22
        android:id="@+id/progress"
23
        android:layout_width="wrap_content"
24
        android:layout_height="wrap_content"/>
25
</LinearLayout>

+ 28 - 0
app/src/main/res/layout/fragment_total_list.xml

@ -8,6 +8,34 @@
8 8
    tools:context="com.electric.chargingpile.fragment.MonthListFragment">
9 9
10 10
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"
18
        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"
29
            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
            />
35
36
37
    </LinearLayout>
38
11 39
    <RelativeLayout
12 40
        android:id="@+id/rl_totalList"
13 41
        android:layout_width="match_parent"

+ 10 - 0
app/src/main/res/layout/layout_quarter.xml

@ -0,0 +1,10 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="92dp"
4
    android:background="@drawable/bg_quarter"
5
    android:layout_height="wrap_content">
6
    <androidx.recyclerview.widget.RecyclerView
7
        android:id="@+id/recyclerView"
8
        android:layout_width="match_parent"
9
        android:layout_height="wrap_content"/>
10
</LinearLayout>

+ 12 - 0
app/src/main/res/layout/layout_text_item.xml

@ -0,0 +1,12 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
3
    android:layout_width="match_parent"
4
    xmlns:tools="http://schemas.android.com/tools"
5
    tools:textColor="#ff0e0e0e"
6
    android:textSize="12sp"
7
    android:id="@+id/textView"
8
    tools:text="第一季度"
9
    android:paddingTop="14dp"
10
    android:paddingBottom="14dp"
11
    android:gravity="center"
12
    android:layout_height="wrap_content" />

+ 4 - 0
app/src/main/res/values/colors.xml

@ -0,0 +1,4 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
    <color name="color_green_style1">#ff3ab948</color>
4
</resources>

+ 1 - 1
app/src/main/res/values/strings.xml

@ -18,7 +18,7 @@
18 18
    <string name="updated_at">上次更新于%1$s前</string>
19 19
    <string name="updated_just_now">刚刚更新</string>
20 20
    <string name="time_error">时间有问题</string>
21
    <string name="string_tab_qa">聊聊</string>
21
    <string name="string_tab_qa">社区</string>
22 22
23 23
24 24
    <string name="main_name">主界面</string>

+ 1 - 0
build.gradle

@ -12,6 +12,7 @@ buildscript {
12 12
        maven {url 'https://maven.aliyun.com/repository/google/'}
13 13
        maven {url 'https://maven.aliyun.com/repository/public/'}
14 14
        maven {url 'https://maven.aliyun.com/repository/gradle-plugin/'}
15
        maven { url "https://www.jitpack.io" }
15 16
        mavenCentral()
16 17
    }
17 18

cdzApp - Gogs: Go Git Service

充电桩app代码

.gitignore 24B

    /build /local.properties