Skip to content

Commit

Permalink
Added GCDiscreetNotification bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
dalexsoto committed Feb 15, 2013
1 parent 254e681 commit 8298d19
Show file tree
Hide file tree
Showing 19 changed files with 1,314 additions and 0 deletions.
28 changes: 28 additions & 0 deletions GCDiscreetNotification/LICENSE.txt
@@ -0,0 +1,28 @@
This control is dual licensed:

You can use it for free under the MIT licence below or, if you require non-attribution you can purchase the commercial licence available at http://www.cocoacontrols.com/authors/gcamp

---

Copyright (c) 2011 Guillaume Campagna

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.
2 changes: 2 additions & 0 deletions GCDiscreetNotification/Makefile
@@ -0,0 +1,2 @@
ASSEMBLY=GCDiscreetNotification.dll
include ../Rules.make
67 changes: 67 additions & 0 deletions GCDiscreetNotification/README.textile
@@ -0,0 +1,67 @@
h1. GCDiscreetNotificationView

GCDiscreetNotificationView is a discreet, non-modal, notification view for iOS. You can use it to show an activity or state of you app without blocking the user interactions.

!http://i.imgur.com/8vcti5u.png!

GCDiscreetNotificationView features:

* Easy to use : init and show
* Can show an activity indicator
* Two presentation mode (top and bottom)
* All properties (text, activity and presentation mode) can be changed in a animated fashion

h2. Usage

(See the demo project included)

You simply allocate the notification view with one of the following methods.

The parameters are the following :
* _text_ : the text presented on the notification
* _activity_ : if set to @YES@, the notification with show a activity indicator
* _aPresentationMode_ : the presentation mode of the notification (top or bottom)
* _aView_ : the view that will contain the notification. The view should be able to accept subviews (will not work on a @UITableView@ for example)

<pre>
- (id) initWithText:(NSString *)text inView:(UIView *)aView;
- (id) initWithText:(NSString *)text showActivity:(BOOL)activity inView:(UIView *)aView;
- (id) initWithText:(NSString *)text showActivity:(BOOL)activity inPresentationMode:(GCDiscreetNotificationViewPresentationMode) aPresentationMode inView:(UIView *)aView;
</pre>

You show or hide the notification with these methods. The @showAndDismissAutomaticallyAnimated@ will hide your notification automatically after 1 second.

<pre>
- (void) showAnimated;
- (void) hideAnimated;
- (void) hideAnimatedAfter:(NSTimeInterval) timeInterval;
- (void) show:(BOOL) animated;
- (void) hide:(BOOL) animated;
- (void) showAndDismissAutomaticallyAnimated;
- (void) showAndDismissAfter:(NSTimeInterval) timeInterval;
</pre>

You can change the text of the label of the activity viewing at any moment with these properties.

<pre>
@property (nonatomic, assign) UIView *view;
@property (nonatomic, assign) GCDiscreetNotificationViewPresentationMode presentationMode;
@property (nonatomic, copy) NSString* textLabel;
@property (nonatomic, assign) BOOL showActivity;
</pre>

These properties can be changed in a animated fashion (except the view).

<pre>
- (void) setTextLabel:(NSString *) aText animated:(BOOL) animated;
- (void) setShowActivity:(BOOL) activity animated:(BOOL) animated;
- (void) setTextLabel:(NSString *)aText andSetShowActivity:(BOOL)activity animated:(BOOL)animated;
- (void) setPresentationMode:(GCDiscreetNotificationViewPresentationMode) newPresentationMode animated:(BOOL) animated;
</pre>

You can access directly the notification's label and activity indicator. And change some propreties on that label and activity indicator. If you want to change the label's text or hide the indicator, use @textLabel@ or @showActivity@ instead.

<pre>
@property (nonatomic, retain, readonly) UILabel *label;
@property (nonatomic, retain, readonly) UIActivityIndicatorView *activityIndicator;
</pre>
76 changes: 76 additions & 0 deletions GCDiscreetNotification/binding/ApiDefinition.cs
@@ -0,0 +1,76 @@
using System;
using System.Drawing;

using MonoTouch.ObjCRuntime;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace GCDiscreetNotification
{

[BaseType (typeof (UIView))]
interface GCDiscreetNotificationView {

[Export ("label", ArgumentSemantic.Retain)]
UILabel Label { get; }

[Export ("activityIndicator", ArgumentSemantic.Retain)]
UIActivityIndicatorView ActivityIndicator { get; }

[Export ("view", ArgumentSemantic.Assign)]
UIView View { get; set; }

[Export ("presentationMode", ArgumentSemantic.Assign)]
GCDNPresentationMode PresentationMode { get; set; }

[Export ("textLabel", ArgumentSemantic.Copy)]
string TextLabel { get; set; }

[Export ("showActivity", ArgumentSemantic.Assign)]
bool ShowActivity { get; set; }

[Export ("showing")]
bool Showing { [Bind ("isShowing")] get; }

[Export ("initWithText:inView:")]
IntPtr Constructor (string text, UIView view);

[Export ("initWithText:showActivity:inView:")]
IntPtr Constructor (string text, bool activity, UIView view);

[Export ("initWithText:showActivity:inPresentationMode:inView:")]
IntPtr Constructor (string text, bool activity, GCDNPresentationMode presentationMode, UIView view);

[Export ("showAnimated")]
void ShowAnimated ();

[Export ("hideAnimated")]
void HideAnimated ();

[Export ("hideAnimatedAfter:")]
void hideAnimated (double timeInterval);

[Export ("show:")]
void Show (bool animated);

[Export ("hide:")]
void Hide (bool animated);

[Export ("showAndDismissAutomaticallyAnimated")]
void ShowAndDismissAutomaticallyAnimated ();

[Export ("showAndDismissAfter:")]
void ShowAndDismissAfter (double timeInterval);

[Export ("setTextLabel:animated:")]
void SetTextLabel (string text, bool animated);

[Export ("setShowActivity:animated:")]
void SetShowActivity (bool activity, bool animated);

[Export ("setTextLabel:andSetShowActivity:animated:")]
void SetTextLabel (string text, bool activity, bool animated);
}

}

4 changes: 4 additions & 0 deletions GCDiscreetNotification/binding/AssemblyInfo.cs
@@ -0,0 +1,4 @@
using System;
using MonoTouch.ObjCRuntime;

[assembly: LinkWith ("libGCDiscreetNotificationView.a", LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Simulator, ForceLoad = true, Frameworks = "CoreGraphics")]
11 changes: 11 additions & 0 deletions GCDiscreetNotification/binding/Makefile
@@ -0,0 +1,11 @@
BTOUCH=/Developer/MonoTouch/usr/bin/btouch
SMCS=/Developer/MonoTouch/usr/bin/smcs

all: GCDiscreetNotification.dll

GCDiscreetNotification.dll: Makefile AssemblyInfo.cs ApiDefinition.cs StructsAndEnums.cs libGCDiscreetNotificationView.a
-mkdir -p ios
$(BTOUCH) -unsafe -d:DEBUG ApiDefinition.cs -s:StructsAndEnums.cs -tmpdir:ios -sourceonly:ios/sources.list
$(SMCS) -noconfig -debug+ -debug:full -optimize- -out:GCDiscreetNotification.dll -resource:libGCDiscreetNotificationView.a AssemblyInfo.cs StructsAndEnums.cs @ios/sources.list -target:library -unsafe+ -define:DEBUG -reference:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll -reference:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll -reference:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll
clean:
-rm -rf list ios *.dll *.zip *.mdb
11 changes: 11 additions & 0 deletions GCDiscreetNotification/binding/StructsAndEnums.cs
@@ -0,0 +1,11 @@
using System;

namespace GCDiscreetNotification
{
public enum GCDNPresentationMode
{
Top,
Bottom,
}
}

Binary file not shown.
145 changes: 145 additions & 0 deletions GCDiscreetNotification/docs/ApiDefinition/Messaging.xml
@@ -0,0 +1,145 @@
<Type Name="Messaging" FullName="ApiDefinition.Messaging">
<TypeSignature Language="C#" Value="public class Messaging" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Messaging extends System.Object" />
<AssemblyInfo>
<AssemblyName>GCDiscreetNotification</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Messaging ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IntPtr_objc_msgSend_IntPtr_bool_int_IntPtr">
<MemberSignature Language="C#" Value="public static IntPtr IntPtr_objc_msgSend_IntPtr_bool_int_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1, bool arg2, int arg3, IntPtr arg4);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig pinvokeimpl (&quot;/usr/lib/libobjc.dylib&quot; as &quot;objc_msgSend&quot; winapi)native int IntPtr_objc_msgSend_IntPtr_bool_int_IntPtr(native int receiver, native int selector, native int arg1, bool arg2, int32 arg3, native int arg4) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="receiver" Type="System.IntPtr" />
<Parameter Name="selector" Type="System.IntPtr" />
<Parameter Name="arg1" Type="System.IntPtr" />
<Parameter Name="arg2" Type="System.Boolean" />
<Parameter Name="arg3" Type="System.Int32" />
<Parameter Name="arg4" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="receiver">To be added.</param>
<param name="selector">To be added.</param>
<param name="arg1">To be added.</param>
<param name="arg2">To be added.</param>
<param name="arg3">To be added.</param>
<param name="arg4">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IntPtr_objc_msgSendSuper_IntPtr_bool_int_IntPtr">
<MemberSignature Language="C#" Value="public static IntPtr IntPtr_objc_msgSendSuper_IntPtr_bool_int_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1, bool arg2, int arg3, IntPtr arg4);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig pinvokeimpl (&quot;/usr/lib/libobjc.dylib&quot; as &quot;objc_msgSendSuper&quot; winapi)native int IntPtr_objc_msgSendSuper_IntPtr_bool_int_IntPtr(native int receiver, native int selector, native int arg1, bool arg2, int32 arg3, native int arg4) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="receiver" Type="System.IntPtr" />
<Parameter Name="selector" Type="System.IntPtr" />
<Parameter Name="arg1" Type="System.IntPtr" />
<Parameter Name="arg2" Type="System.Boolean" />
<Parameter Name="arg3" Type="System.Int32" />
<Parameter Name="arg4" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="receiver">To be added.</param>
<param name="selector">To be added.</param>
<param name="arg1">To be added.</param>
<param name="arg2">To be added.</param>
<param name="arg3">To be added.</param>
<param name="arg4">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="void_objc_msgSend_IntPtr_bool_bool">
<MemberSignature Language="C#" Value="public static void void_objc_msgSend_IntPtr_bool_bool (IntPtr receiver, IntPtr selector, IntPtr arg1, bool arg2, bool arg3);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig pinvokeimpl (&quot;/usr/lib/libobjc.dylib&quot; as &quot;objc_msgSend&quot; winapi)void void_objc_msgSend_IntPtr_bool_bool(native int receiver, native int selector, native int arg1, bool arg2, bool arg3) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="receiver" Type="System.IntPtr" />
<Parameter Name="selector" Type="System.IntPtr" />
<Parameter Name="arg1" Type="System.IntPtr" />
<Parameter Name="arg2" Type="System.Boolean" />
<Parameter Name="arg3" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="receiver">To be added.</param>
<param name="selector">To be added.</param>
<param name="arg1">To be added.</param>
<param name="arg2">To be added.</param>
<param name="arg3">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="void_objc_msgSendSuper_IntPtr_bool_bool">
<MemberSignature Language="C#" Value="public static void void_objc_msgSendSuper_IntPtr_bool_bool (IntPtr receiver, IntPtr selector, IntPtr arg1, bool arg2, bool arg3);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig pinvokeimpl (&quot;/usr/lib/libobjc.dylib&quot; as &quot;objc_msgSendSuper&quot; winapi)void void_objc_msgSendSuper_IntPtr_bool_bool(native int receiver, native int selector, native int arg1, bool arg2, bool arg3) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="receiver" Type="System.IntPtr" />
<Parameter Name="selector" Type="System.IntPtr" />
<Parameter Name="arg1" Type="System.IntPtr" />
<Parameter Name="arg2" Type="System.Boolean" />
<Parameter Name="arg3" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="receiver">To be added.</param>
<param name="selector">To be added.</param>
<param name="arg1">To be added.</param>
<param name="arg2">To be added.</param>
<param name="arg3">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>
@@ -0,0 +1,45 @@
<Type Name="GCDNPresentationMode" FullName="GCDiscreetNotification.GCDNPresentationMode">
<TypeSignature Language="C#" Value="public enum GCDNPresentationMode" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed GCDNPresentationMode extends System.Enum" />
<AssemblyInfo>
<AssemblyName>GCDiscreetNotification</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Enum</BaseTypeName>
</Base>
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="Bottom">
<MemberSignature Language="C#" Value="Bottom" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype GCDiscreetNotification.GCDNPresentationMode Bottom = int32(1)" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>GCDiscreetNotification.GCDNPresentationMode</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added.</summary>
</Docs>
</Member>
<Member MemberName="Top">
<MemberSignature Language="C#" Value="Top" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype GCDiscreetNotification.GCDNPresentationMode Top = int32(0)" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>GCDiscreetNotification.GCDNPresentationMode</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added.</summary>
</Docs>
</Member>
</Members>
</Type>

0 comments on commit 8298d19

Please sign in to comment.