Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
cedarmaps-sdk-android-public
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Cedar Studios
cedarmaps-sdk-android-public
Commits
3c9262b2
Commit
3c9262b2
authored
May 08, 2015
by
Mohsen Taleb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for custom API urls and updated to mapbox-0.7.3
parent
2d853272
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
48 additions
and
24 deletions
+48
-24
build.gradle
CedarMapsSDK/build.gradle
+6
-6
CedarMapsException.java
...ava/com/cedarstudios/cedarmapssdk/CedarMapsException.java
+0
-3
CedarMapsImpl.java
...ain/java/com/cedarstudios/cedarmapssdk/CedarMapsImpl.java
+2
-2
CedarMapsConstants.java
.../cedarstudios/cedarmapssdk/config/CedarMapsConstants.java
+5
-0
Configuration.java
...a/com/cedarstudios/cedarmapssdk/config/Configuration.java
+1
-1
ConfigurationBase.java
...m/cedarstudios/cedarmapssdk/config/ConfigurationBase.java
+8
-4
ConfigurationBuilder.java
...edarstudios/cedarmapssdk/config/ConfigurationBuilder.java
+6
-0
CedarMapsTileLayer.java
...studios/cedarmapssdk/tileprovider/CedarMapsTileLayer.java
+2
-3
build.gradle
CedarMapsTestApp/build.gradle
+3
-3
README.md
README.md
+14
-1
build.gradle
build.gradle
+1
-1
No files found.
CedarMapsSDK/build.gradle
View file @
3c9262b2
apply
plugin:
'com.android.library'
apply
plugin:
'com.github.dcendents.android-maven'
version
=
"0.7.
1
"
version
=
"0.7.
3
"
def
siteUrl
=
'http://cedarmaps.com'
def
gitUrl
=
'http://cedarmaps.com/git'
group
=
"com.cedarmaps"
android
{
compileSdkVersion
2
1
compileSdkVersion
2
2
buildToolsVersion
"21.1.2"
defaultConfig
{
minSdkVersion
9
targetSdkVersion
2
1
versionCode
2
versionName
"0.7.
1
"
targetSdkVersion
2
2
versionCode
3
versionName
"0.7.
3
"
}
buildTypes
{
}
...
...
@@ -22,7 +22,7 @@ android {
dependencies
{
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
compile
(
'com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.
1
@aar'
)
{
compile
(
'com.mapbox.mapboxsdk:mapbox-android-sdk:0.7.
3
@aar'
)
{
transitive
=
true
}
}
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/CedarMapsException.java
View file @
3c9262b2
...
...
@@ -3,9 +3,6 @@ package com.cedarstudios.cedarmapssdk;
import
com.squareup.okhttp.Response
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.IOException
;
public
class
CedarMapsException
extends
Exception
{
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/CedarMapsImpl.java
View file @
3c9262b2
...
...
@@ -62,7 +62,7 @@ class CedarMapsImpl extends CedarMapsBaseImpl implements CedarMaps {
throw
new
CedarMapsException
(
e
);
}
String
url
=
String
.
format
(
Locale
.
ENGLISH
,
conf
.
get
Rest
BaseURL
()
+
"geocode/%s/%s.json"
,
.
format
(
Locale
.
ENGLISH
,
conf
.
get
API
BaseURL
()
+
"geocode/%s/%s.json"
,
conf
.
getMapId
(),
term
);
url
+=
String
.
format
(
Locale
.
ENGLISH
,
"?limit=%s"
,
limit
);
...
...
@@ -88,7 +88,7 @@ class CedarMapsImpl extends CedarMapsBaseImpl implements CedarMaps {
@Override
public
JSONObject
geocode
(
double
lat
,
double
lng
)
throws
CedarMapsException
{
String
url
=
String
.
format
(
Locale
.
ENGLISH
,
conf
.
get
Rest
BaseURL
()
+
"geocode/%1$s/%2$s,%3$s.json"
,
conf
.
getMapId
(),
lat
,
lng
);
conf
.
get
API
BaseURL
()
+
"geocode/%1$s/%2$s,%3$s.json"
,
conf
.
getMapId
(),
lat
,
lng
);
if
(
TextUtils
.
isEmpty
(
conf
.
getMapId
()))
{
throw
new
CedarMapsException
(
new
NullPointerException
(
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/config/CedarMapsConstants.java
0 → 100644
View file @
3c9262b2
package
com
.
cedarstudios
.
cedarmapssdk
.
config
;
class
CedarMapsConstants
{
public
final
static
String
CEDARMAPS_BASE_URL_V1
=
"http://api.cedarmaps.com/v1/"
;
}
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/config/Configuration.java
View file @
3c9262b2
...
...
@@ -12,7 +12,7 @@ public interface Configuration extends AuthorizationConfiguration, Serializable
String
getOAuth2AccessToken
();
String
get
Rest
BaseURL
();
String
get
API
BaseURL
();
String
getOAuth2Scope
();
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/config/ConfigurationBase.java
View file @
3c9262b2
package
com
.
cedarstudios
.
cedarmapssdk
.
config
;
import
com.cedarstudios.cedarmapssdk.CedarMapsConstants
;
import
java.io.ObjectStreamException
;
import
java.io.Serializable
;
...
...
@@ -22,10 +21,10 @@ class ConfigurationBase implements Configuration, Serializable {
private
String
mapId
;
private
String
oAuth2TokenURL
=
CedarMapsConstants
.
CEDARMAPS_BASE_URL_V1
+
"token"
;
private
String
restBaseURL
=
CedarMapsConstants
.
CEDARMAPS_BASE_URL_V1
;
private
String
oAuth2TokenURL
=
restBaseURL
+
"token"
;
public
void
setOAuthClientId
(
String
oAuthClientId
)
{
this
.
oAuthClientId
=
oAuthClientId
;
...
...
@@ -39,8 +38,13 @@ class ConfigurationBase implements Configuration, Serializable {
this
.
mapId
=
mapId
;
}
public
void
setAPIBaseUrl
(
String
baseUrl
)
{
restBaseURL
=
baseUrl
;
setOAuth2TokenURL
(
restBaseURL
+
"token"
);
}
@Override
public
String
get
Rest
BaseURL
()
{
public
String
get
API
BaseURL
()
{
return
restBaseURL
;
}
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/config/ConfigurationBuilder.java
View file @
3c9262b2
...
...
@@ -4,6 +4,12 @@ public final class ConfigurationBuilder {
private
ConfigurationBase
configurationBase
=
new
ConfigurationBase
();
public
ConfigurationBuilder
setAPIBaseURL
(
String
baseURL
)
{
checkNotBuilt
();
configurationBase
.
setAPIBaseUrl
(
baseURL
);
return
this
;
}
public
ConfigurationBuilder
setClientId
(
String
clientId
)
{
checkNotBuilt
();
...
...
CedarMapsSDK/src/main/java/com/cedarstudios/cedarmapssdk/tileprovider/CedarMapsTileLayer.java
View file @
3c9262b2
package
com
.
cedarstudios
.
cedarmapssdk
.
tileprovider
;
import
com.cedarstudios.cedarmapssdk.CedarMaps
;
import
com.cedarstudios.cedarmapssdk.CedarMapsConstants
;
import
com.cedarstudios.cedarmapssdk.CedarMapsException
;
import
com.cedarstudios.cedarmapssdk.CedarMapsFactory
;
import
com.cedarstudios.cedarmapssdk.CedarMapsTileLayerListener
;
...
...
@@ -202,7 +201,7 @@ public class CedarMapsTileLayer extends WebSourceTileLayer {
private
String
getBrandedJSONURL
()
{
String
url
=
String
.
format
(
Locale
.
ENGLISH
,
CedarMapsConstants
.
CEDARMAPS_BASE_URL_V1
.
format
(
Locale
.
ENGLISH
,
mConfiguration
.
getAPIBaseURL
()
+
"tiles/%s.json?access_token=%s&secure=1"
,
mId
,
CedarMapsUtils
.
getAccessToken
());
if
(!
mEnableSSL
)
{
...
...
@@ -263,7 +262,7 @@ public class CedarMapsTileLayer extends WebSourceTileLayer {
if
(!
TextUtils
.
isEmpty
(
aUrl
)
&&
!
aUrl
.
toLowerCase
(
Locale
.
US
).
contains
(
"http://"
)
&&
!
aUrl
.
toLowerCase
(
Locale
.
US
).
contains
(
"https://"
))
{
super
.
setURL
(
CedarMapsConstants
.
CEDARMAPS_BASE_URL_V1
+
"tiles/"
+
aUrl
mConfiguration
.
getAPIBaseURL
()
+
"tiles/"
+
aUrl
+
"/{z}/{x}/{y}.png?access_token="
+
CedarMapsUtils
.
getAccessToken
());
}
else
{
...
...
CedarMapsTestApp/build.gradle
View file @
3c9262b2
apply
plugin:
'com.android.application'
android
{
compileSdkVersion
2
1
compileSdkVersion
2
2
buildToolsVersion
"21.1.2"
defaultConfig
{
applicationId
"com.cedarstudios.cedarmaps.sample"
minSdkVersion
9
targetSdkVersion
2
1
targetSdkVersion
2
2
versionCode
1
versionName
"1.0"
}
...
...
@@ -21,6 +21,6 @@ android {
dependencies
{
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
compile
'com.android.support:appcompat-v7:2
1.0.3
'
compile
'com.android.support:appcompat-v7:2
2.1.1
'
compile
(
project
(
':CedarMapsSDK'
))
}
README.md
View file @
3c9262b2
...
...
@@ -16,7 +16,7 @@ repositories {
}
dependencies
{
compile
(
'com.cedarmaps:CedarMapsSDK:0.7.
1
@aar'
)
{
compile
(
'com.cedarmaps:CedarMapsSDK:0.7.
3
@aar'
)
{
transitive
=
true
}
}
...
...
@@ -112,6 +112,19 @@ Configuration configuration = new ConfigurationBuilder()
Currently you can use
`cedarmaps.streets`
as default mapId
#### Changing API Base Url
You can change API Base Url by setting it on configuration object:
```
java
MapView
mapView
=
new
MapView
(
context
);
Configuration
configuration
=
new
ConfigurationBuilder
()
.
setAPIBaseURL
(
CUSTOM_API_URL
)
.
setClientId
(
Constants
.
CLIENT_ID
)
.
setClientSecret
(
Constants
.
CLIENT_SECRET
)
.
setMapId
(
Constants
.
MAPID_CEDARMAPS_STREETS
)
.
build
();
```
### Attention
...
...
build.gradle
View file @
3c9262b2
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:1.
0.1
'
classpath
'com.android.tools.build:gradle:1.
2.3
'
classpath
'com.github.dcendents:android-maven-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment