1145873331@qq.com 6 anos atrás
pai
commit
51d3ab6459

+ 5 - 5
app/build.gradle

@ -215,8 +215,7 @@ MobSDK {
215 215
}
216 216
217 217
dependencies {
218
219
//    compile files('libs/badgeview.jar')
218
    //    compile files('libs/badgeview.jar')
220 219
    compile files('libs/mframework.jar')
221 220
    compile files('libs/picasso-2.5.2.jar')
222 221
    compile project(':autolayout')
@ -237,11 +236,11 @@ dependencies {
237 236
    compile files('libs/jpush-android_v3.0.6.jar')
238 237
    compile files('libs/jcore-android_v1.1.3.jar')
239 238
    compile 'com.blankj:utilcode:1.9.8'
240
//    compile project(':xrichtextt')
239
    //    compile project(':xrichtextt')
241 240
    compile 'com.android.support:multidex:1.0.1'
242 241
    compile 'com.umeng.analytics:analytics:latest.integration'
243 242
    compile 'com.google.code.gson:gson:2.2.4'
244
//    compile 'com.squareup.okhttp:okhttp:3.14.0'
243
    //    compile 'com.squareup.okhttp:okhttp:3.14.0'
245 244
    compile 'com.squareup.okhttp:okhttp:2.0.0'
246 245
    compile 'com.zhy:okhttputils:2.4.1'
247 246
    compile 'com.android.support:support-v4:26.1.0'
@ -258,7 +257,7 @@ dependencies {
258 257
    compile 'com.yinglan.scrolllayout:scrolllayout:1.0.0'
259 258
    compile 'com.android.support:appcompat-v7:26.1.0'
260 259
    compile 'com.android.support:design:26.1.0'
261
//    compile 'com.nineoldandroids:library:2.4.0'
260
    //    compile 'com.nineoldandroids:library:2.4.0'
262 261
    compile 'com.github.bumptech.glide:glide:4.1.1'
263 262
    compile 'me.iwf.photopicker:PhotoPicker:0.9.12@aar'
264 263
    compile 'top.zibin:Luban:1.1.2'
@ -280,4 +279,5 @@ dependencies {
280 279
    compile 'com.github.Aspsine:IRecyclerView:0.0.7'
281 280
    compile project(':ijkplayer-java')
282 281
    compile 'com.upyun:upyun-android-sdk:+'
282
//    compile project(':SmallVideoLib2')
283 283
}

+ 0 - 3
app/lint.xml

@ -1,3 +0,0 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<lint>
3
</lint>

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

@ -989,6 +989,7 @@
989 989
        <activity
990 990
            android:name=".activity.VideoDetaislActivity"
991 991
            android:screenOrientation="portrait"
992
            android:keepScreenOn="true"
992 993
            android:windowSoftInputMode="adjustPan" />
993 994
        <activity
994 995
            android:name=".activity.PublishTopicActivity"

+ 32 - 76
app/src/main/java/com/electric/chargingpile/activity/PublishPicTopicActivity.java

@ -50,7 +50,6 @@ import android.widget.Toast;
50 50
import com.electric.chargingpile.R;
51 51
import com.electric.chargingpile.application.MainApplication;
52 52
import com.electric.chargingpile.data.AuthSignBean;
53
import com.electric.chargingpile.data.HomePageBean;
54 53
import com.electric.chargingpile.data.TalkRecommendBean;
55 54
import com.electric.chargingpile.data.UploadPic;
56 55
import com.electric.chargingpile.util.BarColorUtil;
@ -64,11 +63,8 @@ import com.electric.chargingpile.util.ScreenUtils;
64 63
import com.electric.chargingpile.util.SystemTypeUtil;
65 64
import com.electric.chargingpile.util.ToastUtil;
66 65
import com.electric.chargingpile.util.UploadUtil;
67
import com.electric.chargingpile.view.footer.LoadMoreFooterView;
68 66
import com.umeng.analytics.MobclickAgent;
69 67
import com.upyun.library.common.ParallelUploader;
70
import com.upyun.library.common.Params;
71
import com.upyun.library.common.SerialUploader;
72 68
import com.upyun.library.common.UploadEngine;
73 69
import com.upyun.library.listener.UpCompleteListener;
74 70
import com.upyun.library.listener.UpProgressListener;
@ -76,10 +72,6 @@ import com.upyun.library.utils.UpYunUtils;
76 72
import com.zhy.http.okhttp.OkHttpUtils;
77 73
import com.zhy.http.okhttp.callback.StringCallback;
78 74
79
import org.json.JSONArray;
80
import org.json.JSONException;
81
import org.json.JSONObject;
82
83 75
import java.io.ByteArrayOutputStream;
84 76
import java.io.File;
85 77
import java.io.FileNotFoundException;
@ -157,15 +149,13 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
157 149
    private TextView publishtopic_choose_topic, mPublishtopicChooseTopic;
158 150
159 151
    //空间名
160
    public static String SPACE = "formtest";
152
    public static String SPACE = "d1evcom01-fs";
161 153
    private String policy = "";
162 154
    private String OPERATER = "d1evvideo01";
163
//    private String signature = "CuThEAj+xqwwtPotif1l2dT6P8w=";
164
    public static String KEY = "GqSu2v26RI+Xu3yLdsWfynTS/LM=";
165 155
    @SuppressLint("SdCardPath")
166 156
//    private static final String SAMPLE_PIC_FILE = "/mnt/sdcard/tdtest.mp4";
167 157
    private ParallelUploader parallelUploader;
168
//    private SerialUploader serialUploader;
158
    //    private SerialUploader serialUploader;
169 159
    private String picSavePath;
170 160
171 161
@ -189,15 +179,14 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
189 179
    }
190 180
191 181
    /**
192
     *
193 182
     * 初始化 又拍云
194
     * */
183
     */
195 184
    private void initYouPaiYun() {
196 185
197 186
        //初始化断点续传 (服务端签名可用)
198
        if(parallelUploader == null){
187
        if (parallelUploader == null) {
199 188
            parallelUploader = new ParallelUploader();
200
            picSavePath = "/d/file/liaoliao/img/" + SystemTypeUtil.stampToDate(System.currentTimeMillis()+"");
189
            picSavePath = "/d/file/liaoliao/img/" + SystemTypeUtil.stampToDate(System.currentTimeMillis() + "");
201 190
        }
202 191
        //图文路径
203 192
//        String p = "/d/file/liaoliao/img/" + y + "/" + m + "/" + d;
@ -308,7 +297,7 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
308 297
            String fileNameDir = Bimp.tempSelectBitmap.get(i).getImagePath();
309 298
310 299
            Log.e("fileNameDir", fileNameDir);
311
            String fileName = fileNameDir.substring(fileNameDir.lastIndexOf("/")+1);
300
            String fileName = fileNameDir.substring(fileNameDir.lastIndexOf("/") + 1);
312 301
            Log.e("fileNameDir fileName", fileName);
313 302
            if (TextUtils.isEmpty(fileNames))
314 303
                fileNames = fileName;
@ -334,17 +323,19 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
334 323
                    String rtnMsg = JsonUtils.getKeyResult(response, "data");
335 324
                    ArrayList<AuthSignBean> signBeans = (ArrayList<AuthSignBean>) JsonUtils.parseToObjectList(rtnMsg, AuthSignBean.class);
336 325
337
                    if(null != signBeans && signBeans.size()>0){
338
                        File tempFile =new File(Bimp.tempSelectBitmap.get(0).getImagePath().trim());
326
                    if (null != signBeans && signBeans.size() > 0) {
327
                        File tempFile = new File(Bimp.tempSelectBitmap.get(0).getImagePath().trim());
339 328
                        String fileName = tempFile.getName();
340 329
                        //生产policy传的参数
341 330
                        Map<String, Object> map = new HashMap<>();
342 331
                        map.put("bucket", "d1evcom01-fs");
343
                        map.put("expiration", (System.currentTimeMillis()+1800)+"");
344
                        map.put("save-key", picSavePath+"/"+tempFile.getName());
332
                        map.put("expiration", (System.currentTimeMillis() + 1800) + "");
333
                        map.put("save-key", picSavePath + "/" + tempFile.getName());
345 334
                        policy = UpYunUtils.getPolicy(map);
335
                        String sign = signBeans.get(0).sign;
346 336
347
                        formUpload(Bimp.tempSelectBitmap.get(0).getImagePath(),signBeans.get(0).sign, signBeans.get(0).fname);
337
                        formUpload(Bimp.tempSelectBitmap.get(0).getImagePath(), sign,
338
                                signBeans.get(0).fname);
348 339
                    }
349 340
                }
350 341
            }
@ -1025,36 +1016,28 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
1025 1016
1026 1017
1027 1018
    /**
1028
     *
1029 1019
     * 表单上传
1020
     *
1030 1021
     * @param sign
1031 1022
     * @param saveName
1032
     *
1033
     * */
1023
     */
1034 1024
    private void formUpload(String SAMPLE_PIC_FILE, String sign, String saveName) {
1035
        File temp = null;
1036
//        try {
1037
//            temp = getTempFile();
1038
//        } catch (IOException e) {
1039
//            e.printStackTrace();
1040
//        }
1041
1042
        temp = new File(SAMPLE_PIC_FILE);
1043
1044
        final Map<String, Object> paramsMap = new HashMap<>();
1045
        //上传空间
1046
        paramsMap.put(Params.BUCKET, SPACE);
1047
        //保存路径,任选其中一个
1048
        paramsMap.put(Params.SAVE_KEY, picSavePath);
1049
        //添加 CONTENT_LENGTH 参数使用大文件表单上传
1050
        paramsMap.put(Params.CONTENT_LENGTH, temp.length());
1051
1052
1053
        paramsMap.put(Params.CONTENT_MD5, UpYunUtils.md5Hex(temp));
1054
//        paramsMap.put(Params.PATH, savePath);
1055
        //可选参数(详情见api文档介绍)
1056
        paramsMap.put(Params.RETURN_URL, "httpbin.org/post");
1057
        //进度回调,可为空
1025
        File temp = new File(SAMPLE_PIC_FILE);
1026
//
1027
//        final Map<String, Object> paramsMap = new HashMap<>();
1028
//        //上传空间
1029
//        paramsMap.put(Params.BUCKET, SPACE);
1030
//        //保存路径,任选其中一个
1031
//        paramsMap.put(Params.SAVE_KEY, picSavePath);
1032
//        //添加 CONTENT_LENGTH 参数使用大文件表单上传
1033
//        paramsMap.put(Params.CONTENT_LENGTH, temp.length());
1034
//
1035
//
1036
//        paramsMap.put(Params.CONTENT_MD5, UpYunUtils.md5Hex(temp));
1037
////        paramsMap.put(Params.PATH, savePath);
1038
//        //可选参数(详情见api文档介绍)
1039
//        paramsMap.put(Params.RETURN_URL, "httpbin.org/post");
1040
//        //进度回调,可为空
1058 1041
        UpProgressListener progressListener = new UpProgressListener() {
1059 1042
            @Override
1060 1043
            public void onRequestProgress(long bytesWrite, long contentLength) {
@ -1073,37 +1056,10 @@ public class PublishPicTopicActivity extends Activity implements OnClickListener
1073 1056
                Log.e(TAG, isSuccess + ":" + result);
1074 1057
            }
1075 1058
        };
1076
1077
        //初始化JSONArray,上传预处理(异步)参数详见 http://docs.upyun.com/cloud/image/#_6,
1078
        JSONArray array = new JSONArray();
1079
1080
        //初始化JSONObject
1081
        JSONObject json = new JSONObject();
1082
1083
        //json 添加 name 属性
1084
        try {
1085
            json.put("name", "thumb");
1086
            //json 添加 X_GMKERL_THUMB 属性
1087
//            json.put("x-gmkerl-thumb", "/fw/300/unsharp/true/quality/80/format/png");
1088
//            json.put("x-gmkerl-thumb", "/watermark/url/L2dta2VybC5qcGc=/align/center");
1089
            json.put("x-gmkerl-thumb", picSavePath);
1090
            //json 添加 save_as 属性
1091
            json.put("save_as", saveName);
1092
            //json 添加 notify_url 属性
1093
            json.put("notify_url", "http://httpbin.org/post");
1094
        } catch (JSONException e) {
1095
            e.printStackTrace();
1096
        }
1097
        //将json 对象放入 JSONArray
1098
        array.put(json);
1099
        //添加异步作图参数 APPS
1100
        paramsMap.put("apps", array);
1101
        //表单上传(本地签名方式)
1102
//        UploadEngine.getInstance().formUpload(temp, paramsMap, OPERATER, sign, completeListener, progressListener);
1103 1059
        //表单上传(服务器签名方式)
1104 1060
        UploadEngine.getInstance().formUpload(temp, policy, OPERATER, sign, completeListener, progressListener);
1105
    }
1106 1061
1062
    }
1107 1063
1108 1064
1109 1065
}

+ 6 - 0
app/src/main/java/com/electric/chargingpile/adapter/VideoCommentAdapter.java

@ -95,6 +95,12 @@ public class VideoCommentAdapter extends RecyclerView.Adapter<VideoCommentAdapte
95 95
    public void cleanData() {
96 96
97 97
    }
98
    public void addDataSingle(VideoCommentBean qadata) {
99
        if (qadata != null) {
100
            dataList.add(qadata);
101
        }
102
        notifyDataSetChanged();
103
    }
98 104
99 105
    public void addData(List<VideoCommentBean> qadata) {
100 106
        if (qadata != null) {

+ 5 - 0
app/src/main/java/com/electric/chargingpile/data/VideoCommentBean.java

@ -5,9 +5,13 @@ package com.electric.chargingpile.data;
5 5
 */
6 6
7 7
public class VideoCommentBean {
8
    public int id;
8 9
    public long targetId;
9 10
    public int targetType;
10 11
    public int level;
12
    public int parentId;
13
    public int toCommentsId;
14
    public int platformSource;
11 15
    public String userId;
12 16
    public String nickNameFromUser;
13 17
    public String headImgFromUser;
@ -15,6 +19,7 @@ public class VideoCommentBean {
15 19
    public String nickNameToUser;
16 20
    public String headImgToUser;
17 21
    public String content;
22
    public String addDate;
18 23
    public int likeNums;
19 24
    public int likeFlg;
20 25
    public long addTime;

+ 34 - 16
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

@ -14,6 +14,7 @@ import android.view.LayoutInflater;
14 14
import android.view.View;
15 15
import android.view.Window;
16 16
import android.view.WindowManager;
17
import android.view.inputmethod.InputMethodManager;
17 18
import android.widget.EditText;
18 19
import android.widget.LinearLayout;
19 20
import android.widget.TextView;
@ -31,7 +32,6 @@ import com.zhy.http.okhttp.callback.StringCallback;
31 32
32 33
import java.util.ArrayList;
33 34
import java.util.HashMap;
34
import java.util.List;
35 35
import java.util.Map;
36 36
37 37
import okhttp3.Call;
@ -54,6 +54,8 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
54 54
        super(context, R.style.bottomDialogStyle);
55 55
        this.context = context;
56 56
        this.talkRecommendBean = talkRecommendBean;
57
        imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
58
57 59
    }
58 60
59 61
@ -152,17 +154,18 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
152 154
153 155
            @Override
154 156
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
157
158
            }
159
160
            @Override
161
            public void afterTextChanged(Editable editable) {
162
                int i2 = editable.length();
155 163
                if (i2 > 0) {
156 164
                    showCommentPublish.setTextColor(Color.parseColor("#00edb2"));
157 165
                } else {
158 166
                    showCommentPublish.setTextColor(Color.parseColor("#7E7E7E"));
159 167
                }
160 168
            }
161
162
            @Override
163
            public void afterTextChanged(Editable editable) {
164
165
            }
166 169
        });
167 170
        videoCommentAdapter = new VideoCommentAdapter(context);
168 171
        showCommentLv.setAdapter(videoCommentAdapter);
@ -205,11 +208,11 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
205 208
        map.put("toUserId", toUserId);
206 209
        map.put("parentId", parentId);
207 210
        map.put("level", level + "");
208
        map.put("toCommentIds", toCommentIds);
209
        map.put("commentCon", commentCon);
211
        map.put("toCommentsId", toCommentIds);
212
        map.put("content", commentCon);
210 213
211 214
        if (MainApplication.isLogin()) {
212
            map.put("user_id", MainApplication.userId);
215
            map.put("userId", MainApplication.userId);
213 216
        }
214 217
215 218
        OkHttpUtils
@ -231,19 +234,34 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
231 234
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
232 235
                        if ("1000".equals(rtnCode)) {
233 236
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
234
                            List<VideoCommentBean> qadata = JsonUtils.parseToObjectList(rtnMsg, VideoCommentBean.class);
237
                            VideoCommentBean qadata = JsonUtils.parseToObjectBean(rtnMsg, VideoCommentBean.class);
238
239
                            showCommentPublish.setText("");
240
                            hideKeyboard(showCommentPublish);
235 241
236 242
                            if (videoCommentAdapter != null) {
237
                                if (qadata.size() > 0) {
238
                                    showCommentTitle.setText("全部评论 " + qadata.size());
239
                                } else {
240
                                    show_comment_no.setVisibility(View.VISIBLE);
243
                                videoCommentAdapter.addDataSingle(qadata);
244
                                int count = videoCommentAdapter.getItemCount();
245
                                if (count > 0) {
246
                                    showCommentTitle.setText("全部评论 " + count);
247
                                    show_comment_no.setVisibility(View.GONE);
241 248
                                }
242
243
                                videoCommentAdapter.addData(qadata);
244 249
                            }
245 250
                        }
246 251
                    }
247 252
                });
248 253
    }
254
255
    InputMethodManager imm;
256
257
    public boolean hideKeyboard(View v) {
258
        if (imm.isActive(v)) {
259
            //因为是在fragment下,所以用了getView()获取view,也可以用findViewById()来获取父控件
260
            getCurrentFocus().requestFocus();//强制获取焦点,不然getActivity().getCurrentFocus().getWindowToken()会报错
261
            imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
262
            imm.restartInput(v);
263
            return true;
264
        }
265
        return false;
266
    }
249 267
}

+ 2 - 1
settings.gradle

@ -1 +1,2 @@
1
include ':app', ':autolayout',   ':zxing', ':XRefreshView',':ijkplayer-java',':library'
1
include ':app', ':autolayout', ':zxing', ':XRefreshView', ':ijkplayer-java', ':library'
2
//, ':SmallVideoLib2'