Skip to content

Commit c3f8772

Browse files
committed
add module
1 parent c2117a5 commit c3f8772

File tree

11 files changed

+171
-95
lines changed

11 files changed

+171
-95
lines changed

README

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
TiMob-Module-Android-Thumbnail
2+
------------------------------
3+
4+
How to use
5+
==========
6+
7+
* add project/modules/android(if !exits create dir) copy
8+
9+
* append module directive
10+
<ti:app>
11+
:
12+
:
13+
<modules>
14+
<module version="0.1">com.github.nowelium.titanium.module.thumbnail</module>
15+
</modules>
16+
</ti:app>
17+
18+
* js code
19+
20+
var thumbnail = require('com.github.nowelium.titanium.module.thumbnail');
21+
var resizedBlob = thumbnail.resize(tiblob);
22+
win.add(Ti.UI.createImageView({image: resizedBlob*)
23+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: place your license here and we'll include it in the module distribution
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<h1>thumbnail Module</h1>
2+
<h2>Description</h2>
3+
<p>TODO: Enter your module description here</p>
4+
<h2>Accessing the thumbnail Module</h2>
5+
<p>To access this module from JavaScript, you would do the following:</p>
6+
<pre><code>var thumbnail = require("com.github.nowelium.titanium.module.thumbnail");
7+
</code></pre>
8+
<p>The thumbnail variable is a reference to the Module object. </p>
9+
<h2>Reference</h2>
10+
<p>TODO: If your module has an API, you should document
11+
the reference here.</p>
12+
<h3><strong>_PROJECTNAMEASIDENTIFIER</strong>.function</h3>
13+
<p>TODO: This is an example of a module function.</p>
14+
<h3><strong>_PROJECTNAMEASIDENTIFIER</strong>.property</h3>
15+
<p>TODO: This is an example of a module property.</p>
16+
<h2>Usage</h2>
17+
<p>TODO: Enter your usage example here</p>
18+
<h2>Author</h2>
19+
<p>TODO: Enter your author name, email and other contact
20+
details you want to share here. </p>
21+
<h2>License</h2>
22+
<p>TODO: Enter your license/legal information here.</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var window = Ti.UI.createWindow({
2+
backgroundColor:'white'
3+
});
4+
var label = Ti.UI.createLabel();
5+
window.add(label);
6+
window.open();
7+
8+
var thumbnail = require('com.github.nowelium.titanium.module.thumbnail');
9+
Ti.API.info("module is => " + thumbnail);
10+
11+
var media = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'hoge.png').read();
12+
var blob_1 = thumbnail.resize(media);
13+
var blob_2 = thumbnail.resizeTo(media, {
14+
width: 32,
15+
height: 32,
16+
keepAspect: true
17+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# this is your module manifest and used by Titanium
3+
# during compilation, packaging, distribution, etc.
4+
#
5+
version: 0.1
6+
description: My module
7+
author: Your Name
8+
license: Specify your license
9+
copyright: Copyright (c) 2011 by Your Company
10+
11+
12+
# these should not be edited
13+
name: thumbnail
14+
moduleid: com.github.nowelium.titanium.module.thumbnail
15+
guid: 76655c5e-29ec-4a53-9691-7201717fcb66
16+
platform: android
17+
minsdk: 1.7.2
8.46 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ti:module xmlns:ti="http://ti.appcelerator.org" xmlns:android="http://schemas.android.com/apk/res/android">
3+
<!--
4+
Similar to tiapp.xml, but contains module/platform specific
5+
configuration in <iphone> and <android> sections
6+
-->
7+
<iphone>
8+
</iphone>
9+
<android xmlns:android="http://schemas.android.com/apk/res/android">
10+
</android>
11+
</ti:module>

dist/thumbnail.jar

8.47 KB
Binary file not shown.

example/app.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1-
// This is a test harness for your module
2-
// You should do something interesting in this harness
3-
// to test out the module and to provide instructions
4-
// to users on how to use it by example.
5-
6-
7-
// open a single window
81
var window = Ti.UI.createWindow({
92
backgroundColor:'white'
103
});
114
var label = Ti.UI.createLabel();
125
window.add(label);
136
window.open();
147

15-
// TODO: write your module tests here
168
var thumbnail = require('com.github.nowelium.titanium.module.thumbnail');
179
Ti.API.info("module is => " + thumbnail);
1810

19-
label.text = thumbnail.example();
20-
21-
Ti.API.info("module exampleProp is => " + thumbnail.exampleProp);
22-
thumbnail.exampleProp = "This is a test value";
23-
24-
if (Ti.Platform.name == "android") {
25-
var proxy = thumbnail.createExample({message: "Creating an example Proxy"});
26-
proxy.printMessage("Hello world!");
27-
}
11+
var media = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'hoge.png').read();
12+
var blob_1 = thumbnail.resize(media);
13+
var blob_2 = thumbnail.resizeTo(media, {
14+
width: 32,
15+
height: 32,
16+
keepAspect: true
17+
})

src/com/github/nowelium/titanium/module/thumbnail/ExampleProxy.java

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)