2 Commits d346a7d2bd ... 7d2c807000

Autor SHA1 Nachricht Datum
  dxh 7d2c807000 fix bug vor 5 Jahren
  dxh ecf7857ad8 fix bug vor 5 Jahren

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

@ -240,6 +240,10 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
240 240
                                String policy = signBeans.get(0).policy;
241 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,12 +286,22 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
282 286
    }
283 287
284 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 295
        String url = MainApplication.urlNew + "/topic/publish.do";
286 296
        Map<String, String> map = new HashMap<>();
287 297
        map.put("content", mPublishtopicCon.getText().toString());
288 298
        map.put("urls", urls);
289 299
        map.put("topicId", talkRecommendBean.targetId + "");
290 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 305
        if (MainApplication.isLogin()) {
292 306
            map.put("userId", MainApplication.userId);
293 307
            map.put("appToken", MainApplication.messageToken);
@ -344,7 +358,7 @@ public class PublishTopicActivity extends Activity implements OnClickListener {
344 358
345 359
                Glide
346 360
                        .with(this)
347
                        .load(Uri.fromFile(new File(media.getPath())))
361
                        .load(Uri.fromFile(new File(media.getCompressPath())))
348 362
                        .apply(new RequestOptions().centerCrop())
349 363
                        .into(mItemVideo);
350 364
                mItemVideoLl.setVisibility(View.VISIBLE);

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

@ -36,7 +36,6 @@ import com.electric.chargingpile.view.VideoCommentDialog;
36 36
import com.electric.chargingpile.view.VideoPubilshDialog;
37 37
import com.electric.chargingpile.widge.photoview.PhotoView;
38 38
import com.electric.chargingpile.widge.photoview.ZoomingViewpager;
39
import com.mabeijianxi.smallvideorecord2.Log;
40 39
import com.qmuiteam.qmui.widget.dialog.QMUIBottomSheet;
41 40
import com.squareup.picasso.Picasso;
42 41
import com.zhy.http.okhttp.OkHttpUtils;
@ -44,6 +43,7 @@ import com.zhy.http.okhttp.callback.StringCallback;
44 43
45 44
import java.math.RoundingMode;
46 45
import java.text.NumberFormat;
46
import java.util.ArrayList;
47 47
import java.util.HashMap;
48 48
import java.util.List;
49 49
import java.util.Map;
@ -349,10 +349,23 @@ public class SvVideoShowView implements View.OnClickListener {
349 349
    }
350 350
351 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 366
        @Override
354 367
        public int getCount() {
355
            return talkRecommendBean.imgUrls != null ? talkRecommendBean.imgUrls.size() : 0;
368
            return imageList.size();
356 369
        }
357 370
358 371
        @Override
@ -365,7 +378,7 @@ public class SvVideoShowView implements View.OnClickListener {
365 378
            PhotoView photoView = new PhotoView(container.getContext());
366 379
            Glide
367 380
                    .with(activity)
368
                    .load(talkRecommendBean.imgUrls.get(position))
381
                    .load(imageList.get(position))
369 382
                    .apply(new RequestOptions().fitCenter())
370 383
                    .into(photoView);            // Now just add PhotoView to ViewPager and return it
371 384
            container.addView(photoView, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
@ -385,6 +398,9 @@ public class SvVideoShowView implements View.OnClickListener {
385 398
    }
386 399
387 400
    public void updateView() {
401
        if(view==null){
402
            return;
403
        }
388 404
        String title = talkRecommendBean.title;
389 405
390 406
        sv_show_tvcon_more.setVisibility(View.GONE);
@ -401,14 +417,15 @@ public class SvVideoShowView implements View.OnClickListener {
401 417
        }
402 418
403 419
        sv_show_tvcon.setText(talkRecommendBean.title);
420
404 421
    }
405 422
406 423
407 424
    public void initAndPlay() {
408 425
        if (talkRecommendBean.targetType == 24) {
409 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 429
        } else {
413 430
            if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
414 431
                String videoUrl = talkRecommendBean.videoUrl;

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

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