/span>
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
|
|
|
|
@ -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);
|
|
|
@ -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
|
}
|
|
|
@ -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
|
}
|
|
|
@ -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(
|
|
|
@ -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
|
}
|
|
|
@ -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"
|
|
|
@ -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>
|