Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit a9cfce7

Browse files
authored
#1783 resolves a NPE related to disableFollowLocation from MyLocationNewOverlay, the rest of the changes are test code to reproduce the issue. Note: i tried to rig up an automated test for this but i was not successful. (#1811)
1 parent c4338fa commit a9cfce7

File tree

7 files changed

+239
-118
lines changed

7 files changed

+239
-118
lines changed
Lines changed: 128 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,38 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="org.osmdroid">
5-
6-
<uses-sdk tools:overrideLibrary="mil.army.missioncommand,armyc2.c2sd.singlepointrenderer,org.osmdroid.gpkg,mil.nga.geopackage,org.osmdroid.mapsforge,android.support.v13,com.github.angads25.filepicker,android.support.v7.gridlayout" />
7-
8-
<supports-screens
9-
android:anyDensity="true"
10-
android:largeScreens="true"
11-
android:normalScreens="true" />
12-
13-
<!-- PROTECTION_NORMAL permissions, automatically granted -->
14-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
15-
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
16-
<uses-permission android:name="android.permission.INTERNET" />
17-
18-
<!-- DANGEROUS PERMISSIONS, must request -->
19-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
20-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
21-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
22-
23-
<uses-feature
24-
android:name="android.hardware.location.network"
25-
android:required="false" />
26-
<uses-feature
27-
android:name="android.hardware.location.gps"
28-
android:required="false" />
29-
<uses-feature
30-
android:name="android.hardware.telephony"
31-
android:required="false" />
32-
<uses-feature
33-
android:name="android.hardware.wifi"
34-
android:required="false" />
2+
<manifest package="org.osmdroid"
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools">
355

366
<application
37-
tools:replace="android:allowBackup"
38-
android:allowBackup="true"
397
android:name=".OsmApplication"
8+
android:allowBackup="true"
409
android:hardwareAccelerated="true"
41-
android:largeHeap="true"
4210
android:icon="@drawable/icon"
43-
android:theme="@style/AppTheme"
11+
android:label="@string/app_name"
12+
android:largeHeap="true"
4413
android:networkSecurityConfig="@xml/network_security_config"
45-
android:label="@string/app_name">
46-
47-
<!-- Bing maps tile users:
14+
android:theme="@style/AppTheme"
15+
tools:replace="android:allowBackup">
16+
<activity
17+
android:name=".Bug1783Activity"
18+
android:exported="false" />
19+
<!--
20+
Bing maps tile users:
4821
all applications based on this code should get their own Bing key
4922
DO NOT USE THIS KEY IN YOUR APP
5023
-->
51-
<meta-data
52-
android:name="BING_KEY"
53-
android:value="" />
24+
<activity
25+
android:name=".intro.IntroActivity"
26+
android:icon="@drawable/icon"
27+
android:label="@string/app_name">
28+
<intent-filter>
29+
<action android:name="android.intent.action.MAIN" />
5430

55-
<!-- Mapquest tile source users:
31+
<category android:name="android.intent.category.LAUNCHER" />
32+
</intent-filter>
33+
</activity>
34+
<!--
35+
Mapquest tile source users:
5636
all applications based on this code should get their own MapQuest key
5737
see https://developer.mapquest.com however the access token they provide doesn't work for
5838
direct tile access, their web javascript api must handle it differently
@@ -62,60 +42,7 @@
6242
NOTE: to get this key, we had to go to MapBox's website
6343
Yes that's a MapBox token for MapQuest tiles.
6444
https://www.mapbox.com/studio/account/tokens/
65-
-->
66-
<meta-data android:name="MAPQUEST_ACCESS_TOKEN" android:value=""/>
67-
68-
<!-- MapBox tile source users:
69-
all applications based on this code should get their own MapBox key
70-
see https://www.mapbox.com/studio/account/tokens/
71-
72-
DO NOT USE THIS KEY IN YOUR APP
73-
74-
NOTE: to get this key, we had to go to MapBox's website
75-
https://www.mapbox.com/studio/account/tokens/
76-
-->
77-
<meta-data android:name="MAPBOX_MAPID" android:value="mapbox.mapbox-streets-v7"/>
78-
<meta-data android:name="MAPBOX_ACCESS_TOKEN" android:value=""/>
79-
80-
81-
<!-- HERE We Go tile source users:
82-
all applications based on this code should get their own MapBox key
83-
see https://www.mapbox.com/studio/account/tokens/
84-
85-
DO NOT USE THIS KEY IN YOUR APP
86-
87-
NOTE: to get this key, we had to go to MapBox's website
88-
https://www.mapbox.com/studio/account/tokens/
89-
-->
90-
<meta-data android:name="HEREWEGO_MAPID" android:value="hybrid.day"/>
91-
<meta-data android:name="HEREWEGO_APPID" android:value=""/>
92-
<meta-data android:name="HEREWEGO_APPCODE" android:value=""/>
93-
<!-- optional, use this to change the destination URL, default is shown below
94-
other known urls
95-
base.maps.api.here.com
96-
97-
<meta-data android:name="HEREWEGO_DOMAIN_OVERRIDE" android:value="aerial.maps.cit.api.here.com" />
9845
-->
99-
100-
101-
102-
103-
<uses-library
104-
android:name="com.google.android.maps"
105-
android:required="false" />
106-
107-
<activity android:name=".intro.IntroActivity"
108-
android:icon="@drawable/icon"
109-
android:label="@string/app_name"
110-
>
111-
<intent-filter>
112-
<action android:name="android.intent.action.MAIN" />
113-
114-
<category android:name="android.intent.category.LAUNCHER" />
115-
</intent-filter>
116-
117-
118-
</activity>
11946
<activity
12047
android:name=".MainActivity"
12148
android:icon="@drawable/icon"
@@ -126,6 +53,16 @@
12653
<category android:name="android.intent.category.LAUNCHER" />
12754
</intent-filter>
12855
</activity>
56+
<!--
57+
MapBox tile source users:
58+
all applications based on this code should get their own MapBox key
59+
see https://www.mapbox.com/studio/account/tokens/
60+
61+
DO NOT USE THIS KEY IN YOUR APP
62+
63+
NOTE: to get this key, we had to go to MapBox's website
64+
https://www.mapbox.com/studio/account/tokens/
65+
-->
12966
<activity
13067
android:name=".StarterMapActivity"
13168
android:icon="@drawable/icon"
@@ -145,7 +82,16 @@
14582
<category android:name="android.intent.category.DEFAULT" />
14683
</intent-filter>
14784
</activity>
85+
<!--
86+
HERE We Go tile source users:
87+
all applications based on this code should get their own MapBox key
88+
see https://www.mapbox.com/studio/account/tokens/
89+
90+
DO NOT USE THIS KEY IN YOUR APP
14891
92+
NOTE: to get this key, we had to go to MapBox's website
93+
https://www.mapbox.com/studio/account/tokens/
94+
-->
14995
<activity
15096
android:name=".samples.SampleWithTilesOverlay"
15197
android:label="OSMapView with Tiles Overlay">
@@ -164,72 +110,138 @@
164110
<category android:name="android.intent.category.DEFAULT" />
165111
</intent-filter>
166112
</activity>
167-
<activity android:name=".BugsTestingActivity"
113+
<activity
114+
android:name=".BugsTestingActivity"
168115
android:label="Bug Drivers">
169116
<intent-filter>
170117
<action android:name="android.intent.action.VIEW" />
118+
171119
<category android:name="android.intent.category.DEFAULT" />
172120
</intent-filter>
173121
</activity>
122+
<!--
123+
optional, use this to change the destination URL, default is shown below
124+
other known urls
125+
base.maps.api.here.com
174126
175-
<activity android:name=".debug.browser.CacheBrowserActivity"
176-
android:label="Cache Browser">
127+
<meta-data android:name="HEREWEGO_DOMAIN_OVERRIDE" android:value="aerial.maps.cit.api.here.com" />
128+
-->
129+
<activity
130+
android:name=".debug.browser.CacheBrowserActivity"
131+
android:label="Cache Browser">
177132
<intent-filter>
178133
<action android:name="android.intent.action.VIEW" />
134+
179135
<category android:name="android.intent.category.DEFAULT" />
180136
</intent-filter>
181137
</activity>
182-
<activity android:name=".debug.CacheAnalyzerActivity"
183-
android:label="Cache Analyzer">
138+
139+
<activity
140+
android:name=".debug.CacheAnalyzerActivity"
141+
android:label="Cache Analyzer">
184142
<intent-filter>
185143
<action android:name="android.intent.action.VIEW" />
144+
186145
<category android:name="android.intent.category.DEFAULT" />
187146
</intent-filter>
188147
</activity>
189-
<activity android:name=".ExtraSamplesActivity"
148+
<activity
149+
android:name=".ExtraSamplesActivity"
190150
android:label="More Samples">
191151
<intent-filter>
192152
<action android:name="android.intent.action.VIEW" />
193153

194154
<category android:name="android.intent.category.DEFAULT" />
195155
</intent-filter>
196156
</activity>
197-
<activity android:name=".bugtestfragments.WeathForceActivity"
157+
<activity
158+
android:name=".bugtestfragments.WeathForceActivity"
198159
android:label="WeathForce Test">
199160
<intent-filter>
200161
<action android:name="android.intent.action.VIEW" />
201162

202163
<category android:name="android.intent.category.DEFAULT" />
203164
</intent-filter>
204165
</activity>
205-
206-
207-
<activity android:name=".PreferenceActivity"
208-
android:windowSoftInputMode="stateHidden"
209-
android:label="Open Map Preferences">
166+
<activity
167+
android:name=".PreferenceActivity"
168+
android:label="Open Map Preferences"
169+
android:windowSoftInputMode="stateHidden">
210170
<intent-filter>
211171
<action android:name="android.intent.action.VIEW" />
212172

213173
<category android:name="android.intent.category.DEFAULT" />
214174
</intent-filter>
215175
</activity>
216-
<activity android:name=".LicenseActivity"
217-
android:windowSoftInputMode="stateHidden"
218-
android:label="Licenses">
176+
<activity
177+
android:name=".LicenseActivity"
178+
android:label="Licenses"
179+
android:windowSoftInputMode="stateHidden">
219180
<intent-filter>
220181
<action android:name="android.intent.action.VIEW" />
221182

222183
<category android:name="android.intent.category.DEFAULT" />
223184
</intent-filter>
224185
</activity>
225-
<activity android:name=".diag.DiagnosticsActivity"
226-
android:label="Diagnostics">
186+
<activity
187+
android:name=".diag.DiagnosticsActivity"
188+
android:label="Diagnostics">
227189
<intent-filter>
228190
<action android:name="android.intent.action.VIEW" />
191+
229192
<category android:name="android.intent.category.DEFAULT" />
230193
</intent-filter>
231194
</activity>
232-
195+
<meta-data
196+
android:name="BING_KEY"
197+
android:value="" />
198+
<meta-data
199+
android:name="MAPQUEST_ACCESS_TOKEN"
200+
android:value="" />
201+
<meta-data
202+
android:name="MAPBOX_MAPID"
203+
android:value="mapbox.mapbox-streets-v7" />
204+
<meta-data
205+
android:name="MAPBOX_ACCESS_TOKEN"
206+
android:value="" />
207+
<meta-data
208+
android:name="HEREWEGO_MAPID"
209+
android:value="hybrid.day" />
210+
<meta-data
211+
android:name="HEREWEGO_APPID"
212+
android:value="" />
213+
<meta-data
214+
android:name="HEREWEGO_APPCODE"
215+
android:value="" />
216+
<uses-library
217+
android:name="com.google.android.maps"
218+
android:required="false" />
233219
</application>
234220

235-
</manifest>
221+
<supports-screens
222+
android:anyDensity="true"
223+
android:largeScreens="true"
224+
android:normalScreens="true" /> <!-- PROTECTION_NORMAL permissions, automatically granted -->
225+
<uses-feature
226+
android:name="android.hardware.location.network"
227+
android:required="false" />
228+
<uses-feature
229+
android:name="android.hardware.location.gps"
230+
android:required="false" />
231+
<uses-feature
232+
android:name="android.hardware.telephony"
233+
android:required="false" /> <!-- DANGEROUS PERMISSIONS, must request -->
234+
<uses-feature
235+
android:name="android.hardware.wifi"
236+
android:required="false" />
237+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
238+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
239+
240+
<uses-permission android:name="android.permission.INTERNET" />
241+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
242+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
243+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
244+
245+
<uses-sdk tools:overrideLibrary="mil.army.missioncommand,armyc2.c2sd.singlepointrenderer,org.osmdroid.gpkg,mil.nga.geopackage,org.osmdroid.mapsforge,android.support.v13,com.github.angads25.filepicker,android.support.v7.gridlayout" />
246+
247+
</manifest>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package org.osmdroid;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.DialogFragment;
5+
import android.support.v4.app.FragmentActivity;
6+
import android.view.View;
7+
import android.widget.Button;
8+
9+
import org.osmdroid.bugtestfragments.Bug1783MyLocationOverlayNPE;
10+
import org.osmdroid.model.IBaseActivity;
11+
12+
public class Bug1783Activity extends FragmentActivity implements IBaseActivity {
13+
14+
@Override
15+
protected void onCreate(Bundle savedInstanceState) {
16+
super.onCreate(savedInstanceState);
17+
setContentView(R.layout.activity_bug1783);
18+
Button button = findViewById(R.id.bug1782Button);
19+
button.setOnClickListener(new View.OnClickListener() {
20+
public void onClick(View v) {
21+
22+
final DialogFragment dialog = new Bug1783MyLocationOverlayNPE();
23+
24+
dialog.show(Bug1783Activity.this.getSupportFragmentManager(), "tag");
25+
/* try {
26+
Thread.sleep(1000);
27+
} catch (InterruptedException e) {
28+
29+
}
30+
Bug1783Activity.this.runOnUiThread(new Runnable() {
31+
@Override
32+
public void run() {
33+
dialog.dismiss();
34+
35+
}
36+
});*/
37+
38+
39+
40+
}
41+
});
42+
}
43+
44+
@Override
45+
public String getActivityTitle() {
46+
return "My location overview dialog fragment";
47+
}
48+
}

OpenStreetMapViewer/src/main/java/org/osmdroid/BugsTestingActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
4141
if (fm.findFragmentByTag(SAMPLES_FRAGMENT_TAG) == null) {
4242
List<IBaseActivity> extras = new ArrayList<>();
4343
extras.add(new WeathForceActivity());
44+
extras.add(new Bug1783Activity());
4445
fragmentSamples = SamplesMenuFragment.newInstance(BugFactory.getInstance(), extras);
4546
fm.beginTransaction().add(org.osmdroid.R.id.samples_container, fragmentSamples, SAMPLES_FRAGMENT_TAG).commit();
4647
}

0 commit comments

Comments
 (0)