[Android] [PATCH 1/3] Safer for threading

Geoffrey Métais geoffrey.metais at gmail.com
Mon Feb 16 17:12:09 CET 2015


Plus, removed redundant call to onSizeChanged
---
 vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java    | 5 +++--
 vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
index 65af6ed..9da56f2 100644
--- a/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/BrowserActivity.java
@@ -130,8 +130,9 @@ public class BrowserActivity extends ListActivity {
                 // remove any checkmarks of the custom item
                 final MediaDatabase dbManager = MediaDatabase.getInstance();
                 for(File f : dbManager.getMediaDirs()) {
-                    if(f.getPath().startsWith(item.getPath()))
-                        dbManager.removeDir(f.getPath());
+                    final String path = f.getPath();
+                    if(path.startsWith(item.getPath()))
+                        dbManager.removeDir(path);
                 }
                 CustomDirectories.removeCustomDirectory(item.getPath());
                 refresh();
diff --git a/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java b/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
index b451321..360cd64 100644
--- a/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
+++ b/vlc-android/src/org/videolan/vlc/widget/VerticalSeekBar.java
@@ -100,8 +100,8 @@ public class VerticalSeekBar extends SeekBar {
             case MotionEvent.ACTION_MOVE:
                 if (mIsMovingThumb) {
                     final int max = getMax();
-                    setProgress( max - (int) (max* event.getY() / getHeight()));
-                    onSizeChanged(getWidth(), getHeight(), 0, 0);
+                    final int progress = max - (int) (max* event.getY() / getHeight());
+                    setProgress(progress);
                     handled = true;
                 }
                 break;
-- 
2.1.0



More information about the Android mailing list