Skip to content

Commit 49f4cfd

Browse files
committed
Initial android version.
1 parent b36f15f commit 49f4cfd

File tree

30 files changed

+531
-0
lines changed

30 files changed

+531
-0
lines changed

android/.project

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>TiImageCropper</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.appcelerator.titanium.core.builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>com.aptana.ide.core.unifiedBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.jdt.core.javabuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.jdt.core.javanature</nature>
26+
<nature>com.appcelerator.titanium.mobile.module.nature</nature>
27+
<nature>com.aptana.projects.webnature</nature>
28+
</natures>
29+
</projectDescription>

android/LICENSE

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

android/assets/README

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Place your assets like PNG files in this directory and they will be packaged
2+
with your module.
3+
4+
All JavaScript files in the assets directory are IGNORED except if you create a
5+
file named "se.hyperlab.imagecropper.js" in this directory in which case it will be
6+
wrapped by native code, compiled, and used as your module. This allows you to
7+
run pure JavaScript modules that are pre-compiled.
8+
9+
Note: Mobile Web does not support this assets directory.

android/build.xml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<project name="tiimagecropper" default="dist">
2+
<description>
3+
Ant build script for Titanium Android module TiImageCropper
4+
</description>
5+
6+
<property name="ti.module.root" location="${basedir}"/>
7+
<property file="build.properties" />
8+
9+
<!-- Make sure 'architectures' is in manifest file -->
10+
<property file="${ti.module.root}/manifest" prefix="manifest"/>
11+
<fail message="Missing required manifest key 'architectures'.">
12+
<condition>
13+
<not>
14+
<isset property="manifest.architectures"/>
15+
</not>
16+
</condition>
17+
</fail>
18+
19+
<fail message="Manifest key 'architectures' has no value.">
20+
<condition>
21+
<not>
22+
<length string="${manifest.architectures}" trim="true" when="greater" length="0"/>
23+
</not>
24+
</condition>
25+
</fail>
26+
27+
<!-- Copy documentation subdirectories -->
28+
<mkdir dir="${basedir}/documentation"/>
29+
<copy todir="${basedir}/documentation">
30+
<fileset dir="${basedir}/../documentation"/>
31+
</copy>
32+
33+
<!-- Copy example subdirectories -->
34+
<mkdir dir="${basedir}/example"/>
35+
<copy todir="${basedir}/example">
36+
<fileset dir="${basedir}/../example"/>
37+
</copy>
38+
39+
<!-- Copy assets subdirectories -->
40+
<mkdir dir="${basedir}/assets"/>
41+
<copy todir="${basedir}/assets">
42+
<fileset dir="${basedir}/../assets"/>
43+
</copy>
44+
45+
<!-- Copy license -->
46+
<copy todir="${basedir}" file="${basedir}/../LICENSE"/>
47+
48+
<target name="cleancopy" description="Delete old copies">
49+
<delete dir="${basedir}/documentation"/>
50+
<delete dir="${basedir}/example"/>
51+
<delete dir="${basedir}/assets"/>
52+
<delete file="${basedir}/LICENSE"/>
53+
</target>
54+
55+
<import file="${titanium.platform}/../module/android/build.xml"/>
56+
</project>

android/documentation/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# TiImageCropper Module
2+
3+
## Description
4+
5+
TODO: Enter your module description here
6+
7+
## Accessing the TiImageCropper Module
8+
9+
To access this module from JavaScript, you would do the following:
10+
11+
var tiimagecropper = require("se.hyperlab.imagecropper");
12+
13+
The tiimagecropper variable is a reference to the Module object.
14+
15+
## Reference
16+
17+
TODO: If your module has an API, you should document
18+
the reference here.
19+
20+
### tiimagecropper.function
21+
22+
TODO: This is an example of a module function.
23+
24+
### tiimagecropper.property
25+
26+
TODO: This is an example of a module property.
27+
28+
## Usage
29+
30+
TODO: Enter your usage example here
31+
32+
## Author
33+
34+
TODO: Enter your author name, email and other contact
35+
details you want to share here.
36+
37+
## License
38+
39+
TODO: Enter your license/legal information here.

android/example/app.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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
8+
var win = Ti.UI.createWindow({
9+
backgroundColor:'white'
10+
});
11+
var label = Ti.UI.createLabel();
12+
win.add(label);
13+
win.open();
14+
15+
// TODO: write your module tests here
16+
var tiimagecropper = require('se.hyperlab.imagecropper');
17+
Ti.API.info("module is => " + tiimagecropper);
18+
19+
label.text = tiimagecropper.example();
20+
21+
Ti.API.info("module exampleProp is => " + tiimagecropper.exampleProp);
22+
tiimagecropper.exampleProp = "This is a test value";
23+
24+
if (Ti.Platform.name == "android") {
25+
var proxy = tiimagecropper.createExample({
26+
message: "Creating an example Proxy",
27+
backgroundColor: "red",
28+
width: 100,
29+
height: 100,
30+
top: 100,
31+
left: 150
32+
});
33+
34+
proxy.printMessage("Hello world!");
35+
proxy.message = "Hi world!. It's me again.";
36+
proxy.printMessage("Hello world!");
37+
win.add(proxy);
38+
}
39+

android/lib/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
You can place any .jar dependencies in this directory and they will be included
2+
when your module is being compiled.

android/lib/android-crop-0.9.10.jar

43.1 KB
Binary file not shown.

android/manifest

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# this is your module manifest and used by Titanium
3+
# during compilation, packaging, distribution, etc.
4+
#
5+
version: 1.0.0
6+
apiversion: 2
7+
architectures: armeabi armeabi-v7a x86
8+
description: TiImageCropper
9+
author: Jonatan Lundin
10+
license: MIT
11+
copyright: Copyright (c) 2015 by Hyperlab AB
12+
13+
respackage: com.soundcloud.android.crop
14+
15+
# these should not be edited
16+
name: TiImageCropper
17+
moduleid: se.hyperlab.imagecropper
18+
guid: 3f9278fb-c443-430a-8b6c-e7ee932b746c
19+
platform: android
20+
minsdk: 3.4.1.GA

android/platform/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module.
2+
3+
When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<selector xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
5+
6+
<item android:state_pressed="true">
7+
<shape>
8+
<solid android:color="@color/crop__selector_pressed" />
9+
</shape>
10+
</item>
11+
12+
<item android:state_focused="true">
13+
<shape>
14+
<solid android:color="@color/crop__selector_focused" />
15+
</shape>
16+
</item>
17+
18+
<item android:drawable="@android:color/transparent" />
19+
20+
</selector><!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/drawable/crop__selectable_background.xml -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:src="@drawable/crop__tile"
5+
android:tileMode="repeat" /><!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/drawable/crop__texture.xml -->
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<RelativeLayout
4+
xmlns:android="http://schemas.android.com/apk/res/android"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent">
7+
8+
<include
9+
android:id="@+id/done_cancel_bar"
10+
layout="@layout/crop__layout_done_cancel" />
11+
12+
<com.soundcloud.android.crop.CropImageView
13+
android:id="@+id/crop_image"
14+
android:layout_width="match_parent"
15+
android:layout_height="match_parent"
16+
android:background="@drawable/crop__texture"
17+
android:layout_below="@id/done_cancel_bar" />
18+
19+
</RelativeLayout><!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/layout/crop__activity_crop.xml -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
style="@style/Crop.DoneCancelBar">
3+
4+
<FrameLayout
5+
android:id="@+id/btn_cancel"
6+
style="@style/Crop.ActionButton">
7+
<TextView style="@style/Crop.ActionButtonText.Cancel" />
8+
</FrameLayout>
9+
10+
<FrameLayout
11+
android:id="@+id/btn_done"
12+
style="@style/Crop.ActionButton">
13+
<TextView style="@style/Crop.ActionButtonText.Done" />
14+
</FrameLayout>
15+
16+
</LinearLayout>
17+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/layout/crop__layout_done_cancel.xml -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values-land/dimens.xml -->
5+
<eat-comment />
6+
7+
<dimen name="crop__bar_height">40dp</dimen>
8+
9+
</resources>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values-large-land/dimens.xml -->
5+
<eat-comment />
6+
7+
<dimen name="crop__bar_height">56dp</dimen>
8+
9+
</resources>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values-large/dimens.xml -->
5+
<eat-comment />
6+
7+
<dimen name="crop__bar_height">56dp</dimen>
8+
9+
</resources>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources xmlns:ns1="http://schemas.android.com/tools">
3+
4+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/attrs.xml -->
5+
<eat-comment />
6+
7+
<attr name="cropImageStyle" format="reference" />
8+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/colors.xml -->
9+
<eat-comment />
10+
11+
<color name="crop__button_bar">#f3f3f3</color>
12+
<color name="crop__button_text">#666666</color>
13+
<color name="crop__selector_focused">#77000000</color>
14+
<color name="crop__selector_pressed">#1a000000</color>
15+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/attrs.xml -->
16+
<eat-comment />
17+
18+
<declare-styleable name="CropImageView">
19+
<attr name="highlightColor" format="reference|color" />
20+
<attr name="showThirds" format="boolean" />
21+
<attr name="showHandles">
22+
<enum name="changing" value="0" />
23+
<enum name="always" value="1" />
24+
<enum name="never" value="2" />
25+
</attr>
26+
</declare-styleable>
27+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/dimens.xml -->
28+
<eat-comment />
29+
30+
<dimen name="crop__bar_height">48dp</dimen>
31+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/strings.xml -->
32+
<eat-comment />
33+
34+
<string name="crop__cancel" ns1:ignore="ButtonCase">CANCEL</string>
35+
<string name="crop__done">DONE</string>
36+
<string name="crop__pick_error">No image sources available</string>
37+
<string name="crop__saving">Saving picture…</string>
38+
<string name="crop__wait">Please wait…</string>
39+
<!-- From: file:/Users/James/dev/sc/android-crop/lib/src/main/res/values/styles.xml -->
40+
<eat-comment />
41+
42+
<style name="Crop" />
43+
44+
<style name="Crop.ActionButton">
45+
<item name="android:layout_width">0dp</item>
46+
<item name="android:layout_height">match_parent</item>
47+
<item name="android:layout_weight">1</item>
48+
<item name="android:background">@drawable/crop__selectable_background</item>
49+
</style>
50+
51+
<style name="Crop.ActionButtonText">
52+
<item name="android:layout_width">wrap_content</item>
53+
<item name="android:layout_height">wrap_content</item>
54+
<item name="android:layout_gravity">center</item>
55+
<item name="android:gravity">center_vertical</item>
56+
<item name="android:paddingRight">20dp</item> <!-- Offsets left drawable -->
57+
<item name="android:drawablePadding">8dp</item>
58+
<item name="android:textColor">@color/crop__button_text</item>
59+
<item name="android:textStyle">bold</item>
60+
<item name="android:textSize">13sp</item>
61+
</style>
62+
63+
<style name="Crop.ActionButtonText.Cancel">
64+
<item name="android:drawableLeft">@drawable/crop__ic_cancel</item>
65+
<item name="android:text">@string/crop__cancel</item>
66+
</style>
67+
68+
<style name="Crop.ActionButtonText.Done">
69+
<item name="android:drawableLeft">@drawable/crop__ic_done</item>
70+
<item name="android:text">@string/crop__done</item>
71+
</style>
72+
73+
<style name="Crop.DoneCancelBar">
74+
<item name="android:layout_width">match_parent</item>
75+
<item name="android:layout_height">@dimen/crop__bar_height</item>
76+
<item name="android:orientation">horizontal</item>
77+
<item name="android:divider">@drawable/crop__divider</item>
78+
<item name="android:showDividers" ns1:ignore="NewApi">middle</item>
79+
<item name="android:dividerPadding" ns1:ignore="NewApi">12dp</item>
80+
<item name="android:background">@color/crop__button_bar</item>
81+
</style>
82+
83+
</resources>

0 commit comments

Comments
 (0)