add vtm-android-starterkit

This commit is contained in:
Hannes Janetzek 2014-03-23 03:02:26 +01:00
parent c2b17899a2
commit 334943c094
8 changed files with 172 additions and 0 deletions

View File

@ -3,6 +3,7 @@ include ':vtm-extras'
include ':vtm-android' include ':vtm-android'
include ':vtm-android-example' include ':vtm-android-example'
include ':vtm-android-app' include ':vtm-android-app'
include ':vtm-android-start'
include ':vtm-themes' include ':vtm-themes'
include ':vtm-gdx' include ':vtm-gdx'
include ':vtm-desktop' include ':vtm-desktop'

View File

@ -0,0 +1,30 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.oscim.android.start"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<application
android:label="VTM Start"
android:icon="@drawable/ic_launcher"
android:allowBackup="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name="org.oscim.android.start.TestActivity"
android:label="VTM Start" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -0,0 +1,79 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
dependencies {
compile project(':vtm-android')
compile project(':vtm-themes')
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src', 'assets']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
// ignore deprecated
lintOptions.abortOnError false
}
// Including configurations into Eclipse
eclipse {
sourceCompatibility = 1.6
targetCompatibility = 1.6
// Configuring Eclipse classpath
classpath {
plusConfigurations += configurations.compile
defaultOutputDir = file('bin/classes')
file {
// Direct manipulation of the generated classpath XML
withXml {
def node = it.asNode()
node.appendNode('classpathentry kind="src" path="src"')
node.appendNode('classpathentry kind="src" path="gen"')
}
}
}
project {
natures = ['com.android.ide.eclipse.adt.AndroidNature',
'org.eclipse.jdt.core.javanature']
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
}
}
task run (dependsOn: 'installDebug'){
doFirst {
println(">> adb run...")
String adb = System.getenv()['ANDROID_HOME'] + '/platform-tools/adb'
String cmd = "${adb} shell am start -n org.oscim.jeo.android/.TestActivity"
def proc = cmd.execute()
proc.in.eachLine {line -> println line}
proc.err.eachLine {line -> System.err.println( 'ERROR: ' + line)}
proc.waitFor()
}
}

View File

@ -0,0 +1,15 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
android.library.reference.1=../vtm-android

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -0,0 +1,12 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.oscim.android.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</org.oscim.android.MapView>
</RelativeLayout>

View File

@ -0,0 +1 @@
root=DEBUG:%logger

View File

@ -0,0 +1,34 @@
package org.oscim.android.start;
import org.oscim.android.MapActivity;
import org.oscim.layers.tile.vector.BuildingLayer;
import org.oscim.layers.tile.vector.VectorTileLayer;
import org.oscim.layers.tile.vector.labeling.LabelLayer;
import org.oscim.map.Map;
import org.oscim.theme.VtmThemes;
import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import android.os.Bundle;
public class TestActivity extends MapActivity {
public static final Logger log = LoggerFactory.getLogger(TestActivity.class);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
Map map = this.map();
VectorTileLayer baseLayer = map.setBaseMap(new OSciMap4TileSource());
map.layers().add(new BuildingLayer(map, baseLayer));
map.layers().add(new LabelLayer(map, baseLayer));
map.setTheme(VtmThemes.DEFAULT);
//mMap.setMapPosition(49.417, 8.673, 1 << 17);
map.setMapPosition(53.5620092, 9.9866457, 1 << 16);
// mMap.layers().add(new TileGridLayer(mMap));
}
}