dxh 5 years ago
parent
commit
6123ab93ee

+ 11 - 9
app/src/main/java/com/electric/chargingpile/activity/PersonalPageActivity.java

87
        map.put("limit", "20");
87
        map.put("limit", "20");
88
        if (MainApplication.isLogin()) {
88
        if (MainApplication.isLogin()) {
89
            map.put("userId", MainApplication.userId);
89
            map.put("userId", MainApplication.userId);
90
            if(TextUtils.isEmpty(targetUserId)){
90
            if (TextUtils.isEmpty(targetUserId)) {
91
                user_edit.setVisibility(View.VISIBLE);
91
                user_edit.setVisibility(View.VISIBLE);
92
                map.put("targetUserId", MainApplication.userId);//说明是自己
92
                map.put("targetUserId", MainApplication.userId);//说明是自己
93
            }
94
            else{
93
            } else {
95
                user_edit.setVisibility(View.GONE);
94
                user_edit.setVisibility(View.GONE);
96
                map.put("targetUserId", targetUserId);
95
                map.put("targetUserId", targetUserId);
97
            }
96
            }
97
        }else {
98
            map.put("targetUserId", targetUserId);
98
        }
99
        }
99
        OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
100
        OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
100
            @Override
101
            @Override
158
        data_info.setText(qadata.userVo.topicNums + "");
159
        data_info.setText(qadata.userVo.topicNums + "");
159
        if (!"".equals(qadata.userVo.headImgUrl)) {
160
        if (!"".equals(qadata.userVo.headImgUrl)) {
160
            Picasso.with(this)
161
            Picasso.with(this)
161
                    .load("http://cdz.evcharge.cc/zhannew/uploadfile/"+qadata.userVo.headImgUrl)
162
                    .load("http://cdz.evcharge.cc/zhannew/uploadfile/" + qadata.userVo.headImgUrl)
162
                    .into(new Target() {
163
                    .into(new Target() {
163
                        @Override
164
                        @Override
164
                        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
165
                        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
226
        waterFallAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
227
        waterFallAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
227
            @Override
228
            @Override
228
            public void onItemClickListener(int position, int index) {
229
            public void onItemClickListener(int position, int index) {
229
                startActivity(new Intent(PersonalPageActivity.this, TopicDetailsActivity.class).putExtra("topicId", waterFallAdapter.getCurrentData().get(position).topicId+""));
230
                startActivity(new Intent(PersonalPageActivity.this, TopicDetailsActivity.class).putExtra("topicId", waterFallAdapter.getCurrentData().get(position).topicId + ""));
230
            }
231
            }
231
        });
232
        });
232
    }
233
    }
233
234
234
    private ChargingShareBean chargingShareBean = new ChargingShareBean();
235
    private ChargingShareBean chargingShareBean = new ChargingShareBean();
236
235
    @Override
237
    @Override
236
    public void onClick(View v) {
238
    public void onClick(View v) {
237
        switch (v.getId()) {
239
        switch (v.getId()) {
246
                break;
248
                break;
247
            case R.id.iv_more:
249
            case R.id.iv_more:
248
250
249
                if (!MainApplication.isLogin()){
250
                    startActivity(new Intent(this.getApplicationContext(),LoginActivity.class));
251
                    ToastUtil.showToast(this.getApplicationContext(),"请先登录", Toast.LENGTH_SHORT);
251
                if (!MainApplication.isLogin()) {
252
                    startActivity(new Intent(this.getApplicationContext(), LoginActivity.class));
253
                    ToastUtil.showToast(this.getApplicationContext(), "请先登录", Toast.LENGTH_SHORT);
252
                    return;
254
                    return;
253
                }
255
                }
254
256
255
                if(null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
257
                if (null == chargingShareBean.getUrl() || TextUtils.isEmpty(chargingShareBean.getUrl()))
256
                    return;
258
                    return;
257
//                if(null == chargingShareBean){
259
//                if(null == chargingShareBean){
258
//                    getShareData();
260
//                    getShareData();

+ 16 - 16
app/src/main/java/com/electric/chargingpile/activity/VideoDetaislActivity.java

136
        }
136
        }
137
    }
137
    }
138
138
139
    @Override
140
    protected void onResume() {
141
        if (videoShowView != null) {
142
            videoShowView.onResume();
143
        }
144
        super.onResume();
145
146
    }
147
148
    @Override
149
    protected void onPause() {
150
        if (videoShowView != null) {
151
            videoShowView.onPause();
152
        }
153
        super.onPause();
154
    }
139
//    @Override
140
//    protected void onResume() {
141
//        if (videoShowView != null) {
142
//            videoShowView.onResume();
143
//        }
144
//        super.onResume();
145
//
146
//    }
147
148
//    @Override
149
//    protected void onPause() {
150
//        if (videoShowView != null) {
151
//            videoShowView.onPause();
152
//        }
153
//        super.onPause();
154
//    }
155
155
156
    @Override
156
    @Override
157
    protected void onStop() {
157
    protected void onStop() {

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

42
import com.zhy.http.okhttp.OkHttpUtils;
42
import com.zhy.http.okhttp.OkHttpUtils;
43
import com.zhy.http.okhttp.callback.StringCallback;
43
import com.zhy.http.okhttp.callback.StringCallback;
44
44
45
import java.math.RoundingMode;
46
import java.text.NumberFormat;
45
import java.util.HashMap;
47
import java.util.HashMap;
46
import java.util.List;
48
import java.util.List;
47
import java.util.Locale;
48
import java.util.Map;
49
import java.util.Map;
49
50
50
import cn.sharesdk.framework.Platform;
51
import cn.sharesdk.framework.Platform;
146
147
147
    private String num4(int num) {
148
    private String num4(int num) {
148
        String re = "";
149
        String re = "";
149
        if (num < 999) {
150
        if (num < 10000) {
150
            re = re + num;
151
            re = re + num;
151
        } else {
152
        } else {
152
            float result = num / 10000;
153
            int sl = num % 10000;
154
            if (sl == 0) {
155
                re = String.format(Locale.CHINESE, "%f", result) + "W";
156
            } else {
157
                re = String.format(Locale.CHINESE, "%.1f", result) + "W";
158
            }
153
            float result = (float) num / 10000;
154
155
            NumberFormat nf = NumberFormat.getInstance();
156
            nf.setRoundingMode(RoundingMode.DOWN);
157
            nf.setMaximumFractionDigits(1);
158
            re = nf.format(result) + "W";
159
        }
159
        }
160
        return re;
160
        return re;
161
    }
161
    }
287
    private void initPlayer(View view) {
287
    private void initPlayer(View view) {
288
        playIcon = view.findViewById(R.id.view_show_icon);
288
        playIcon = view.findViewById(R.id.view_show_icon);
289
        upVideoView2 = view.findViewById(R.id.view_show_video);
289
        upVideoView2 = view.findViewById(R.id.view_show_video);
290
        upVideoView2.setOnCompletionListener(new IMediaPlayer.OnCompletionListener() {
291
            @Override
292
            public void onCompletion(IMediaPlayer mp) {
293
                playIcon.setVisibility(View.VISIBLE);
294
            }
295
        });
290
        upVideoView2.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() {
296
        upVideoView2.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() {
291
            @Override
297
            @Override
292
            public void onPrepared(IMediaPlayer mp) {
298
            public void onPrepared(IMediaPlayer mp) {
299
                mp.setLooping(false);
293
                int videoWidth = mp.getVideoWidth();
300
                int videoWidth = mp.getVideoWidth();
294
                int videoHeight = mp.getVideoHeight();
301
                int videoHeight = mp.getVideoHeight();
295
                if (videoHeight > videoWidth) {
302
                if (videoHeight > videoWidth) {
302
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
309
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
303
            @Override
310
            @Override
304
            public boolean onTouch(View view, MotionEvent motionEvent) {
311
            public boolean onTouch(View view, MotionEvent motionEvent) {
305
                boolean playing = upVideoView2.isPlaying();
306
                if (playing) {
307
                    upVideoView2.pause();
308
                    playIcon.setVisibility(View.VISIBLE);
309
                } else {
310
                    playIcon.setVisibility(View.GONE);
311
                    upVideoView2.start();
312
                if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
313
                    boolean playing = upVideoView2.isPlaying();
314
315
                    if (playing) {
316
                        upVideoView2.pause();
317
                        playIcon.setVisibility(View.VISIBLE);
318
                    } else {
319
                        playIcon.setVisibility(View.GONE);
320
                        upVideoView2.start();
321
                    }
312
                }
322
                }
313
                return false;
323
                return true;
314
            }
324
            }
315
        });
325
        });
316
    }
326
    }
593
        }
603
        }
594
    }
604
    }
595
605
596
    public void onStop() {
597
        if (upVideoView2 != null) {
598
            upVideoView2.stopPlayback();
599
        }
600
    }
601
602
    public void onResume() {
606
    public void onResume() {
603
        if (upVideoView2 != null && !upVideoView2.isPlaying() && talkRecommendBean != null &&
607
        if (upVideoView2 != null && !upVideoView2.isPlaying() && talkRecommendBean != null &&
604
                !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
608
                !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
617
        }
621
        }
618
    }
622
    }
619
623
620
    public void onPause() {
621
        if (upVideoView2 != null) {
622
            upVideoView2.stopPlayback();
624
625
    public void onStop() {
626
        if (upVideoView2 != null && upVideoView2.isPlaying()) {
627
            upVideoView2.pause();
628
        }
629
        if (playIcon != null) {
630
            playIcon.setVisibility(View.VISIBLE);
623
        }
631
        }
624
    }
632
    }
625
633

+ 5 - 0
app/src/main/java/com/electric/chargingpile/view/VideoCommentDialog.java

267
                                    show_comment_no.setVisibility(View.GONE);
267
                                    show_comment_no.setVisibility(View.GONE);
268
                                }
268
                                }
269
                            }
269
                            }
270
                        }else{
271
                            String rtnMsg = JsonUtils.getKeyResult(response, "desc");
272
273
                            ToastUtil.showToast(context, rtnMsg, Toast.LENGTH_SHORT);
274
270
                        }
275
                        }
271
                    }
276
                    }
272
                });
277
                });