[Android] [PATCH 1/4] move WeakHandler to libvlc
Thomas Guillem
thomas at gllm.fr
Fri Dec 5 14:43:40 CET 2014
---
.../src/org/videolan/libvlc/util/WeakHandler.java | 37 ++++++++++++++++++++++
vlc-android/src/org/videolan/vlc/MediaLibrary.java | 2 +-
.../src/org/videolan/vlc/audio/AudioService.java | 2 +-
.../src/org/videolan/vlc/gui/HistoryAdapter.java | 2 +-
.../src/org/videolan/vlc/gui/MainActivity.java | 2 +-
.../vlc/gui/audio/AudioBrowserFragment.java | 2 +-
.../videolan/vlc/gui/video/MediaInfoFragment.java | 2 +-
.../videolan/vlc/gui/video/VideoListHandler.java | 2 +-
.../vlc/gui/video/VideoPlayerActivity.java | 2 +-
.../src/org/videolan/vlc/util/WeakHandler.java | 37 ----------------------
10 files changed, 45 insertions(+), 45 deletions(-)
create mode 100644 libvlc/src/org/videolan/libvlc/util/WeakHandler.java
delete mode 100644 vlc-android/src/org/videolan/vlc/util/WeakHandler.java
diff --git a/libvlc/src/org/videolan/libvlc/util/WeakHandler.java b/libvlc/src/org/videolan/libvlc/util/WeakHandler.java
new file mode 100644
index 0000000..e955671
--- /dev/null
+++ b/libvlc/src/org/videolan/libvlc/util/WeakHandler.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * WeakHandler.java
+ *****************************************************************************
+ * Copyright © 2012 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+package org.videolan.libvlc.util;
+
+import java.lang.ref.WeakReference;
+
+import android.os.Handler;
+
+public abstract class WeakHandler<T> extends Handler {
+ private WeakReference<T> mOwner;
+
+ public WeakHandler(T owner) {
+ mOwner = new WeakReference<T>(owner);
+ }
+
+ public T getOwner() {
+ return mOwner.get();
+ }
+}
diff --git a/vlc-android/src/org/videolan/vlc/MediaLibrary.java b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
index 4a495bd..6f8408f 100644
--- a/vlc-android/src/org/videolan/vlc/MediaLibrary.java
+++ b/vlc-android/src/org/videolan/vlc/MediaLibrary.java
@@ -36,12 +36,12 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.gui.audio.AudioBrowserFragment;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
-import org.videolan.vlc.util.WeakHandler;
import android.content.Context;
import android.os.Environment;
diff --git a/vlc-android/src/org/videolan/vlc/audio/AudioService.java b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
index c33abc8..d81fd45 100644
--- a/vlc-android/src/org/videolan/vlc/audio/AudioService.java
+++ b/vlc-android/src/org/videolan/vlc/audio/AudioService.java
@@ -44,6 +44,7 @@ import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.LibVlcUtil;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.MediaList;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.R;
import org.videolan.vlc.RemoteControlClientReceiver;
@@ -55,7 +56,6 @@ import org.videolan.vlc.interfaces.IAudioService;
import org.videolan.vlc.interfaces.IAudioServiceCallback;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VLCInstance;
-import org.videolan.vlc.util.WeakHandler;
import android.annotation.TargetApi;
import android.app.Notification;
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index f24577c..82edbcb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -24,10 +24,10 @@ import org.videolan.libvlc.EventHandler;
import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.audio.AudioUtil;
-import org.videolan.vlc.util.WeakHandler;
import android.content.Context;
import android.graphics.Bitmap;
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index c2e05c6..e87a103 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -26,6 +26,7 @@ import java.util.List;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.LibVlcUtil;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
@@ -46,7 +47,6 @@ import org.videolan.vlc.interfaces.ISortable;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.util.VLCInstance;
-import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.widget.SlidingPaneLayout;
import android.annotation.TargetApi;
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index 26f53ec..70edd3c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -53,6 +53,7 @@ import android.widget.ProgressBar;
import org.videolan.libvlc.LibVlcUtil;
import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.audio.AudioServiceController;
@@ -61,7 +62,6 @@ import org.videolan.vlc.gui.CommonDialogs;
import org.videolan.vlc.gui.MainActivity;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.VLCRunnable;
-import org.videolan.vlc.util.WeakHandler;
import org.videolan.vlc.widget.FlingViewGroup;
import org.videolan.vlc.widget.FlingViewGroup.ViewSwitchListener;
import org.videolan.vlc.widget.HeaderScrollView;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
index dfc37c8..b76eee1 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/MediaInfoFragment.java
@@ -26,12 +26,12 @@ import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.Media;
import org.videolan.libvlc.TrackInfo;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaLibrary;
import org.videolan.vlc.R;
import org.videolan.vlc.util.BitmapUtil;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.VLCInstance;
-import org.videolan.vlc.util.WeakHandler;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListHandler.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListHandler.java
index 74a6461..cd9e45e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListHandler.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListHandler.java
@@ -1,7 +1,7 @@
package org.videolan.vlc.gui.video;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaLibrary;
-import org.videolan.vlc.util.WeakHandler;
import android.os.Message;
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 4cf4793..39dfd47 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -44,6 +44,7 @@ import org.videolan.libvlc.LibVLC;
import org.videolan.libvlc.LibVlcException;
import org.videolan.libvlc.LibVlcUtil;
import org.videolan.libvlc.Media;
+import org.videolan.libvlc.util.WeakHandler;
import org.videolan.vlc.MediaDatabase;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
@@ -55,7 +56,6 @@ import org.videolan.vlc.gui.PreferencesActivity;
import org.videolan.vlc.util.AndroidDevices;
import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.VLCInstance;
-import org.videolan.vlc.util.WeakHandler;
import android.annotation.TargetApi;
import android.app.Activity;
diff --git a/vlc-android/src/org/videolan/vlc/util/WeakHandler.java b/vlc-android/src/org/videolan/vlc/util/WeakHandler.java
deleted file mode 100644
index 94b0d18..0000000
--- a/vlc-android/src/org/videolan/vlc/util/WeakHandler.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*****************************************************************************
- * WeakHandler.java
- *****************************************************************************
- * Copyright © 2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-package org.videolan.vlc.util;
-
-import java.lang.ref.WeakReference;
-
-import android.os.Handler;
-
-public abstract class WeakHandler<T> extends Handler {
- private WeakReference<T> mOwner;
-
- public WeakHandler(T owner) {
- mOwner = new WeakReference<T>(owner);
- }
-
- public T getOwner() {
- return mOwner.get();
- }
-}
--
2.1.3
More information about the Android
mailing list