Skip to content

Commit 048f4fa

Browse files
committed
google API
1 parent fa7cd39 commit 048f4fa

File tree

12 files changed

+82
-46
lines changed

12 files changed

+82
-46
lines changed

.DS_Store

12 KB
Binary file not shown.

android/GoogleMapsV2CustomBalloons/AndroidManifest.xml

+25-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,35 @@
88
android:minSdkVersion="8"
99
android:targetSdkVersion="17" />
1010

11+
<permission
12+
android:name="com.hrupin.sample.googlemapsv2customballoons.permission.MAPS_RECEIVE"
13+
android:protectionLevel="signature" />
14+
15+
<uses-permission android:name="com.hrupin.sample.googlemapsv2customballoons.permission.MAPS_RECEIVE" />
16+
<uses-permission android:name="android.permission.INTERNET" />
17+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
18+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
19+
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
20+
<!--
21+
The following two permissions are not required to use
22+
Google Maps Android API v2, but are recommended.
23+
-->
24+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
25+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
26+
27+
<uses-feature
28+
android:glEsVersion="0x00020000"
29+
android:required="true" />
30+
1131
<application
1232
android:allowBackup="true"
1333
android:icon="@drawable/ic_launcher"
1434
android:label="@string/app_name"
1535
android:theme="@style/AppTheme" >
36+
<meta-data
37+
android:name="com.google.android.maps.v2.API_KEY"
38+
android:value="your_api_key" />
39+
1640
<activity
1741
android:name="com.hrupin.sample.googlemapsv2customballoons.MainActivity"
1842
android:label="@string/app_name" >
@@ -24,4 +48,4 @@
2448
</activity>
2549
</application>
2650

27-
</manifest>
51+
</manifest>
Loading

android/GoogleMapsV2CustomBalloons/res/layout/activity_main.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
22
xmlns:tools="http://schemas.android.com/tools"
33
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
tools:context=".MainActivity" >
4+
android:layout_height="match_parent" >
65

76
<fragment
87
android:id="@+id/map"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="wrap_content"
4+
android:layout_height="wrap_content"
5+
android:orientation="vertical"
6+
android:background="@drawable/balloon_bg">
7+
8+
<TextView
9+
android:id="@+id/textViewTitle"
10+
android:layout_width="match_parent"
11+
android:layout_height="match_parent"
12+
android:layout_margin="10dp"
13+
android:gravity="center"
14+
android:text="TextView"
15+
android:textSize="20sp" />
16+
17+
</LinearLayout>

android/GoogleMapsV2CustomBalloons/res/values-sw600dp/dimens.xml

-8
This file was deleted.

android/GoogleMapsV2CustomBalloons/res/values-sw720dp-land/dimens.xml

-9
This file was deleted.

android/GoogleMapsV2CustomBalloons/res/values-v11/styles.xml

-11
This file was deleted.

android/GoogleMapsV2CustomBalloons/res/values-v14/styles.xml

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
*
3+
*/
4+
package com.hrupin.sample.googlemapsv2customballoons;
5+
6+
import android.support.v4.app.FragmentActivity;
7+
import android.view.LayoutInflater;
8+
import android.view.View;
9+
import android.widget.TextView;
10+
11+
import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
12+
import com.google.android.gms.maps.model.Marker;
13+
14+
public class BalloonAdapter implements InfoWindowAdapter {
15+
public static final String IS_MY_LOCATION_MARKER = "###%%%MY_LOCATION###%%%";
16+
LayoutInflater inflater = null;
17+
private TextView textViewTitle;
18+
private FragmentActivity activity;
19+
20+
public BalloonAdapter(LayoutInflater inflater, FragmentActivity activity) {
21+
this.inflater = inflater;
22+
this.activity = activity;
23+
}
24+
25+
@Override
26+
public View getInfoWindow(Marker marker) {
27+
View v = inflater.inflate(R.layout.balloon, null);
28+
textViewTitle = (TextView) v.findViewById(R.id.terrain);
29+
textViewTitle.setText(marker.getTitle());
30+
return (v);
31+
}
32+
33+
@Override
34+
public View getInfoContents(Marker marker) {
35+
return (null);
36+
}
37+
}

android/GoogleMapsV2CustomBalloons/src/com/hrupin/sample/googlemapsv2customballoons/MainActivity.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.google.android.gms.maps.SupportMapFragment;
88
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
99
import com.google.android.gms.maps.model.LatLng;
10-
import com.google.android.gms.maps.model.Marker;
1110
import com.google.android.gms.maps.model.MarkerOptions;
1211

1312
public class MainActivity extends FragmentActivity {
@@ -24,8 +23,8 @@ protected void onCreate(Bundle savedInstanceState) {
2423
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
2524

2625
if (map != null) {
27-
Marker la = map.addMarker(new MarkerOptions().position(LOS_ANGELES).title("Los Angeles"));
28-
Marker sf = map.addMarker(new MarkerOptions().position(SAN_FRANCISCO).title("San Francisco").snippet("This is San Francisco")
26+
map.addMarker(new MarkerOptions().position(LOS_ANGELES).title("Los Angeles"));
27+
map.addMarker(new MarkerOptions().position(SAN_FRANCISCO).title("San Francisco")
2928
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
3029
}
3130
}

bash/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)