dxh 5 years ago
parent
commit
7c67d39c71

+ 14 - 17
app/src/main/java/com/electric/chargingpile/activity/PublishTopicActivity.java

4
import android.content.Context;
4
import android.content.Context;
5
import android.content.DialogInterface;
5
import android.content.DialogInterface;
6
import android.content.Intent;
6
import android.content.Intent;
7
import android.graphics.drawable.Drawable;
8
import android.net.Uri;
7
import android.net.Uri;
9
import android.os.Bundle;
8
import android.os.Bundle;
10
import android.os.Environment;
9
import android.os.Environment;
11
import android.support.annotation.Nullable;
12
import android.support.v7.app.AlertDialog;
10
import android.support.v7.app.AlertDialog;
13
import android.text.Editable;
11
import android.text.Editable;
14
import android.text.Html;
12
import android.text.Html;
26
24
27
import com.blankj.utilcode.util.ToastUtils;
25
import com.blankj.utilcode.util.ToastUtils;
28
import com.bumptech.glide.Glide;
26
import com.bumptech.glide.Glide;
29
import com.bumptech.glide.load.DataSource;
30
import com.bumptech.glide.load.engine.GlideException;
31
import com.bumptech.glide.request.RequestListener;
32
import com.bumptech.glide.request.RequestOptions;
27
import com.bumptech.glide.request.RequestOptions;
33
import com.bumptech.glide.request.target.Target;
34
import com.electric.chargingpile.R;
28
import com.electric.chargingpile.R;
35
import com.electric.chargingpile.application.MainApplication;
29
import com.electric.chargingpile.application.MainApplication;
36
import com.electric.chargingpile.data.AuthSignBean;
30
import com.electric.chargingpile.data.AuthSignBean;
216
        Log.e("fileNameDir fileName", fileNames);
210
        Log.e("fileNameDir fileName", fileNames);
217
        map.put("targetType", "23");//23视频/24图片
211
        map.put("targetType", "23");//23视频/24图片
218
        String token = ProfileManager.getInstance().getKeyMessageToken(getApplicationContext());
212
        String token = ProfileManager.getInstance().getKeyMessageToken(getApplicationContext());
219
        map.put("appToken", token+"");
213
        map.put("appToken", token + "");
220
        map.put("userId", MainApplication.userId);
214
        map.put("userId", MainApplication.userId);
221
        OkHttpUtils
215
        OkHttpUtils
222
                .post()
216
                .post()
244
                                String policy = signBeans.get(0).policy;
238
                                String policy = signBeans.get(0).policy;
245
                                formUpload(media.getPath(), sign, policy);
239
                                formUpload(media.getPath(), sign, policy);
246
                            }
240
                            }
247
                        }else {
241
                        } else {
248
                            String desc = JsonUtils.getKeyResult(response, "desc");
242
                            String desc = JsonUtils.getKeyResult(response, "desc");
249
                            ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
243
                            ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
250
                            loadingDialog.dismiss();
244
                            loadingDialog.dismiss();
290
    }
284
    }
291
285
292
    private void requestPublishServer(String urls) {
286
    private void requestPublishServer(String urls) {
293
        File file =new File(media.getPath());
294
        long size =0L;
295
        if(file.exists()){
287
        File file = new File(media.getPath());
288
        long size = 0L;
289
        if (file.exists()) {
296
            size = file.length();
290
            size = file.length();
297
        }
291
        }
298
292
301
        map.put("content", mPublishtopicCon.getText().toString());
295
        map.put("content", mPublishtopicCon.getText().toString());
302
        map.put("urls", urls);
296
        map.put("urls", urls);
303
        map.put("topicId", talkRecommendBean.targetId + "");
297
        map.put("topicId", talkRecommendBean.targetId + "");
304
        map.put("targetType",  "23");
305
        map.put("coverImgW",media.getWidth()+"");
306
        map.put("coverImgH",media.getHeight()+"");
307
        map.put("duration",media.getDuration()+"");
308
        map.put("size",size+"");
298
        map.put("targetType", "23");
299
        map.put("coverImgW", media.getWidth() + "");
300
        map.put("coverImgH", media.getHeight() + "");
301
        map.put("duration", media.getDuration() + "");
302
        map.put("size", size + "");
309
        if (MainApplication.isLogin()) {
303
        if (MainApplication.isLogin()) {
310
            map.put("userId", MainApplication.userId);
304
            map.put("userId", MainApplication.userId);
311
            map.put("appToken", MainApplication.messageToken);
305
            map.put("appToken", MainApplication.messageToken);
359
                    Log.e("yopic", "文件可能不存在了~");
353
                    Log.e("yopic", "文件可能不存在了~");
360
                    return;
354
                    return;
361
                }
355
                }
356
                if (isDestroyed()) {
357
                    return;
358
                }
362
359
363
                Glide
360
                Glide
364
                        .with(this)
361
                        .with(this)
405
        MobclickAgent.onPause(this);
402
        MobclickAgent.onPause(this);
406
    }
403
    }
407
404
408
    private void showDialogToExit(){
405
    private void showDialogToExit() {
409
        AlertDialog.Builder builder = new AlertDialog.Builder(PublishTopicActivity.this);
406
        AlertDialog.Builder builder = new AlertDialog.Builder(PublishTopicActivity.this);
410
        builder.setTitle("提示");
407
        builder.setTitle("提示");
411
        builder.setMessage("是否离开发布页?");
408
        builder.setMessage("是否离开发布页?");

+ 28 - 31
app/src/main/java/com/electric/chargingpile/activity/TopicDetailsActivity.java

1
package com.electric.chargingpile.activity;
1
package com.electric.chargingpile.activity;
2
2
3
import android.content.Intent;
3
import android.content.Intent;
4
import android.graphics.Color;
5
import android.os.Bundle;
4
import android.os.Bundle;
6
import android.support.annotation.Nullable;
5
import android.support.annotation.Nullable;
7
import android.support.v4.app.FragmentActivity;
6
import android.support.v4.app.FragmentActivity;
8
import android.support.v7.app.AppCompatActivity;
9
import android.support.v7.widget.GridLayoutManager;
7
import android.support.v7.widget.GridLayoutManager;
10
import android.support.v7.widget.LinearLayoutManager;
11
import android.support.v7.widget.StaggeredGridLayoutManager;
8
import android.support.v7.widget.StaggeredGridLayoutManager;
12
import android.text.TextUtils;
9
import android.text.TextUtils;
13
import android.util.Log;
14
import android.view.View;
10
import android.view.View;
15
import android.view.ViewTreeObserver;
11
import android.view.ViewTreeObserver;
16
import android.widget.FrameLayout;
12
import android.widget.FrameLayout;
17
import android.widget.ImageView;
13
import android.widget.ImageView;
18
import android.widget.LinearLayout;
14
import android.widget.LinearLayout;
19
import android.widget.RelativeLayout;
20
import android.widget.TextView;
15
import android.widget.TextView;
21
import android.widget.Toast;
16
import android.widget.Toast;
22
17
23
import com.aspsine.irecyclerview.IRecyclerView;
18
import com.aspsine.irecyclerview.IRecyclerView;
24
import com.aspsine.irecyclerview.OnLoadMoreListener;
19
import com.aspsine.irecyclerview.OnLoadMoreListener;
25
import com.blankj.utilcode.util.LogUtils;
20
import com.blankj.utilcode.util.LogUtils;
26
import com.blankj.utilcode.util.NetworkUtils;
27
import com.electric.chargingpile.R;
21
import com.electric.chargingpile.R;
28
import com.electric.chargingpile.adapter.WaterFallAdapter;
22
import com.electric.chargingpile.adapter.WaterFallAdapter;
29
import com.electric.chargingpile.application.MainApplication;
23
import com.electric.chargingpile.application.MainApplication;
37
import com.electric.chargingpile.util.ScreenUtils;
31
import com.electric.chargingpile.util.ScreenUtils;
38
import com.electric.chargingpile.util.ToastUtil;
32
import com.electric.chargingpile.util.ToastUtil;
39
import com.electric.chargingpile.view.PullToZoomScrollView3;
33
import com.electric.chargingpile.view.PullToZoomScrollView3;
40
import com.electric.chargingpile.view.SortPopWindow;
41
import com.electric.chargingpile.view.SortTopicPopWindow;
34
import com.electric.chargingpile.view.SortTopicPopWindow;
42
import com.electric.chargingpile.view.footer.LoadMoreFooterView;
35
import com.electric.chargingpile.view.footer.LoadMoreFooterView;
43
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
36
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
65
    private PullToZoomScrollView3 scrollview;
58
    private PullToZoomScrollView3 scrollview;
66
    private String topicTitleContent;
59
    private String topicTitleContent;
67
    private int screenWidth, bgHeight, screenHeight;
60
    private int screenWidth, bgHeight, screenHeight;
68
    private TextView textview, topic_title,topic_content, read_data, join_data, sort_text_info;
61
    private TextView textview, topic_title, topic_content, read_data, join_data, sort_text_info;
69
    private FrameLayout top_view;
62
    private FrameLayout top_view;
70
    private LinearLayout content_view, ll_sort_view;
63
    private LinearLayout content_view, ll_sort_view;
71
    private int page = 1;
64
    private int page = 1;
86
        initListeners();
79
        initListeners();
87
        initListeners(findViewById(R.id.make_header_lines));
80
        initListeners(findViewById(R.id.make_header_lines));
88
81
89
        if(NetUtil.CheckNetwork(this)){
82
        if (NetUtil.CheckNetwork(this)) {
90
            requestData();
83
            requestData();
91
        }else {
92
findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
93
findViewById(R.id.iv_back_nonet).setOnClickListener(this);
94
findViewById(R.id.request_refresh).setOnClickListener(this);
84
        } else {
85
            findViewById(R.id.no_net_view).setVisibility(View.VISIBLE);
86
            findViewById(R.id.iv_back_nonet).setOnClickListener(this);
87
            findViewById(R.id.request_refresh).setOnClickListener(this);
95
88
96
        }
89
        }
97
//        requestShareData();
90
//        requestShareData();
152
    }
145
    }
153
146
154
    ChargingShareBean chargingShareBean = new ChargingShareBean();
147
    ChargingShareBean chargingShareBean = new ChargingShareBean();
148
155
    @Override
149
    @Override
156
    public void onClick(View v) {
150
    public void onClick(View v) {
157
        switch (v.getId()) {
151
        switch (v.getId()) {
164
                user_content_more.setVisibility(View.GONE);
158
                user_content_more.setVisibility(View.GONE);
165
                break;
159
                break;
166
            case R.id.textview_share:
160
            case R.id.textview_share:
167
                if (!MainApplication.isLogin()){
168
                    startActivity(new Intent(this.getApplicationContext(),LoginActivity.class));
169
                    ToastUtil.showToast(this.getApplicationContext(),"请先登录", Toast.LENGTH_SHORT);
161
                if (!MainApplication.isLogin()) {
162
                    startActivity(new Intent(this.getApplicationContext(), LoginActivity.class));
163
                    ToastUtil.showToast(this.getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
170
                    return;
164
                    return;
171
                }
165
                }
172
                if(null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
166
                if (null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
173
                    return;
167
                    return;
174
                showSimpleBottomSheetGrid(chargingShareBean);
168
                showSimpleBottomSheetGrid(chargingShareBean);
175
                break;
169
                break;
176
            case R.id.request_refresh:
170
            case R.id.request_refresh:
177
                if(NetUtil.CheckNetwork(this)){
171
                if (NetUtil.CheckNetwork(this)) {
178
                    requestData();
172
                    requestData();
179
173
180
                }
174
                }
257
        String url = MainApplication.urlNew + "/topic/homepage.do";
251
        String url = MainApplication.urlNew + "/topic/homepage.do";
258
        Map<String, String> map = new HashMap<>();
252
        Map<String, String> map = new HashMap<>();
259
        map.put("topicId", topicId + "");
253
        map.put("topicId", topicId + "");
260
        map.put("sort", sort+"");//1最新发布/2最后回复/3最热
254
        map.put("sort", sort + "");//1最新发布/2最后回复/3最热
261
        map.put("init", "1");//1返回话题名等信息 0只返回话题下内容列表
255
        map.put("init", "1");//1返回话题名等信息 0只返回话题下内容列表
262
        map.put("page", page + "");
256
        map.put("page", page + "");
263
        map.put("limit", "20");
257
        map.put("limit", "20");
268
            @Override
262
            @Override
269
            public void onError(Call call, Exception e) {
263
            public void onError(Call call, Exception e) {
270
                loadMoreFooterView.setStatus(LoadMoreFooterView.Status.ERROR);
264
                loadMoreFooterView.setStatus(LoadMoreFooterView.Status.ERROR);
271
                if(page>1)
265
                if (page > 1)
272
                    page -= 1;
266
                    page -= 1;
273
            }
267
            }
274
268
290
                            chargingShareBean.setText(qadata.list.get(0).title);
284
                            chargingShareBean.setText(qadata.list.get(0).title);
291
                        }
285
                        }
292
                    }
286
                    }
293
                    if (page == 1){
287
                    if (page == 1) {
294
                        waterFallAdapter.setData(qadata.list);
288
                        waterFallAdapter.setData(qadata.list);
295
289
296
                        if(null == qadata.list || qadata.list.size() == 0){
290
                        if (null == qadata.list || qadata.list.size() == 0) {
297
                            findViewById(R.id.no_content_view).setVisibility(View.VISIBLE);
291
                            findViewById(R.id.no_content_view).setVisibility(View.VISIBLE);
298
                            comment_data.setVisibility(View.GONE);
292
                            comment_data.setVisibility(View.GONE);
299
                        }else {
293
                        } else {
300
                            findViewById(R.id.no_content_view).setVisibility(View.GONE);
294
                            findViewById(R.id.no_content_view).setVisibility(View.GONE);
301
                            comment_data.setVisibility(View.VISIBLE);
295
                            comment_data.setVisibility(View.VISIBLE);
302
                        }
296
                        }
303
                    }
304
                    else
297
                    } else
305
                        waterFallAdapter.addData(qadata.list);
298
                        waterFallAdapter.addData(qadata.list);
306
299
307
                    if (qadata.list == null || qadata.list.size() < 20) {
300
                    if (qadata.list == null || qadata.list.size() < 20) {
320
    }
313
    }
321
314
322
    private String contentAll = "";
315
    private String contentAll = "";
316
323
    private void initHeaderData(ArrayList<TalkRecommendBean> list) {
317
    private void initHeaderData(ArrayList<TalkRecommendBean> list) {
324
        if(null != list && list.size()>0){
318
        if (null != list && list.size() > 0) {
325
            textview.setText(list.get(0).topicName);
319
            textview.setText(list.get(0).topicName);
326
            topic_title.setText(list.get(0).topicName);
320
            topic_title.setText(list.get(0).topicName);
327
            read_data.setText(list.get(0).visitNums+"");
328
            join_data.setText(list.get(0).joinNums+"");
321
            read_data.setText(list.get(0).visitNums + "");
322
            join_data.setText(list.get(0).joinNums + "");
329
            contentAll = list.get(0).title;
323
            contentAll = list.get(0).title;
330
            if(!TextUtils.isEmpty(contentAll) && contentAll.length()>80){
324
            if (!TextUtils.isEmpty(contentAll) && contentAll.length() > 80) {
331
                topic_content.setText(contentAll.substring(0, 80));
325
                topic_content.setText(contentAll.substring(0, 80));
332
                user_content_more.setVisibility(View.VISIBLE);
326
                user_content_more.setVisibility(View.VISIBLE);
333
            }else {
327
            } else {
334
                topic_content.setText(contentAll);
328
                topic_content.setText(contentAll);
335
            }
329
            }
336
            ImageDisplayUtils.dispalyImg(this, "http://cdz.evcharge.cc/zhannew/uploadfile/"+list.get(0).headImgUrl, user_avater);
330
            if (isDestroyed()) {
331
                return;
332
            }
333
            ImageDisplayUtils.dispalyImg(this, "http://cdz.evcharge.cc/zhannew/uploadfile/" + list.get(0).headImgUrl, user_avater);
337
        }
334
        }
338
    }
335
    }
339
336

+ 2 - 2
app/src/main/java/com/electric/chargingpile/fragment/SvVideoShowView.java

398
    }
398
    }
399
399
400
    public void updateView() {
400
    public void updateView() {
401
        if(view==null){
401
        if (view == null) {
402
            return;
402
            return;
403
        }
403
        }
404
        String title = talkRecommendBean.title;
404
        String title = talkRecommendBean.title;
422
422
423
423
424
    public void initAndPlay() {
424
    public void initAndPlay() {
425
        if (talkRecommendBean.targetType == 24) {
425
        if (talkRecommendBean.targetType == 24 && imageAdapter != null && zoomingViewpager != null) {
426
            String s = talkRecommendBean.imgUrls.toString();
426
            String s = talkRecommendBean.imgUrls.toString();
427
            LogUtils.d("demo 11", s);
427
            LogUtils.d("demo 11", s);
428
            imageAdapter.addData(talkRecommendBean.imgUrls);
428
            imageAdapter.addData(talkRecommendBean.imgUrls);