1145873331@qq.com 6 years ago
parent
commit
5a325da74a

+ 7 - 0
app/bugly/BuglyUploadLog.txt

@ -12,3 +12,10 @@ appChannel=anzhi
12 12
appPackage=com.electric.chargingpile
13 13
appVersion=3.2.1
14 14
15
file=C:\Development Projects\Android_project\android_chargingpile\app\build\outputs\mapping\anzhi\debug\mapping.txt
16
sha1=e4dfdf35975c6f448fb7116476e3abc7cc92c751
17
appId=900010422
18
appChannel=anzhi
19
appPackage=com.electric.chargingpile
20
appVersion=3.2.1
21

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

@ -6,6 +6,7 @@ import android.os.Handler;
6 6
import android.support.annotation.Nullable;
7 7
import android.support.v4.view.ViewPager;
8 8
import android.view.View;
9
import android.widget.Toast;
9 10
10 11
import com.electric.chargingpile.R;
11 12
import com.electric.chargingpile.adapter.SvVideoPagerAdapter;
@ -99,8 +100,10 @@ public class VideoDetaislActivity extends Activity implements View.OnClickListen
99 100
    private void addIntentInfo() {
100 101
        position = getIntent().getIntExtra("pos", 0);
101 102
        talkRecommendBeans = (List<TalkRecommendBean>) getIntent().getSerializableExtra("list");
103
102 104
        viewPagerAdapter.notifyChanged(talkRecommendBeans);
103 105
        pager_video.setCurrentItem(position);
106
104 107
        viewPagerAdapter.setInitViewListener(new SvVideoPagerAdapter.InitViewListener() {
105 108
            @Override
106 109
            public void initFirstViewAfter() {
@ -112,23 +115,73 @@ public class VideoDetaislActivity extends Activity implements View.OnClickListen
112 115
        });
113 116
    }
114 117
115
    private void initPlayByPostion(final List<TalkRecommendBean> videoInfos, final int position, final boolean isNeedSer) {
118
    private void initPlayByPostion(final List<TalkRecommendBean> videoInfos, final int position,
119
                                   final boolean isNeedSet) {
116 120
        videoShowView = viewPagerAdapter.getViewList(position % viewPagerAdapter.getList());
117
        if (videoShowView.getRootView() != null) {
118 121
122
        if (videoShowView.getRootView() != null) {
119 123
            mHandler.postDelayed(new Runnable() {
120 124
                @Override
121 125
                public void run() {
122
                    if (isNeedSer) {
126
                    if (isNeedSet) {
123 127
                        if (videoInfos.size() > 0 && position < videoInfos.size()) {
124 128
                            videoShowView.setInfo(videoInfos.get(position));
125 129
                        }
126 130
                    }
127
                    videoShowView.updateView(position, videoInfos.get(position));
131
132
133
                    videoShowView.updateView();
128 134
                    videoShowView.initAndPlay();
129 135
                }
130 136
            }, 100);
131 137
132 138
        }
133 139
    }
140
141
    int i = 0;
142
    SvVideoShowView.ReqonseCallback reqonseCallback = new SvVideoShowView.ReqonseCallback() {
143
        @Override
144
        public void onsuccess() {
145
            Toast.makeText(VideoDetaislActivity.this, "i: " + (i += 1), Toast.LENGTH_SHORT).show();
146
147
            videoShowView.initAndPlay();
148
        }
149
150
        @Override
151
        public void failed() {
152
153
        }
154
    };
155
156
    @Override
157
    protected void onResume() {
158
        if (videoShowView != null) {
159
            videoShowView.onResume();
160
        }
161
        super.onResume();
162
163
    }
164
165
    @Override
166
    protected void onPause() {
167
        if (videoShowView != null) {
168
            videoShowView.onPause();
169
        }
170
        super.onPause();
171
    }
172
173
    @Override
174
    protected void onStop() {
175
        if (videoShowView != null) {
176
            videoShowView.onStop();
177
        }
178
        super.onStop();
179
    }
180
181
    @Override
182
    public void finish() {
183
        viewPagerAdapter.onDestory();
184
        super.finish();
185
    }
186
134 187
}

+ 6 - 4
app/src/main/java/com/electric/chargingpile/adapter/SvVideoPagerAdapter.java

@ -16,7 +16,6 @@ import java.util.Map;
16 16
public class SvVideoPagerAdapter extends PagerAdapter {
17 17
    InitViewListener initViewListener;
18 18
    private Activity activity;
19
    private boolean isPlay;
20 19
21 20
    private List<TalkRecommendBean> videoInfoList = new ArrayList();
22 21
    private List<SvVideoShowView> list = new ArrayList();
@ -35,9 +34,6 @@ public class SvVideoPagerAdapter extends PagerAdapter {
35 34
        list.add(v3);
36 35
    }
37 36
38
    public void setIsPlay(boolean play) {
39
        isPlay = play;
40
    }
41 37
42 38
    @Override
43 39
    public int getCount() {
@ -97,4 +93,10 @@ public class SvVideoPagerAdapter extends PagerAdapter {
97 93
    public interface InitViewListener {
98 94
        void initFirstViewAfter();
99 95
    }
96
97
    public void onDestory() {
98
        for (SvVideoShowView svVideoShowView : list) {
99
            svVideoShowView.onDestroy();
100
        }
101
    }
100 102
}

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

@ -1,7 +1,6 @@
1 1
package com.electric.chargingpile.fragment;
2 2
3 3
import android.app.Activity;
4
import android.net.Uri;
5 4
import android.text.TextUtils;
6 5
import android.util.Log;
7 6
import android.view.LayoutInflater;
@ -70,14 +69,19 @@ public class SvVideoShowView implements View.OnClickListener {
70 69
            initZoomPhoto(view);
71 70
        }
72 71
        initBottom(view);
72
        getDate();
73 73
        viewGroup.addView(view);
74
    }
75
76
    public void getDate(){
74 77
        if (talkRecommendBean.isLoaded) {
75 78
            setData();
76 79
        } else {
77
            requestHeaderData(targetType, talkRecommendBean.targetId);
80
            requestHeaderData(talkRecommendBean.targetType, talkRecommendBean.targetId);
78 81
        }
79 82
    }
80 83
84
81 85
    private void requestHeaderData(int targetType, long targetId) {
82 86
        String url = MainApplication.urlNew + "/topic/detail.do";
83 87
        Map<String, String> map = new HashMap<>();
@ -99,15 +103,13 @@ public class SvVideoShowView implements View.OnClickListener {
99 103
                    @Override
100 104
                    public void onError(Call call, Exception e) {
101 105
                        ToastUtil.showToast(activity, "加载失败,请重试", Toast.LENGTH_SHORT);
106
                        if (reqonseCallback != null) {
107
                            reqonseCallback.failed();
108
                        }
102 109
                    }
103 110
104 111
                    @Override
105 112
                    public void onResponse(String response) {
106
107
                        Log.e("SvVideoShowView", talkRecommendBean.toString());
108
109
                        Log.e("SvVideoShowView", response);
110
                        Log.e("SvVideoShowView", "-----------------------------");
111 113
                        String rtnCode = JsonUtils.getKeyResult(response, "code");
112 114
                        if ("1000".equals(rtnCode)) {
113 115
                            String rtnMsg = JsonUtils.getKeyResult(response, "data");
@ -148,14 +150,7 @@ public class SvVideoShowView implements View.OnClickListener {
148 150
        }
149 151
150 152
        if (talkRecommendBean.targetType == 23) {
151
            String videoUrl = talkRecommendBean.videoUrl;
152
            videoUrl = "http://uprocess.b0.upaiyun.com/demo/short_video/UPYUN_0.flv";
153
            if (!TextUtils.isEmpty(videoUrl)) {
154
                upVideoView2.setVideoPath(videoUrl);
155
                if(!upVideoView2.isPlaying()){
156
                    upVideoView2.start();
157
                }
158
            }
153
           initAndPlay();
159 154
        } else if (talkRecommendBean.targetType == 24) {
160 155
161 156
        }
@ -249,13 +244,19 @@ public class SvVideoShowView implements View.OnClickListener {
249 244
        return view;
250 245
    }
251 246
252
    public void updateView(int position, TalkRecommendBean talkRecommendBean) {
253
        int targetType = talkRecommendBean.targetType;
254
        long targetId = talkRecommendBean.targetId;
247
    public void updateView() {
248
//        long targetId = talkRecommendBean.targetId;
255 249
256 250
    }
257 251
258 252
    public void initAndPlay() {
253
        if (upVideoView2 != null && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
254
            String videoUrl = talkRecommendBean.videoUrl;
255
            videoUrl = "http://uprocess.b0.upaiyun.com/demo/short_video/UPYUN_0.flv";
256
            Log.d("SvVideoShowView", "play");
257
            upVideoView2.setVideoPath(videoUrl);
258
            upVideoView2.start();
259
        }
259 260
    }
260 261
261 262
    @Override
@ -276,11 +277,66 @@ public class SvVideoShowView implements View.OnClickListener {
276 277
277 278
    public void onDestroy() {
278 279
        if (upVideoView2 != null) {
280
            upVideoView2.stopPlayback();
279 281
            upVideoView2.release(true);
280 282
        }
281
//释放播放资源
282 283
    }
283 284
285
    public void onStop() {
286
        if (upVideoView2 != null) {
287
            upVideoView2.stopPlayback();
288
        }
289
    }
290
291
    public void onResume() {
292
        if (upVideoView2 != null && !upVideoView2.isPlaying() && talkRecommendBean != null &&
293
                !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
294
            onResume(talkRecommendBean.videoUrl);
295
        } else if (upVideoView2 == null && talkRecommendBean != null
296
                && talkRecommendBean.targetType == 23
297
                && !TextUtils.isEmpty(talkRecommendBean.videoUrl)) {
298
            initAndPlay();
299
        }
300
    }
301
302
    public void onResume(String url) {
303
        if (upVideoView2 != null) {
304
//            pauseTime=0;
305
//            if (status==STATUS_PLAYING) {
306
//                if (isLive) {
307
//                    videoView.seekTo(0);
308
//                } else {
309
//                    if (currentPosition>0) {
310
//                        videoView.seekTo(currentPosition);
311
//                    }
312
//                }
313
            upVideoView2.start();
314
//            } else if (status == STATUS_IDLE) {
315
//                play(url);
316
        }
317
    }
318
319
    public void onPause() {
320
        if (upVideoView2 != null) {
321
            upVideoView2.stopPlayback();
322
        }
323
    }
324
325
    ReqonseCallback reqonseCallback;
326
327
    public void setReqonseCallback(ReqonseCallback reqonseCallback) {
328
        this.reqonseCallback = reqonseCallback;
329
    }
330
331
    public ReqonseCallback getReqonseCallback() {
332
        return reqonseCallback;
333
    }
334
335
    public interface ReqonseCallback {
336
        void onsuccess();
337
338
        void failed();
339
    }
284 340
285 341
    public interface OnDeleteVideoListener {
286 342
        void onDelete();

+ 0 - 1
app/src/main/res/layout/view_show_zoom.xml

@ -9,7 +9,6 @@
9 9
        android:layout_width="match_parent"
10 10
        android:layout_height="match_parent" />
11 11
12
13 12
    <include layout="@layout/view_show_bottom" />
14 13
15 14
</RelativeLayout>