cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject [21/50] cordova-plugin-screen-orientation git commit: Initial npm plugin support
Date Mon, 23 May 2016 13:42:19 GMT
Initial npm plugin support


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/commit/503a3806
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/tree/503a3806
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/diff/503a3806

Branch: refs/heads/master
Commit: 503a380624d63b86e87e347002000de31cfa4fba
Parents: 4c86a0d
Author: Grant Benvenuti <g.benvenuti@pni.com.au>
Authored: Wed May 20 13:54:47 2015 +1000
Committer: Grant Benvenuti <g.benvenuti@pni.com.au>
Committed: Wed May 20 13:54:47 2015 +1000

----------------------------------------------------------------------
 package.json                                    |  32 ++++++
 plugin.xml                                      |   6 +-
 src/android/YoikScreenOrientation.java          | 103 +++++++++++++++++++
 .../YoikScreenOrientation.java                  | 103 -------------------
 4 files changed, 138 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/503a3806/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..deedbed
--- /dev/null
+++ b/package.json
@@ -0,0 +1,32 @@
+{
+  "name": "cordova-plugin-screen-orientaion",
+  "version": "1.3.5",
+  "description": "Adds Screen Orientation API lock and unlock functions to the global screen
object in android, iOS, WP8 and BB10.",
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/gbenvenuti/cordova-plugin-screen-orientation.git"
+  },
+  "cordova": {
+    "id": "cordova-plugin-screen-orientaion",
+    "platforms": [
+      "android",
+      "ios",
+      "wp8"
+    ]
+  },
+  "keywords": [
+    "cordova",
+    "device",
+    "ecosystem:cordova",
+    "screen",
+    "orientation",
+    "portrait",
+    "landscape"
+  ],
+  "author": "gbenvenuti",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/gbenvenuti/cordova-plugin-screen-orientation/issues"
+  },
+  "homepage": "https://github.com/gbenvenuti/cordova-plugin-screen-orientation#readme"
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/503a3806/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 0424eb8..d1d3775 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
     xmlns:android="http://schemas.android.com/apk/res/android"
-    id="net.yoik.cordova.plugins.screenorientation"
-    version="1.3.4">
+    id="cordova-plugin-screen-orientation"
+    version="1.3.5">
 
     <name>Screen Orientation</name>
     <description>Adds Screen Orientation API lock and unlock functions to the global
screen object in android, iOS, WP8 and BB10.</description>
@@ -30,7 +30,7 @@
     </platform>
 
     <platform name="android">
-        <source-file src="src/android/net/yoik/cordova/plugins/screenorientation/YoikScreenOrientation.java"
target-dir="src/net/yoik/cordova/plugins/screenorientation/" />
+        <source-file src="src/android/YoikScreenOrientation.java" target-dir="src/net/yoik/cordova/plugins/screenorientation/"
/>
 
         <config-file target="res/xml/config.xml" parent="/*">
             <feature name="YoikScreenOrientation">

http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/503a3806/src/android/YoikScreenOrientation.java
----------------------------------------------------------------------
diff --git a/src/android/YoikScreenOrientation.java b/src/android/YoikScreenOrientation.java
new file mode 100644
index 0000000..bce750b
--- /dev/null
+++ b/src/android/YoikScreenOrientation.java
@@ -0,0 +1,103 @@
+/*
+The MIT License (MIT)
+
+Copyright (c) 2014
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+ */
+package net.yoik.cordova.plugins.screenorientation;
+
+import org.apache.cordova.CallbackContext;
+import org.apache.cordova.CordovaPlugin;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.util.Log;
+
+public class YoikScreenOrientation extends CordovaPlugin {
+
+    private static final String TAG = "YoikScreenOrientation";
+
+    /**
+     * Screen Orientation Constants
+     */
+
+    private static final String UNLOCKED = "unlocked";
+    private static final String PORTRAIT_PRIMARY = "portrait-primary";
+    private static final String PORTRAIT_SECONDARY = "portrait-secondary";
+    private static final String LANDSCAPE_PRIMARY = "landscape-primary";
+    private static final String LANDSCAPE_SECONDARY = "landscape-secondary";
+    private static final String PORTRAIT = "portrait";
+    private static final String LANDSCAPE = "landscape";
+
+    @Override
+    public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
{
+
+        Log.d(TAG, "execute action: " + action);
+
+        // Route the Action
+        if (action.equals("screenOrientation")) {
+            return routeScreenOrientation(args, callbackContext);
+        }
+
+        // Action not found
+        callbackContext.error("action not recognised");
+        return false;
+    }
+
+    private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext)
{
+
+        String action = args.optString(0);
+
+        if (action.equals("set")) {
+
+            String orientation = args.optString(1);
+
+            Log.d(TAG, "Requested ScreenOrientation: " + orientation);
+
+            Activity activity = cordova.getActivity();
+
+            if (orientation.equals(UNLOCKED)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+            } else if (orientation.equals(LANDSCAPE_PRIMARY)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+            } else if (orientation.equals(PORTRAIT_PRIMARY)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+            } else if (orientation.equals(LANDSCAPE)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
+            } else if (orientation.equals(PORTRAIT)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
+            } else if (orientation.equals(LANDSCAPE_SECONDARY)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
+            } else if (orientation.equals(PORTRAIT_SECONDARY)) {
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
+            }
+
+            callbackContext.success();
+            return true;
+
+        } else {
+            callbackContext.error("ScreenOrientation not recognised");
+            return false;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugin-screen-orientation/blob/503a3806/src/android/net/yoik/cordova/plugins/screenorientation/YoikScreenOrientation.java
----------------------------------------------------------------------
diff --git a/src/android/net/yoik/cordova/plugins/screenorientation/YoikScreenOrientation.java
b/src/android/net/yoik/cordova/plugins/screenorientation/YoikScreenOrientation.java
deleted file mode 100644
index bce750b..0000000
--- a/src/android/net/yoik/cordova/plugins/screenorientation/YoikScreenOrientation.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-The MIT License (MIT)
-
-Copyright (c) 2014
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
- */
-package net.yoik.cordova.plugins.screenorientation;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaPlugin;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-
-import android.app.Activity;
-import android.content.pm.ActivityInfo;
-import android.util.Log;
-
-public class YoikScreenOrientation extends CordovaPlugin {
-
-    private static final String TAG = "YoikScreenOrientation";
-
-    /**
-     * Screen Orientation Constants
-     */
-
-    private static final String UNLOCKED = "unlocked";
-    private static final String PORTRAIT_PRIMARY = "portrait-primary";
-    private static final String PORTRAIT_SECONDARY = "portrait-secondary";
-    private static final String LANDSCAPE_PRIMARY = "landscape-primary";
-    private static final String LANDSCAPE_SECONDARY = "landscape-secondary";
-    private static final String PORTRAIT = "portrait";
-    private static final String LANDSCAPE = "landscape";
-
-    @Override
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
{
-
-        Log.d(TAG, "execute action: " + action);
-
-        // Route the Action
-        if (action.equals("screenOrientation")) {
-            return routeScreenOrientation(args, callbackContext);
-        }
-
-        // Action not found
-        callbackContext.error("action not recognised");
-        return false;
-    }
-
-    private boolean routeScreenOrientation(JSONArray args, CallbackContext callbackContext)
{
-
-        String action = args.optString(0);
-
-        if (action.equals("set")) {
-
-            String orientation = args.optString(1);
-
-            Log.d(TAG, "Requested ScreenOrientation: " + orientation);
-
-            Activity activity = cordova.getActivity();
-
-            if (orientation.equals(UNLOCKED)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
-            } else if (orientation.equals(LANDSCAPE_PRIMARY)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-            } else if (orientation.equals(PORTRAIT_PRIMARY)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-            } else if (orientation.equals(LANDSCAPE)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
-            } else if (orientation.equals(PORTRAIT)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
-            } else if (orientation.equals(LANDSCAPE_SECONDARY)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
-            } else if (orientation.equals(PORTRAIT_SECONDARY)) {
-                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
-            }
-
-            callbackContext.success();
-            return true;
-
-        } else {
-            callbackContext.error("ScreenOrientation not recognised");
-            return false;
-        }
-    }
-}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message