e-java"> 112
                    } catch (Exception e) {
113
                        e.printStackTrace();
114
                    }
115
116
                    deleteUserInfo();
117
                    SharedPreferences sharedPreferences = getSharedPreferences("userInfo",
118
                            Activity.MODE_PRIVATE);
119
                    sharedPreferences.edit().clear();
120
                    startActivity(new Intent(LogOutActivity.this,MainMapActivity.class));
121
                }else{
122
                    String rtnMsg = JsonUtils.getKeyResult(response, "rtnMsg");
123
                    showDialog(rtnMsg);
124
                }
125
126
            }
127
        });
128
129
    }
130
131
    /**
132
     * 取消注销
133
     * */
134
    private void cancelLogout(){
135
        String url=MainApplication.url +"/zhannew/basic/web/index.php/userdel/del?phone="+ MainApplication.userPhone+"&password="+MainApplication.userPassword;
136
        OkHttpUtils.get().url(url).build().execute(new StringCallback() {
137
            @Override
138
            public void onError(Call call, Exception e) {
139
140
            }
141
142
            @Override
143
            public void onResponse(String response) {
144
                Log.e("onResponse cancelLogout", response);
145
                String code = JsonUtils.getKeyResult(response, "code");
146
            }
147
        });
148
149
    }
150
    //发送用户退出状态接口
151
    private void sendLoginStatus() throws Exception {
152
        long appTime1 = System.currentTimeMillis() / 1000;
153
        Log.i("appTime(long)---", appTime1 + "");
154
        long updatetime = appTime1 - MainMapActivity.cha - 3;
155
        Log.i("updatetime(long)---", updatetime + "");
156
        Log.i("cha---", MainMapActivity.cha + "");
157
        String token = String.valueOf(updatetime);
158
        String encode_token = DES3.encode(token);
159
        String replace = URLEncoder.encode(encode_token, "UTF-8");
160
        String url = MainApplication.url + "/zhannew/basic/web/index.php/tpmember/logout?phone="
161
                + MainApplication.userPhone + "&password=" + URLEncoder.encode(MainApplication.userPassword, "UTF-8") + "&token=" + replace
162
                + "&imei=" + "android_" + MainApplication.imei + "&registration_id=" + MainApplication.getInstance().getPushID();
163
        Log.i("token解密:", DES3.decode(encode_token));
164
        OkHttpUtils.get()
165
                .url(url)
166
                .build()
167
                .execute(new StringCallback() {
168
                    @Override
169
                    public void onError(Call call, Exception e) {
170
171
                    }
172
173
                    @Override
174
                    public void onResponse(String response) {
175
                        Log.e("exitLogin===", response);
176
                    }
177
                });
178
    }
179
180
    private void deleteUserInfo() {
181
        //保存用户id
182
        MainApplication.userId = "";
183
        ProfileManager.getInstance().setUserid(getApplicationContext(), "");
184
        //保存用户昵称
185
        MainApplication.userNickname = "";
186
        ProfileManager.getInstance().setNickname(getApplicationContext(), "");
187
        //保存用户手机号
188
        MainApplication.userPhone = "";
189
        ProfileManager.getInstance().setUsername(getApplicationContext(), "");
190
        //保存用户头像
191
        MainApplication.userIcon = "";
192
        ProfileManager.getInstance().setUsericon(getApplicationContext(), "");
193
        //保存用户车型
194
        MainApplication.userCar = "";
195
        ProfileManager.getInstance().setUsercar(getApplicationContext(), "");
196
        //保存用户密码
197
        MainApplication.userPassword = "";
198
199
        //保存用户意向车型
200
        MainApplication.userCarIntentMode = "";
201
        ProfileManager.getInstance().setCarIntentModel(getApplicationContext(), "");
202
203
        ProfileManager.getInstance().setKeyUserpassword(getApplicationContext(), "");
204
        if (isPermissionOK()) {
205
            if (ImageTools.findPhotoFromSDCard(MainApplication.storePath, "user_icon")) {
206
                ImageTools.deletePhotoAtPathAndName(MainApplication.storePath, "user_icon");
207
            }
208
        }
209
210
        MainApplication.userCertifiedModel="";
211
212
    }
213
    private boolean isPermissionOK() {
214
        return EasyPermissions.hasPermissions(this,
215
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
216
                Manifest.permission.READ_EXTERNAL_STORAGE
217
        );
218
    }
219
220
    /**
221
     * @param state  0表示由UserCenterMoreActivity打开 1 表示从登录页面跳转过来
222
     * */
223
    public static void actionStart(Context context,String state){
224
        Intent intent = new Intent(context, LogOutActivity.class);
225
        intent.putExtra("state",state);
226
        context.startActivity(intent);
227
    }
228
}

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

936
//                i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
936
//                i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
937
//                startActivity(i);
937
//                startActivity(i);
938
                Intent i = new Intent(getApplication(), MyWebViewActivity.class);
938
                Intent i = new Intent(getApplication(), MyWebViewActivity.class);
939
                i.putExtra("url", "https://cdz.evcharge.cc/zhannew/share/share-2.html");
939
                i.putExtra("url", "http://fans.d1ev.com/");
940
                startActivity(i);
940
                startActivity(i);
941
                break;
941
                break;
942
942

+ 10 - 0
app/src/main/java/com/electric/chargingpile/activity/UserCenterMoreActivity.java

182
        rl_about = (RelativeLayout) findViewById(R.id.rl_about);
182
        rl_about = (RelativeLayout) findViewById(R.id.rl_about);
183
        rl_about.setOnClickListener(this);
183
        rl_about.setOnClickListener(this);
184
        findViewById(R.id.rl_alter_password).setOnClickListener(this);
184
        findViewById(R.id.rl_alter_password).setOnClickListener(this);
185
        findViewById(R.id.logOutLayout).setOnClickListener(this);
185
186
186
//        iv_fen = (ImageView) findViewById(R.id.imageView11);
187
//        iv_fen = (ImageView) findViewById(R.id.imageView11);
187
188
402
//                    }
403
//                    }
403
//                }).show();
404
//                }).show();
404
                break;
405
                break;
406
407
            case R.id.logOutLayout:
408
                if (!MainApplication.isLogin()) {
409
                    Toast.makeText(getApplication(), "请先登录", Toast.LENGTH_SHORT).show();
410
                    startActivity(new Intent(getApplication(), LoginActivity.class));
411
                }else{
412
                    LogOutActivity.actionStart(this,"0");
413
                }
414
                break;
405
        }
415
        }
406
    }
416
    }
407
417

+ 4 - 4
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

91
    public static String firstPoint = "";
91
    public static String firstPoint = "";
92
    public static Boolean firstSsyd;
92
    public static Boolean firstSsyd;
93
    public static String password = "";
93
    public static String password = "";
94
//        public static String url = "http://59.110.68.162";// 充电桩测试环境
95
//    public static String pic_url = "http://59.110.68.162/zhannew/uploadfile/";
96
    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
97
    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
94
        public static String url = "http://59.110.68.162";// 充电桩测试环境
95
    public static String pic_url = "http://59.110.68.162/zhannew/uploadfile/";
96
//    public static String url = "http://cdz.evcharge.cc";// 充电桩正式环境
97
//    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
98

98

99
//        public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
99
//        public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
100
    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
100
    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境

+ 82 - 0
app/src/main/java/com/electric/chargingpile/view/StateDialog.java

1
package com.electric.chargingpile.view;
2
3
import android.app.Dialog;
4
import android.content.Context;
5
import android.os.Bundle;
6
import android.view.Display;
7
import android.view.LayoutInflater;
8
import android.view.View;
9
import android.view.WindowManager;
10
import android.widget.FrameLayout;
11
import android.widget.ImageView;
12
import android.widget.LinearLayout;
13
import android.widget.RelativeLayout;
14
import android.widget.TextView;
15
16
import androidx.annotation.DrawableRes;
17
import androidx.annotation.Nullable;
18
import androidx.fragment.app.DialogFragment;
19
20
import com.electric.chargingpile.R;
21
import com.electric.chargingpile.util.DensityUtil;
22
23
public class StateDialog {
24
    private Context mContext;
25
    private Display mDisPlay;
26
    private Dialog mDialog;
27
    private TextView stateText;
28
    private ImageView stateImg;
29
30
    public StateDialog(Context context) {
31
        mContext = context;
32
        WindowManager windowManager = (WindowManager) context
33
                .getSystemService(Context.WINDOW_SERVICE);
34
        mDisPlay = windowManager.getDefaultDisplay();
35
    }
36
37
38
    public StateDialog builder() {
39
        // 获取Dialog布局
40
        View view = LayoutInflater.from(mContext).inflate(
41
                R.layout.dialog_state, null);
42
43
        // 获取自定义Dialog布局中的控件
44
        RelativeLayout stateLayout = (RelativeLayout) view.findViewById(R.id.stateLayout);
45
        stateText = view.findViewById(R.id.stateText);
46
        stateImg = view.findViewById(R.id.stateImg);
47
48
49
        mDialog = new Dialog(mContext, R.style.AlertDialogStyle);
50
        mDialog.setContentView(view);
51
52
        // 调整dialog背景大小
53
        stateLayout.setLayoutParams(new FrameLayout.LayoutParams(
54
                DensityUtil.dip2px(mContext,  268),
55
                DensityUtil.dip2px(mContext, 124)
56
        ));
57
58
59
        return this;
60
    }
61
    public StateDialog setContent(String str){
62
        if (stateText!=null){
63
            stateText.setText(str);
64
        }
65
        return this;
66
    }
67
    public StateDialog setImg(@DrawableRes int resId){
68
        if (stateImg!=null){
69
            stateImg.setImageResource(resId);
70
        }
71
        return this;
72
    }
73
    public StateDialog setCancelable(boolean cancel) {
74
        mDialog.setCancelable(cancel);
75
        mDialog.setCanceledOnTouchOutside(cancel);
76
        return this;
77
    }
78
    public void show() {
79
        mDialog.show();
80
    }
81
82
}

BIN
app/src/main/res/drawable-xxhdpi/ic_logout_dialog.webp


BIN
app/src/main/res/drawable-xxhdpi/ic_logout_dialog2.webp


BIN
app/src/main/res/drawable-xxhdpi/ic_logout_hint.webp


BIN
app/src/main/res/drawable-xxhdpi/ic_logout_hint2.webp


+ 9 - 0
app/src/main/res/drawable/bg_radius_6_white.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3
    <item>
4
        <shape android:shape="rectangle">
5
            <solid android:color="@color/white" />
6
            <corners android:radius="6dp" />
7
        </shape>
8
    </item>
9
</selector>

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

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

+ 354 - 344
app/src/main/res/layout/activity_charging_status.xml

50
50
51
    </RelativeLayout>
51
    </RelativeLayout>
52
52
53
    <LinearLayout
54
        android:id="@+id/ll_charginginfo"
53
    <androidx.core.widget.NestedScrollView
54
        android:fillViewport="true"
55
        android:layout_width="match_parent"
55
        android:layout_width="match_parent"
56
        android:layout_height="72dp"
57
        android:layout_below="@+id/rl_circle"
58
        android:layout_marginLeft="12dp"
59
        android:layout_marginTop="26dp"
60
        android:layout_marginRight="12dp"
61
        android:orientation="horizontal">
62
63
        <RelativeLayout
64
65
            android:background="@drawable/bg_f9f9fb_radius14"
66
            android:layout_width="0dp"
67
            android:layout_height="match_parent"
68
            android:layout_weight="1">
69
            <ImageView
70
                android:id="@+id/imgA"
71
                android:gravity="center_vertical"
72
                android:layout_marginStart="10dp"
73
                android:layout_centerVertical="true"
74
                android:src="@drawable/ic_dianliu"
75
                android:layout_width="wrap_content"
76
                android:layout_height="wrap_content"/>
56
        android:layout_height="wrap_content">
57
        <LinearLayout
58
            android:orientation="vertical"
59
            android:layout_width="match_parent"
60
            android:layout_height="match_parent">
77
            <LinearLayout
61
            <LinearLayout
78
                android:layout_centerInParent="true"
79
                android:orientation="vertical"
80
                android:layout_alignParentEnd="true"
81
                android:layout_toEndOf="@+id/imgA"
82
                android:layout_width="wrap_content"
83
                android:layout_height="wrap_content">
84
85
                <TextView
86
                    android:gravity="center"
87
                    android:id="@+id/tv_dianliu"
88
                    android:layout_width="match_parent"
89
                    android:layout_height="wrap_content"
90
                    android:text="--"
91
                    android:textStyle="bold"
92
                    android:textColor="@color/color_0e0e0e"
93
                    android:textSize="18sp" />
94
                <TextView
95
                    android:layout_marginTop="8dp"
96
                    android:gravity="center"
97
                    android:layout_width="match_parent"
98
                    android:layout_height="wrap_content"
99
                    android:text="电流(安)"
100
                    android:textColor="@color/color_0e0e0e"
101
                    android:textSize="12sp" />
62
                android:id="@+id/ll_charginginfo"
63
                android:layout_width="match_parent"
64
                android:layout_height="72dp"
65
                android:layout_below="@+id/rl_circle"
66
                android:layout_marginLeft="12dp"
67
                android:layout_marginTop="26dp"
68
                android:layout_marginRight="12dpdp"
69
                android:orientation="horizontal">
70
71
                <RelativeLayout
72
73
                    android:background="@drawable/bg_f9f9fb_radius14"
74
                    android:layout_width="0dp"
75
                    android:layout_height="match_parent"
76
                    android:layout_weight="1">
77
                    <ImageView
78
                        android:id="@+id/imgA"
79
                        android:gravity="center_vertical"
80
                        android:layout_marginStart="10dp"
81
                        android:layout_centerVertical="true"
82
                        android:src="@drawable/ic_dianliu"
83
                        android:layout_width="wrap_content"
84
                        android:layout_height="wrap_content"/>
85
                    <LinearLayout
86
                        android:layout_centerInParent="true"
87
                        android:orientation="vertical"
88
                        android:layout_alignParentEnd="true"
89
                        android:layout_toEndOf="@+id/imgA"
90
                        android:layout_width="wrap_content"
91
                        android:layout_height="wrap_content">
92
93
                        <TextView
94
                            android:gravity="center"
95
                            android:id="@+id/tv_dianliu"
96
                            android:layout_width="match_parent"
97
                            android:layout_height="wrap_content"
98
                            android:text="--"
99
                            android:textStyle="bold"
100
                            android:textColor="@color/color_0e0e0e"
101
                            android:textSize="18sp" />
102
                        <TextView
103
                            android:layout_marginTop="8dp"
104
                            android:gravity="center"
105
                            android:layout_width="match_parent"
106
                            android:layout_height="wrap_content"
107
                            android:text="电流(安)"
108
                            android:textColor="@color/color_0e0e0e"
109
                            android:textSize="12sp" />
110
111
                    </LinearLayout>
112
113
                </RelativeLayout>
114
115
116
                <RelativeLayout
117
                    android:background="@drawable/bg_f9f9fb_radius14"
118
                    android:layout_marginEnd="10dp"
119
                    android:layout_marginStart="10dp"
120
                    android:layout_width="0dp"
121
                    android:layout_height="match_parent"
122
                    android:layout_weight="1">
123
                    <ImageView
124
                        android:id="@+id/imgV"
125
                        android:gravity="center_vertical"
126
                        android:layout_marginStart="10dp"
127
                        android:layout_centerVertical="true"
128
                        android:src="@drawable/ic_dianya"
129
                        android:layout_width="wrap_content"
130
                        android:layout_height="wrap_content"/>
131
132
                    <LinearLayout
133
                        android:layout_centerInParent="true"
134
                        android:layout_alignParentEnd="true"
135
                        android:layout_toEndOf="@+id/imgV"
136
                        android:orientation="vertical"
137
                        android:layout_width="wrap_content"
138
                        android:layout_height="wrap_content">
139
140
141
                        <TextView
142
                            android:gravity="center"
143
                            android:id="@+id/tv_dianya"
144
                            android:layout_width="match_parent"
145
                            android:layout_height="wrap_content"
146
                            android:text="--"
147
                            android:textStyle="bold"
148
                            android:textColor="@color/color_0e0e0e"
149
                            android:textSize="18sp" />
150
                        <TextView
151
                            android:layout_marginTop="8dp"
152
                            android:gravity="center"
153
                            android:layout_width="match_parent"
154
                            android:layout_height="wrap_content"
155
                            android:text="电压(伏)"
156
                            android:textColor="@color/color_0e0e0e"
157
                            android:textSize="12sp" />
158
159
                    </LinearLayout>
160
161
                </RelativeLayout>
162
163
164
                <RelativeLayout
165
                    android:background="@drawable/bg_f9f9fb_radius14"
166
                    android:layout_width="0dp"
167
                    android:layout_height="match_parent"
168
                    android:layout_weight="1">
169
                    <ImageView
170
                        android:id="@+id/imgProgrees"
171
                        android:gravity="center_vertical"
172
                        android:layout_marginStart="10dp"
173
                        android:layout_centerVertical="true"
174
                        android:src="@drawable/ic_jindu"
175
                        android:layout_width="wrap_content"
176
                        android:layout_height="wrap_content"/>
177
178
                    <LinearLayout
179
                        android:layout_centerInParent="true"
180
                        android:orientation="vertical"
181
                        android:layout_alignParentEnd="true"
182
                        android:layout_toEndOf="@+id/imgProgrees"
183
                        android:layout_width="wrap_content"
184
                        android:layout_height="wrap_content">
185
                        <TextView
186
                            android:textStyle="bold"
187
                            android:gravity="center"
188
                            android:id="@+id/tv_jindu"
189
                            android:layout_width="match_parent"
190
                            android:layout_height="wrap_content"
191
                            android:text="--"
192
                            android:textColor="@color/color_0e0e0e"
193
                            android:textSize="18sp" />
194
195
196
                        <TextView
197
                            android:layout_marginTop="8dp"
198
                            android:gravity="center"
199
                            android:layout_width="match_parent"
200
                            android:layout_height="wrap_content"
201
                            android:text="充电进程"
202
                            android:textColor="@color/color_0e0e0e"
203
                            android:textSize="12sp" />
204
205
                    </LinearLayout>
206
207
                </RelativeLayout>
102
208
103
            </LinearLayout>
209
            </LinearLayout>
104
210
105
        </RelativeLayout>
106
107
108
        <RelativeLayout
109
            android:background="@drawable/bg_f9f9fb_radius14"
110
            android:layout_marginEnd="10dp"
111
            android:layout_marginStart="10dp"
112
            android:layout_width="0dp"
113
            android:layout_height="match_parent"
114
            android:layout_weight="1">
115
            <ImageView
116
                android:id="@+id/imgV"
117
                android:gravity="center_vertical"
118
                android:layout_marginStart="10dp"
119
                android:layout_centerVertical="true"
120
                android:src="@drawable/ic_dianya"
121
                android:layout_width="wrap_content"
122
                android:layout_height="wrap_content"/>
123
124
            <LinearLayout
125
                android:layout_centerInParent="true"
126
                android:layout_alignParentEnd="true"
127
                android:layout_toEndOf="@+id/imgV"
128
                android:orientation="vertical"
129
                android:layout_width="wrap_content"
130
                android:layout_height="wrap_content">
131
132
133
                <TextView
134
                    android:gravity="center"
135
                    android:id="@+id/tv_dianya"
136
                    android:layout_width="match_parent"
137
                    android:layout_height="wrap_content"
138
                    android:text="--"
139
                    android:textStyle="bold"
140
                    android:textColor="@color/color_0e0e0e"
141
                    android:textSize="18sp" />
142
                <TextView
143
                    android:layout_marginTop="8dp"
144
                    android:gravity="center"
145
                    android:layout_width="match_parent"
146
                    android:layout_height="wrap_content"
147
                    android:text="电压(伏)"
148
                    android:textColor="@color/color_0e0e0e"
149
                    android:textSize="12sp" />
150
151
            </LinearLayout>
152
153
        </RelativeLayout>
154
155
156
        <RelativeLayout
157
            android:background="@drawable/bg_f9f9fb_radius14"
158
            android:layout_width="0dp"
159
            android:layout_height="match_parent"
160
            android:layout_weight="1">
161
            <ImageView
162
                android:id="@+id/imgProgrees"
163
                android:gravity="center_vertical"
164
                android:layout_marginStart="10dp"
165
                android:layout_centerVertical="true"
166
                android:src="@drawable/ic_jindu"
167
                android:layout_width="wrap_content"
168
                android:layout_height="wrap_content"/>
169
170
            <LinearLayout
171
                android:layout_centerInParent="true"
172
                android:orientation="vertical"
173
                android:layout_alignParentEnd="true"
174
                android:layout_toEndOf="@+id/imgProgrees"
175
                android:layout_width="wrap_content"
176
                android:layout_height="wrap_content">
177
                <TextView
178
                    android:textStyle="bold"
179
                    android:gravity="center"
180
                    android:id="@+id/tv_jindu"
181
                    android:layout_width="match_parent"
182
                    android:layout_height="wrap_content"
183
                    android:text="--"
184
                    android:textColor="@color/color_0e0e0e"
185
                    android:textSize="18sp" />
186
211
               <RelativeLayout
212
                android:id="@+id/rl_circle"
213
                android:layout_width="172dp"
214
                android:layout_height="172dp"
215
                android:layout_centerHorizontal="true"
216
                android:layout_gravity="center_horizontal"
217
                android:layout_marginTop="40dp"
218
                android:background="@drawable/bg_charging">
187
219
188
                <TextView
189
                    android:layout_marginTop="8dp"
190
                    android:gravity="center"
220
                <me.itangqi.waveloadingview.WaveLoadingView
221
                    android:id="@+id/waveLoadingView"
191
                    android:layout_width="match_parent"
222
                    android:layout_width="match_parent"
223
                    android:layout_height="match_parent"
224
                    app:wlv_borderColor="#00ffffff"
225
                    app:wlv_borderWidth="1dp"
226
                    app:wlv_round_rectangle="false"
227
                    app:wlv_shapeType="circle"
228
                    app:wlv_titleCenterStrokeColor="@android:color/holo_blue_dark"
229
                    app:wlv_titleCenterStrokeWidth="3dp"
230
                    app:wlv_waveAmplitude="60"
231
                    app:wlv_waveColor="#3fffffff"
232
                    app:wlv_wave_background_Color="#00ffffff" />
233
234
235
                <!--<com.loonggg.circleprogressbarlibrary.view.CircleProgressBar-->
236
                <!--android:id="@+id/pb"-->
237
                <!--android:layout_width="143dp"-->
238
                <!--android:layout_height="143dp"-->
239
                <!--android:visibility="gone"-->
240
                <!--android:layout_centerInParent="true"-->
241
                <!--loonggg:bgProgressBarColor="#efefef"-->
242
                <!--loonggg:circleStrokeWidth="5dp" />-->
243
244
                <LinearLayout
245
                    android:layout_width="wrap_content"
192
                    android:layout_height="wrap_content"
246
                    android:layout_height="wrap_content"
193
                    android:text="充电进程"
194
                    android:textColor="@color/color_0e0e0e"
195
                    android:textSize="12sp" />
196
197
            </LinearLayout>
198
199
        </RelativeLayout>
200
201
    </LinearLayout>
202
203
    <RelativeLayout
204
        android:id="@+id/rl_circle"
205
        android:layout_width="172dp"
206
        android:layout_height="172dp"
207
        android:layout_centerHorizontal="true"
208
        android:layout_gravity="center_horizontal"
209
        android:layout_marginTop="40dp"
210
        android:background="@drawable/bg_charging">
211
212
        <me.itangqi.waveloadingview.WaveLoadingView
213
            android:id="@+id/waveLoadingView"
214
            android:layout_width="match_parent"
215
            android:layout_height="match_parent"
216
            app:wlv_borderColor="#00ffffff"
217
            app:wlv_borderWidth="1dp"
218
            app:wlv_round_rectangle="false"
219
            app:wlv_shapeType="circle"
220
            app:wlv_titleCenterStrokeColor="@android:color/holo_blue_dark"
221
            app:wlv_titleCenterStrokeWidth="3dp"
222
            app:wlv_waveAmplitude="60"
223
            app:wlv_waveColor="#3fffffff"
224
            app:wlv_wave_background_Color="#00ffffff" />
225
226
227
        <!--<com.loonggg.circleprogressbarlibrary.view.CircleProgressBar-->
228
        <!--android:id="@+id/pb"-->
229
        <!--android:layout_width="143dp"-->
230
        <!--android:layout_height="143dp"-->
231
        <!--android:visibility="gone"-->
232
        <!--android:layout_centerInParent="true"-->
233
        <!--loonggg:bgProgressBarColor="#efefef"-->
234
        <!--loonggg:circleStrokeWidth="5dp" />-->
235
236
        <LinearLayout
237
            android:layout_width="wrap_content"
238
            android:layout_height="wrap_content"
239
            android:layout_centerInParent="true"
240
            android:orientation="vertical"
241
            android:visibility="visible">
247
                    android:layout_centerInParent="true"
248
                    android:orientation="vertical"
249
                    android:visibility="visible">
250
251
                    <TextView
252
                        android:id="@+id/tv_chongdianliang"
253
                        android:layout_width="wrap_content"
254
                        android:layout_height="wrap_content"
255
                        android:layout_gravity="center"
256
                        android:text=""
257
                        android:textColor="@color/white"
258
                        android:textSize="40sp" />
259
260
                    <TextView
261
                        android:layout_width="wrap_content"
262
                        android:layout_height="wrap_content"
263
                        android:layout_gravity="center"
264
                        android:layout_marginTop="5dp"
265
                        android:text="充电量(度)"
266
                        android:textColor="@color/white"
267
                        android:textSize="12sp" />
268
269
                </LinearLayout>
270
271
            </RelativeLayout>
242
272
243
            <TextView
273
            <TextView
244
                android:id="@+id/tv_chongdianliang"
274
                android:id="@+id/tv_zhuang_num"
245
                android:layout_width="wrap_content"
275
                android:layout_width="wrap_content"
246
                android:layout_height="wrap_content"
276
                android:layout_height="wrap_content"
247
                android:layout_gravity="center"
277
                android:layout_gravity="center_horizontal"
278
                android:layout_marginTop="33dp"
279
                android:drawableLeft="@drawable/icon_zhan_name"
280
                android:drawablePadding="8dp"
281
                android:gravity="center_vertical"
248
                android:text=""
282
                android:text=""
249
                android:textColor="@color/white"
250
                android:textSize="40sp" />
251
252
            <TextView
253
                android:layout_width="wrap_content"
254
                android:layout_height="wrap_content"
255
                android:layout_gravity="center"
256
                android:layout_marginTop="5dp"
257
                android:text="充电量(度)"
258
                android:textColor="@color/white"
259
                android:textSize="12sp" />
260
261
        </LinearLayout>
262
263
    </RelativeLayout>
264
265
    <TextView
266
        android:id="@+id/tv_zhuang_num"
267
        android:layout_width="wrap_content"
268
        android:layout_height="wrap_content"
269
        android:layout_gravity="center_horizontal"
270
        android:layout_marginTop="33dp"
271
        android:drawableLeft="@drawable/icon_zhan_name"
272
        android:drawablePadding="8dp"
273
        android:gravity="center_vertical"
274
        android:text=""
275
        android:textColor="@color/ui_62"
276
        android:textSize="18sp" />
277
278
    <LinearLayout
279
        android:layout_width="match_parent"
280
        android:layout_height="49dp"
281
        android:layout_marginTop="38dp"
282
        android:orientation="horizontal">
283
284
        <RelativeLayout
285
            android:layout_width="0dp"
286
            android:layout_height="match_parent"
287
            android:layout_weight="1">
288
289
            <TextView
290
                android:layout_width="wrap_content"
291
                android:layout_height="wrap_content"
292
                android:layout_alignParentTop="true"
293
                android:layout_centerHorizontal="true"
294
                android:text="充电时长"
295
                android:textColor="@color/ui_68"
296
                android:textSize="12sp" />
297
298
            <TextView
299
                android:id="@+id/tv_time"
300
                android:layout_width="wrap_content"
301
                android:layout_height="wrap_content"
302
                android:layout_alignParentBottom="true"
303
                android:layout_centerHorizontal="true"
304
                android:text="--"
305
                android:textColor="@color/ui_62"
283
                android:textColor="@color/ui_62"
306
                android:textSize="21sp" />
284
                android:textSize="18sp" />
307
285
308
        </RelativeLayout>
309
310
        <View
311
            android:layout_width="0.5dp"
312
            android:layout_height="match_parent"
313
            android:background="@color/ui_6d" />
314
315
        <RelativeLayout
316
            android:layout_width="0dp"
317
            android:layout_height="match_parent"
318
            android:layout_weight="1">
319
320
            <TextView
321
                android:layout_width="wrap_content"
322
                android:layout_height="wrap_content"
323
                android:layout_alignParentTop="true"
324
                android:layout_centerHorizontal="true"
325
                android:text="充电金额"
326
                android:textColor="@color/ui_68"
327
                android:textSize="12sp" />
286
            <LinearLayout
287
                android:layout_width="match_parent"
288
                android:layout_height="49dp"
289
                android:layout_marginTop="38dp"
290
                android:orientation="horizontal">
291
292
                <RelativeLayout
293
                    android:layout_width="0dp"
294
                    android:layout_height="match_parent"
295
                    android:layout_weight="1">
296
297
                    <TextView
298
                        android:layout_width="wrap_content"
299
                        android:layout_height="wrap_content"
300
                        android:layout_alignParentTop="true"
301
                        android:layout_centerHorizontal="true"
302
                        android:text="充电时长"
303
                        android:textColor="@color/ui_68"
304
                        android:textSize="12sp" />
305
306
                    <TextView
307
                        android:id="@+id/tv_time"
308
                        android:layout_width="wrap_content"
309
                        android:layout_height="wrap_content"
310
                        android:layout_alignParentBottom="true"
311
                        android:layout_centerHorizontal="true"
312
                        android:text="--"
313
                        android:textColor="@color/ui_62"
314
                        android:textSize="21sp" />
315
316
                </RelativeLayout>
317
318
                <View
319
                    android:layout_width="0.5dp"
320
                    android:layout_height="match_parent"
321
                    android:background="@color/ui_6d" />
322
323
                <RelativeLayout
324
                    android:layout_width="0dp"
325
                    android:layout_height="match_parent"
326
                    android:layout_weight="1">
327
328
                    <TextView
329
                        android:layout_width="wrap_content"
330
                        android:layout_height="wrap_content"
331
                        android:layout_alignParentTop="true"
332
                        android:layout_centerHorizontal="true"
333
                        android:text="充电金额"
334
                        android:textColor="@color/ui_68"
335
                        android:textSize="12sp" />
336
337
                    <TextView
338
                        android:id="@+id/tv_cost"
339
                        android:layout_width="wrap_content"
340
                        android:layout_height="wrap_content"
341
                        android:layout_alignParentBottom="true"
342
                        android:layout_centerHorizontal="true"
343
                        android:layout_centerVertical="true"
344
                        android:text="--"
345
                        android:textColor="@color/ui_62"
346
                        android:textSize="21sp" />
347
348
                </RelativeLayout>
328
349
329
            <TextView
330
                android:id="@+id/tv_cost"
331
                android:layout_width="wrap_content"
332
                android:layout_height="wrap_content"
333
                android:layout_alignParentBottom="true"
334
                android:layout_centerHorizontal="true"
335
                android:layout_centerVertical="true"
336
                android:text="--"
337
                android:textColor="@color/ui_62"
338
                android:textSize="21sp" />
350
            </LinearLayout>
339
351
340
        </RelativeLayout>
341
352
342
    </LinearLayout>
353
            <RelativeLayout
354
                android:layout_width="match_parent"
355
                android:layout_height="match_parent">
356
                <LinearLayout
357
                    tools:visibility="visible"
358
                    android:visibility="gone"
359
                    android:id="@+id/layoutCarCertificate"
360
                    android:background="@drawable/bg_f9f9fb_radius5"
361
                    android:paddingBottom="3dp"
362
                    android:paddingTop="3dp"
363
                    android:paddingStart="13dp"
364
                    android:paddingEnd="13dp"
365
                    android:layout_marginTop="30dp"
366
                    android:layout_centerHorizontal="true"
367
                    android:layout_width="wrap_content"
368
                    android:layout_height="wrap_content">
369
                    <TextView
370
                        android:id="@+id/certifiedCarOwner"
371
                        android:drawablePadding="12dp"
372
                        android:drawableLeft="@drawable/ic_certification"
373
                        android:layout_marginEnd="35dp"
374
                        android:gravity="center"
375
                        android:layout_width="wrap_content"
376
                        android:layout_height="match_parent"
377
                        android:text="认证车主有优惠哦~"
378
                        android:textColor="@color/color_0e0e0e"
379
                        android:textSize="14sp"
380
                        />
381
                    <ImageView
382
                        android:src="@drawable/right_cursor"
383
                        android:layout_width="wrap_content"
384
                        android:layout_height="match_parent"/>
385
386
                </LinearLayout>
387
                <ImageView
388
                    tools:visibility="visible"
389
                    android:id="@+id/iv_activity"
390
                    android:layout_width="wrap_content"
391
                    android:layout_height="wrap_content"
392
                    android:layout_alignParentTop="true"
393
                    android:layout_alignParentRight="true"
394
                    android:layout_marginTop="21dp"
395
                    android:layout_marginRight="13dp"
396
                    android:visibility="gone" />
343
397
398
                <TextView
399
                    tools:visibility="visible"
400
                    android:id="@+id/tv_activity"
401
                    android:layout_width="wrap_content"
402
                    android:layout_height="wrap_content"
403
                    android:layout_below="@+id/tv_stop"
404
                    android:layout_centerHorizontal="true"
405
                    android:paddingTop="20dp"
406
                    android:paddingBottom="15dp"
407
                    android:text=""
408
                    android:textColor="#ffa900"
409
                    android:textSize="14sp"
410
                    android:visibility="visible" />
344
411
345
    <RelativeLayout
346
        android:layout_width="match_parent"
347
        android:layout_height="match_parent">
348
        <LinearLayout
349
            tools:visibility="visible"
350
            android:visibility="gone"
351
            android:id="@+id/layoutCarCertificate"
352
            android:background="@drawable/bg_f9f9fb_radius5"
353
            android:paddingBottom="3dp"
354
            android:paddingTop="3dp"
355
            android:paddingStart="13dp"
356
            android:paddingEnd="13dp"
357
            android:layout_marginTop="30dp"
358
            android:layout_centerHorizontal="true"
359
            android:layout_width="wrap_content"
360
            android:layout_height="wrap_content">
361
            <TextView
362
                android:id="@+id/certifiedCarOwner"
363
                android:drawablePadding="12dp"
364
                android:drawableLeft="@drawable/ic_certification"
365
                android:layout_marginEnd="35dp"
366
                android:gravity="center"
367
                android:layout_width="wrap_content"
368
                android:layout_height="match_parent"
369
                android:text="认证车主有优惠哦~"
370
                android:textColor="@color/color_0e0e0e"
371
                android:textSize="14sp"
372
                />
373
            <ImageView
374
                android:src="@drawable/right_cursor"
375
                android:layout_width="wrap_content"
376
                android:layout_height="match_parent"/>
412
                <TextView
413
                    android:layout_centerHorizontal="true"
414
                    android:textStyle="bold"
415
                    android:id="@+id/tv_stop"
416
                    android:layout_width="160dp"
417
                    android:layout_height="42dp"
418
                    android:layout_alignParentBottom="true"
419
                    android:layout_marginBottom="94dp"
420
                    android:background="@drawable/bg_3ec34c_radius10"
421
                    android:gravity="center"
422
                    android:text="结束充电"
423
                    android:textColor="@color/color_3ec34c"
424
                    android:textSize="18sp" />
425
            </RelativeLayout>
377
426
378
        </LinearLayout>
427
        </LinearLayout>
379
        <ImageView
380
            tools:visibility="visible"
381
            android:id="@+id/iv_activity"
382
            android:layout_width="wrap_content"
383
            android:layout_height="wrap_content"
384
            android:layout_alignParentTop="true"
385
            android:layout_alignParentRight="true"
386
            android:layout_marginTop="21dp"
387
            android:layout_marginRight="13dp"
388
            android:visibility="gone" />
389
390
        <TextView
391
            tools:visibility="visible"
392
            android:id="@+id/tv_activity"
393
            android:layout_width="wrap_content"
394
            android:layout_height="wrap_content"
395
            android:layout_below="@+id/tv_stop"
396
            android:layout_centerHorizontal="true"
397
            android:paddingTop="20dp"
398
            android:paddingBottom="15dp"
399
            android:text=""
400
            android:textColor="#ffa900"
401
            android:textSize="14sp"
402
            android:visibility="visible" />
403
404
        <TextView
405
            android:layout_centerHorizontal="true"
406
            android:textStyle="bold"
407
            android:id="@+id/tv_stop"
408
            android:layout_width="160dp"
409
            android:layout_height="42dp"
410
            android:layout_alignParentBottom="true"
411
            android:layout_marginBottom="94dp"
412
            android:background="@drawable/bg_3ec34c_radius10"
413
            android:gravity="center"
414
            android:text="结束充电"
415
            android:textColor="@color/color_3ec34c"
416
            android:textSize="18sp" />
417
    </RelativeLayout>
418
428
    </androidx.core.widget.NestedScrollView>
419
</LinearLayout>
429
</LinearLayout>

+ 224 - 0
app/src/main/res/layout/activity_logout.xml

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
    xmlns:tools="http://schemas.android.com/tools"
5
    android:orientation="vertical"
6
    android:background="@color/color_f6f6f6"
7
    android:layout_height="match_parent">
8
9
    <com.zhy.autolayout.AutoRelativeLayout
10
        android:layout_width="fill_parent"
11
        android:layout_height="130px"
12
        android:background="@color/title_background">
13
14
        <TextView
15
            android:id="@+id/title"
16
            android:layout_width="wrap_content"
17
            android:layout_height="wrap_content"
18
            android:layout_centerInParent="true"
19
            android:text="注销"
20
            android:textColor="@color/ui_62"
21
            android:textSize="16sp" />
22
23
        <ImageView
24
            android:id="@+id/iv_back"
25
            android:layout_width="wrap_content"
26
            android:layout_height="match_parent"
27
            android:layout_alignParentLeft="true"
28
            android:layout_centerVertical="true"
29
            android:contentDescription="@null"
30
            android:paddingBottom="4dp"
31
            android:paddingLeft="44px"
32
            android:paddingRight="44px"
33
            android:paddingTop="4dp"
34
            android:src="@drawable/icon_lvback1119" />
35
    </com.zhy.autolayout.AutoRelativeLayout>
36
37
    <LinearLayout
38
        android:orientation="vertical"
39
        android:id="@+id/unSubmittedLayout"
40
        android:layout_width="match_parent"
41
        android:layout_height="wrap_content">
42
43
        <ImageView
44
            android:layout_marginTop="40dp"
45
            android:layout_gravity="center"
46
            android:src="@drawable/ic_logout_hint"
47
            android:layout_width="wrap_content"
48
            android:layout_height="wrap_content"/>
49
50
        <TextView
51
            android:layout_gravity="center"
52
            android:layout_marginTop="30dp"
53
            android:textStyle="bold"
54
            android:gravity="center"
55
            android:layout_marginEnd="60dp"
56
            android:layout_marginStart="60dp"
57
            android:layout_width="match_parent"
58
            android:layout_height="wrap_content"
59
            android:text="非常遗憾不能继续为您服务\n感谢您的支持和陪伴"
60
            android:textColor="@color/color_0e0e0e"
61
            android:textSize="21sp"
62
            />
63
        <TextView
64
            android:layout_marginTop="20dp"
65
            android:layout_marginEnd="12dp"
66
            android:layout_marginStart="12dp"
67
            android:layout_width="match_parent"
68
            android:layout_height="wrap_content"
69
            android:text="注销账号前我们需要确认以下是否有未完成或未结算,以保证您的帐号安全"
70
            android:textColor="#ff707070"
71
            android:textSize="12sp"
72
            />
73
        <LinearLayout
74
            android:background="@drawable/bg_radius_6_white"
75
            android:layout_marginTop="20dp"
76
            android:layout_marginEnd="12dp"
77
            android:layout_marginStart="12dp"
78
            android:orientation="vertical"
79
            android:layout_width="match_parent"
80
            android:layout_height="wrap_content">
81
            <LinearLayout
82
                android:padding="14dp"
83
                android:layout_width="match_parent"
84
                android:layout_height="wrap_content">
85
                <TextView
86
                    android:layout_gravity="center_vertical"
87
                    android:layout_width="wrap_content"
88
                    android:layout_height="wrap_content"
89
                    android:text="●"
90
                    android:textColor="@color/color_707070"
91
                    android:textSize="4sp"
92
                    />
93
94
                <TextView
95
                    android:layout_marginStart="6dp"
96
                    android:layout_width="wrap_content"
97
                    android:layout_height="wrap_content"
98
                    android:text="您的账号当前没有正在充电的订单"
99
                    android:textColor="@color/color_707070"
100
                    android:textSize="12sp"
101
                    />
102
103
            </LinearLayout>
104
            <LinearLayout
105
                android:padding="14dp"
106
                android:layout_width="match_parent"
107
                android:layout_height="wrap_content">
108
                <TextView
109
                    android:layout_gravity="center_vertical"
110
                    android:layout_width="wrap_content"
111
                    android:layout_height="wrap_content"
112
                    android:text="●"
113
                    android:textColor="@color/color_707070"
114
                    android:textSize="4sp"
115
                    />
116
117
                <TextView
118
                    android:layout_marginStart="6dp"
119
                    android:layout_width="wrap_content"
120
                    android:layout_height="wrap_content"
121
                    android:text="您的账号没有未结算的充电订单"
122
                    android:textColor="@color/color_707070"
123
                    android:textSize="12sp"
124
                    />
125
126
            </LinearLayout>
127
            <LinearLayout
128
                android:padding="14dp"
129
                android:layout_width="match_parent"
130
                android:layout_height="wrap_content">
131
                <TextView
132
                    android:layout_gravity="center_vertical"
133
                    android:layout_width="wrap_content"
134
                    android:layout_height="wrap_content"
135
                    android:text="●"
136
                    android:textColor="@color/color_707070"
137
                    android:textSize="4dp"
138
                    />
139
140
                <TextView
141
                    android:layout_width="wrap_content"
142
                    android:layout_height="wrap_content"
143
                    android:layout_marginStart="6dp"
144
                    android:text="您的账号如果有余额请先完成退款或联系客服清空赠送金额"
145
                    android:textColor="@color/color_707070"
146
                    android:textSize="12sp" />
147
148
            </LinearLayout>
149
            <View
150
                android:background="@color/color_f5f6f7"
151
                android:layout_marginEnd="14dp"
152
                android:layout_marginStart="14dp"
153
                android:layout_width="match_parent"
154
                android:layout_height="1dp"/>
155
156
            <TextView
157
                android:padding="14dp"
158
                android:layout_width="match_parent"
159
                android:layout_height="wrap_content"
160
                android:text="注销提交后冻结账号15天,15天后自动注销账号,将清除账号所有相关信息和记录。冻结期内不可使用APP功能,可取消注销。"
161
                android:textColor="#ff707070"
162
                android:textSize="12sp"
163
                />
164
        </LinearLayout>
165
    </LinearLayout>
166
167
    <LinearLayout
168
        tools:visibility="visible"
169
        android:visibility="gone"
170
        android:id="@+id/unRegisterLayout"
171
        android:orientation="vertical"
172
        android:layout_width="match_parent"
173
        android:layout_height="wrap_content">
174
        <ImageView
175
            android:layout_marginTop="40dp"
176
            android:layout_gravity="center_horizontal"
177
            android:src="@drawable/ic_logout_hint2"
178
            android:layout_width="wrap_content"
179
            android:layout_height="wrap_content"/>
180
        <TextView
181
            android:layout_gravity="center"
182
            android:layout_marginTop="30dp"
183
            android:layout_width="wrap_content"
184
            android:layout_height="wrap_content"
185
            android:text="注销正在审核中…"
186
            android:textColor="@color/color_0e0e0e"
187
            android:textSize="21sp"
188
            />
189
190
        <TextView
191
            android:layout_marginTop="20dp"
192
            android:layout_gravity="center"
193
            android:layout_width="wrap_content"
194
            android:layout_height="wrap_content"
195
            tools:text="提交时间:2021-8-16  17:00"
196
            android:textColor="@color/app_color_9b"
197
            android:textSize="12sp"
198
            />
199
        <TextView
200
            android:layout_marginTop="20dp"
201
            android:layout_gravity="center"
202
            android:layout_width="wrap_content"
203
            android:layout_height="wrap_content"
204
            tools:text="审核中不能充值和开启充电,取消注销可继续使用"
205
            android:textColor="#ff0e0e0e"
206
            android:textSize="12sp"
207
            />
208
    </LinearLayout>
209
    <View
210
        android:layout_weight="1"
211
        android:layout_width="match_parent"
212
        android:layout_height="0dp"/>
213
    <TextView
214
        android:id="@+id/text"
215
        android:layout_marginBottom="40dp"
216
        android:layout_marginEnd="12dp"
217
        android:layout_marginStart="12dp"
218
        android:gravity="center"
219
        android:textColor="@color/white"
220
        android:text="退出登录"
221
        android:background="@drawable/bg_raduis_20_lvse"
222
        android:layout_width="match_parent"
223
        android:layout_height="40dp"/>
224
</LinearLayout>

+ 49 - 4
app/src/main/res/layout/activity_user_center_more.xml

42
        android:background="@color/ui_titleline"/>
42
        android:background="@color/ui_titleline"/>
43
43
44
    <com.zhy.autolayout.AutoLinearLayout
44
    <com.zhy.autolayout.AutoLinearLayout
45
        android:layout_marginEnd="12dp"
46
        android:layout_marginStart="12dp"
45
        android:layout_width="match_parent"
47
        android:layout_width="match_parent"
46
        android:layout_height="wrap_content"
48
        android:layout_height="wrap_content"
47
        android:layout_marginTop="44px"
49
        android:layout_marginTop="44px"
48
        android:background="@color/white"
50
        android:background="@drawable/bg_radius_6_white"
49
        android:orientation="vertical">
51
        android:orientation="vertical">
50
52
51
        <View
53
        <View
288
            android:background="@color/Line" />
290
            android:background="@color/Line" />
289
291
290
    </com.zhy.autolayout.AutoLinearLayout>
292
    </com.zhy.autolayout.AutoLinearLayout>
293
    <LinearLayout
294
        android:id="@+id/logOutLayout"
295
        android:paddingBottom="20dp"
296
        android:paddingTop="20dp"
297
        android:layout_marginEnd="12dp"
298
        android:layout_marginStart="12dp"
299
        android:background="@drawable/bg_radius_6_white"
300
        android:layout_marginTop="15dp"
301
        android:layout_width="match_parent"
302
        android:layout_height="wrap_content">
303
        <TextView
304
            android:layout_marginStart="14dp"
305
            android:layout_gravity="center_vertical"
306
            android:layout_width="wrap_content"
307
            android:layout_height="wrap_content"
308
            android:text="注销账号"
309
            android:textColor="@color/color_0e0e0e"
310
            android:textSize="14sp"
311
            />
312
        <View
313
            android:layout_weight="1"
314
            android:layout_gravity="center_vertical"
315
            android:layout_width="0dp"
316
            android:layout_height="1dp"/>
317
        <TextView
318
            android:layout_marginEnd="9dp"
319
            android:layout_width="wrap_content"
320
            android:layout_height="wrap_content"
321
            tools:text="正在审核中"
322
            android:textColor="@color/color_e32727"
323
            android:textSize="14sp"
324
            />
325
        <ImageView
326
            android:layout_width="wrap_content"
327
            android:layout_height="match_parent"
328
            android:layout_alignParentRight="true"
329
            android:layout_centerVertical="true"
330
            android:contentDescription="@null"
331
            android:paddingRight="16dp"
332
            android:src="@drawable/icon_more2_0" />
333
    </LinearLayout>
291
334
292
    <com.zhy.autolayout.AutoRelativeLayout
335
    <com.zhy.autolayout.AutoRelativeLayout
293
        android:layout_width="match_parent"
336
        android:layout_width="match_parent"
294
        android:layout_height="match_parent">
337
        android:layout_height="match_parent">
295
    <TextView
338
    <TextView
339
        android:layout_marginBottom="40dp"
340
        android:layout_marginEnd="12dp"
341
        android:layout_marginStart="12dp"
296
        android:id="@+id/tv_exit"
342
        android:id="@+id/tv_exit"
297
        android:layout_width="fill_parent"
343
        android:layout_width="fill_parent"
298
        android:layout_height="127px"
299
        android:background="@color/lvse"
344
        android:layout_height="40dp"
345
        android:background="@drawable/bg_raduis_20_lvse"
300
        android:gravity="center"
346
        android:gravity="center"
301
        android:text="退出登录"
347
        android:text="退出登录"
302
        android:textColor="@color/bg_row"
348
        android:textColor="@color/bg_row"
324
370
325
    </com.zhy.autolayout.AutoRelativeLayout>
371
    </com.zhy.autolayout.AutoRelativeLayout>
326
372
327
328
</com.zhy.autolayout.AutoLinearLayout>
373
</com.zhy.autolayout.AutoLinearLayout>
329
374
330
375

+ 35 - 0
app/src/main/res/layout/dialog_state.xml

1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout 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:background="#f1f1"
6
    android:id="@+id/stateLayout"
7
    android:orientation="vertical"
8
    android:layout_height="match_parent">
9
10
    <LinearLayout
11
        android:gravity="center"
12
        android:orientation="vertical"
13
        android:layout_centerInParent="true"
14
        android:background="@drawable/bg_white_radius10"
15
        android:layout_width="268dp"
16
        android:layout_height="124dp">
17
18
        <ImageView
19
            android:id="@+id/stateImg"
20
            android:layout_marginTop="10dp"
21
            tools:src="@drawable/ic_logout_dialog"
22
            android:layout_gravity="center"
23
            android:layout_width="wrap_content"
24
            android:layout_height="wrap_content"/>
25
        <TextView
26
            android:layout_marginTop="20dp"
27
            android:id="@+id/stateText"
28
            android:layout_marginBottom="10dp"
29
            android:layout_gravity="center"
30
            tools:text="请先退款或完成退款订单"
31
            android:textColor="@color/black"
32
            android:layout_width="wrap_content"
33
            android:layout_height="wrap_content"/>
34
    </LinearLayout>
35
</RelativeLayout>

+ 3 - 0
app/src/main/res/values/color.xml

200
    <color name="color_f08f4b">#F08F4B</color>
200
    <color name="color_f08f4b">#F08F4B</color>
201
    <color name="color_ff333333">#ff333333</color>
201
    <color name="color_ff333333">#ff333333</color>
202

202

203
    <color name="color_e32727">#ffe32727</color>
204
    <color name="color_707070">#ff707070</color>
205
    <color name="color_f5f6f7">#F5F6F7</color>
203

206

204

207

205

208


完成发表评论以及图片、视频选择UI展示 · 78c104f7fc - Gogs: Go Git Service
Parcourir la Source

完成发表评论以及图片、视频选择UI展示

hy 4 ans auparavant
Parent
commit
78c104f7fc

+ 3 - 0
app/src/main/AndroidManifest.xml

@ -100,6 +100,9 @@
100 100
            android:name=".activity.PermissionAgreementActivity"
101 101
            android:screenOrientation="portrait"/>
102 102
        <activity
103
            android:name=".activity.ImageDisplayActivity"
104
            android:screenOrientation="portrait"/>
105
        <activity
103 106
            android:name=".activity.VideoCompressionActivity"
104 107
            android:screenOrientation="portrait"/>
105 108
        <activity

+ 206 - 0
app/src/main/java/com/electric/chargingpile/activity/ImageDisplayActivity.java

@ -0,0 +1,206 @@
1
package com.electric.chargingpile.activity;
2
3
import android.content.Context;
4
import android.content.Intent;
5
import android.graphics.Bitmap;
6
import android.graphics.Color;
7
import android.os.Bundle;
8
import android.text.TextUtils;
9
import android.view.View;
10
import android.view.ViewGroup;
11
import android.widget.RelativeLayout;
12
import android.widget.TextView;
13
14
import androidx.annotation.Nullable;
15
import androidx.appcompat.app.AppCompatActivity;
16
import androidx.viewpager.widget.PagerAdapter;
17
import androidx.viewpager.widget.ViewPager;
18
19
import com.bumptech.glide.Glide;
20
import com.electric.chargingpile.R;
21
import com.electric.chargingpile.util.Bimp;
22
import com.electric.chargingpile.util.PublicWayFour;
23
import com.electric.chargingpile.util.PublicWayONE;
24
import com.electric.chargingpile.util.Res;
25
import com.electric.chargingpile.widge.photoview.PhotoView;
26
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
27
import com.luck.picture.lib.entity.LocalMedia;
28
29
import java.util.ArrayList;
30
import java.util.List;
31
32
public class ImageDisplayActivity extends AppCompatActivity implements View.OnClickListener {
33
34
    // 返回按钮
35
    private TextView back_bt;
36
    // 发送按钮
37
    private TextView send_bt;
38
    //删除按钮
39
    private TextView del_bt;
40
    //顶部显示预览图片位置的textview
41
    private TextView positionTextView;
42
    //获取前一个activity传过来的position
43
    private int position;
44
45
46
    private ArrayList<View> listViews = null;
47
    private ZoomingViewpager pager;
48
    private MyPageAdapter adapter;
49
50
    public List<Bitmap> bmp = new ArrayList<Bitmap>();
51
    public List<String> drr = new ArrayList<String>();
52
    public List<String> del = new ArrayList<String>();
53
54
    private Context mContext;
55
56
    RelativeLayout photo_relativeLayout;
57
58
    @Override
59
    protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
60
        super.onCreate(savedInstanceState);
61
        setContentView(R.layout.activity_gallery_activity_alter);
62
        back_bt = (TextView) findViewById(R.id.gallery_back);
63
        send_bt = (TextView) findViewById(R.id.send_button);
64
        del_bt = (TextView) findViewById(R.id.gallery_del);
65
//        back_bt.setOnClickListener(new BackListener());
66
        send_bt.setOnClickListener(this);
67
        del_bt.setOnClickListener(this);
68
        // 为发送按钮设置文字
69
        pager = (ZoomingViewpager) findViewById(R.id.gallery01);
70
        pager.setBackgroundColor(getResources().getColor(R.color.white));
71
72
        initListViews(Bimp.tempSelectMedia);
73
        adapter = new MyPageAdapter(listViews);
74
        pager.setAdapter(adapter);
75
        pager.setOnPageChangeListener(pageChangeListener);
76
        pager.setPageMargin((int) getResources().getDimensionPixelOffset(Res.getDimenID("ui_10_dip")));
77
78
        position = getIntent().getIntExtra("position",0);
79
        pager.setCurrentItem(this.position);
80
        isShowOkBt();
81
82
    }
83
    private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() {
84
85
        @Override
86
        public void onPageSelected(int arg0) {
87
            send_bt.setText(Res.getString("finish") + "(" + (arg0 + 1) + "/" + Bimp.tempSelectMedia.size() + ")");
88
        }
89
90
        @Override
91
        public void onPageScrolled(int arg0, float arg1, int arg2) {
92
93
        }
94
95
        @Override
96
        public void onPageScrollStateChanged(int arg0) {
97
98
        }
99
    };
100
101
    public void isShowOkBt() {
102
        if (Bimp.tempSelectMedia.size() > 0) {
103
            send_bt.setPressed(true);
104
            send_bt.setClickable(true);
105
            send_bt.setText(Res.getString("finish") + "(" + (pager.getCurrentItem()+1) + "/" + Bimp.tempSelectMedia.size() + ")");
106
107
            send_bt.setTextColor(getResources().getColor(R.color.lvse));
108
        } else {
109
            send_bt.setPressed(false);
110
            send_bt.setClickable(false);
111
            send_bt.setTextColor(Color.parseColor("#E1E0DE"));
112
        }
113
    }
114
    private void initListViews(List<LocalMedia> list) {
115
        if (listViews == null)
116
            listViews = new ArrayList<View>();
117
        for (LocalMedia media:list){
118
            PhotoView img = new PhotoView(this);
119
            img.setBackgroundColor(0xffffffff);
120
            String path = TextUtils.isEmpty(media.getAndroidQToPath()) ? media.getPath() : media.getAndroidQToPath();
121
            Glide.with(this)
122
                    .load(path)
123
                    .into(img);
124
            img.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
125
                    ViewGroup.LayoutParams.MATCH_PARENT));
126
            listViews.add(img);
127
        }
128
    }
129
130
    @Override
131
    public void onClick(View v) {
132
        switch (v.getId()){
133
            case R.id.send_button:
134
                finish();
135
                break;
136
137
            case R.id.gallery_del:
138
                if (listViews.size() == 1) {
139
                    Bimp.tempSelectMedia.clear();
140
                    send_bt.setText(Res.getString("finish") + "(" + (pager.getCurrentItem()+1) + "/" + Bimp.tempSelectMedia.size() + ")");
141
                    finish();
142
                } else {
143
                    Bimp.tempSelectMedia.remove(pager.getCurrentItem());
144
                    pager.removeAllViews();
145
                    listViews.remove(pager.getCurrentItem());
146
                    adapter.setListViews(listViews);
147
                    adapter.notifyDataSetChanged();
148
                    send_bt.setText(Res.getString("finish") + "(" +  (pager.getCurrentItem()+1) + "/" + Bimp.tempSelectMedia.size() + ")");
149
150
                }
151
                break;
152
        }
153
    }
154
155
    class MyPageAdapter extends PagerAdapter {
156
157
        private ArrayList<View> listViews;
158
159
        private int size;
160
161
        public MyPageAdapter(ArrayList<View> listViews) {
162
            this.listViews = listViews;
163
            size = listViews == null ? 0 : listViews.size();
164
        }
165
166
        public void setListViews(ArrayList<View> listViews) {
167
            this.listViews = listViews;
168
            size = listViews == null ? 0 : listViews.size();
169
        }
170
171
        public int getCount() {
172
            return size;
173
        }
174
175
        public int getItemPosition(Object object) {
176
            return POSITION_NONE;
177
        }
178
179
        public void destroyItem(View arg0, int arg1, Object arg2) {
180
            ((ZoomingViewpager) arg0).removeView(listViews.get(arg1 % size));
181
        }
182
183
        public void finishUpdate(View arg0) {
184
        }
185
186
        public Object instantiateItem(View arg0, int arg1) {
187
            try {
188
                ((ZoomingViewpager) arg0).addView(listViews.get(arg1 % size), 0);
189
190
            } catch (Exception e) {
191
            }
192
            return listViews.get(arg1 % size);
193
        }
194
195
        public boolean isViewFromObject(View arg0, Object arg1) {
196
            return arg0 == arg1;
197
        }
198
199
    }
200
201
    public static void  actionStart(Context context,int position){
202
        Intent intent = new Intent(context, ImageDisplayActivity.class);
203
        intent.putExtra("position",position);
204
        context.startActivity(intent);
205
    }
206
}

+ 2 - 0
app/src/main/java/com/electric/chargingpile/activity/SelectTopicActivity.java

@ -3,6 +3,7 @@ package com.electric.chargingpile.activity;
3 3
import android.app.Activity;
4 4
import android.content.Intent;
5 5
import android.os.Bundle;
6
import android.util.Log;
6 7
import android.view.View;
7 8
import android.widget.TextView;
8 9
import android.widget.Toast;
@ -75,6 +76,7 @@ public class SelectTopicActivity  extends AppCompatActivity {
75 76
76 77
    public void requestTopicList(){
77 78
        String url = MainApplication.url + "/zhannew/basic/web/index.php/theme/getlist";
79
        Log.e("HYC", "onResponse: "+url );
78 80
        OkHttpUtils.get().url(url).build().connTimeOut(5000).readTimeOut(5000).execute(new StringCallback() {
79 81
80 82
            @Override

+ 93 - 402
app/src/main/java/com/electric/chargingpile/activity/ZhanCommentActivity.java

@ -1,53 +1,39 @@
1 1
package com.electric.chargingpile.activity;
2 2
3 3
import android.Manifest;
4
import android.app.Activity;
5 4
import android.app.ProgressDialog;
6 5
import android.content.BroadcastReceiver;
7
import android.content.ContentValues;
8 6
import android.content.Context;
9 7
import android.content.Intent;
10 8
import android.content.IntentFilter;
11
import android.database.Cursor;
12 9
import android.graphics.Bitmap;
13
import android.graphics.BitmapFactory;
14
import android.graphics.Color;
15
import android.graphics.Matrix;
16
import android.graphics.drawable.BitmapDrawable;
17
import android.graphics.drawable.ColorDrawable;
18
import android.net.Uri;
19
import android.os.Build;
20 10
import android.os.Bundle;
21 11
22 12
import android.os.Handler;
23 13
import android.os.Message;
24
import android.provider.MediaStore;
25 14
import android.text.Editable;
26 15
import android.text.Html;
16
import android.text.TextUtils;
27 17
import android.text.TextWatcher;
28
import android.util.Base64;
29 18
import android.util.Log;
30 19
import android.view.LayoutInflater;
31 20
import android.view.View;
32
import android.view.ViewGroup;
33 21
import android.view.animation.AnimationUtils;
34 22
import android.view.inputmethod.InputMethodManager;
35
import android.widget.AdapterView;
36
import android.widget.BaseAdapter;
37
import android.widget.Button;
38
import android.widget.GridView;
39 23
import android.widget.ImageView;
40 24
import android.widget.LinearLayout;
41
import android.widget.PopupWindow;
42 25
import android.widget.RelativeLayout;
43 26
import android.widget.TextView;
44 27
import android.widget.Toast;
45 28
46 29
import androidx.annotation.NonNull;
47 30
import androidx.appcompat.app.AppCompatActivity;
31
import androidx.recyclerview.widget.GridLayoutManager;
32
import androidx.recyclerview.widget.RecyclerView;
48 33
49 34
import com.blankj.utilcode.util.CacheUtils;
50 35
import com.electric.chargingpile.R;
36
import com.electric.chargingpile.adapter.GridImageAdapter;
51 37
import com.electric.chargingpile.application.MainApplication;
52 38
import com.electric.chargingpile.data.CommentsBean;
53 39
import com.electric.chargingpile.data.MyOtto;
@ -57,19 +43,15 @@ import com.electric.chargingpile.engine.GlideEngine;
57 43
import com.electric.chargingpile.util.BarColorUtil;
58 44
import com.electric.chargingpile.util.Bimp;
59 45
import com.electric.chargingpile.util.DES3;
60
import com.electric.chargingpile.util.FileUtils;
61
import com.electric.chargingpile.util.ImageItem;
62
import com.electric.chargingpile.util.ImageUtils;
46
import com.electric.chargingpile.util.DensityUtil;
63 47
import com.electric.chargingpile.util.JsonUtils;
64 48
import com.electric.chargingpile.util.LoadingDialog;
65 49
import com.electric.chargingpile.util.Md5Util;
66
import com.electric.chargingpile.util.PhotoUtils;
67 50
import com.electric.chargingpile.util.PublicWayONE;
68 51
import com.electric.chargingpile.util.Res;
69 52
import com.electric.chargingpile.util.ScreenUtils;
70 53
import com.electric.chargingpile.util.StatusConstants;
71 54
import com.electric.chargingpile.util.ToastUtil;
72
import com.electric.chargingpile.util.UploadUtil;
73 55
import com.electric.chargingpile.util.Util;
74 56
import com.electric.chargingpile.view.CommentHintDialog;
75 57
import com.electric.chargingpile.view.REditText;
@ -90,31 +72,18 @@ import com.zhy.view.flowlayout.TagFlowLayout;
90 72
import org.json.JSONException;
91 73
import org.json.JSONObject;
92 74
93
import java.io.ByteArrayOutputStream;
94
import java.io.File;
95
import java.io.FileNotFoundException;
96
import java.io.IOException;
97 75
import java.net.URLEncoder;
98 76
import java.util.ArrayList;
99
import java.util.HashMap;
100 77
import java.util.List;
101
import java.util.Map;
102 78
import java.util.Set;
103 79
104
import io.reactivex.Observable;
105
import io.reactivex.ObservableEmitter;
106
import io.reactivex.ObservableOnSubscribe;
107
import io.reactivex.Observer;
108
import io.reactivex.android.schedulers.AndroidSchedulers;
109
import io.reactivex.disposables.Disposable;
110
import io.reactivex.schedulers.Schedulers;
111 80
import okhttp3.Call;
112 81
import pub.devrel.easypermissions.AfterPermissionGranted;
113 82
import pub.devrel.easypermissions.EasyPermissions;
114 83
115 84
import static android.text.Html.FROM_HTML_MODE_LEGACY;
116 85
117
public class ZhanCommentActivity extends AppCompatActivity implements View.OnClickListener, EasyPermissions.PermissionCallbacks {
86
public class ZhanCommentActivity extends AppCompatActivity implements View.OnClickListener, EasyPermissions.PermissionCallbacks, GridImageAdapter.GridImgListener {
118 87
    private static final String TAG = "ZhanCommentActivity";
119 88
    private static final int PIC_NUM = 3;
120 89
    private ProgressDialog insertDialog;
@ -141,13 +110,9 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
141 110
    private String select_ss = "";
142 111
    private TextView tv_grade, tv_point,tv_zhan_name,topicText,commentHint;
143 112
144
    private static String PHOTO_FILE_NAME = "";
145
    private static final String PHOTO_FILE_PATH = getPath(PhotoUtils.CACHE_DIR);
146
    public static Bitmap bimap;
147 113
148
149
    private GridView noScrollgridview;
150
    private GridAdapter adapter;
114
    private RecyclerView noScrollgridview;
115
    private GridImageAdapter mAdapter;
151 116
    private static final int PHOTO_REQUEST_CAMERA = 1;
152 117
    private static final int PHOTO_REQUEST_GALLERY = 2;
153 118
    private static final int PHOTO_REQUEST_CUT = 3;
@ -193,7 +158,10 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
193 158
            super.handleMessage(msg);
194 159
        }
195 160
    };
196
    private List<LocalMedia> mSelectionData =new ArrayList<LocalMedia>();
161
162
    private int mItemWidth;
163
    private int mInsterType = -1; //1 插入图片 2 插入视频 -1 未插入数据
164
197 165
    @Override
198 166
    protected void onCreate(Bundle savedInstanceState) {
199 167
        super.onCreate(savedInstanceState);
@ -206,9 +174,6 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
206 174
        registerReceiver(networkChangeReceiver, intentFilter);
207 175
        MyOtto.getInstance().unregister(this);
208 176
        Res.init(this);
209
        bimap = BitmapFactory.decodeResource(
210
                getResources(),
211
                R.drawable.addpic65);
212 177
        PublicWayONE.activityList.add(this);
213 178
        if (null == imm) {
214 179
            imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
@ -469,56 +434,18 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
469 434
470 435
    public void Init() {
471 436
472
        noScrollgridview = (GridView) findViewById(R.id.noScrollgridview);
473
        noScrollgridview.setSelector(new ColorDrawable(Color.TRANSPARENT));
474
        adapter = new GridAdapter(this);
475
        adapter.update();
476
        noScrollgridview.setAdapter(adapter);
477
        noScrollgridview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
478
479
            @Override
480
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
481
                                    long arg3) {
482
                imm.hideSoftInputFromWindow(arg1.getWindowToken(), 0);
483
                if (arg2 == Bimp.tempSelectBitmap.size()) {
484
                    permissionTask();
485
                } else {
486
                    Intent intent = new Intent(ZhanCommentActivity.this,
487
                            GalleryActivityComment.class);
488
                    intent.putExtra("position", "1");
489
                    intent.putExtra("ID", arg2);
490
                    startActivity(intent);
491
                }
492
            }
493
        });
437
        noScrollgridview = (RecyclerView) findViewById(R.id.noScrollgridview);
438
        noScrollgridview.setLayoutManager(new GridLayoutManager(this,4));
439
        int screenWidth = ScreenUtils.getScreenWidth(this);
440
        int mRvMargin=(DensityUtil.dip2px(this,15) * 2);//rv左右间距
441
        int mItemMargin=(DensityUtil.dip2px(this,15) * 3);//item之间的间隙
442
        mItemWidth = ( screenWidth - mRvMargin -  mItemMargin ) / 4;
443
        mAdapter=new GridImageAdapter(this,3,mItemWidth,0);
444
        mAdapter.setListener(this);
445
        noScrollgridview.setAdapter(mAdapter);
494 446
495 447
    }
496 448
497
    /**
498
     * 调用图库选择
499
     */
500
    private void callGallery() {
501
        PictureSelector.create(this)
502
                .openGallery(PictureMimeType.ofImage())
503
                .maxSelectNum(PIC_NUM - Bimp.tempSelectBitmap.size())
504
                .selectionMode(PictureConfig.MULTIPLE)
505
                .selectionData(mSelectionData)//是否传入已选图片
506
                .isCompress(true)//是否压缩
507
                .isPreviewEggs(true)//预览图片时是否增强左右滑动图片体验
508
                .isGif(true)//是否显示gif
509
                .isAndroidQTransform(true)
510
                .imageEngine(GlideEngine.createGlideEngine())
511
                .isWeChatStyle(false)// 是否开启微信图片选择风格
512
                .isUseCustomCamera(false)// 是否使用自定义相机
513
                .isPageStrategy(true)// 是否开启分页策略 & 每页多少条;默认开启
514
                .setPictureStyle(Util.getWhiteStyle(this))// 动态自定义相册主题
515
                .setRecyclerAnimationMode(AnimationType.SLIDE_IN_BOTTOM_ANIMATION)// 列表动画效果
516
                .isMaxSelectEnabledMask(true)// 选择数到了最大阀值列表是否启用蒙层效果
517
                .imageSpanCount(4)// 每行显示个数
518
                .isReturnEmpty(false)// 未选择数据时点击按钮是否可以返回
519
                .isAutomaticTitleRecyclerTop(true)//图片列表超过一屏连续点击顶部标题栏快速回滚至顶部
520
                .forResult(REQUEST_CODE_CHOOSE);
521
    }
522 449
523 450
    @Override
524 451
    protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
@ -528,14 +455,23 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
528 455
                if (requestCode == 1) {
529 456
                    //处理调用系统图库
530 457
                } else if (requestCode == REQUEST_CODE_CHOOSE) {
531
                    noScrollgridview.setVisibility(View.VISIBLE);
532
                    layoutHint.setVisibility(View.GONE);
458
                    setLayoutHintVisible(1);
533 459
                    //异步方式插入图片
534
                    insertImagesSync(data);
460
//                    insertImagesSync(data);
461
                    Bimp.tempSelectMedia = PictureSelector.obtainMultipleResult(data);
462
                    mAdapter.setMaxCount(3);
463
                    mInsterType=1;
464
465
                    mAdapter.setDatas(Bimp.tempSelectMedia);
466
467
535 468
                } else if (requestCode == REQUEST_VIDEO_CODE_CHOOSE) {
536
                    //异步方式插入图片
537
                    noScrollgridview.setVisibility(View.VISIBLE);
538
                    layoutHint.setVisibility(View.GONE);
469
                    //异步方式插入视频
470
                    setLayoutHintVisible(2);
471
                    mInsterType=2;
472
                    mAdapter.setMaxCount(1);
473
                    Bimp.tempSelectMedia= PictureSelector.obtainMultipleResult(data);
474
                    mAdapter.setDatas(Bimp.tempSelectMedia);
539 475
                }
540 476
            }
541 477
        }else if  (requestCode==REQUEST_TOPIC_CODE && resultCode == SelectTopicActivity.REESULT_CODE){
@ -545,109 +481,19 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
545 481
        }
546 482
547 483
    }
548
549 484
    /**
550
     * 异步方式插入图片
551
     *
552
     * @param data
553
     */
554
    private void insertImagesSync(final Intent data) {
555
        insertDialog.show();
556
        Observable.create(new ObservableOnSubscribe<String>() {
557
            @Override
558
            public void subscribe(ObservableEmitter<String> subscriber) throws Exception {
559
                try {
560
//                    List<Uri> uriList = Matisse.obtainResult(data);
561
                    mSelectionData= PictureSelector.obtainMultipleResult(data);
562
                    for (LocalMedia media : mSelectionData) {
563
//                        Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
564
//                        File file = FileUtils.from(ZhanCommentActivity.this, uri);
565
//
566
//                        bitmap = FileUtils.rotateIfRequired(file, bitmap);
567
//                        bitmap = imageZoom(bitmap);
568
//                        ImageItem takePhoto = new ImageItem();
569
//                        takePhoto.setBitmap(bitmap);
570
//                        Bimp.tempSelectBitmap.add(takePhoto);
571
                        String path="";
572
                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
573
                            path= media.getAndroidQToPath();
574
                        }else{
575
                            path=media.getPath();
576
                        }
577
                        ImageItem takePhoto = new ImageItem();
578
                        takePhoto.setBitmap(imageZoom(BitmapFactory.decodeFile(path)));
579
                        Bimp.tempSelectBitmap.add(takePhoto);
580
                        subscriber.onNext("");
581
                    }
582
                    subscriber.onComplete();
583
                } catch (Exception e) {
584
                    e.printStackTrace();
585
                    subscriber.onError(e);
586
                }
587
            }
588
        })
589
                .subscribeOn(Schedulers.io())//生产事件在io
590
                .observeOn(AndroidSchedulers.mainThread())//消费事件在UI线程
591
                .subscribe(new Observer<String>() {
592
593
                    @Override
594
                    public void onSubscribe(Disposable d) {
595
596
                    }
597
598
                    @Override
599
                    public void onNext(String s) {
600
601
                    }
602
603
                    @Override
604
                    public void onError(Throwable e) {
605
                        insertDialog.dismiss();
606
                        Log.e(TAG, "onError: " + "图片插入失败:" + e.getMessage());
607
                        ToastUtil.showToast(getApplicationContext(), "图片插入失败", Toast.LENGTH_SHORT);
608
                    }
609
610
                    @Override
611
                    public void onComplete() {
612
                        Log.e(TAG, "onCompleted: -------------");
613
                        insertDialog.dismiss();
614
                        adapter.update();
615
616
                    }
617
                });
618
    }
619
620
    public void shite(String s) throws Exception {
621
        Map<String, String> par = new HashMap<String, String>();
622
        String file;
623
        long appTime1 = System.currentTimeMillis() / 1000;
624
        Log.i("appTime(long)---", appTime1 + "");
625
        long updatetime = appTime1 - MainMapActivity.cha - 1;
626
        Log.i("updatetime(long)---", updatetime + "");
627
        Log.i("cha---", MainMapActivity.cha + "");
628
        for (int i = 0; i < Bimp.tempSelectBitmap.size(); i++) {
629
            try {
630
                bm = imageZoom(Bimp.tempSelectBitmap.get(i).getBitmap());
631
                file = bitmapToBase64(bm);
632
                par.put("file", file);
633
                Log.i("file--------" + (i + 1), file);
634
                par.put("filename", "androidapp.jpg");
635
            } catch (Exception e) {
636
                e.printStackTrace();
637
            }
638
639
        }
640
        try {
641
            String u = UploadUtil.post(MainApplication.url + "/zhannew/basic/web/index.php/fileupload/upload",
642
                    par, null);
643
            System.err.println(u);
644
            // submit(u);
645
            Message msg = new Message();
646
            msg.obj = u;
647
            msg.what = 2;
648
            handler.sendMessage(msg);
649
        } catch (IOException e) {
650
            e.printStackTrace();
485
     * @param type  1表示插入图片成功 2表示插入视频成功 -1表示 插入数据为null
486
     * */
487
    public void setLayoutHintVisible(int type){
488
        if (type==1){
489
            noScrollgridview.setVisibility(View.VISIBLE);
490
            layoutHint.setVisibility(View.GONE);
491
        }else if (type == 2){
492
            noScrollgridview.setVisibility(View.VISIBLE);
493
            layoutHint.setVisibility(View.GONE);
494
        }else if (type == -1){
495
            layoutHint.setVisibility(View.VISIBLE);
496
            noScrollgridview.setVisibility(View.GONE);
651 497
        }
652 498
    }
653 499
@ -848,7 +694,7 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
848 694
                                @Override
849 695
                                public void run() {
850 696
                                    try {
851
                                        shite("");
697
//                                        shite("");
852 698
                                    } catch (Exception e) {
853 699
                                        e.printStackTrace();
854 700
                                    }
@ -876,21 +722,21 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
876 722
                finish();
877 723
                break;
878 724
            case R.id.videoUpLoad:
879
                openVideo();
725
                addVideo();
880 726
                break;
881 727
882 728
            case R.id.imgUpload:
883
                openImg();
729
                addImg();
884 730
                break;
885 731
        }
886 732
    }
887 733
888
    private void openImg(){
734
    private void addImg(){
889 735
        PictureSelector.create(this)
890 736
                .openGallery(PictureMimeType.ofImage())
891 737
                .maxSelectNum(PIC_NUM)
892 738
                .selectionMode(PictureConfig.MULTIPLE)
893
                .selectionData(mSelectionData)//是否传入已选图片
739
                .selectionData(Bimp.tempSelectMedia)//是否传入已选图片
894 740
                .isCompress(true)//是否压缩
895 741
                .isPreviewEggs(true)//预览图片时是否增强左右滑动图片体验
896 742
                .isGif(true)//是否显示gif
@ -907,7 +753,7 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
907 753
                .isAutomaticTitleRecyclerTop(true)//图片列表超过一屏连续点击顶部标题栏快速回滚至顶部
908 754
                .forResult(REQUEST_CODE_CHOOSE);
909 755
    }
910
    private void openVideo(){
756
    private void addVideo(){
911 757
        PictureSelector.create(this)
912 758
                .openGallery(PictureMimeType.ofVideo())
913 759
                .selectionMode(PictureConfig.SINGLE)
@ -952,7 +798,7 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
952 798
    @AfterPermissionGranted(RC_ALBUM_PERM)
953 799
    public void permissionTask() {
954 800
        if (isPermissionOK()) {
955
            callGallery();
801
            addImg();
956 802
        } else {
957 803
            // Ask for one permission
958 804
            EasyPermissions.requestPermissions(
@ -972,150 +818,51 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
972 818
        );
973 819
    }
974 820
975
    public class MyTopic extends RObject {
976
        private String id;
977
978
        // 其他属性...
979
980
        public String getId() {
981
            return id;
982
        }
983
984
        public void setId(String id) {
985
            this.id = id;
821
    @Override
822
    public void add() {
823
        if (mInsterType == 1){
824
            addImg();
825
        }else if (mInsterType == 2){
826
            addVideo();
986 827
        }
987 828
    }
988 829
989
    private File getFile(String path) {
990
        File f = new File(path);
991
        if (!f.exists()) {
992
            try {
993
                f.createNewFile();
994
            } catch (IOException e) {
995
                e.printStackTrace();
996
            }
830
    @Override
831
    public void remove(int position) {
832
        if (mAdapter.getItemCount() == 1){
833
            setLayoutHintVisible(-1);
834
            mInsterType=-1;
997 835
        }
998
        return f;
999
    }
1000 836
1001
    private static String getPath(String path) {
1002
        File f = new File(path);
1003
        if (!f.exists()) {
1004
            f.mkdirs();
1005
        }
1006
        return f.getAbsolutePath();
1007 837
    }
1008 838
1009
    public class GridAdapter extends BaseAdapter {
1010
        private LayoutInflater inflater;
1011
        private int selectedPosition = -1;
1012
        private boolean shape;
1013
1014
        public boolean isShape() {
1015
            return shape;
1016
        }
1017
1018
        public void setShape(boolean shape) {
1019
            this.shape = shape;
1020
        }
1021
1022
        public GridAdapter(Context context) {
1023
            inflater = LayoutInflater.from(context);
1024
        }
1025
1026
        public void update() {
1027
            loading();
1028
        }
1029
1030
        public int getCount() {
1031
            if (Bimp.tempSelectBitmap.size() == 1) {
1032
                return 1;
1033
            }
1034
            return (Bimp.tempSelectBitmap.size() + 1);
1035
        }
1036
1037
        public Object getItem(int arg0) {
1038
            return null;
1039
        }
1040
1041
        public long getItemId(int arg0) {
1042
            return 0;
1043
        }
1044
1045
        public void setSelectedPosition(int position) {
1046
            selectedPosition = position;
1047
        }
1048
1049
        public int getSelectedPosition() {
1050
            return selectedPosition;
839
    @Override
840
    public void open(int position, LocalMedia mLocalMedia) {
841
        if (mInsterType == 1){
842
            ImageDisplayActivity.actionStart(this,position);
843
        }else if (mInsterType == 2){
844
            PictureSelector.create(ZhanCommentActivity.this)
845
                    .themeStyle(R.style.picture_default_style)
846
                    .setPictureStyle(Util.getWhiteStyle(ZhanCommentActivity.this))// 动态自定义相册主题
847
                    .externalPictureVideo(TextUtils.isEmpty(mLocalMedia.getAndroidQToPath()) ? mLocalMedia.getPath() : mLocalMedia.getAndroidQToPath());
1051 848
        }
849
    }
1052 850
1053
        public View getView(int position, View convertView, ViewGroup parent) {
1054
            GridAdapter.ViewHolder holder = null;
1055
            if (convertView == null) {
1056
                convertView = inflater.inflate(R.layout.item_published_grida,
1057
                        parent, false);
1058
                holder = new GridAdapter.ViewHolder();
1059
                holder.image = (ImageView) convertView
1060
                        .findViewById(R.id.item_grida_image);
1061
                convertView.setTag(holder);
1062
            } else {
1063
                holder = (GridAdapter.ViewHolder) convertView.getTag();
1064
            }
1065
1066
            if (position == Bimp.tempSelectBitmap.size()) {
1067
                holder.image.setImageBitmap(BitmapFactory.decodeResource(
1068
                        getResources(), R.drawable.actionsheet_middle_selector));
1069
                if (position == 1) {
1070
                    holder.image.setVisibility(View.GONE);
1071
                }
1072
            } else {
1073
                holder.image.setImageBitmap(Bimp.tempSelectBitmap.get(position).getBitmap());
1074
            }
851
    public class MyTopic extends RObject {
852
        private String id;
1075 853
1076
            return convertView;
1077
        }
854
        // 其他属性...
1078 855
1079
        public class ViewHolder {
1080
            public ImageView image;
856
        public String getId() {
857
            return id;
1081 858
        }
1082 859
1083
        Handler handler = new Handler() {
1084
            public void handleMessage(Message msg) {
1085
                switch (msg.what) {
1086
                    case 1:
1087
                        adapter.notifyDataSetChanged();
1088
                        break;
1089
                }
1090
                super.handleMessage(msg);
1091
            }
1092
        };
1093
1094
        public void loading() {
1095
            new Thread(new Runnable() {
1096
                public void run() {
1097
                    while (true) {
1098
                        if (Bimp.max == Bimp.tempSelectBitmap.size()) {
1099
                            Message message = new Message();
1100
                            message.what = 1;
1101
                            handler.sendMessage(message);
1102
                            break;
1103
                        } else {
1104
                            Bimp.max += 1;
1105
                            Message message = new Message();
1106
                            message.what = 1;
1107
                            handler.sendMessage(message);
1108
                        }
1109
                    }
1110
                }
1111
            }).start();
860
        public void setId(String id) {
861
            this.id = id;
1112 862
        }
1113 863
    }
1114 864
1115
1116
1117 865
    protected void onRestart() {
1118
        adapter.update();
1119 866
        super.onRestart();
1120 867
    }
1121 868
@ -1126,75 +873,10 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
1126 873
        MyOtto.getInstance().unregister(this);
1127 874
        Bimp.tempSelectBitmap.clear();
1128 875
        Bimp.max = 0;
1129
    }
1130
1131
    private String bitmapToBase64(Bitmap bitmap) {
1132
1133
        String result = null;
1134
        ByteArrayOutputStream baos = null;
1135
        try {
1136
            if (bitmap != null) {
1137
                baos = new ByteArrayOutputStream();
1138
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
1139
                baos.flush();
1140
                baos.close();
1141
                byte[] bitmapBytes = baos.toByteArray();
1142
                result = Base64.encodeToString(bitmapBytes, Base64.DEFAULT);
1143
            }
1144
        } catch (IOException e) {
1145
            e.printStackTrace();
1146
        } finally {
1147
            try {
1148
                if (baos != null) {
1149
                    baos.flush();
1150
                    baos.close();
1151
                }
1152
            } catch (IOException e) {
1153
                e.printStackTrace();
1154
            }
1155
        }
1156
        return result;
1157
    }
1158
1159
    private Bitmap imageZoom(Bitmap bm) {
1160
        // 图片允许最大空间 单位:KB
1161
        double maxSize = 200.00;
1162
        // 将bitmap放至数组中,意在bitmap的大小(与实际读取的原文件要大)
1163
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
1164
        bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
1165
        byte[] b = baos.toByteArray();
1166
        // 将字节换成KB
1167
        double mid = b.length / 1024;
1168
        // 判断bitmap占用空间是否大于允许最大空间 如果大于则压缩 小于则不压缩
1169
        if (mid > maxSize) {
1170
            // 获取bitmap大小 是允许最大大小的多少倍
1171
            double i = mid / maxSize;
1172
            // 开始压缩 此处用到平方根 将宽带和高度压缩掉对应的平方根倍
1173
            // (1.保持刻度和高度和原bitmap比率一致,压缩后也达到了最大大小占用空间的大小)
1174
            bm = zoomImage(bm, bm.getWidth() / Math.sqrt(i), bm.getHeight()
1175
                    / Math.sqrt(i));
1176
        }
1177 876
1178
        return bm;
877
        Bimp.tempSelectMedia.clear();
1179 878
    }
1180 879
1181
    public Bitmap zoomImage(Bitmap bgimage, double newWidth, double newHeight) {
1182
        // 获取这个图片的宽和高
1183
        float width = bgimage.getWidth();
1184
        float height = bgimage.getHeight();
1185
        // 创建操作图片用的matrix对象
1186
        Matrix matrix = new Matrix();
1187
        // 计算宽高缩放率
1188
        float scaleWidth = ((float) newWidth) / width;
1189
        float scaleHeight = ((float) newHeight) / height;
1190
        // 缩放图片动作
1191
        matrix.postScale(scaleWidth, scaleHeight);
1192
        Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
1193
                (int) height, matrix, true);
1194
//        iv_2.setImageBitmap(bitmap);
1195
//        tv_2.setText(bitmap.getRowBytes() * bitmap.getHeight() + "");
1196
        return bitmap;
1197
    }
1198 880
1199 881
    class NetworkChangeReceiver extends BroadcastReceiver {
1200 882
@ -1220,6 +902,15 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
1220 902
            tv_make_sure.setTextColor(getResources().getColor(R.color.lvse));
1221 903
            tv_make_sure.setEnabled(true);
1222 904
        }
905
        mAdapter.notifyDataSetChanged();
906
907
        if (mInsterType == 1 && mAdapter.getItemCount() == 1){
908
            setLayoutHintVisible(-1);
909
            mInsterType=-1;
910
        }else if (mInsterType == 2 && mAdapter.getItemCount() == 0){
911
            setLayoutHintVisible(-1);
912
            mInsterType=-1;
913
        }
1223 914
1224 915
    }
1225 916

+ 6 - 2
app/src/main/java/com/electric/chargingpile/adapter/CommentTopicAdapter.java

@ -1,5 +1,6 @@
1 1
package com.electric.chargingpile.adapter;
2 2
3
import android.annotation.SuppressLint;
3 4
import android.view.LayoutInflater;
4 5
import android.view.View;
5 6
import android.view.ViewGroup;
@ -10,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
10 11
11 12
import com.electric.chargingpile.R;
12 13
import com.electric.chargingpile.data.TopicBean;
14
import com.electric.chargingpile.util.Util;
13 15
14 16
import org.jetbrains.annotations.NotNull;
15 17
import org.w3c.dom.Text;
@ -55,8 +57,10 @@ public class CommentTopicAdapter extends RecyclerView.Adapter<CommentTopicAdapte
55 57
        TopicBean data = mDatas.get(position);
56 58
57 59
        holder.title.setText(data.getMeg());
58
        holder.participateText.setText("内容够"+position+"参与");
59
        holder.onlookersText.setText("标题"+position+"围观");
60
61
        holder.participateText.setText(Util.convetW(data.getPartake_number(),"暂无","车主参与"));
62
        holder.onlookersText.setText(Util.convetW(data.getLook_number(),"暂无","车主围观"));
63
60 64
        holder.itemView.setOnClickListener(v->{
61 65
            if (mListener!=null)
62 66
                mListener.onItemClick(position);

+ 51 - 14
app/src/main/java/com/electric/chargingpile/adapter/GridImageAdapter.java

@ -13,32 +13,51 @@ import androidx.recyclerview.widget.RecyclerView;
13 13
import com.bumptech.glide.Glide;
14 14
import com.electric.chargingpile.R;
15 15
import com.luck.picture.lib.entity.LocalMedia;
16
import com.luck.picture.lib.entity.MediaData;
16 17
17 18
import org.jetbrains.annotations.NotNull;
18 19
19 20
import java.util.ArrayList;
21
import java.util.List;
20 22
21 23
public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.ViewHolder> {
22
    private ArrayList<LocalMedia> mDatas=new ArrayList<>();
24
    private List<LocalMedia> mDatas=new ArrayList<>();
23 25
    private Context context;
24 26
    private int maxCount=9;
25 27
    private int mItemWidth=0;
26 28
    private int mItemMarginTop=0;
27 29
30
    public int getMaxCount() {
31
        return maxCount;
32
    }
33
34
    public void setMaxCount(int maxCount) {
35
        this.maxCount = maxCount;
36
    }
37
38
    private GridImgListener mListener =null;
39
40
    public GridImgListener getListener() {
41
        return mListener;
42
    }
43
44
    public void setListener(GridImgListener mListener) {
45
        this.mListener = mListener;
46
    }
47
28 48
    public GridImageAdapter(Context context, int maxCount, int mItemWidth,int mItemMarginTop) {
29 49
        this.context = context;
30 50
        this.maxCount = maxCount;
31 51
        this.mItemWidth = mItemWidth;
32
33 52
        this.mItemMarginTop = mItemMarginTop;
34 53
    }
35 54
36 55
37
    public ArrayList<LocalMedia> getDatas() {
56
    public List<LocalMedia> getDatas() {
38 57
        return mDatas;
39 58
    }
40 59
41
    public void setDatas(ArrayList<LocalMedia> mDatas) {
60
    public void setDatas(List<LocalMedia> mDatas) {
42 61
        this.mDatas = mDatas;
43 62
        notifyDataSetChanged();
44 63
    }
@ -48,11 +67,11 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
48 67
    @Override
49 68
    public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
50 69
        View rootView = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_item_add_img, parent, false);
51
//        GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) rootView.getLayoutParams();
52
//        layoutParams.width=mItemWidth;
53
//        layoutParams.height=mItemWidth;
54
//        layoutParams.topMargin = mItemMarginTop;
55
//        rootView.setLayoutParams(layoutParams);
70
        GridLayoutManager.LayoutParams layoutParams = (GridLayoutManager.LayoutParams) rootView.getLayoutParams();
71
        layoutParams.width=mItemWidth;
72
        layoutParams.height=mItemWidth;
73
        layoutParams.topMargin = mItemMarginTop;
74
        rootView.setLayoutParams(layoutParams);
56 75
        return new ViewHolder(rootView);
57 76
    }
58 77
@ -63,17 +82,21 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
63 82
64 83
            //进行添加
65 84
            holder.itemView.setOnClickListener(v->{
66
                //mItemAddOnClick?.invoke();
85
                if (mListener != null){
86
                    mListener.add();
87
                }
67 88
            });
68
            holder.imageView.setImageResource(R.drawable.actionsheet_middle_selector);
89
            holder.imageView.setImageResource(R.drawable.icon_comment_upload);
90
//            holder.imageView.setImageResource(R.drawable.addpic65);
69 91
            holder.remove.setVisibility( View.GONE);
70 92
        } else {
71 93
72 94
            String path="";
95
            LocalMedia data = mDatas.get(position);
73 96
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q)
74
                path=mDatas.get(position).getAndroidQToPath();
97
                path= data.getAndroidQToPath();
75 98
            else {
76
                path=mDatas.get(position).getPath();
99
                path= data.getPath();
77 100
            }
78 101
79 102
@ -83,11 +106,18 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
83 106
            holder.remove.setVisibility( View.VISIBLE);
84 107
            holder.remove.setOnClickListener(v->{
85 108
                //删除
109
                mDatas.remove(position);
110
                notifyItemRemoved(position);
111
                if (mListener!=null){
112
                    mListener.remove(position);
113
                }
86 114
            });
87 115
88 116
            holder.itemView.setOnClickListener(v->{
89 117
                //跳转至图片详情页
90
              //  mItemOpenOnClick?.invoke(position)
118
                if (mListener != null){
119
                    mListener.open(position,data);
120
                }
91 121
            });
92 122
        }
93 123
@ -113,4 +143,11 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
113 143
            remove = itemView.findViewById(R.id.remove);
114 144
        }
115 145
    }
146
147
148
    public interface GridImgListener{
149
        void add();
150
        void remove(int position);
151
        void open(int position, LocalMedia mLocalMedia );
152
    }
116 153
}

+ 18 - 0
app/src/main/java/com/electric/chargingpile/data/TopicBean.java

@ -5,6 +5,8 @@ public class TopicBean {
5 5
    private String id;
6 6
    private String meg;
7 7
    private String icon;
8
    private String look_number;
9
    private String partake_number;
8 10
9 11
    public String getId() {
10 12
        return id;
@ -29,4 +31,20 @@ public class TopicBean {
29 31
    public void setIcon(String icon) {
30 32
        this.icon = icon;
31 33
    }
34
35
    public String getLook_number() {
36
        return look_number;
37
    }
38
39
    public void setLook_number(String look_number) {
40
        this.look_number = look_number;
41
    }
42
43
    public String getPartake_number() {
44
        return partake_number;
45
    }
46
47
    public void setPartake_number(String partake_number) {
48
        this.partake_number = partake_number;
49
    }
32 50
}

+ 4 - 0
app/src/main/java/com/electric/chargingpile/util/Bimp.java

@ -3,6 +3,8 @@ package com.electric.chargingpile.util;
3 3
import android.graphics.Bitmap;
4 4
import android.graphics.BitmapFactory;
5 5

6
import com.luck.picture.lib.entity.LocalMedia;
7

6 8
import java.io.BufferedInputStream;
7 9
import java.io.File;
8 10
import java.io.FileInputStream;
@ -10,11 +12,13 @@ import java.io.IOException;
10 12
import java.io.InputStream;
11 13
import java.net.URL;
12 14
import java.util.ArrayList;
15
import java.util.List;
13 16

14 17
public class Bimp {
15 18
    public static int max = 0;
16 19

17 20
    public static ArrayList<ImageItem> tempSelectBitmap = new ArrayList<ImageItem>();   //选择的图片的临时列表
21
    public static List<LocalMedia> tempSelectMedia = new ArrayList<>();   //选择的图片的临时列表
18 22

19 23
    public static Bitmap revitionImageSize(String path) throws IOException {
20 24
        BufferedInputStream in = new BufferedInputStream(new FileInputStream(

+ 26 - 9
app/src/main/java/com/electric/chargingpile/util/Util.java

@ -1,13 +1,11 @@
1 1
package com.electric.chargingpile.util;
2 2

3
import android.annotation.SuppressLint;
3 4
import android.app.Activity;
4 5
import android.content.Context;
5 6
import android.content.pm.PackageInfo;
6 7
import android.content.pm.PackageManager;
7 8
import android.graphics.Color;
8
import android.net.wifi.WifiInfo;
9
import android.net.wifi.WifiManager;
10
import android.os.Build;
11 9
import android.text.TextUtils;
12 10
import android.util.Log;
13 11
import android.view.WindowManager;
@ -15,7 +13,6 @@ import android.view.WindowManager;
15 13
import androidx.core.content.ContextCompat;
16 14

17 15
import com.amap.api.maps.AMap;
18
import com.amap.api.maps.model.CustomMapStyleOptions;
19 16
import com.blankj.utilcode.util.StringUtils;
20 17
import com.electric.chargingpile.R;
21 18
import com.electric.chargingpile.activity.MainMapActivity;
@ -28,15 +25,10 @@ import com.luck.picture.lib.style.PictureParameterStyle;
28 25
import com.tencent.mm.opensdk.openapi.IWXAPI;
29 26
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
30 27

31
import java.io.IOException;
32
import java.io.InputStream;
33 28
import java.io.UnsupportedEncodingException;
34
import java.net.NetworkInterface;
35
import java.net.SocketException;
36 29
import java.net.URLEncoder;
37 30
import java.text.DecimalFormat;
38 31
import java.util.ArrayList;
39
import java.util.Enumeration;
40 32
import java.util.HashMap;
41 33
import java.util.List;
42 34
import java.util.Map;
@ -643,4 +635,29 @@ public class Util {
643 635
        double discount = money / 10;
644 636
        return String.format("%.1f", discount);
645 637
    }
638

639

640
    public static String convetW(String num,String zero,String suffix){
641
        if (TextUtils.isEmpty(num.trim())){
642
            num="0";
643
        }
644
       return convetW(Long.parseLong(num),zero,suffix);
645
    }
646

647
    public static String convetW(long num, String zero, String suffix){
648
        StringBuilder builder=new StringBuilder();
649
        if (num == 0){
650
            builder.append(zero).append(suffix);
651
        }else if (num>0 && num<10000){
652
            builder.append(num)
653
                    .append(suffix);
654
        }else{
655
            float v = num / 10000F;
656
            @SuppressLint("DefaultLocale") String result = String.format("%.1f",v);
657
            builder.append(result)
658
                    .append("W")
659
                    .append(suffix);
660
        }
661
        return builder.toString();
662
    }
646 663
}

BIN
app/src/main/res/drawable-xxhdpi/ic_round_close.png


+ 2 - 4
app/src/main/res/layout/activity_zhan_comment.xml

@ -246,17 +246,15 @@
246 246
                    />
247 247
            </LinearLayout>
248 248
249
            <GridView
249
            <androidx.recyclerview.widget.RecyclerView
250 250
                android:visibility="gone"
251 251
                android:id="@+id/noScrollgridview"
252 252
                android:layout_width="match_parent"
253 253
                android:layout_height="wrap_content"
254 254
                android:layout_marginLeft="15dp"
255 255
                android:layout_marginRight="15dp"
256
                android:horizontalSpacing="3dp"
257
                android:numColumns="3"
258 256
                android:scrollbars="none"
259
                android:verticalSpacing="5dp"></GridView>
257
                />
260 258
261 259
            <View
262 260
                android:layout_width="match_parent"

+ 6 - 4
app/src/main/res/layout/layout_item_add_img.xml

@ -1,18 +1,20 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
2
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent">
4
    android:layout_height="match_parent"
5
    xmlns:tools="http://schemas.android.com/tools">
5 6
    <ImageView
7
        tools:src="@drawable/icon_comment_upload"
6 8
        android:id="@+id/image"
7 9
        android:scaleType="centerCrop"
8 10
        android:layout_centerInParent="true"
9 11
        android:layout_width="match_parent"
10 12
        android:layout_height="match_parent"/>
11 13
    <ImageView
12
        android:padding="8dp"
14
        android:padding="5dp"
13 15
        android:id="@+id/remove"
14 16
        android:layout_alignParentEnd="true"
15
        android:src="@drawable/icon_close"
17
        android:src="@drawable/ic_round_close"
16 18
        android:layout_width="wrap_content"
17 19
        android:layout_height="wrap_content"/>
18 20
</RelativeLayout>