This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added sample
InfoWindowConcurrentActivity
to illustrate the behavio…
…r of multiple InfoWindows visible at a time (#3115).
- Loading branch information
Showing
6 changed files
with
149 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
...idSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowConcurrentActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package com.mapbox.mapboxsdk.testapp; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.ActionBar; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.MenuItem; | ||
|
||
import com.mapbox.mapboxsdk.annotations.MarkerOptions; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.utils.ApiAccess; | ||
import com.mapbox.mapboxsdk.views.MapView; | ||
|
||
public class InfoWindowConcurrentActivity extends AppCompatActivity { | ||
|
||
private MapView mMapView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_infowindow_concurrent); | ||
|
||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
setSupportActionBar(toolbar); | ||
|
||
ActionBar actionBar = getSupportActionBar(); | ||
if (actionBar != null) { | ||
actionBar.setDisplayHomeAsUpEnabled(true); | ||
actionBar.setDisplayShowHomeEnabled(true); | ||
} | ||
|
||
mMapView = (MapView) findViewById(R.id.mapView); | ||
mMapView.setAccessToken(ApiAccess.getToken(this)); | ||
mMapView.onCreate(savedInstanceState); | ||
|
||
// Enable to let concurrent multiple infowindows to be shown. | ||
mMapView.setAllowConcurrentMultipleOpenInfoWindows(true); | ||
|
||
mMapView.addMarker(new MarkerOptions() | ||
.title("Intersection") | ||
.snippet("H St NW with 15th St NW") | ||
.position(new LatLng(38.9002073, -77.03364419))); | ||
|
||
mMapView.addMarker(new MarkerOptions() | ||
.title("White House") | ||
.snippet("The official residence and principal workplace of the President of the United States, located at 1600 Pennsylvania Avenue NW in Washington, D.C. It has been the residence of every U.S. president since John Adams in 1800.") | ||
.position(new LatLng(38.897705003219784, -77.03655168667463))); | ||
|
||
mMapView.addMarker(new MarkerOptions().title("Intersection") | ||
.snippet("E St NW with 17th St NW") | ||
.position(new LatLng(38.8954236, -77.0394623))); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
mMapView.onStart(); | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
super.onResume(); | ||
mMapView.onResume(); | ||
} | ||
|
||
@Override | ||
public void onPause() { | ||
super.onPause(); | ||
mMapView.onPause(); | ||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
super.onStop(); | ||
mMapView.onStop(); | ||
} | ||
|
||
@Override | ||
protected void onSaveInstanceState(Bundle outState) { | ||
super.onSaveInstanceState(outState); | ||
mMapView.onSaveInstanceState(outState); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
mMapView.onDestroy(); | ||
} | ||
|
||
@Override | ||
public void onLowMemory() { | ||
super.onLowMemory(); | ||
mMapView.onLowMemory(); | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch (item.getItemId()) { | ||
case android.R.id.home: | ||
onBackPressed(); | ||
return true; | ||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_concurrent.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="?attr/actionBarSize" | ||
android:background="@color/primary" | ||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> | ||
|
||
<com.mapbox.mapboxsdk.views.MapView | ||
android:id="@+id/mapView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:style_url="@string/style_mapbox_streets" | ||
app:center_latitude="38.897705003219784" | ||
app:center_longitude="-77.03655168667463" | ||
app:zoom_level="15" /> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters