Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: purplecabbage/phonegap-plugins
base: master
...
head fork: infil00p/phonegap-plugins
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 5 files changed
  • 0 commit comments
  • 3 contributors
View
66 Android/ClipboardManager/ClipboardManagerPlugin.java
@@ -0,0 +1,66 @@
+/**
+ * Phonegap ClipboardManager plugin
+ * Omer Saatcioglu 2011
+ *
+ */
+
+package com.saatcioglu.phonegap.clipboardmanager;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+
+import android.content.Context;
+import android.text.ClipboardManager;
+
+import com.phonegap.DroidGap;
+import com.phonegap.api.Plugin;
+import com.phonegap.api.PluginResult;
+
+public class ClipboardManagerPlugin extends Plugin {
+ private static final String actionCopy = "copy";
+ private static final String actionPaste = "paste";
+ private static final String errorParse = "Couldn't get the text to copy";
+ private static final String errorUnknown = "Unknown Error";
+
+ private ClipboardManager mClipboardManager;
+
+ public void setContext(DroidGap ctx) {
+ super.setContext(ctx);
+ mClipboardManager = (ClipboardManager) ctx
+ .getSystemService(Context.CLIPBOARD_SERVICE);
+ }
+
+ /**
+ * Executes the request and returns PluginResult.
+ *
+ * @param action
+ * The action to execute.
+ * @param args
+ * JSONArry of arguments for the plugin.
+ * @param callbackId
+ * The callback id used when calling back into JavaScript.
+ * @return A PluginResult object with a status and message.
+ */
+ public PluginResult execute(String action, JSONArray args, String callbackId) {
+ if (action.equals(actionCopy)) {
+ String arg = "";
+ try {
+ arg = (String) args.get(0);
+ mClipboardManager.setText(arg);
+ } catch (JSONException e) {
+ return new PluginResult(PluginResult.Status.ERROR, errorParse);
+ } catch (Exception e) {
+ return new PluginResult(PluginResult.Status.ERROR, errorUnknown);
+ }
+ return new PluginResult(PluginResult.Status.OK, arg);
+ } else if (action.equals(actionPaste)) {
+ String arg = (String) mClipboardManager.getText();
+ if (arg == null) {
+ arg = "";
+ }
+ return new PluginResult(PluginResult.Status.OK, arg);
+ } else {
+ return new PluginResult(PluginResult.Status.INVALID_ACTION);
+ }
+ }
+}
View
61 Android/ClipboardManager/README.md
@@ -0,0 +1,61 @@
+# ClipboardManager plugin for Phonegap #
+By Omer Saatcioglu
+
+## Adding the Plugin to your project ##
+1. To install the plugin, move clipboardmanager.js to your project's www folder and include a reference to it in your html files.
+2. Create a folder called 'src/com/saatcioglu/phonegap/clipboardmanager' within your project's src folder.
+3. And copy ClipboardManagerPlugin.java into that new folder.
+
+`mkdir <your_project>/src/com/saatcioglu/phonegap/clipboardmanager`
+`cp ./ClipboardManagerPlugin.java <your_project>/src/com/beetight/barcodescanner`
+
+## Using the plugin ##
+The plugin creates the object `window.plugins.clipboardManager` with the methods
+
+`copy(str, success, fail)` that copies the given string
+`paste(success, fail)` that returns the text from the Clipboard
+
+`success` and `fail` are callback functions.
+
+An example for copy:
+
+ window.plugins.clipboardManager.copy(
+ "the text to copy",
+ function(r){alert("copy is successful")},
+ function(e){alert(e)}
+ );
+
+An example for paste:
+
+ window.plugins.clipboardManager.paste(
+ function(r){alert("The text in the clipboard is " + r)},
+ function(e){alert(e)}
+ );
+
+
+## BUGS AND CONTRIBUTIONS ##
+The latest version is available [at GitHub](https://github.com/osaatcioglu/phonegap-plugins/tree/master/Android)
+If you have a patch, fork my repo baby and send me a pull request. Submit bug reports on GitHub, please.
+
+## Licence ##
+The MIT License
+
+Copyright (c) 2010 Matt Kane
+
+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.
View
21 Android/ClipboardManager/clipboardmanager.js
@@ -0,0 +1,21 @@
+/**
+ * Phonegap ClipboardManager plugin
+ * Omer Saatcioglu 2011
+ *
+ */
+
+var ClipboardManager = function() {
+}
+
+ClipboardManager.prototype.copy = function(str, success, fail) {
+ PhoneGap.execAsync(success, fail, "ClipboardManager", "copy", [str,]);
+};
+
+ClipboardManager.prototype.paste = function(success, fail) {
+ PhoneGap.execAsync(success, fail, "ClipboardManager", "paste", []);
+};
+
+PhoneGap.addConstructor(function() {
+ PhoneGap.addPlugin('clipboardManager', new ClipboardManager());
+ PluginManager.addService("ClipboardManager","com.saatcioglu.phonegap.clipboardmanager.ClipboardManagerPlugin");
+});
View
85 iPhone/AdPlugin/SAiOSAdPlugin.m
@@ -56,19 +56,11 @@ - (void) __prepare:(BOOL)atBottom
Class adBannerViewClass = NSClassFromString(@"ADBannerView");
if (adBannerViewClass && !self.adView)
{
- self.adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
- self.adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil];
- self.adView.delegate = self;
-
- CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
- if (atBottom) {
- CGRect adViewFrame = self.adView.frame;
- adViewFrame.origin.y = [UIScreen mainScreen].bounds.size.height - statusBarHeight - adViewFrame.size.height;
- self.adView.frame = adViewFrame;
-
- self.bannerIsAtBottom = YES;
- }
-
+ adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
+ adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil];
+ adView.delegate = self;
+
+ self.bannerIsAtBottom = atBottom;
self.bannerIsVisible = NO;
self.bannerIsInitialized = YES;
}
@@ -90,55 +82,76 @@ - (void) __showAd:(BOOL)show
return;
}
- CGRect adViewFrame = self.adView.frame;
- CGRect webViewFrame = [super webView].frame;
- CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
+ CGRect adViewFrame = adView.frame;
+ CGRect webViewFrame = webView.frame;
+ CGRect screenFrame = [ [ UIScreen mainScreen ] applicationFrame ];
+
+ //CGFloat statusBarHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
+
+ [UIView beginAnimations:@"blah" context:NULL];
+ [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
if (show)
{
- if (self.bannerIsAtBottom)
+// CGFloat bannerHeight = 0.0;
+//
+// // First, setup the banner's content size and adjustment based on the current orientation
+// if(UIInterfaceOrientationIsLandscape(self.appViewController.interfaceOrientation))
+// {
+// adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
+// bannerHeight = 32.0;
+// }
+// else
+// {
+// adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
+// bannerHeight = 50.0;
+// }
+
+ adViewFrame.size.width = screenFrame.size.width;
+
+ if (self.bannerIsAtBottom)
{
- webViewFrame.size.height -= (adViewFrame.size.height + statusBarHeight);
+ adViewFrame.origin.y = screenFrame.size.height - adViewFrame.size.height;
+
+ self.adView.frame = adViewFrame;
+
}
- else
+ else // aka: at the top
{
webViewFrame.origin.y += adViewFrame.size.height;
- webViewFrame.size.height -= (adViewFrame.size.height + statusBarHeight);
}
- [UIView beginAnimations:@"blah" context:NULL];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
-
- [super webView].frame = webViewFrame;
- [[[super webView] superview] addSubview:self.adView];
- [UIView commitAnimations];
+ webViewFrame.size.height -= adViewFrame.size.height;
+ webView.frame = webViewFrame;
+ [ webView.superview addSubview:self.adView];
+
self.bannerIsVisible = YES;
}
else
{
- if (self.bannerIsAtBottom)
+ if (self.bannerIsAtBottom)
{
- webViewFrame.size.height += (adViewFrame.size.height + statusBarHeight);
+
}
- else
+ else // aka: at the top
{
- webViewFrame.origin.y -= adViewFrame.size.height;
- webViewFrame.size.height += (adViewFrame.size.height + statusBarHeight);
+ webViewFrame.origin.y = screenFrame.origin.y;
}
+
- [UIView beginAnimations:@"blah" context:NULL];
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
+ webViewFrame.size.height += adViewFrame.size.height;
- [super webView].frame = webViewFrame;
- [self.adView removeFromSuperview];
+ webView.frame = webViewFrame;
+ [ adView removeFromSuperview];
- [UIView commitAnimations];
self.bannerIsVisible = NO;
}
+ [UIView commitAnimations];
+
}
#pragma mark -
View
29 iPhone/EmailComposer/readme.txt
@@ -1,23 +1,8 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf290
-{\fonttbl\f0\fswiss\fcharset0 ArialMT;}
-{\colortbl;\red255\green255\blue255;}
-\margl1440\margr1440\vieww12240\viewh15840\viewkind1
-\deftab720
-\pard\pardeftab720\ql\qnatural
+You will need to add MessageUI.framework to your project if it is not already included.
-\f0\fs26 \cf0 \
-\
-You will need to add MessageUI.framework to your project if it is not already included.\
-\
-\pard\pardeftab720\ql\qnatural
-\cf0 Just add the .m.h files to your project ( you can add them directly to your own project, you don't need to put them in phonegap lib ).\
-\
-Place the .js file in your app root, and include it from your html.\
-\
-This is intended to also demonstrate how to pass arguments to native code using the options/map object. \'a0Please review the js file to understand the interface you can call, and reply with any questions.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\
-\
-\
-}
+Just add the .m.h files to your project ( you can add them directly to your own project, you don't need to put them in phonegap lib ).
+
+Place the .js file in your app root, and include it from your html.
+
+This is intended to also demonstrate how to pass arguments to native code using the options/map object.
+Please review the js file to understand the interface you can call, and reply with any questions.

No commit comments for this range

Something went wrong with that request. Please try again.