BaseFindFragment.java
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.cnlive.goldenline.ui.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import com.cnlive.goldenline.ui.base.BaseFragment;
import com.cnlive.goldenline.ui.model.EventPlayerListFullScreen;
import com.cnlive.goldenline.ui.model.EventPlayerListPageChange;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
/**
* Created by gujun on 2017/3/22.
*/
public abstract class BaseFindFragment extends BaseFragment {
@Override
protected int getLayoutRes() {
return 0;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventBus.getDefault().register(this);
}
@Override
public void onDestroy() {
EventBus.getDefault().unregister(this);
super.onDestroy();
}
protected void onPageChange() {
//播放列表关闭播放的视频
EventBus.getDefault().post(new EventPlayerListPageChange());
}
/**
* 监听播放列表中视频的全屏切换
*
* @param event
*/
@Subscribe
public void onEventCallBack(EventPlayerListFullScreen event) {
View[] views = getViews();
if (views == null || views.length < 1) return;
if (event.isPortrait()) {
for (View view : views) {
if (view != null)
view.setVisibility(View.VISIBLE);
}
} else {
for (View view : views) {
if (view != null)
view.setVisibility(View.GONE);
}
}
}
protected abstract View[] getViews();
}