Skip to content

Commit

Permalink
Clean Build
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedMSayed committed May 11, 2019
1 parent fa2f8f0 commit 276dc03
Show file tree
Hide file tree
Showing 19 changed files with 129 additions and 326 deletions.
13 changes: 0 additions & 13 deletions android/.classpath

This file was deleted.

5 changes: 0 additions & 5 deletions android/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions android/.project

This file was deleted.

8 changes: 8 additions & 0 deletions android/Resources/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Files in this folder are copied directory into the compiled product directory
when the Android app is compiled:

<project-dir>/build/android/bin/assets/Resources/

Files in this directory are copied directly on top of whatever files are already
in the build directory, so please be careful that your files don't clobber
essential project files or files from other modules.
9 changes: 0 additions & 9 deletions android/build.properties.example

This file was deleted.

58 changes: 52 additions & 6 deletions android/build.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,56 @@
<project name="imagefactory" default="dist">
<description>
Ant build script for Titanium Android module imagefactory
</description>
<description>
Ant build script for Titanium Android module imagefactory
</description>

<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties"/>
<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties" />

<import file="${titanium.platform}/../module/android/build.xml"/>
<!-- Make sure 'architectures' is in manifest file -->
<property file="${ti.module.root}/manifest" prefix="manifest"/>
<fail message="Missing required manifest key 'architectures'.">
<condition>
<not>
<isset property="manifest.architectures"/>
</not>
</condition>
</fail>

<fail message="Manifest key 'architectures' has no value.">
<condition>
<not>
<length string="${manifest.architectures}" trim="true" when="greater" length="0"/>
</not>
</condition>
</fail>

<!-- Copy documentation subdirectories -->
<mkdir dir="${basedir}/documentation"/>
<copy todir="${basedir}/documentation">
<fileset dir="${basedir}/../documentation"/>
</copy>

<!-- Copy example subdirectories -->
<mkdir dir="${basedir}/example"/>
<copy todir="${basedir}/example">
<fileset dir="${basedir}/../example"/>
</copy>

<!-- Copy assets subdirectories -->
<mkdir dir="${basedir}/assets"/>
<copy todir="${basedir}/assets">
<fileset dir="${basedir}/../assets"/>
</copy>

<!-- Copy license -->
<copy todir="${basedir}" file="${basedir}/../LICENSE"/>

<target name="cleancopy" description="Delete old copies">
<delete dir="${basedir}/documentation"/>
<delete dir="${basedir}/example"/>
<delete dir="${basedir}/assets"/>
<delete file="${basedir}/LICENSE"/>
</target>

<import file="${titanium.platform}/../module/android/build.xml"/>
</project>
1 change: 0 additions & 1 deletion android/hooks/README

This file was deleted.

35 changes: 0 additions & 35 deletions android/hooks/add.py

This file was deleted.

19 changes: 0 additions & 19 deletions android/hooks/install.py

This file was deleted.

34 changes: 0 additions & 34 deletions android/hooks/remove.py

This file was deleted.

18 changes: 0 additions & 18 deletions android/hooks/uninstall.py

This file was deleted.

4 changes: 2 additions & 2 deletions android/lib/README
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This folder is required by the build process even if no
3rd party libraries are being used in the module.
You can place any .jar dependencies in this directory and they will be included
when your module is being compiled.
4 changes: 2 additions & 2 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 4.0.0
version: 4.1.0
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: Image Factory
Expand All @@ -13,6 +13,6 @@ copyright: Copyright (c) 2013-2017 by Appcelerator, Inc.
# these should not be edited
name: imagefactory
moduleid: ti.imagefactory
guid: 0aab25d7-0486-40ab-94a3-ed4f9a293414
guid: 7e931244-295e-45d1-8cb5-98d66b6ba18f
platform: android
minsdk: 7.0.0
3 changes: 0 additions & 3 deletions android/platform/README

This file was deleted.

Binary file removed android/screenshots/main screen.png
Binary file not shown.
Binary file removed android/screenshots/rounded corners.png
Binary file not shown.
58 changes: 57 additions & 1 deletion android/src/ti/imagefactory/ImageFactoryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;

import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.titanium.TiApplication;

import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.io.TiBaseFile;
Expand All @@ -25,6 +27,7 @@

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.media.ExifInterface;
import android.graphics.Bitmap.CompressFormat;
import android.util.Log;

Expand Down Expand Up @@ -152,7 +155,60 @@ private TiBlob imageTransform(int type, TiBlob blob, KrollDict args)
return result;
}

// Public Image Methods
private String convertPath(String path) {
if (path.startsWith("file://") || path.startsWith("content://") || path.startsWith("appdata://")
|| path.startsWith("appdata-private://")) {
path = path.replaceAll("file://", "");
path = path.replaceAll("content://", "");
path = path.replaceAll("appdata:///?", "/mnt/sdcard/" + TiApplication.getInstance().getPackageName() + "/");
path = path.replaceAll("appdata-private:///?",
"/data/data/" + TiApplication.getInstance().getPackageName() + "/app_appdata/");
}
return path;
}

// Public Image Methods
@Kroll.method
public TiBlob fixOrientation(TiBlob blob, String filename) {

ExifInterface Exif = null;
int orientation = ExifInterface.ORIENTATION_NORMAL;
KrollDict args = null;

try {
filename = convertPath(filename);
Exif = new ExifInterface(filename);
} catch (IOException e) {
Log.e(LCAT, "IO Exception occured, file probably does not exist.");
}

if (Exif != null)
orientation = Exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);

switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
args = new KrollDict();
args.put("degrees", "90");
break;
case ExifInterface.ORIENTATION_ROTATE_180:
args = new KrollDict();
args.put("degrees", "180");
break;

case ExifInterface.ORIENTATION_ROTATE_270:
args = new KrollDict();
args.put("degrees", "270");
break;
}

if (args != null) {
return imageTransform(TRANSFORM_ROTATE, blob, args);
} else {
args = new KrollDict();
args.put("degrees", "0");
return imageTransform(TRANSFORM_ROTATE, blob, args);
}
}

@Kroll.method
public TiBlob imageWithRotation(TiBlob blob, HashMap args)
Expand Down
16 changes: 8 additions & 8 deletions android/timodule.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<ti:module xmlns:ti="http://ti.appcelerator.org" xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Similar to tiapp.xml, but contains module/platform specific
configuration in <iphone> and <android> sections
-->
<iphone>
</iphone>
<android xmlns:android="http://schemas.android.com/apk/res/android">
</android>
<!--
Similar to tiapp.xml, but contains module/platform specific
configuration in <iphone> and <android> sections
-->
<iphone>
</iphone>
<android xmlns:android="http://schemas.android.com/apk/res/android">
</android>
</ti:module>
Loading

0 comments on commit 276dc03

Please sign in to comment.