Commit c96c7a71 authored by Alexandre Perraud's avatar Alexandre Perraud Committed by Jean-Baptiste Kempf
Browse files

Tracks & Subtitles Bug : Split the T&S update in a method


Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent ab56cb99
......@@ -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);
}
}
}
/**
*
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment