NetChangeLayoutView.java
2.48 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.wd.player.gesture;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.aliyun.svideo.wd.player.R;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.player.control.ControlView;
import com.wd.player.interfaces.ViewAction;
import com.wd.player.widget.AliyunScreenMode;
public class NetChangeLayoutView extends RelativeLayout implements ViewAction {
// 视频播放状态
private ControlView.PlayState mPlayState = ControlView.PlayState.NotPlaying;
// 整个view的显示控制:
// 不显示的原因。如果是错误的,那么view就都不显示了。
private HideType mHideType = null;
// 切换大小屏相关
private AliyunScreenMode mAliyunScreenMode = AliyunScreenMode.Small;
private TextView trafficPlay ;
public NetChangeLayoutView(Context context) {
super(context);
init();
}
public NetChangeLayoutView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public NetChangeLayoutView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public NetChangeLayoutView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
private void init() {
// Inflate布局
LayoutInflater.from(getContext()).inflate(R.layout.layout_net_change, this, true);
trafficPlay = findViewById(R.id.tv_traffic_play);
}
public void setOnClickListener(BaseClickListener baseClickListener){
trafficPlay.setOnClickListener(baseClickListener);
}
@Override
public void reset() {
mHideType = null;
}
@Override
public void show() {
setVisibility(VISIBLE);
}
public boolean isShow() {
return getVisibility() == VISIBLE;
}
@Override
public void hide(HideType hideType) {
setVisibility(GONE);
}
@Override
public void setScreenModeStatus(AliyunScreenMode mode) {
mAliyunScreenMode = mode;
}
public void setHideType(HideType hideType) {
this.mHideType = hideType;
}
/**
* 设置当前的播放状态
*
* @param playState 播放状态
*/
public void setPlayState(ControlView.PlayState playState) {
mPlayState = playState;
}
}