You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/27 00:27:12 UTC
[03/15] git commit: [CB-4763] Remove reference to cordova-android's
FileHelper.
[CB-4763] Remove reference to cordova-android's FileHelper.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/7d62099d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/7d62099d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/7d62099d
Branch: refs/heads/master
Commit: 7d62099d7b26f18cb9ba1ec4843bb4032092af33
Parents: 883f4c6
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 9 15:06:11 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 9 15:06:11 2013 -0400
----------------------------------------------------------------------
plugin.xml | 1 +
src/android/AudioHandler.java | 1 -
src/android/FileHelper.java | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/7d62099d/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 61d1c9e..2a2552e 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -33,6 +33,7 @@ id="org.apache.cordova.core.AudioHandler"
<source-file src="src/android/AudioHandler.java" target-dir="src/org/apache/cordova/media" />
<source-file src="src/android/AudioPlayer.java" target-dir="src/org/apache/cordova/media" />
+ <source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/media" />
</platform>
<!-- ios -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/7d62099d/src/android/AudioHandler.java
----------------------------------------------------------------------
diff --git a/src/android/AudioHandler.java b/src/android/AudioHandler.java
index 7872a66..63d8580 100644
--- a/src/android/AudioHandler.java
+++ b/src/android/AudioHandler.java
@@ -18,7 +18,6 @@
*/
package org.apache.cordova.media;
-import org.apache.cordova.FileHelper;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/7d62099d/src/android/FileHelper.java
----------------------------------------------------------------------
diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java
new file mode 100644
index 0000000..e20752c
--- /dev/null
+++ b/src/android/FileHelper.java
@@ -0,0 +1,38 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+package org.apache.cordova.media;
+
+import android.net.Uri;
+
+public class FileHelper {
+
+ /**
+ * Removes the "file://" prefix from the given URI string, if applicable.
+ * If the given URI string doesn't have a "file://" prefix, it is returned unchanged.
+ *
+ * @param uriString the URI string to operate on
+ * @return a path without the "file://" prefix
+ */
+ public static String stripFileProtocol(String uriString) {
+ if (uriString.startsWith("file://")) {
+ return Uri.parse(uriString).getPath();
+ }
+ return uriString;
+ }
+}