dxh 5 anni fa
parent
commit
6123ab93ee

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

@ -87,14 +87,15 @@ public class PersonalPageActivity extends Activity implements View.OnClickListen
87 87
        map.put("limit", "20");
88 88
        if (MainApplication.isLogin()) {
89 89
            map.put("userId", MainApplication.userId);
90
            if(TextUtils.isEmpty(targetUserId)){
90
            if (TextUtils.isEmpty(targetUserId)) {
91 91
                user_edit.setVisibility(View.VISIBLE);
92 92
                map.put("targetUserId", MainApplication.userId);//说明是自己
93
            }
94
            else{
93
            } else {
95 94
                user_edit.setVisibility(View.GONE);
96 95
                map.put("targetUserId", targetUserId);
97 96
            }
97
        }else {
98
            map.put("targetUserId", targetUserId);
98 99
        }
99 100
        OkHttpUtils.get().params(map).url(url).build().connTimeOut(6000).readTimeOut(6000).execute(new StringCallback() {
100 101
            @Override
@ -158,7 +159,7 @@ public class PersonalPageActivity extends Activity implements View.OnClickListen
158 159
        data_info.setText(qadata.userVo.topicNums + "");
159 160
        if (!"".equals(qadata.userVo.headImgUrl)) {
160 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 163
                    .into(new Target() {
163 164
                        @Override
164 165
                        public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom loadedFrom) {
@ -226,12 +227,13 @@ public class PersonalPageActivity extends Activity implements View.OnClickListen
226 227
        waterFallAdapter.setOnRecyclerItemClickListener(new RecyclerItemTypeClickListener() {
227 228
            @Override
228 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 235
    private ChargingShareBean chargingShareBean = new ChargingShareBean();
236
235 237
    @Override
236 238
    public void onClick(View v) {
237 239
        switch (v.getId()) {
@ -246,13 +248,13 @@ public class PersonalPageActivity extends Activity implements View.OnClickListen
246 248
                break;
247 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 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 258
                    return;
257 259
//                if(null == chargingShareBean){
258 260
//                    getShareData();

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

@ -136,22 +136,22 @@ public class VideoDetaislActivity extends Activity implements View.OnClickListen
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 156
    @Override
157 157
    protected void onStop() {

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

@ -42,9 +42,10 @@ import com.squareup.picasso.Picasso;
42 42
import com.zhy.http.okhttp.OkHttpUtils;
43 43
import com.zhy.http.okhttp.callback.StringCallback;
44 44
45
import java.math.RoundingMode;
46
import java.text.NumberFormat;
45 47
import java.util.HashMap;
46 48
import java.util.List;
47
import java.util.Locale;
48 49
import java.util.Map;
49 50
50 51
import cn.sharesdk.framework.Platform;
@ -146,16 +147,15 @@ public class SvVideoShowView implements View.OnClickListener {
146 147
147 148
    private String num4(int num) {
148 149
        String re = "";
149
        if (num < 999) {
150
        if (num < 10000) {
150 151
            re = re + num;
151 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 160
        return re;
161 161
    }
@ -287,9 +287,16 @@ public class SvVideoShowView implements View.OnClickListener {
287 287
    private void initPlayer(View view) {
288 288
        playIcon = view.findViewById(R.id.view_show_icon);
289 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 296
        upVideoView2.setOnPreparedListener(new IMediaPlayer.OnPreparedListener() {
291 297
            @Override
292 298
            public void onPrepared(IMediaPlayer mp) {
299
                mp.setLooping(false);
293 300
                int videoWidth = mp.getVideoWidth();
294 301
                int videoHeight = mp.getVideoHeight();
295 302
                if (videoHeight > videoWidth) {
@ -302,15 +309,18 @@ public class SvVideoShowView implements View.OnClickListener {
302 309
        upVideoView2.setOnTouchListener(new View.OnTouchListener() {
303 310
            @Override
304 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,12 +603,6 @@ public class SvVideoShowView implements View.OnClickListener {
593 603
        }
594 604
    }
595 605
596
    public void onStop() {
597
        if (upVideoView2 != null) {
598
            upVideoView2.stopPlayback();
599
        }
600
    }
601
602 606
    public void onResume() {
603 607
        if (upVideoView2 != null && !upVideoView2.isPlaying() && talkRecommendBean != null &&
604 608
                !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
@ -617,9 +621,13 @@ public class SvVideoShowView implements View.OnClickListener {
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,6 +267,11 @@ public class VideoCommentDialog extends Dialog implements View.OnClickListener {
267 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
                });