[Android] LibVLC: VLCEvent: factorize arguments

Thomas Guillem git at videolan.org
Mon Nov 2 11:38:07 CET 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov  2 11:36:05 2015 +0100| [d2c285727589d3f46ef2dd1daa280160c88e04c1] | committer: Thomas Guillem

LibVLC: VLCEvent: factorize arguments

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d2c285727589d3f46ef2dd1daa280160c88e04c1
---

 libvlc/src/org/videolan/libvlc/MediaPlayer.java |   13 +++----------
 libvlc/src/org/videolan/libvlc/VLCEvent.java    |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index 5215634..2eab202 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -50,23 +50,16 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
         public static final int ESDeleted           = 0x115;
         //public static final int ESSelected          = 0x116;
 
-        private final long arg1;
-        private final float arg2;
         protected Event(int type) {
             super(type);
-            this.arg1 = 0;
-            this.arg2 = 0;
         }
         protected Event(int type, long arg1) {
-            super(type);
-            this.arg1 = arg1;
-            this.arg2 = 0;
+            super(type, arg1);
         }
         protected Event(int type, float arg2) {
-            super(type);
-            this.arg1 = 0;
-            this.arg2 = arg2;
+            super(type, arg2);
         }
+
         public long getTimeChanged() {
             return arg1;
         }
diff --git a/libvlc/src/org/videolan/libvlc/VLCEvent.java b/libvlc/src/org/videolan/libvlc/VLCEvent.java
index a2f78f2..d2e748b 100644
--- a/libvlc/src/org/videolan/libvlc/VLCEvent.java
+++ b/libvlc/src/org/videolan/libvlc/VLCEvent.java
@@ -22,8 +22,23 @@ package org.videolan.libvlc;
 
 abstract class VLCEvent {
     public final int type;
+    protected final long arg1;
+    protected final float arg2;
+
     protected VLCEvent(int type) {
         this.type = type;
+        this.arg1 = 0;
+        this.arg2 = 0;
+    }
+    protected VLCEvent(int type, long arg1) {
+        this.type = type;
+        this.arg1 = arg1;
+        this.arg2 = 0;
+    }
+    protected VLCEvent(int type, float arg2) {
+        this.type = type;
+        this.arg1 = 0;
+        this.arg2 = arg2;
     }
 
     /**



More information about the Android mailing list