23
23
import android .widget .SeekBar ;
24
24
import android .widget .TextView ;
25
25
import android .widget .Toast ;
26
+
26
27
import java .text .SimpleDateFormat ;
27
28
import java .util .Date ;
28
29
import java .util .Timer ;
29
30
import java .util .TimerTask ;
31
+
30
32
import com .hacknife .iplayer .R ;
31
33
32
34
/**
33
35
* Created by Nathen
34
36
* On 2016/04/18 16:15
35
37
*/
36
- public class Iplayer extends Video {
38
+ public class Iplayer extends Video implements SettingView . OnSettingListener {
37
39
38
40
protected static Timer DISMISS_CONTROL_VIEW_TIMER ;
39
41
@@ -43,6 +45,7 @@ public class Iplayer extends Video {
43
45
public ImageView thumbImageView ;
44
46
public ImageView tinyBackImageView ;
45
47
public LinearLayout batteryTimeLayout ;
48
+ public ImageView setting ;
46
49
public ImageView batteryLevel ;
47
50
public TextView videoCurrentTime ;
48
51
public TextView replayTextView ;
@@ -64,6 +67,7 @@ public class Iplayer extends Video {
64
67
protected Dialog mBrightnessDialog ;
65
68
protected ProgressBar mDialogBrightnessProgressBar ;
66
69
protected TextView mDialogBrightnessTextView ;
70
+ protected SettingView settingView ;
67
71
public static long LAST_GET_BATTERYLEVEL_TIME = 0 ;
68
72
public static int LAST_GET_BATTERYLEVEL_PERCENT = 70 ;
69
73
@@ -93,6 +97,7 @@ public Iplayer(Context context, AttributeSet attrs) {
93
97
public void init (Context context ) {
94
98
super .init (context );
95
99
batteryTimeLayout = findViewById (R .id .battery_time_layout );
100
+ setting = findViewById (R .id .iv_setting );
96
101
bottomProgressBar = findViewById (R .id .bottom_progress );
97
102
titleTextView = findViewById (R .id .title );
98
103
backButton = findViewById (R .id .back );
@@ -105,11 +110,14 @@ public void init(Context context) {
105
110
clarity = findViewById (R .id .clarity );
106
111
mRetryBtn = findViewById (R .id .retry_btn );
107
112
mRetryLayout = findViewById (R .id .retry_layout );
113
+ settingView = findViewById (R .id .setting );
108
114
thumbImageView .setOnClickListener (this );
109
115
backButton .setOnClickListener (this );
110
116
tinyBackImageView .setOnClickListener (this );
111
117
clarity .setOnClickListener (this );
112
118
mRetryBtn .setOnClickListener (this );
119
+ setting .setOnClickListener (this );
120
+ settingView .setOnSettingListener (this );
113
121
}
114
122
115
123
public void setUp (DataSource dataSource , int screen ) {
@@ -120,6 +128,7 @@ public void setUp(DataSource dataSource, int screen) {
120
128
backButton .setVisibility (View .VISIBLE );
121
129
tinyBackImageView .setVisibility (View .INVISIBLE );
122
130
batteryTimeLayout .setVisibility (View .VISIBLE );
131
+ setting .setVisibility (View .VISIBLE );
123
132
if (dataSource .urlsMap .size () == 1 ) {
124
133
clarity .setVisibility (GONE );
125
134
} else {
@@ -134,12 +143,14 @@ public void setUp(DataSource dataSource, int screen) {
134
143
tinyBackImageView .setVisibility (View .INVISIBLE );
135
144
changeStartButtonSize ((int ) getResources ().getDimension (R .dimen .iplayer_start_button_w_h_normal ));
136
145
batteryTimeLayout .setVisibility (View .GONE );
146
+ setting .setVisibility (View .GONE );
137
147
clarity .setVisibility (View .GONE );
138
148
} else if (currentScreen == SCREEN_WINDOW_TINY ) {
139
149
tinyBackImageView .setVisibility (View .VISIBLE );
140
150
setAllControlsVisiblity (View .INVISIBLE , View .INVISIBLE , View .INVISIBLE ,
141
151
View .INVISIBLE , View .INVISIBLE , View .INVISIBLE , View .INVISIBLE );
142
152
batteryTimeLayout .setVisibility (View .GONE );
153
+ setting .setVisibility (View .GONE );
143
154
clarity .setVisibility (View .GONE );
144
155
}
145
156
setSystemTimeAndBattery ();
@@ -344,6 +355,12 @@ public void onClick(View v) {
344
355
MediaManager .setDataSource (dataSource );
345
356
onStatePreparing ();
346
357
onEvent (UserAction .ON_CLICK_START_ERROR );
358
+ } else if (R .id .iv_setting == v .getId ()) {
359
+ if (settingView .getVisibility () == View .VISIBLE ) {
360
+ settingView .setVisibility (View .GONE );
361
+ } else {
362
+ settingView .setVisibility (View .VISIBLE );
363
+ }
347
364
}
348
365
}
349
366
@@ -832,8 +849,17 @@ public void run() {
832
849
}
833
850
}
834
851
835
- public class DismissControlViewTimerTask extends TimerTask {
852
+ @ Override
853
+ public void onRatate (int angle ) {
854
+ Video .setTextureViewRotation (angle );
855
+ }
856
+
857
+ @ Override
858
+ public void onSize (int size ) {
836
859
860
+ }
861
+
862
+ public class DismissControlViewTimerTask extends TimerTask {
837
863
@ Override
838
864
public void run () {
839
865
dissmissControlView ();
0 commit comments