Issue 416 allow to user share location (partially browsable)

This commit is contained in:
Victor Shcherb 2011-04-29 10:13:46 +02:00
parent a7cdc87553
commit 6b1edfac11
3 changed files with 17 additions and 3 deletions

View file

@ -10,7 +10,20 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait"></activity> <activity android:name=".activities.MapActivity" android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<data android:scheme="geo" android:host="osmand.net"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
<intent-filter>
<data android:scheme="http" android:host="download.osmand.net"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
<activity android:name=".activities.SettingsActivity" android:label="@string/settings_activity" android:configChanges="keyboardHidden|orientation"></activity> <activity android:name=".activities.SettingsActivity" android:label="@string/settings_activity" android:configChanges="keyboardHidden|orientation"></activity>
<activity android:name=".activities.search.SearchActivity" android:label="@string/search_activity" ></activity> <activity android:name=".activities.search.SearchActivity" android:label="@string/search_activity" ></activity>
<activity android:name=".activities.NavigatePointActivity"></activity> <activity android:name=".activities.NavigatePointActivity"></activity>

View file

@ -4,7 +4,7 @@
<string name="send_location_sms_pattern">Я нахожусь : {0} , {1}</string> <string name="send_location_sms_pattern">Я нахожусь : {0} , {1}</string>
<string name="send_location_email_pattern">Чтобы увидить местоположение следуйте ссылке {0} или android ссылке {1}</string> <string name="send_location_email_pattern">Чтобы увидить местоположение следуйте ссылке {0} или android ссылке {1}</string>
<string name="send_location">Отправить местоположение</string> <string name="send_location">Отправить местоположение</string>
<string name="context_menu_item_share_location">Поделиться</string> <string name="context_menu_item_share_location">Поделиться местоположением</string>
<string name="add_waypoint_dialog_added">Точка \'\'{0}\'\' была успешно добавлена</string> <string name="add_waypoint_dialog_added">Точка \'\'{0}\'\' была успешно добавлена</string>
<string name="add_waypoint_dialog_title">Добавить точку к записи GPX трека</string> <string name="add_waypoint_dialog_title">Добавить точку к записи GPX трека</string>
<string name="context_menu_item_add_waypoint">Добавить точку к треку</string> <string name="context_menu_item_add_waypoint">Добавить точку к треку</string>

View file

@ -1744,6 +1744,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
protected void shareLocation(final double latitude, final double longitude, int zoom){ protected void shareLocation(final double latitude, final double longitude, int zoom){
final String shortOsmUrl = MapUtils.buildShortOsmUrl(latitude, longitude, zoom); final String shortOsmUrl = MapUtils.buildShortOsmUrl(latitude, longitude, zoom);
final String simpleGeo = "geo:"+((float) latitude)+","+((float)longitude) +"?z="+zoom; final String simpleGeo = "geo:"+((float) latitude)+","+((float)longitude) +"?z="+zoom;
final String tr = "geo://osmand.net?lat="+((float) latitude)+"&lon="+((float)longitude) +"&z="+zoom;
//final String geoIntent = "<a href=\""+simpleGeo+"\">geo link</a>"; //final String geoIntent = "<a href=\""+simpleGeo+"\">geo link</a>";
AlertDialog.Builder builder = new Builder(this); AlertDialog.Builder builder = new Builder(this);
@ -1755,7 +1756,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String sms = MessageFormat.format(getString(R.string.send_location_sms_pattern), shortOsmUrl, simpleGeo); String sms = MessageFormat.format(getString(R.string.send_location_sms_pattern), shortOsmUrl, simpleGeo);
String email = MessageFormat.format(getString(R.string.send_location_email_pattern), shortOsmUrl, simpleGeo ); String email = MessageFormat.format(getString(R.string.send_location_email_pattern), shortOsmUrl, tr );
if(which == 0){ if(which == 0){
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$ intent.setType("vnd.android.cursor.dir/email"); //$NON-NLS-1$