[Android] Tracks & Subtitles Bug : Split the T&S update in a method
Alexandre Perraud
git at videolan.org
Fri Sep 28 17:52:59 CEST 2012
vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Fri Sep 28 17:36:30 2012 +0200| [c96c7a7126511a02f542a709de65e56080eb293e] | committer: Jean-Baptiste Kempf
Tracks & Subtitles Bug : Split the T&S update in a method
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c96c7a7126511a02f542a709de65e56080eb293e
---
.../vlc/gui/video/VideoPlayerActivity.java | 68 +++++++++++---------
1 file changed, 36 insertions(+), 32 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 2495e58..cb52918 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1086,38 +1086,6 @@ public class VideoPlayerActivity extends Activity {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(msg, timeout);
}
- if (mAudioTracks == null) {
- mAudioTracks = mLibVLC.getAudioTrackDescription();
- if (mAudioTracks != null && mAudioTracks.length > 1) {
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAudioTracks);
- mAudio.setAdapter(adapter);
- int current = mLibVLC.getAudioTrack() - 1;
- mAudio.setSelection(current);
- mAudio.setOnItemSelectedListener(mAudioListener);
- mAudio.setEnabled(true);
- }
- else {
- mAudio.setEnabled(false);
- mAudio.setOnItemSelectedListener(null);
- mAudio.setAdapter(null);
- }
- }
- if (mSubtitleTracks == null) {
- mSubtitleTracks = mLibVLC.getSpuTrackDescription();
- if (mSubtitleTracks != null && mSubtitleTracks.length > 0) {
- ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mSubtitleTracks);
- mSubtitles.setAdapter(adapter);
- int current = mLibVLC.getSpuTrack();
- mSubtitles.setSelection(current);
- mSubtitles.setOnItemSelectedListener(mSubtitlesListener);
- mSubtitles.setEnabled(true);
- }
- else {
- mSubtitles.setEnabled(false);
- mSubtitles.setOnItemSelectedListener(null);
- mSubtitles.setAdapter(null);
- }
- }
updateOverlayPausePlay();
}
@@ -1185,6 +1153,42 @@ public class VideoPlayerActivity extends Activity {
return time;
}
+ private void setTracksAndSubtitles () {
+ if (mAudioTracks == null) {
+ mAudioTracks = mLibVLC.getAudioTrackDescription();
+ if (mAudioTracks != null && mAudioTracks.length > 1) {
+ ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mAudioTracks);
+ mAudio.setAdapter(adapter);
+ int current = mLibVLC.getAudioTrack() - 1;
+ mAudio.setSelection(current);
+ mAudio.setOnItemSelectedListener(mAudioListener);
+ mAudio.setEnabled(true);
+ }
+ else {
+ mAudio.setEnabled(false);
+ mAudio.setOnItemSelectedListener(null);
+ mAudio.setAdapter(null);
+ }
+ }
+ if (mSubtitleTracks == null) {
+ mSubtitleTracks = mLibVLC.getSpuTrackDescription();
+ if (mSubtitleTracks != null && mSubtitleTracks.length > 0) {
+ ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mSubtitleTracks);
+ mSubtitles.setAdapter(adapter);
+ int current = mLibVLC.getSpuTrack();
+ mSubtitles.setSelection(current);
+ mSubtitles.setOnItemSelectedListener(mSubtitlesListener);
+ mSubtitles.setEnabled(true);
+ }
+ else {
+ mSubtitles.setEnabled(false);
+ mSubtitles.setOnItemSelectedListener(null);
+ mSubtitles.setAdapter(null);
+ }
+ }
+ }
+
+
/**
*
*/
More information about the Android
mailing list