[Android] Group subtitles operations
Geoffrey Métais
git at videolan.org
Fri Mar 18 15:59:46 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Mar 18 15:58:47 2016 +0100| [2113f71b642c5b7a96aeadc9b224850b7c19052a] | committer: Geoffrey Métais
Group subtitles operations
> https://code.videolan.org/videolan/vlc-android/commit/2113f71b642c5b7a96aeadc9b224850b7c19052a
---
.../vlc/gui/video/VideoPlayerActivity.java | 25 +++++++++++++---------
1 file changed, 15 insertions(+), 10 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 293660b..4a8a5db 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -293,7 +293,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
* It is possible to have multiple custom subs in one session
* (just like desktop VLC allows you as well.)
*/
- private final volatile ArrayList<String> mSubtitleSelectedFiles = new ArrayList<>();
+ private final ArrayList<String> mSubtitleSelectedFiles = new ArrayList<>();
/**
* Flag to indicate whether the media should be paused once loaded
@@ -731,14 +731,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if (ratePref == 2)
mService.setRate(mSettings.getFloat(PreferencesActivity.VIDEO_RATE, 1.0f));
- // Add any selected subtitle file from the file picker
- if(mSubtitleSelectedFiles.size() > 0) {
- for(String file : mSubtitleSelectedFiles) {
- Log.i(TAG, "Adding user-selected subtitle " + file);
- mService.addSubtitleTrack(file);
- }
- }
-
if (mService.getMediaListSize() > 1) {
mPlaylistAdapter = new PlaylistAdapter(this);
mPlaylistAdapter.setService(mService);
@@ -2836,7 +2828,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
private void getSubtitles() {
String subtitleList_serialized = mSettings.getString(PreferencesActivity.VIDEO_SUBTITLE_FILES, null);
- ArrayList<String> prefsList = new ArrayList<String>();
+ ArrayList<String> prefsList = new ArrayList<>();
if(subtitleList_serialized != null) {
ByteArrayInputStream bis = new ByteArrayInputStream(subtitleList_serialized.getBytes());
try {
@@ -2850,6 +2842,19 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
if(!mSubtitleSelectedFiles.contains(x))
mSubtitleSelectedFiles.add(x);
}
+
+ // Add any selected subtitle file from the file picker
+ if(mSubtitleSelectedFiles.size() > 0) {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ for(String file : mSubtitleSelectedFiles) {
+ Log.i(TAG, "Adding user-selected subtitle " + file);
+ mService.addSubtitleTrack(file);
+ }
+ }
+ });
+ }
}
@SuppressWarnings("deprecation")
More information about the Android
mailing list