77 1109
        Bimp.tempSelectMedia.clear();
878 1110
    }
879 1111
1112
    private String bitmapToBase64(Bitmap bitmap) {
1113
1114
        String result = null;
1115
        ByteArrayOutputStream baos = null;
1116
        try {
1117
            if (bitmap != null) {
1118
                baos = new ByteArrayOutputStream();
1119
                bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
1120
                baos.flush();
1121
                baos.close();
1122
                byte[] bitmapBytes = baos.toByteArray();
1123
                result = Base64.encodeToString(bitmapBytes, Base64.DEFAULT);
1124
            }
1125
        } catch (IOException e) {
1126
            e.printStackTrace();
1127
        } finally {
1128
            try {
1129
                if (baos != null) {
1130
                    baos.flush();
1131
                    baos.close();
1132
                }
1133
            } catch (IOException e) {
1134
                e.printStackTrace();
1135
            }
1136
        }
1137
        return result;
1138
    }
1139
1140
    private Bitmap imageZoom(Bitmap bm) {
1141
        // 图片允许最大空间 单位:KB
1142
        double maxSize = 200.00;
1143
        // 将bitmap放至数组中,意在bitmap的大小(与实际读取的原文件要大)
1144
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
1145
        bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
1146
        byte[] b = baos.toByteArray();
1147
        // 将字节换成KB
1148
        double mid = b.length / 1024;
1149
        // 判断bitmap占用空间是否大于允许最大空间 如果大于则压缩 小于则不压缩
1150
        if (mid > maxSize) {
1151
            // 获取bitmap大小 是允许最大大小的多少倍
1152
            double i = mid / maxSize;
1153
            // 开始压缩 此处用到平方根 将宽带和高度压缩掉对应的平方根倍
1154
            // (1.保持刻度和高度和原bitmap比率一致,压缩后也达到了最大大小占用空间的大小)
1155
            bm = zoomImage(bm, bm.getWidth() / Math.sqrt(i), bm.getHeight()
1156
                    / Math.sqrt(i));
1157
        }
1158
1159
        return bm;
1160
    }
1161
1162
    public Bitmap zoomImage(Bitmap bgimage, double newWidth, double newHeight) {
1163
        // 获取这个图片的宽和高
1164
        float width = bgimage.getWidth();
1165
        float height = bgimage.getHeight();
1166
        // 创建操作图片用的matrix对象
1167
        Matrix matrix = new Matrix();
1168
        // 计算宽高缩放率
1169
        float scaleWidth = ((float) newWidth) / width;
1170
        float scaleHeight = ((float) newHeight) / height;
1171
        // 缩放图片动作
1172
        matrix.postScale(scaleWidth, scaleHeight);
1173
        Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, (int) width,
1174
                (int) height, matrix, true);
1175
//        iv_2.setImageBitmap(bitmap);
1176
//        tv_2.setText(bitmap.getRowBytes() * bitmap.getHeight() + "");
1177
        return bitmap;
1178
    }
880 1179
881 1180
    class NetworkChangeReceiver extends BroadcastReceiver {
882 1181
@ -904,12 +1203,12 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
904 1203
        }
905 1204
        mAdapter.notifyDataSetChanged();
906 1205
907
        if (mInsterType == 1 && mAdapter.getItemCount() == 1){
1206
        if (mInsterType == 1 && mAdapter.getItemCount() == 1) {
908 1207
            setLayoutHintVisible(-1);
909
            mInsterType=-1;
910
        }else if (mInsterType == 2 && mAdapter.getItemCount() == 0){
1208
            mInsterType = -1;
1209
        } else if (mInsterType == 2 && mAdapter.getItemCount() == 0) {
911 1210
            setLayoutHintVisible(-1);
912
            mInsterType=-1;
1211
            mInsterType = -1;
913 1212
        }
914 1213
915 1214
    }
@ -944,4 +1243,38 @@ public class ZhanCommentActivity extends AppCompatActivity implements View.OnCli
944 1243
                && (codePoint <= 0x10FFFF));
945 1244
    }
946 1245
1246
    /**
1247
     * 将json 数组转换为Map 对象
1248
     *
1249
     * @param jsonString
1250
     * @return
1251
     */
1252
1253
    public static Map<String, Object> getMap(String jsonString) {
1254
        JSONObject jsonObject;
1255
        Map<String, Object> valueMap = new HashMap<String, Object>();
1256
        if (TextUtils.isEmpty(jsonString)) {
1257
            return valueMap;
1258
        }
1259
        try {
1260
            jsonObject = new JSONObject(jsonString);
1261
            @SuppressWarnings("unchecked")
1262
            Iterator<String> keyIter = jsonObject.keys();
1263
            String key;
1264
            Object value;
1265
1266
            while (keyIter.hasNext()) {
1267
                key = (String) keyIter.next();
1268
                value = jsonObject.get(key);
1269
                valueMap.put(key, value);
1270
            }
1271
            return valueMap;
1272
        } catch (JSONException e) {
1273
            e.printStackTrace();
1274
        }
1275
1276
        return valueMap;
1277
1278
    }
1279
947 1280
}

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

@ -97,6 +97,8 @@ public class MainApplication extends MultiDexApplication {
97 97
//    public static String pic_url = "http://cdz.evcharge.cc/zhannew/uploadfile/";
98 98

99 99
        public static String urlNew = "http://123.56.67.7:83/api/0300";// 一电测试环境
100
        public static String d1evTestUrl = "https://d1ev-new.yiduyongche.com";// 一电测试环境
101
        public static String CDN = "https://cdn-fs.d1ev.com";
100 102
//    public static String urlNew = "https://api.touchev.com:83/api/0300";// 一电正式环境
101 103

102 104


气泡弹出视图修改 · e7247f6325 - Gogs: Go Git Service
Sfoglia il codice sorgente

气泡弹出视图修改

huyuguo 7 anni fa
parent
commit
e7247f6325
1 ha cambiato i file con 30 aggiunte e 23 eliminazioni
  1. 30 23
      app/src/main/res/layout/activity_main_map.xml

+ 30 - 23
app/src/main/res/layout/activity_main_map.xml

@ -983,13 +983,13 @@
983 983
                    app:layout_constraintTop_toTopOf="parent"></TextView>
984 984
985 985
                <ImageView
986
                    app:layout_constraintTop_toTopOf="parent"
987
                    app:layout_constraintRight_toRightOf="parent"
988
                    app:layout_constraintBottom_toBottomOf="parent"
986
                    android:layout_width="wrap_content"
987
                    android:layout_height="wrap_content"
989 988
                    android:layout_marginRight="20dp"
990 989
                    android:src="@drawable/info_window_chat_cursor"
991
                    android:layout_width="wrap_content"
992
                    android:layout_height="wrap_content" />
990
                    app:layout_constraintBottom_toBottomOf="parent"
991
                    app:layout_constraintRight_toRightOf="parent"
992
                    app:layout_constraintTop_toTopOf="parent" />
993 993
            </android.support.constraint.ConstraintLayout>
994 994
995 995
            <View
@ -1005,25 +1005,22 @@
1005 1005
                android:layout_marginRight="15dp"
1006 1006
                android:gravity="center_vertical">
1007 1007
1008
                <TextView
1009
                    android:id="@+id/window_tv_zhan_name"
1010
                    android:layout_width="200dp"
1011
                    android:layout_height="wrap_content"
1012
                    android:layout_marginRight="6dp"
1013
                    android:ellipsize="end"
1014
                    android:gravity="left"
1015
                    android:singleLine="true"
1016
                    android:text=""
1017
                    android:textColor="@color/ui_62"
1018
                    android:textSize="18sp"
1019
                    tools:text="东方路希尔顿酒店充电站" />
1020
1021 1008
                <LinearLayout
1022 1009
                    android:layout_width="wrap_content"
1023
                    android:layout_height="wrap_content"
1024
                    android:layout_alignParentRight="true"
1025
                    android:layout_centerVertical="true"
1026
                    android:gravity="center_vertical">
1010
                    android:layout_height="wrap_content">
1011
1012
                    <TextView
1013
                        android:id="@+id/window_tv_zhan_name"
1014
                        android:layout_width="200dp"
1015
                        android:layout_height="wrap_content"
1016
                        android:layout_marginRight="6dp"
1017
                        android:ellipsize="end"
1018
                        android:gravity="left"
1019
                        android:singleLine="true"
1020
                        android:text=""
1021
                        android:textColor="@color/ui_62"
1022
                        android:textSize="18sp"
1023
                        tools:text="东方路希尔顿酒店充电站" />
1027 1024
1028 1025
                    <ImageView
1029 1026
                        android:id="@+id/iv_red_paper_bag"
@ -1033,6 +1030,16 @@
1033 1030
                        android:visibility="gone"
1034 1031
                        tools:visibility="visible" />
1035 1032
1033
                </LinearLayout>
1034
1035
1036
                <LinearLayout
1037
                    android:layout_width="wrap_content"
1038
                    android:layout_height="wrap_content"
1039
                    android:layout_alignParentRight="true"
1040
                    android:layout_centerVertical="true"
1041
                    android:gravity="center_vertical">
1042
1036 1043
                    <ImageView
1037 1044
                        android:id="@+id/iv_guzhang"
1038 1045
                        android:layout_width="32dp"
@ -1189,7 +1196,7 @@
1189 1196
                android:layout_width="wrap_content"
1190 1197
                android:layout_height="wrap_content"
1191 1198
                android:layout_marginLeft="15dp"
1192
                android:layout_marginTop="15dp"
1199
                android:layout_marginTop="20dp"
1193 1200
                android:text=""
1194 1201
                android:textColor="@color/ui_62"
1195 1202
                android:textSize="14sp"