Skip to content

Commit

Permalink
Merge pull request #167 from sgtcoolguy/v8-update
Browse files Browse the repository at this point in the history
[TIMOB-23600] Android: Recompile ti.map module against latest SDK
  • Loading branch information
sgtcoolguy authored Jul 11, 2016
2 parents d5a7fff + 8d07086 commit 04b9ee2
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 69 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ android/clean
android/ant_clean
android/.classpath
android/.settings

android/dist/
android/launch-*
nbproject

21 changes: 14 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
language: objective-c
osx_image: xcode7.1
osx_image: xcode7.3
env:
global:
- "ARTIFACTS_AWS_REGION=us-east-1"
- "ARTIFACTS_S3_BUCKET=builds.appcelerator.com"
- "MODULE_NAME=ti.map"
- TRAVIS_NODE_VERSION="4"
before_install:
- MODULE_ROOT=$PWD
- brew update
- brew install nvm
- source $(brew --prefix nvm)/nvm.sh
- nvm install 4
- npm config delete prefix
- nvm use --delete-prefix v4.4.7 4
install:
- cd $MODULE_ROOT
- curl -o install.sh https://raw.githubusercontent.com/appcelerator-modules/ci/master/travis/install.sh #change this to appcelerator-modules once PR has been merged
- source install.sh -s "--branch 5_1_X"
script:
- curl -o script.sh https://raw.githubusercontent.com/appcelerator-modules/ci/master/travis/script.sh
- curl -o install.sh https://raw.githubusercontent.com/sgtcoolguy/ci/v8/travis/install.sh #change this to appcelerator-modules once PR has been merged
- source install.sh -s "--branch master"
script:
- curl -o script.sh https://raw.githubusercontent.com/sgtcoolguy/ci/v8/travis/script.sh
- source script.sh
after_success: # and this only on success
- curl -o deploy.sh https://raw.githubusercontent.com/appcelerator-modules/ci/master/travis/deploy.sh
- source deploy.sh
- curl -o deploy.sh https://raw.githubusercontent.com/appcelerator-modules/ci/master/travis/deploy.sh
- source deploy.sh
8 changes: 4 additions & 4 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.3.10
apiversion: 2
architectures: armeabi armeabi-v7a x86
version: 3.0.0
apiversion: 3
architectures: armeabi-v7a x86
description: External version of Map module to support new Google Map v2 sdk
author: Hieu Pham
license: Apache Public License v2
Expand All @@ -16,5 +16,5 @@ name: map
moduleid: ti.map
guid: f0d8fd44-86d2-4730-b67d-bd454577aeee
platform: android
minsdk: 4.1.0
minsdk: 6.0.0
respackage: com.google.android.gms
20 changes: 7 additions & 13 deletions android/src/ti/map/AnnotationProxy.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2013-2016 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 All @@ -17,7 +17,6 @@
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiBlob;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.TiPoint;
import org.appcelerator.titanium.proxy.TiViewProxy;
Expand Down Expand Up @@ -70,7 +69,7 @@ public interface AnnotationDelegate {
private int iconImageWidth = 0;
private String annoTitle;
private AnnotationDelegate delegate = null;

private static final int MSG_FIRST_ID = KrollProxy.MSG_LAST_ID + 1;

private static final int MSG_SET_LON = MSG_FIRST_ID + 300;
Expand All @@ -86,15 +85,10 @@ public AnnotationProxy()
defaultValues.put(MapModule.PROPERTY_SHOW_INFO_WINDOW, true);
}

public AnnotationProxy(TiContext tiContext)
{
this();
}

public void setDelegate(AnnotationDelegate delegate) {
this.delegate = delegate;
}

@Override
protected KrollDict getLangConversionTable()
{
Expand Down Expand Up @@ -251,7 +245,7 @@ private void handleImage(Object image)
return;
}
}

// Image blob
if (image instanceof TiBlob) {
Bitmap bitmap = ((TiBlob) image).getImage();
Expand All @@ -261,7 +255,7 @@ private void handleImage(Object image)
return;
}
}

Log.w(TAG, "Unable to get the image from the path: " + image);
setIconImageDimensions(-1, -1);
}
Expand Down Expand Up @@ -409,10 +403,10 @@ private void updateInfoWindow()
getMainHandler().sendEmptyMessage(MSG_UPDATE_INFO_WINDOW);
}
}

private void requestRefresh() {
if (this.delegate != null) {
this.delegate.refreshAnnotation(this);
}
}
}
}
11 changes: 6 additions & 5 deletions android/src/ti/map/CircleProxy.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013-2016 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.
*/
package ti.map;

import java.util.HashMap;
Expand All @@ -8,7 +14,6 @@
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.TiDimension;
import org.appcelerator.titanium.util.TiConvert;

Expand Down Expand Up @@ -48,10 +53,6 @@ public CircleProxy() {
super();
}

public CircleProxy(TiContext tiContext) {
this();
}

private int toPx(Object size){
ViewGroup rootViewGroup = (ViewGroup)TiApplication.getAppCurrentActivity().getWindow().getDecorView().findViewById(android.R.id.content);
return TiConvert.toTiDimension(size, TiDimension.COMPLEX_UNIT_AUTO).getAsPixels(rootViewGroup);
Expand Down
3 changes: 1 addition & 2 deletions android/src/ti/map/MapModule.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file was auto-generated by the Titanium Module SDK helper for Android
* Appcelerator Titanium Mobile
* Copyright (c) 2013 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2013-2016 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 @@ -95,4 +95,3 @@ public int isGooglePlayServicesAvailable() {
return GooglePlayServicesUtil.isGooglePlayServicesAvailable(TiApplication.getAppRootOrCurrentActivity());
}
}

11 changes: 6 additions & 5 deletions android/src/ti/map/PolygonProxy.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013-2016 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.
*/
package ti.map;

import java.util.ArrayList;
Expand All @@ -9,7 +15,6 @@
import org.appcelerator.kroll.common.AsyncResult;
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.util.TiConvert;

import ti.map.Shape.IShape;
Expand Down Expand Up @@ -46,10 +51,6 @@ public PolygonProxy() {
super();
}

public PolygonProxy(TiContext tiContext) {
this();
}

@Override
public boolean handleMessage(Message msg) {

Expand Down
13 changes: 7 additions & 6 deletions android/src/ti/map/PolylineProxy.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013-2016 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.
*/
package ti.map;

import java.util.ArrayList;
Expand All @@ -8,7 +14,6 @@
import org.appcelerator.kroll.common.AsyncResult;
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.util.TiConvert;

import ti.map.Shape.IShape;
Expand Down Expand Up @@ -53,10 +58,6 @@ public PolylineProxy() {
super();
}

public PolylineProxy(TiContext tiContext) {
this();
}

@Override
public boolean handleMessage(Message msg)
{
Expand Down Expand Up @@ -111,7 +112,7 @@ public void processOptions() {
if (hasProperty(PolylineProxy.PROPERTY_STROKE_COLOR2)) {
options.color(TiConvert.toColor((String)getProperty(PolylineProxy.PROPERTY_STROKE_COLOR2)));
}

if (hasProperty(MapModule.PROPERTY_STROKE_WIDTH)) {
options.width(TiConvert.toFloat(getProperty(MapModule.PROPERTY_STROKE_WIDTH)));
}
Expand Down
51 changes: 26 additions & 25 deletions android/src/ti/map/RouteProxy.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2013-2016 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.
*/
package ti.map;

import java.util.ArrayList;
Expand All @@ -8,7 +14,6 @@
import org.appcelerator.kroll.common.AsyncResult;
import org.appcelerator.kroll.common.TiMessenger;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiContext;
import org.appcelerator.titanium.util.TiConvert;

import android.os.Message;
Expand All @@ -23,26 +28,22 @@
TiC.PROPERTY_WIDTH
})
public class RouteProxy extends KrollProxy{

private PolylineOptions options;
private Polyline route;

private static final int MSG_FIRST_ID = KrollProxy.MSG_LAST_ID + 1;

private static final int MSG_SET_POINTS = MSG_FIRST_ID + 400;
private static final int MSG_SET_COLOR = MSG_FIRST_ID + 401;
private static final int MSG_SET_WIDTH = MSG_FIRST_ID + 402;

public RouteProxy() {
super();
}

public RouteProxy(TiContext tiContext) {
this();
}


@Override
public boolean handleMessage(Message msg)
public boolean handleMessage(Message msg)
{
AsyncResult result = null;
switch (msg.what) {
Expand All @@ -53,14 +54,14 @@ public boolean handleMessage(Message msg)
result.setResult(null);
return true;
}

case MSG_SET_COLOR: {
result = (AsyncResult) msg.obj;
route.setColor((Integer)result.getArg());
result.setResult(null);
return true;
}

case MSG_SET_WIDTH: {
result = (AsyncResult) msg.obj;
route.setWidth((Float)result.getArg());
Expand All @@ -79,17 +80,17 @@ public void processOptions() {
if (hasProperty(MapModule.PROPERTY_POINTS)) {
processPoints(getProperty(MapModule.PROPERTY_POINTS), false);
}

if (hasProperty(TiC.PROPERTY_WIDTH)) {
options.width(TiConvert.toFloat(getProperty(TiC.PROPERTY_WIDTH)));
}

if (hasProperty(TiC.PROPERTY_COLOR)) {
options.color(TiConvert.toColor((String)getProperty(TiC.PROPERTY_COLOR)));
}

}

public void addLocation(Object loc, ArrayList<LatLng> locationArray, boolean list) {
if (loc instanceof HashMap) {
HashMap<String, String> point = (HashMap<String, String>) loc;
Expand All @@ -107,7 +108,7 @@ public void addLocation(Object loc, ArrayList<LatLng> locationArray, boolean lis
}

public ArrayList<LatLng> processPoints(Object points, boolean list) {

ArrayList<LatLng> locationArray = new ArrayList<LatLng>();
//multiple points
if (points instanceof Object[]) {
Expand All @@ -123,44 +124,44 @@ public ArrayList<LatLng> processPoints(Object points, boolean list) {
addLocation(points, locationArray, list);
return locationArray;
}

public PolylineOptions getOptions() {
return options;
}

public void setRoute(Polyline r) {
route = r;
}

public Polyline getRoute() {
return route;
}

@Override
public void onPropertyChanged(String name, Object value) {
super.onPropertyChanged(name, value);
if (route == null) {
return;
}

else if (name.equals(MapModule.PROPERTY_POINTS)) {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_POINTS), value);
}

else if (name.equals(TiC.PROPERTY_COLOR)) {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_COLOR), TiConvert.toColor((String)value));
}

else if (name.equals(TiC.PROPERTY_WIDTH)) {
TiMessenger.sendBlockingMainMessage(getMainHandler().obtainMessage(MSG_SET_WIDTH), TiConvert.toFloat(value));
}

}

@Override
public boolean hasProperty(String name)
{
return (super.getProperty(name) != null);
}

}
Loading

0 comments on commit 04b9ee2

Please sign in to comment.