2 Commits d346a7d2bd ... 7d2c807000

Author SHA1 Message Date
  dxh 7d2c807000 fix bug 5 years ago
  dxh ecf7857ad8 fix bug 5 years ago

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

240
                                String policy = signBeans.get(0).policy;
240
                                String policy = signBeans.get(0).policy;
241
                                formUpload(media.getPath(), sign, policy);
241
                                formUpload(media.getPath(), sign, policy);
242
                            }
242
                            }
243
                        }else {
244
                            String desc = JsonUtils.getKeyResult(response, "desc");
245
                            ToastUtil.showToast(getApplicationContext(), desc, Toast.LENGTH_SHORT);
246
                            loadingDialog.dismiss();
243
                        }
247
                        }
244
                    }
248
                    }
245
                });
249
                });
282
    }
286
    }
283
287
284
    private void requestPublishServer(String urls) {
288
    private void requestPublishServer(String urls) {
289
        File file =new File(media.getPath());
290
        long size =0L;
291
        if(file.exists()){
292
            size = file.length();
293
        }
294
285
        String url = MainApplication.urlNew + "/topic/publish.do";
295
        String url = MainApplication.urlNew + "/topic/publish.do";
286
        Map<String, String> map = new HashMap<>();
296
        Map<String, String> map = new HashMap<>();
287
        map.put("content", mPublishtopicCon.getText().toString());
297
        map.put("content", mPublishtopicCon.getText().toString());
288
        map.put("urls", urls);
298
        map.put("urls", urls);
289
        map.put("topicId", talkRecommendBean.targetId + "");
299
        map.put("topicId", talkRecommendBean.targetId + "");
290
        map.put("targetType",  "23");
300
        map.put("targetType",  "23");
301
        map.put("coverImgW",media.getWidth()+"");
302
        map.put("coverImgH",media.getHeight()+"");
303
        map.put("duration",media.getDuration()+"");
304
        map.put("size",size+"");
291
        if (MainApplication.isLogin()) {
305
        if (MainApplication.isLogin()) {
292
            map.put("userId", MainApplication.userId);
306
            map.put("userId", MainApplication.userId);
293
            map.put("appToken", MainApplication.messageToken);
307
            map.put("appToken", MainApplication.messageToken);
344
358
345
                Glide
359
                Glide
346
                        .with(this)
360
                        .with(this)
347
                        .load(Uri.fromFile(new File(media.getPath())))
361
                        .load(Uri.fromFile(new File(media.getCompressPath())))
348
                        .apply(new RequestOptions().centerCrop())
362
                        .apply(new RequestOptions().centerCrop())
349
                        .into(mItemVideo);
363
                        .into(mItemVideo);
350
                mItemVideoLl.setVisibility(View.VISIBLE);
364
                mItemVideoLl.setVisibility(View.VISIBLE);

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

36
import com.electric.chargingpile.view.VideoPubilshDialog;
36
import com.electric.chargingpile.view.VideoPubilshDialog;
37
import com.electric.chargingpile.widge.photoview.PhotoView;
37
import com.electric.chargingpile.widge.photoview.PhotoView;
38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
39
import com.mabeijianxi.smallvideorecord2.Log;
40
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
39
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
41
import com.squareup.picasso.Picasso;
40
import com.squareup.picasso.Picasso;
42
import com.zhy.http.okhttp.OkHttpUtils;
41
import com.zhy.http.okhttp.OkHttpUtils;
44
43
45
import java.math.RoundingMode;
44
import java.math.RoundingMode;
46
import java.text.NumberFormat;
45
import java.text.NumberFormat;
46
import java.util.ArrayList;
47
import java.util.HashMap;
47
import java.util.HashMap;
48
import java.util.List;
48
import java.util.List;
49
import java.util.Map;
49
import java.util.Map;
349
    }
349
    }
350
350
351
    class ImageAdapter extends PagerAdapter {
351
    class ImageAdapter extends PagerAdapter {
352
        List<String> imageList = new ArrayList<>();
353
354
        public void addData(List<String> imageUrl) {
355
            imageList.clear();
356
            if (imageUrl != null) {
357
                imageList.addAll(imageUrl);
358
            }
359
        }
360
361
        @Override
362
        public int getItemPosition(Object object) {
363
            return POSITION_NONE;
364
        }
352
365
353
        @Override
366
        @Override
354
        public int getCount() {
367
        public int getCount() {
355
            return talkRecommendBean.imgUrls != null ? talkRecommendBean.imgUrls.size() : 0;
368
            return imageList.size();
356
        }
369
        }
357
370
358
        @Override
371
        @Override
365
            PhotoView photoView = new PhotoView(container.getContext());
378
            PhotoView photoView = new PhotoView(container.getContext());
366
            Glide
379
            Glide
367
                    .with(activity)
380
                    .with(activity)
368
                    .load(talkRecommendBean.imgUrls.get(position))
381
                    .load(imageList.get(position))
369
                    .apply(new RequestOptions().fitCenter())
382
                    .apply(new RequestOptions().fitCenter())
370
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
383
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
371
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
384
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
385
    }
398
    }
386
399
387
    public void updateView() {
400
    public void updateView() {
401
        if(view==null){
402
            return;
403
        }
388
        String title = talkRecommendBean.title;
404
        String title = talkRecommendBean.title;
389
405
390
        sv_show_tvcon_more.setVisibility(View.GONE);
406
        sv_show_tvcon_more.setVisibility(View.GONE);
401
        }
417
        }
402
418
403
        sv_show_tvcon.setText(talkRecommendBean.title);
419
        sv_show_tvcon.setText(talkRecommendBean.title);
420
404
    }
421
    }
405
422
406
423
407
    public void initAndPlay() {
424
    public void initAndPlay() {
408
        if (talkRecommendBean.targetType == 24) {
425
        if (talkRecommendBean.targetType == 24) {
409
            String s = talkRecommendBean.imgUrls.toString();
426
            String s = talkRecommendBean.imgUrls.toString();
410
            LogUtils.d("demo 11",s);
411
            imageAdapter.notifyDataSetChanged();
427
            LogUtils.d("demo 11", s);
428
            imageAdapter.addData(talkRecommendBean.imgUrls);
412
        } else {
429
        } else {
413
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
430
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
414
                String videoUrl = talkRecommendBean.videoUrl;
431
                String videoUrl = talkRecommendBean.videoUrl;

+ 18 - 5
app/src/main/java/com/electric/chargingpile/fragment/TalkRecommendFragment.java

68
    }
68
    }
69
69
70
    boolean isFirst = false;
70
    boolean isFirst = false;
71
71
    @Override
72
    @Override
72
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
73
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
73
                             Bundle savedInstanceState) {
74
                             Bundle savedInstanceState) {
76
        share_info_icon = view.findViewById(R.id.share_info_icon);
77
        share_info_icon = view.findViewById(R.id.share_info_icon);
77
78
78
        String isFirstComeIn = ProfileManager.getInstance().getIsFirstComeIn(getActivity());
79
        String isFirstComeIn = ProfileManager.getInstance().getIsFirstComeIn(getActivity());
79
        if(TextUtils.isEmpty(isFirstComeIn)){
80
        if (TextUtils.isEmpty(isFirstComeIn)) {
80
            isFirst = true;
81
            isFirst = true;
81
            ProfileManager.getInstance().setFirstComeIn(getActivity(), "label");
82
            ProfileManager.getInstance().setFirstComeIn(getActivity(), "label");
82
            view.findViewById(R.id.share_info_icon).setVisibility(View.VISIBLE);
83
            view.findViewById(R.id.share_info_icon).setVisibility(View.VISIBLE);
141
            @Override
142
            @Override
142
            public void onItemClickListener(int position, int type) {
143
            public void onItemClickListener(int position, int type) {
143
                final int pos = position - 1;
144
                final int pos = position - 1;
144
                ArrayList<TalkRecommendBean> talkRecommendBeans = layoutAdapter.getCurrentData();
145
                final ArrayList<TalkRecommendBean> talkRecommendBeans = layoutAdapter.getCurrentData();
145
146
146
                if (!NetUtil.CheckNetwork(getActivity())) {
147
                if (!NetUtil.CheckNetwork(getActivity())) {
147
                    Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_SHORT).show();
148
                    Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_SHORT).show();
168
                            .subscribe(new Consumer<List<TalkRecommendBean>>() {
169
                            .subscribe(new Consumer<List<TalkRecommendBean>>() {
169
                                @Override
170
                                @Override
170
                                public void accept(List<TalkRecommendBean> list) throws Exception {
171
                                public void accept(List<TalkRecommendBean> list) throws Exception {
172
                                    TalkRecommendBean talkRecommendBean = talkRecommendBeans.get(pos);
173
174
                                    int index =0;
175
                                    for (int i = 0; i < list.size(); i++) {
176
                                        TalkRecommendBean tmp = list.get(i);
177
                                        if(tmp.targetType == talkRecommendBean.targetType &&
178
                                        tmp.targetId ==talkRecommendBean.targetId){
179
                                            index = i;
180
                                            break;
181
                                        }
182
                                    }
183
171
                                    Intent intent = new Intent(getActivity(), VideoDetaislActivity.class);
184
                                    Intent intent = new Intent(getActivity(), VideoDetaislActivity.class);
172
                                    intent.putExtra("list", (Serializable) list);
185
                                    intent.putExtra("list", (Serializable) list);
173
                                    intent.putExtra("pos", pos);
186
                                    intent.putExtra("pos", index);
174
                                    startActivity(intent);
187
                                    startActivity(intent);
175
188
176
                                }
189
                                }
192
                //当前状态为停止滑动状态SCROLL_STATE_IDLE时
205
                //当前状态为停止滑动状态SCROLL_STATE_IDLE时
193
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
206
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
194
                    iv_ask.setVisibility(View.VISIBLE);
207
                    iv_ask.setVisibility(View.VISIBLE);
195
                    if(isFirst)
208
                    if (isFirst)
196
                        share_info_icon.setVisibility(View.VISIBLE);
209
                        share_info_icon.setVisibility(View.VISIBLE);
197
                } else if (newState == RecyclerView.SCREEN_STATE_ON) {
210
                } else if (newState == RecyclerView.SCREEN_STATE_ON) {
198
                    iv_ask.setVisibility(View.GONE);
211
                    iv_ask.setVisibility(View.GONE);
199
                    if(isFirst)
212
                    if (isFirst)
200
                        share_info_icon.setVisibility(View.GONE);
213
                        share_info_icon.setVisibility(View.GONE);
201
                }
214
                }
202
            }
215
            }