[Android] Use an unique application prefix
Thomas Guillem
git at videolan.org
Fri Nov 6 14:17:04 CET 2015
vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov 6 14:16:52 2015 +0100| [025a7918be4289ae1b010c1d120c242aa5c423c1] | committer: Thomas Guillem
Use an unique application prefix
Fix conflict between vlc and vlcdebug
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=025a7918be4289ae1b010c1d120c242aa5c423c1
---
.../src/org/videolan/vlc/PlaybackService.java | 18 +++++++--------
.../src/org/videolan/vlc/VLCApplication.java | 2 +-
.../vlc/gui/AudioPlayerContainerActivity.java | 2 +-
.../vlc/gui/video/VideoPlayerActivity.java | 4 ++--
vlc-android/src/org/videolan/vlc/util/Util.java | 9 ++++++--
.../videolan/vlc/widget/VLCAppWidgetProvider.java | 23 ++++++++++----------
6 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 16839ee..749b99d 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -92,15 +92,15 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
private static final int SHOW_PROGRESS = 0;
private static final int SHOW_TOAST = 1;
- public static final String ACTION_REMOTE_GENERIC = "org.videolan.vlc.remote.";
- public static final String ACTION_REMOTE_BACKWARD = "org.videolan.vlc.remote.Backward";
- public static final String ACTION_REMOTE_PLAY = "org.videolan.vlc.remote.Play";
- public static final String ACTION_REMOTE_PLAYPAUSE = "org.videolan.vlc.remote.PlayPause";
- public static final String ACTION_REMOTE_PAUSE = "org.videolan.vlc.remote.Pause";
- public static final String ACTION_REMOTE_STOP = "org.videolan.vlc.remote.Stop";
- public static final String ACTION_REMOTE_FORWARD = "org.videolan.vlc.remote.Forward";
- public static final String ACTION_REMOTE_LAST_PLAYLIST = "org.videolan.vlc.remote.LastPlaylist";
- public static final String ACTION_REMOTE_RESUME_VIDEO = "org.videolan.vlc.remote.ResumeVideo";
+ public static final String ACTION_REMOTE_GENERIC = Util.buildPkgString("remote.");
+ public static final String ACTION_REMOTE_BACKWARD = ACTION_REMOTE_GENERIC+"Backward";
+ public static final String ACTION_REMOTE_PLAY = ACTION_REMOTE_GENERIC+"Play";
+ public static final String ACTION_REMOTE_PLAYPAUSE = ACTION_REMOTE_GENERIC+"PlayPause";
+ public static final String ACTION_REMOTE_PAUSE = ACTION_REMOTE_GENERIC+"Pause";
+ public static final String ACTION_REMOTE_STOP = ACTION_REMOTE_GENERIC+"Stop";
+ public static final String ACTION_REMOTE_FORWARD = ACTION_REMOTE_GENERIC+"Forward";
+ public static final String ACTION_REMOTE_LAST_PLAYLIST = ACTION_REMOTE_GENERIC+"LastPlaylist";
+ public static final String ACTION_REMOTE_RESUME_VIDEO = ACTION_REMOTE_GENERIC+"ResumeVideo";
public interface Callback {
void update();
diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 3eb1dc4..1950143 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -40,7 +40,7 @@ public class VLCApplication extends Application {
public final static String TAG = "VLC/VLCApplication";
private static VLCApplication instance;
- public final static String SLEEP_INTENT = "org.videolan.vlc.SleepIntent";
+ public final static String SLEEP_INTENT = Util.buildPkgString("SleepIntent");
public static Calendar sPlayerSleepTime = null;
/* Up to 2 threads maximum, inactive threads are killed after 2 seconds */
diff --git a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
index 8d2a421..5615e7e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.java
@@ -58,7 +58,7 @@ import org.videolan.vlc.widget.HackyDrawerLayout;
public class AudioPlayerContainerActivity extends AppCompatActivity implements PlaybackService.Client.Callback {
public static final String TAG = "VLC/AudioPlayerContainerActivity";
- public static final String ACTION_SHOW_PLAYER = "org.videolan.vlc.gui.ShowPlayer";
+ public static final String ACTION_SHOW_PLAYER = Util.buildPkgString("gui.ShowPlayer");
protected static final String ID_VIDEO = "video";
protected static final String ID_AUDIO = "audio";
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 75bd32e..9f306cf 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -137,7 +137,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
// Internal intent identifier to distinguish between internal launch and
// external intent.
- public final static String PLAY_FROM_VIDEOGRID = "org.videolan.vlc.gui.video.PLAY_FROM_VIDEOGRID";
+ public final static String PLAY_FROM_VIDEOGRID = Util.buildPkgString("gui.video.PLAY_FROM_VIDEOGRID");
public final static String PLAY_EXTRA_ITEM_LOCATION = "item_location";
public final static String PLAY_EXTRA_SUBTITLES_LOCATION = "subtitles_location";
@@ -145,7 +145,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
public final static String PLAY_EXTRA_FROM_START = "from_start";
public final static String PLAY_EXTRA_OPENED_POSITION = "opened_position";
- public final static String ACTION_RESULT = "org.videolan.vlc.player.result";
+ public final static String ACTION_RESULT = Util.buildPkgString("player.result");
public final static String EXTRA_POSITION = "extra_position";
public final static String EXTRA_DURATION = "extra_duration";
public final static int RESULT_CONNECTION_FAILED = RESULT_FIRST_USER + 1;
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 78c85ff..1bc47f4 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -43,6 +43,7 @@ import android.view.View;
import android.widget.TextView;
import org.videolan.libvlc.util.AndroidUtil;
+import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.MediaWrapper;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
@@ -61,8 +62,8 @@ import java.util.concurrent.atomic.AtomicInteger;
public class Util {
public final static String TAG = "VLC/Util";
private static final AtomicInteger sNextGeneratedId = new AtomicInteger(1);
- public static final String ACTION_SCAN_START = "org.videolan.vlc.gui.ScanStart";
- public static final String ACTION_SCAN_STOP = "org.videolan.vlc.gui.ScanStop";
+ public static final String ACTION_SCAN_START = buildPkgString("gui.ScanStart");
+ public static final String ACTION_SCAN_STOP = buildPkgString("gui.ScanStop");
/** Print an on-screen message to alert the user */
public static void snacker(View view, int stringId) {
@@ -405,4 +406,8 @@ public class Util {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(VLCApplication.getAppContext());
return pref.getBoolean("enable_black_theme", false);
}
+
+ public static String buildPkgString(String string) {
+ return BuildConfig.APPLICATION_ID + "." + string;
+ }
}
diff --git a/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java b/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
index ff9e3e5..a964f95 100644
--- a/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
+++ b/vlc-android/src/org/videolan/vlc/widget/VLCAppWidgetProvider.java
@@ -36,20 +36,21 @@ import org.videolan.vlc.BuildConfig;
import org.videolan.vlc.R;
import org.videolan.vlc.VLCApplication;
import org.videolan.vlc.gui.MainActivity;
+import org.videolan.vlc.util.Util;
abstract public class VLCAppWidgetProvider extends AppWidgetProvider {
public static final String TAG = "VLC/VLCAppWidgetProvider";
- public static final String ACTION_REMOTE_BACKWARD = "org.videolan.vlc.remote.Backward";
- public static final String ACTION_REMOTE_PLAYPAUSE = "org.videolan.vlc.remote.PlayPause";
- public static final String ACTION_REMOTE_STOP = "org.videolan.vlc.remote.Stop";
- public static final String ACTION_REMOTE_FORWARD = "org.videolan.vlc.remote.Forward";
- public static final String ACTION_WIDGET_PREFIX = "org.videolan.vlc.widget.";
- public static final String ACTION_WIDGET_INIT = "org.videolan.vlc.widget.INIT";
- public static final String ACTION_WIDGET_UPDATE = "org.videolan.vlc.widget.UPDATE";
- public static final String ACTION_WIDGET_UPDATE_COVER = "org.videolan.vlc.widget.UPDATE_COVER";
- public static final String ACTION_WIDGET_UPDATE_POSITION = "org.videolan.vlc.widget.UPDATE_POSITION";
-
- public static final String VLC_PACKAGE = "org.videolan.vlc";
+ public static final String ACTION_REMOTE_BACKWARD = Util.buildPkgString("remote.Backward");
+ public static final String ACTION_REMOTE_PLAYPAUSE = Util.buildPkgString("remote.PlayPause");
+ public static final String ACTION_REMOTE_STOP = Util.buildPkgString("remote.Stop");
+ public static final String ACTION_REMOTE_FORWARD = Util.buildPkgString("remote.Forward");
+ public static final String ACTION_WIDGET_PREFIX = Util.buildPkgString("widget.");
+ public static final String ACTION_WIDGET_INIT = ACTION_WIDGET_PREFIX+"INIT";
+ public static final String ACTION_WIDGET_UPDATE = ACTION_WIDGET_PREFIX+"UPDATE";
+ public static final String ACTION_WIDGET_UPDATE_COVER = ACTION_WIDGET_PREFIX+"UPDATE_COVER";
+ public static final String ACTION_WIDGET_UPDATE_POSITION = ACTION_WIDGET_PREFIX+"UPDATE_POSITION";
+
+ public static final String VLC_PACKAGE = BuildConfig.APPLICATION_ID;
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
More information about the Android
mailing list