Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuyukitanimura committed May 15, 2014
0 parents commit 6d2664a
Show file tree
Hide file tree
Showing 33 changed files with 1,559 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tmp
bin
build
*.zip
2 changes: 2 additions & 0 deletions Classes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ComLimilyVerticalscrollableview.h
ComLimilyVerticalscrollableview.m
13 changes: 13 additions & 0 deletions Classes/ComLimilyVerticalscrollableviewModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Copyright (C) 2014 limily.com All rights reserved
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
#import "TiModule.h"

@interface ComLimilyVerticalscrollableviewModule : TiModule
{
}

@end
106 changes: 106 additions & 0 deletions Classes/ComLimilyVerticalscrollableviewModule.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* Copyright (C) 2014 limily.com All rights reserved
*
* Appcelerator Titanium is Copyright (c) 2009-2010 by Appcelerator, Inc.
* and licensed under the Apache Public License (version 2)
*/
#import "ComLimilyVerticalscrollableviewModule.h"
#import "TiBase.h"
#import "TiHost.h"
#import "TiUtils.h"

@implementation ComLimilyVerticalscrollableviewModule

#pragma mark Internal

// this is generated for your module, please do not change it
-(id)moduleGUID
{
return @"3f7b28e1-3e3a-491f-a373-168fd5d52152";
}

// this is generated for your module, please do not change it
-(NSString*)moduleId
{
return @"com.limily.verticalscrollableview";
}

#pragma mark Lifecycle

-(void)startup
{
// this method is called when the module is first loaded
// you *must* call the superclass
[super startup];

NSLog(@"[INFO] %@ loaded",self);
}

-(void)shutdown:(id)sender
{
// this method is called when the module is being unloaded
// typically this is during shutdown. make sure you don't do too
// much processing here or the app will be quit forceably

// you *must* call the superclass
[super shutdown:sender];
}

#pragma mark Cleanup

-(void)dealloc
{
// release any resources that have been retained by the module
[super dealloc];
}

#pragma mark Internal Memory Management

-(void)didReceiveMemoryWarning:(NSNotification*)notification
{
// optionally release any resources that can be dynamically
// reloaded once memory is available - such as caches
[super didReceiveMemoryWarning:notification];
}

#pragma mark Listener Notifications

-(void)_listenerAdded:(NSString *)type count:(int)count
{
if (count == 1 && [type isEqualToString:@"my_event"])
{
// the first (of potentially many) listener is being added
// for event named 'my_event'
}
}

-(void)_listenerRemoved:(NSString *)type count:(int)count
{
if (count == 0 && [type isEqualToString:@"my_event"])
{
// the last listener called for event named 'my_event' has
// been removed, we can optionally clean up any resources
// since no body is listening at this point for that event
}
}

//#pragma Public APIs
//
//-(id)example:(id)args
//{
// // example method
// return @"hello world";
//}
//
//-(id)exampleProp
//{
// // example property getter
// return @"hello world";
//}
//
//-(void)setExampleProp:(id)value
//{
// // example property setter
//}

@end
11 changes: 11 additions & 0 deletions Classes/ComLimilyVerticalscrollableviewModuleAssets.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* This is a generated file. Do not edit or your changes will be lost
*/

@interface ComLimilyVerticalscrollableviewModuleAssets : NSObject
{
}
- (NSData*) moduleAsset;
- (NSData*) resolveModuleAsset:(NSString*)path;

@end
26 changes: 26 additions & 0 deletions Classes/ComLimilyVerticalscrollableviewModuleAssets.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* This is a generated file. Do not edit or your changes will be lost
*/
#import "ComLimilyVerticalscrollableviewModuleAssets.h"

extern NSData* filterDataInRange(NSData* thedata, NSRange range);

@implementation ComLimilyVerticalscrollableviewModuleAssets

- (NSData*) moduleAsset
{
//##TI_AUTOGEN_BEGIN asset
//Compiler generates code for asset here
return nil; // DEFAULT BEHAVIOR
//##TI_AUTOGEN_END asset
}

- (NSData*) resolveModuleAsset:(NSString*)path
{
//##TI_AUTOGEN_BEGIN resolve_asset
//Compiler generates code for asset resolution here
return nil; // DEFAULT BEHAVIOR
//##TI_AUTOGEN_END resolve_asset
}

@end
15 changes: 15 additions & 0 deletions Classes/TiUIScrollableViewProxy+Extend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// TiUIScrollableViewProxy+Extend.h
// VerticalScrollableView
//
// Created by Kazuyuki Tanimura on 5/12/14.
//
//

#import "TiViewProxy.h"
#import "TiUiScrollableViewProxy.h"
#import "TiUIScrollableView.h"

@interface TiUIScrollableViewProxy (Extend)

@end
38 changes: 38 additions & 0 deletions Classes/TiUIScrollableViewProxy+Extend.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// TiUIScrollableViewProxy+Extend.m
// VerticalScrollableView
//
// Created by Kazuyuki Tanimura on 5/12/14.
//
//

#import "TiUIScrollableViewProxy+Extend.h"

@implementation TiUIScrollableViewProxy (Extend)

-(void)shiftView:(id)args
{
if ([viewProxies count] == 0)
{
return;
}

[self lockViewsForWriting];
TiViewProxy * doomedView;
doomedView = [viewProxies objectAtIndex:0];

[doomedView setParent:nil];
TiThreadPerformOnMainThread(^{[doomedView detachView];}, NO);
[self forgetProxy:doomedView];
[viewProxies removeObject:doomedView];
[self unlockViews];
int index = [TiUtils intValue:[self valueForUndefinedKey:@"currentPage"]];
if (index > 0) {
index--;
}
TiThreadPerformOnMainThread(^{
[((TiUIScrollableView*)self.view) setCurrentPage_:NUMINT(index)];
}, NO);
}

@end
4 changes: 4 additions & 0 deletions ComLimilyVerticalscrollableview_Prefix.pch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: place your license here and we'll include it in the module distribution
151 changes: 151 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
Appcelerator Titanium iPhone Module Project
===========================================

This is a skeleton Titanium Mobile iPhone module project. Modules can be
used to extend the functionality of Titanium by providing additional native
code that is compiled into your application at build time and can expose certain
APIs into JavaScript.

MODULE NAMING
--------------

Choose a unique module id for your module. This ID usually follows a namespace
convention using DNS notation. For example, com.appcelerator.module.test. This
ID can only be used once by all public modules in Titanium.


COMPONENTS
-----------

Components that are exposed by your module must follow a special naming convention.
A component (widget, proxy, etc) must be named with the pattern:

Ti<ModuleName><ComponentName>Proxy

For example, if you component was called Foo, your proxy would be named:

TiMyfirstFooProxy

For view proxies or widgets, you must create both a view proxy and a view implementation.
If you widget was named proxy, you would create the following files:

TiMyfirstFooProxy.h
TiMyfirstFooProxy.m
TiMyfirstFoo.h
TiMyfirstFoo.m

The view implementation is named the same except it does contain the suffix `Proxy`.

View implementations extend the Titanium base class `TiUIView`. View Proxies extend the
Titanium base class `TiUIViewProxy` or `TiUIWidgetProxy`.

For proxies that are simply native objects that can be returned to JavaScript, you can
simply extend `TiProxy` and no view implementation is required.


GET STARTED
------------

1. Edit manifest with the appropriate details about your module.
2. Edit LICENSE to add your license details.
3. Place any assets (such as PNG files) that are required in the assets folder.
4. Edit the titanium.xcconfig and make sure you're building for the right Titanium version.
5. Code and build.

BUILD TIME COMPILER CONFIG
--------------------------

You can edit the file `module.xcconfig` to include any build time settings that should be
set during application compilation that your module requires. This file will automatically get `#include` in the main application project.

For more information about this file, please see the Apple documentation at:

<http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeBuildSystem/400-Build_Configurations/build_configs.html>


DOCUMENTATION FOR YOUR MODULE
-----------------------------

You should provide at least minimal documentation for your module in `documentation` folder using the Markdown syntax.

For more information on the Markdown syntax, refer to this documentation at:

<http://daringfireball.net/projects/markdown/>


TEST HARNESS EXAMPLE FOR YOUR MODULE
------------------------------------

The `example` directory contains a skeleton application test harness that can be
used for testing and providing an example of usage to the users of your module.


INSTALL YOUR MODULE
--------------------

1. Run `build.py` which creates your distribution
2. cd to `/Library/Application Support/Titanium`
3. copy this zip file into the folder of your Titanium SDK

REGISTER YOUR MODULE
---------------------

Register your module with your application by editing `tiapp.xml` and adding your module.
Example:

<modules>
<module version="0.1">com.limily.verticalscrollableview</module>
</modules>

When you run your project, the compiler will know automatically compile in your module
dependencies and copy appropriate image assets into the application.

USING YOUR MODULE IN CODE
-------------------------

To use your module in code, you will need to require it.

For example,

var my_module = require('com.limily.verticalscrollableview');
my_module.foo();

WRITING PURE JS NATIVE MODULES
------------------------------

You can write a pure JavaScript "natively compiled" module. This is nice if you
want to distribute a JS module pre-compiled.

To create a module, create a file named com.limily.verticalscrollableview.js under the assets folder.
This file must be in the Common JS format. For example:

exports.echo = function(s)
{
return s;
};

Any functions and properties that are exported will be made available as part of your
module. All other code inside your JS will be private to your module.

For pure JS module, you don't need to modify any of the Objective-C module code. You
can leave it as-is and build.

TESTING YOUR MODULE
-------------------

Run the `titanium.py` script to test your module or test from within XCode.
To test with the script, execute:

titanium run --dir=YOURMODULEDIR


This will execute the app.js in the example folder as a Titanium application.


DISTRIBUTING YOUR MODULE
-------------------------

Currently, you will need to manually distribution your module distribution zip file directly. However, in the near future, we will make module distribution and sharing built-in to Titanium Developer and in the Titanium Marketplace!


Cheers!
Loading

0 comments on commit 6d2664a

Please sign in to comment.