@@ -57,7 +57,8 @@ private void setUpView() {
57
57
ImageButton playpauseButton = (ImageButton ) findViewById (R .id .playpause );
58
58
playpauseButton .setOnClickListener (new OnClickListener () {
59
59
60
- public void onClick (View v ) {
60
+ @ Override
61
+ public void onClick (View v ) {
61
62
switch (state ) {
62
63
case 1 : setState (2 ); break ; // is playing, set to pause
63
64
case 0 : // is stopped, set to play
@@ -71,7 +72,8 @@ public void onClick(View v) {
71
72
ImageButton stopButton = (ImageButton ) findViewById (R .id .stop );
72
73
stopButton .setOnClickListener (new OnClickListener () {
73
74
74
- public void onClick (View v ) {
75
+ @ Override
76
+ public void onClick (View v ) {
75
77
setState (0 );
76
78
}
77
79
@@ -110,18 +112,21 @@ private void setState(int state) {
110
112
//////////////////////////////
111
113
private int seekbarprogress = 0 ;
112
114
113
- public void onProgressChanged (SeekBar seekBar , int progress , boolean fromUser ) {
115
+ @ Override
116
+ public void onProgressChanged (SeekBar seekBar , int progress , boolean fromUser ) {
114
117
if (fromUser ) {
115
118
seekbarprogress = progress ;
116
119
}
117
120
}
118
121
119
- public void onStartTrackingTouch (SeekBar seekBar ) {
122
+ @ Override
123
+ public void onStartTrackingTouch (SeekBar seekBar ) {
120
124
seekbarprogress = 0 ;
121
125
if (state == 1 ) pausePlayer ();
122
126
}
123
127
124
- public void onStopTrackingTouch (SeekBar seekBar ) {
128
+ @ Override
129
+ public void onStopTrackingTouch (SeekBar seekBar ) {
125
130
mediaplayer .seekTo (seekbarprogress * 100 );
126
131
if (state == 1 ) playPlayer (2 );
127
132
seekbarprogress = 0 ;
@@ -135,13 +140,15 @@ private void resetSeekBar() {
135
140
}
136
141
137
142
private final Handler seekbarHandler = new Handler () {
138
- public void handleMessage (Message msg ) {
143
+ @ Override
144
+ public void handleMessage (Message msg ) {
139
145
SeekBar seek = (SeekBar ) findViewById (R .id .seek );
140
146
seek .setProgress (msg .what );
141
147
}
142
148
};
143
149
144
- public void run () {
150
+ @ Override
151
+ public void run () {
145
152
try {
146
153
while (state > 0 ) {
147
154
Thread .sleep (100 ); // 10th of a second
@@ -175,7 +182,8 @@ private void initializeMediaPlayer() {
175
182
}
176
183
}
177
184
178
- public void onCompletion (MediaPlayer mp ) {
185
+ @ Override
186
+ public void onCompletion (MediaPlayer mp ) {
179
187
setState (0 );
180
188
}
181
189
0 commit comments