Skip to content

Commit

Permalink
Merge pull request #80 from dlifshitz-maca/sync_01_2101a385
Browse files Browse the repository at this point in the history
TIMOB-9369: BlackBerry: merge BB fork with appcelerator branch
  • Loading branch information
dlifshitz-maca committed Jun 19, 2012
2 parents d4f7b69 + 58b5f67 commit 14d20c9
Show file tree
Hide file tree
Showing 949 changed files with 33,236 additions and 121,264 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
======================================
Appcelerator Titanium Mobile
Copyright 2008-2011 Appcelerator, Inc.
Copyright 2008-2012 Appcelerator, Inc.
======================================

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For details on Titanium, please see <http://www.appcelerator.com>.
Legal Stuff
-------------

Copyright (C) 2009-2011 by Appcelerator, Inc. All Rights Reserved.
Copyright (C) 2008-2012 by Appcelerator, Inc. All Rights Reserved.
For more information, please visit <http://www.appcelerator.com>.
Appcelerator, Titanium and logos are trademarks of Appcelerator, Inc.

Expand Down
4 changes: 3 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ if build_type in ['full', 'android'] and not only_package:
os.chdir('android')
try:
sdk = AndroidSDK(ARGUMENTS.get("android_sdk", None), 8)
build_x86 = int(ARGUMENTS.get('build_x86', 1))

# TODO re-enable javadoc targets = ["full.build", "build.titanium.javadoc"]
targets = ["full.build"]
if clean: targets = ["clean"]
Expand All @@ -109,7 +111,7 @@ if build_type in ['full', 'android'] and not only_package:

ant.build(targets=targets, properties={"build.version": version, "build.githash": githash,
"android.sdk": sdk.get_android_sdk(), "android.platform": sdk.get_platform_dir(), "google.apis": sdk.get_google_apis_dir(),
"ndk.build.args": "JAVAH=%s" % javah_path })
"ndk.build.args": "JAVAH=%s" % javah_path, "kroll.v8.build.x86": build_x86 })
finally:
os.chdir(d)

Expand Down
37 changes: 29 additions & 8 deletions android/build/common.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Appcelerator Titanium Mobile
Copyright (c) 2010, 2011 by Appcelerator, Inc. All Rights Reserved.
Copyright (c) 2010-2012 by Appcelerator, Inc. All Rights Reserved.
Licensed under the terms of the Apache Public License
Please see the LICENSE included with this distribution for details.
Expand Down Expand Up @@ -121,8 +121,10 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
</else>
</if>

<property name="android.jar" location="${android.platform}/android.jar"/>

<path id="android">
<pathelement path="${android.platform}/android.jar"/>
<pathelement path="${android.jar}"/>
<pathelement path="${google.apis}/libs/maps.jar"/>
</path>

Expand Down Expand Up @@ -167,6 +169,7 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<javac destdir="@{build.dir}"
includes="@{includes}"
excludes="@{excludes}"
target="1.6"
source="1.6"
debug="@{debug}"
includeantruntime="false">
Expand Down Expand Up @@ -385,20 +388,26 @@ Common ant tasks and macros for building Android-based Titanium modules and proj

<target name="build.kroll.v8.so" depends="generate.kroll.v8.bindings">
<property name="ndk.build.args" value=""/>
<property name="kroll.v8.build.x86" value=""/>
<exec executable="${ndk.build}" dir="${kroll.v8.project.dir}" failonerror="true">
<env key="ANDROID_NDK" file="${android.ndk}"/>
<env key="ANDROID_PLATFORM" file="${android.platform}"/>
<env key="BUILD_X86" value="${kroll.v8.build.x86}"/>
<arg value="TI_DEBUG=${ti.debug}"/>
<arg line="${ndk.build.args}"/>
</exec>
<copy todir="${dist.dir}">
<fileset dir="${kroll.v8.project.dir}" includes="libs/armeabi*/lib*.so"/>
<fileset dir="${kroll.v8.project.dir}" includes="libs/**/lib*.so"/>
</copy>
</target>

<target name="build.kroll.common.jar">
<property name="kroll.common.classes.dir" location="${dist.classes.dir}/kroll-common"/>
<mkdir dir="${kroll.common.classes.dir}"/>
<javac srcdir="${kroll.common.project.dir}/src/java" destdir="${kroll.common.classes.dir}" debug="true">
<javac srcdir="${kroll.common.project.dir}/src/java"
destdir="${kroll.common.classes.dir}" debug="true"
source="1.6" target="1.6"
includeantruntime="false">
<classpath refid="android"/>
</javac>

Expand All @@ -409,7 +418,9 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<import file="${kroll.rhino.project.dir}/build.xml"/>
<macrodef name="compile.kroll.rhino.bindings">
<sequential>
<javac destdir="${kroll.rhino.gen.classes.dir}" debug="true">
<javac destdir="${kroll.rhino.gen.classes.dir}"
debug="true" target="1.6" source="1.6"
includeantruntime="false">
<classpath refid="android"/>
<classpath refid="rhino"/>
<classpath>
Expand All @@ -434,7 +445,8 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<mkdir dir="${kroll.rhino.classes.dir}"/>
<mkdir dir="${kroll.rhino.gen.classes.dir}"/>

<javac destdir="${kroll.rhino.classes.dir}" debug="true">
<javac destdir="${kroll.rhino.classes.dir}" debug="true"
target="1.6" source="1.6" includeantruntime="false">
<classpath refid="android"/>
<classpath refid="rhino"/>
<classpath>
Expand Down Expand Up @@ -477,7 +489,8 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<target name="build.kroll.v8.jar" depends="build.kroll.common.jar">
<property name="kroll.v8.classes.dir" location="${dist.classes.dir}/kroll-v8"/>
<mkdir dir="${kroll.v8.classes.dir}"/>
<javac srcdir="${kroll.v8.project.dir}/src/java" destdir="${kroll.v8.classes.dir}" debug="true">
<javac srcdir="${kroll.v8.project.dir}/src/java" destdir="${kroll.v8.classes.dir}" debug="true"
target="1.6" source="1.6" includeantruntime="false">
<classpath refid="android"/>
<classpath>
<fileset file="${dist.dir}/kroll-common.jar"/>
Expand Down Expand Up @@ -681,6 +694,7 @@ Common ant tasks and macros for building Android-based Titanium modules and proj

<exec executable="${ndk.build}" dir="${kroll.v8.project.dir}" failonerror="true">
<env key="ANDROID_NDK" file="${android.ndk}"/>
<env key="ANDROID_PLATFORM" file="${android.platform}"/>
<env key="NUM_CPUS" value="1"/>
<arg value="clean"/>
</exec>
Expand All @@ -699,7 +713,14 @@ Common ant tasks and macros for building Android-based Titanium modules and proj
<macrodef name="build.ti.ant.tasks">
<sequential>
<mkdir dir="${dist.classes.dir}/ant-tasks"/>
<javac srcdir="${ti.build.dir}/src" destdir="${dist.classes.dir}/ant-tasks" includes="**/*.java" classpathref="ti.build.lib.path" includeantruntime="false" debug="true"/>
<javac srcdir="${ti.build.dir}/src"
destdir="${dist.classes.dir}/ant-tasks"
includes="**/*.java"
classpathref="ti.build.lib.path"
includeantruntime="false"
debug="true"
target="1.6"
source="1.6"/>
<jar basedir="${dist.classes.dir}/ant-tasks" destfile="${dist.dir}/ant-tasks.jar"/>
</sequential>
</macrodef>
Expand Down
2 changes: 1 addition & 1 deletion android/build/libv8.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
libv8.version=3.6.4
libv8.version=3.9.24.29
libv8.mode=release
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Handle<FunctionTemplate> ${className}::getProxyTemplate()
titanium::Proxy::getProperty,
titanium::Proxy::onPropertyChanged,
Handle<Value>(), DEFAULT);
DEFINE_PROTOTYPE_METHOD(proxyTemplate, "${getter}", titanium::Proxy::getProperty);
DEFINE_PROTOTYPE_METHOD_DATA(proxyTemplate, "${getter}", titanium::Proxy::getProperty, String::NewSymbol("${name}"));
DEFINE_PROTOTYPE_METHOD_DATA(proxyTemplate, "${setter}", titanium::Proxy::onPropertyChanged, String::NewSymbol("${name}"));
</@Proxy.listPropertyAccessors>

Expand Down Expand Up @@ -298,7 +298,7 @@ void ${className}::setter_${name}(Local<String> property, Local<Value> value, co
<@Proxy.verifyAndConvertArgument expr="value" index=0 info=typeInfo logOnly=true isOptional=false/>

jobject javaProxy = proxy->getJavaObject();
<@Proxy.callJNIMethod [], property.setHasInvocation, property.setReturnType, "methodID", "javaProxy", "jArguments", false ;
<@Proxy.callJNIMethod property.setMethodArgs, property.setHasInvocation, property.setReturnType, "methodID", "javaProxy", "jArguments", false ;
hasResult, resultVar>
</@Proxy.callJNIMethod>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public IntentProxy createIntent(Object[] args)
public IntentProxy createServiceIntent(Object[] args)
{
IntentProxy intent = new IntentProxy();
intent.setType(IntentProxy.TYPE_SERVICE);
intent.setInternalType(IntentProxy.TYPE_SERVICE);
intent.handleCreationArgs(this, args);
Object startMode = intent.getProperty(TiC.INTENT_PROPERTY_START_MODE);
if (startMode != null) {
Expand All @@ -266,7 +266,7 @@ public IntentProxy createServiceIntent(Object[] args)
public IntentProxy createBroadcastIntent(Object[] args)
{
IntentProxy intent = new IntentProxy();
intent.setType(IntentProxy.TYPE_BROADCAST);
intent.setInternalType(IntentProxy.TYPE_BROADCAST);
intent.handleCreationArgs(this, args);
return intent;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand Down Expand Up @@ -66,7 +66,7 @@ public void handleCreationArgs(KrollModule createdInModule, Object[] args)
if (pendingIntentContext == null || intent == null) {
throw new IllegalStateException("Creation arguments must contain intent");
}
switch (intent.getType()) {
switch (intent.getInternalType()) {
case IntentProxy.TYPE_ACTIVITY : {
pendingIntent = PendingIntent.getActivity(
pendingIntentContext, 0, intent.getIntent(), flags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ public void onDestroy() {
TiApplication.getInstance().removeAppEventProxy(this);
}

@Kroll.getProperty(name="id") @Kroll.method
public String getID() {
@Kroll.getProperty @Kroll.method
public String getId() {
return appInfo.getId();
}

@Kroll.method
public String getID() {
return getId();
}

@Kroll.getProperty @Kroll.method
public String getName() {
return appInfo.getName();
Expand All @@ -49,11 +54,16 @@ public String getPublisher() {
return appInfo.getPublisher();
}

@Kroll.getProperty(name="url") @Kroll.method
public String getURL() {
@Kroll.getProperty @Kroll.method
public String getUrl() {
return appInfo.getUrl();
}

@Kroll.method
public String getURL() {
return getUrl();
}

@Kroll.getProperty @Kroll.method
public String getDescription() {
return appInfo.getDescription();
Expand All @@ -64,10 +74,15 @@ public String getCopyright() {
return appInfo.getCopyright();
}

@Kroll.getProperty(name="guid") @Kroll.method
public String getGUID() {
@Kroll.getProperty @Kroll.method
public String getGuid() {
return appInfo.getGUID();
}

@Kroll.method
public String getGUID() {
return getGuid();
}

@Kroll.getProperty @Kroll.method
public String getDeployType() {
Expand Down
12 changes: 6 additions & 6 deletions android/modules/app/src/js/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ exports.bootstrap = function(Titanium) {
Properties[getter] = propertyGetter(Properties[getter]);
});

Properties.getList = function(key, defaultValue) {
Properties.getList = Properties.getObject = function(key, defaultValue) {
if (!Properties.hasProperty(key)) {
return nullOrDefaultValue(defaultValue);
}

return JSON.parse(Properties.getString(key));
}
};

Properties.setList = function(key, list) {
Properties.setString(key, JSON.stringify(list));
}
}
Properties.setList = Properties.setObject = function(key, val) {
Properties.setString(key, JSON.stringify(val));
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class CalendarProxy extends KrollProxy {

protected String id, name;
protected boolean selected, hidden;
private static final long MAX_DATE_RANGE = 2 * DateUtils.YEAR_IN_MILLIS - 3 * DateUtils.DAY_IN_MILLIS;

public CalendarProxy(String id, String name, boolean selected, boolean hidden)
{
Expand Down Expand Up @@ -140,10 +141,21 @@ public EventProxy[] getEventsInDate(int year, int month, int day)
return events.toArray(new EventProxy[events.size()]);
}

@Kroll.method
@Kroll.method
public EventProxy[] getEventsBetweenDates(Date date1, Date date2)
{
ArrayList<EventProxy> events = EventProxy.queryEventsBetweenDates(date1.getTime(), date2.getTime(), this);
long start = date1.getTime();
long end = date2.getTime();
ArrayList<EventProxy> events = new ArrayList<EventProxy>();

// A workaround for TIMOB-8439
while (end - start > MAX_DATE_RANGE) {
events.addAll(EventProxy.queryEventsBetweenDates(start, start + MAX_DATE_RANGE, this));
start += MAX_DATE_RANGE;
}

events.addAll(EventProxy.queryEventsBetweenDates(start, end, this));

return events.toArray(new EventProxy[events.size()]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;

// Columns and value constants taken from android.provider.Calendar in the android source base
@Kroll.proxy(parentModule=CalendarModule.class)
Expand Down Expand Up @@ -77,11 +78,17 @@ public static ArrayList<EventProxy> queryEventsBetweenDates(long date1, long dat
Uri.Builder builder = Uri.parse(getInstancesWhenUri()).buildUpon();
ContentUris.appendId(builder, date1);
ContentUris.appendId(builder, date2);

Cursor eventCursor = contentResolver.query(builder.build(),
new String[] { "event_id", "title", "description", "eventLocation", "begin", "end", "allDay", "hasAlarm", "eventStatus", "visibility"},
query, queryArgs, "startDay ASC, startMinute ASC");


if(eventCursor == null) {
Log.w(TAG, "unable to get any results when pulling events by date range");

return events;
}

while (eventCursor.moveToNext()) {
EventProxy event = new EventProxy();
event.id = eventCursor.getString(0);
Expand Down Expand Up @@ -204,7 +211,14 @@ public static EventProxy createEvent(TiContext context, CalendarProxy calendar,
}

public static ArrayList<EventProxy> queryEventsBetweenDates(long date1, long date2, CalendarProxy calendar) {
return queryEventsBetweenDates(date1, date2, "Calendars._id="+calendar.getId(), null);
if (Build.VERSION.SDK_INT >= 11)
{
return queryEventsBetweenDates(date1, date2, null, null);
}
else
{
return queryEventsBetweenDates(date1, date2, "Calendars._id="+calendar.getId(), null);
}
}

public static ArrayList<EventProxy> queryEventsBetweenDates(TiContext context, long date1, long date2, CalendarProxy calendar)
Expand Down

0 comments on commit 14d20c9

Please sign in to comment.