Skip to content

Commit

Permalink
Upgrade to osmdroid 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MKergall committed Nov 15, 2015
1 parent be6ecb5 commit 3878ad2
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 94 deletions.
3 changes: 1 addition & 2 deletions MapsForgeForOsmdroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 15
buildToolsVersion "22.0.1"
buildToolsVersion "23.0.0"

defaultConfig {
minSdkVersion 10
Expand All @@ -22,5 +22,4 @@ dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'org.osmdroid:osmdroid-android:5.0.1@aar'
//compile 'org.slf4j:slf4j-android:1.6.1-RC1'
}
1 change: 0 additions & 1 deletion OSMBonusPack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies {

compile "com.android.support:support-v4:22.2.0"
compile 'org.osmdroid:osmdroid-android:5.0.1@aar'
//compile 'org.slf4j:slf4j-android:1.6.1-RC1'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.google.code.gson:gson:2.3'
}
25 changes: 13 additions & 12 deletions OSMBonusPack/src/main/java/org/osmdroid/bonuspack/kml/HotSpot.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Parcel;
import android.os.Parcelable;

import java.io.IOException;
import java.io.Writer;

Expand All @@ -20,18 +21,6 @@ public static enum Units {
public float mx, my;
public Units mXUnits, mYUnits;

public static final Creator<HotSpot> CREATOR = new Creator<HotSpot>() {
@Override
public HotSpot createFromParcel(Parcel in) {
return new HotSpot(in);
}

@Override
public HotSpot[] newArray(int size) {
return new HotSpot[size];
}
};

public Units getUnits(String sUnits){
if ("fraction".equals(sUnits))
return Units.fraction;
Expand Down Expand Up @@ -103,6 +92,18 @@ public void writeAsKML(Writer writer){
out.writeInt(mYUnits.ordinal());
}

public static final Creator<HotSpot> CREATOR = new Creator<HotSpot>() {
@Override
public HotSpot createFromParcel(Parcel in) {
return new HotSpot(in);
}

@Override
public HotSpot[] newArray(int size) {
return new HotSpot[size];
}
};

public HotSpot(Parcel in){
mx = in.readFloat();
my = in.readFloat();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package org.osmdroid.bonuspack.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;

import org.apache.http.NameValuePair;
import org.osmdroid.util.BoundingBoxE6;

import java.io.BufferedReader;
import java.io.FilterInputStream;
import java.io.IOException;
Expand All @@ -8,13 +16,6 @@
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import org.apache.http.NameValuePair;
import org.osmdroid.util.BoundingBoxE6;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;

/** Useful functions and common constants.
* @author M.Kergall
Expand Down Expand Up @@ -75,6 +76,24 @@ public static String requestStringFromUrl(String url, String userAgent) {
String result = readStream(connection);
connection.close();
return result;
/* try moving to HttpURLConnection ...
URL uUrl;
HttpURLConnection urlConnection;
try {
uUrl = new URL(url);
urlConnection = (HttpURLConnection) uUrl.openConnection();
} catch (Exception e) {
return null;
}
try {
urlConnection.getInputStream();
String result = readStream(in);
finally{
urlConnection.disconnect();
}
} catch {
}
*/
}

/** sends an http request, and returns the whole content result in a String.
Expand Down
10 changes: 4 additions & 6 deletions OSMBonusPackTuto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 15
buildToolsVersion "22.0.1"
buildToolsVersion "23.0.0"

defaultConfig {
applicationId "com.example.osmbonuspacktuto"
Expand All @@ -28,13 +28,11 @@ repositories {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
//
//compile(name: 'osmbonuspack_v5.4', ext: 'aar')
compile project(":OSMBonusPack")

//compile 'org.osmdroid:osmdroid-android:5.0.1'
//compile 'org.slf4j:slf4j-android:1.6.1-RC1'
compile(name: 'osmbonuspack_v5.5', ext: 'aar')
//compile project(":OSMBonusPack")

compile 'org.osmdroid:osmdroid-android:5.0.1@aar'
compile "com.android.support:support-v4:22.2.0"
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.google.code.gson:gson:2.3'
Expand Down
5 changes: 1 addition & 4 deletions OSMNavigator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 15
buildToolsVersion "22.0.1"
buildToolsVersion "23.0.0"

defaultConfig {
applicationId "com.osmnavigator"
Expand All @@ -24,7 +24,4 @@ dependencies {

compile project(":OSMBonusPack")
compile project(":MapsForgeForOsmdroid")

//compile 'org.osmdroid:osmdroid-android:4.3'
//compile 'org.slf4j:slf4j-android:1.6.1-RC1'
}
27 changes: 24 additions & 3 deletions OSMNavigator/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,22 @@
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="*" android:mimeType="*/*" android:scheme="file" android:pathPattern="/*.kml" />
<data android:host="*" android:mimeType="*/*" android:scheme="file" android:pathPattern="/*.kmz" />
<data android:host="*" android:mimeType="*/*" android:scheme="file" android:pathPattern="/*.json" />

<data
android:host="*"
android:mimeType="*/*"
android:scheme="file"
android:pathPattern=".*\\.kml"/>
<data
android:host="*"
android:mimeType="*/*"
android:scheme="file"
android:pathPattern=".*\\.kmz"/>
<data
android:host="*"
android:mimeType="*/*"
android:scheme="file"
android:pathPattern=".*\\.json"/>
</intent-filter>
</activity>
<activity
Expand All @@ -71,6 +84,14 @@
android:name="com.osmnavigator.KmlStyleActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.osmnavigator.StartSharingActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<activity
android:name="com.osmnavigator.FriendsActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>

</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package com.osmnavigator;

import java.util.ArrayList;
import java.util.HashMap;
import org.osmdroid.bonuspack.kml.Style;
import org.osmdroid.bonuspack.kml.StyleSelector;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
Expand All @@ -18,11 +14,17 @@
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import org.osmdroid.bonuspack.kml.Style;
import org.osmdroid.bonuspack.kml.StyleSelector;

import java.util.ArrayList;
import java.util.HashMap;

public class KmlStylesActivity extends Activity {

/* request codes */
public static final int KML_STYLES_REQUEST = 4;
public static final int KML_STYLE_REQUEST = 5;
public static final int KML_STYLES_REQUEST = 100;
public static final int KML_STYLE_REQUEST = 101;

KmlStyleListAdapter mListAdapter;
ListView mListView;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.osmnavigator;

import org.osmdroid.bonuspack.kml.KmlFeature;
import org.osmdroid.bonuspack.kml.KmlFolder;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
Expand All @@ -20,10 +18,13 @@
import android.widget.ListView;
import android.widget.Spinner;

import org.osmdroid.bonuspack.kml.KmlFeature;
import org.osmdroid.bonuspack.kml.KmlFolder;

public class KmlTreeActivity extends Activity {

/* request codes */
public static final int KML_TREE_REQUEST = 3;
public static final int KML_TREE_REQUEST = 200;

KmlListAdapter mListAdapter;
ListView mListView;
Expand Down
11 changes: 6 additions & 5 deletions OSMNavigator/src/main/res/layout/items_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|clip_vertical"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:background="#FFFFFF"
android:padding="10dp" >
Expand All @@ -27,7 +27,8 @@
<ListView
android:id="@+id/items"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
android:layout_height="fill_parent"/>

</LinearLayout>

</LinearLayout>
8 changes: 8 additions & 0 deletions OSMNavigator/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:background="@drawable/btn_tracking_off" />

<Button
android:id="@+id/buttonFriends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/btn_sharing"/>
</RelativeLayout>

</LinearLayout>
Loading

0 comments on commit 3878ad2

Please sign in to comment.