implement show gps status

git-svn-id: https://osmand.googlecode.com/svn/trunk@187 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-06-20 15:31:20 +00:00
parent 56427dc8ba
commit caedaf92ab
5 changed files with 34 additions and 13 deletions

View file

@ -23,10 +23,6 @@ public class ToDoConstants {
// TODO ANDROID
// 34. Suppport navigation for calculated route (example of get route from internet is in swing app).
// DONE : MiniMap done, Routing settings done, RouteLayer done, RoutingHelper done.
// TODO : Test again?
// 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions.
// Some icons are not fine (as back menu from map - it is blured).
@ -43,16 +39,17 @@ public class ToDoConstants {
// FUTURE RELEASES
// 49. Calculate route from specified point (not from your location only)
// 48. Enable change favourite point (for example fav - "car") means last point you left car. It is not static point.
// 43. Enable poi filter by name (?)
// 44. Show gps status (possibly open existing gps-compass app (free) or suggest to install it - no sense to write own activity)
// 48. Enable change favorite point : (for example fav - "car") means last point you left car. It is not static point,
// you can always use the same name for different locations.
// 50. Invent opening hours editor in order to edit POI hours better on device
// 48. Implement console application that prepare indexes to upload on server...
// 0) run in background 1) download from internet 2) generates indices for Europe (take care about memory) 3) upload?
// 43. Enable poi filter by name
// 45. Get clear <Use internet> settings. Move that setting on top settings screen.
// That setting should rule all activities that use internet. It should ask whenever internet is used
// (would you like to use internet for that operation - if using internet is not checked).
// Internet using now for : edit POI osm, show osm bugs layer, download tiles.
// 47. Internet connectivity could be checked before trying to use
// 48. Implement console application that prepare indexes to upload on server...
// 0) run in background 1) download from internet 2) generates indices for Europe (take care about memory) 3) upload?
// 46. Implement downloading strategy for tiles (do not load 17 zoom, load only 16 for example) - try to scale 15 zoom for 17 (?)
// 40. Support simple vector road rendering (require new index file) (?)
// 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?)
@ -64,10 +61,10 @@ public class ToDoConstants {
// TODO swing
// 1. Download tiles without using dir tiles (?)
// 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index !
// Current result : for big file (1 - task 60-80% time, 90% memory)
// 10. Improve address indexing (use relations).
// 1. Download tiles without using dir tiles (?)
// 10. Improve address indexing (use relations).
// use relation "a6" (to accumulate streets!), "a3" to read all cities & define boundaries for city (& define that street in city).
// BUGS Swing
@ -76,6 +73,9 @@ public class ToDoConstants {
// 37. Get rid of exit button (!). Think about when notification should go & how clear resources if it is necessary
// DONE : add to app settings preference (Refresh indexes).
// 31. Translation.
// 34. Suppport navigation for calculated route (example of get route from internet is in swing app).
// DONE : MiniMap done, Routing settings done, RouteLayer done, RoutingHelper done.
// 44. Show gps status (possibly open existing gps-compass app (free) or suggest to install it - no sense to write own activity)
// DONE SWING

View file

@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/map_context_menu" android:menuCategory="container">
<item android:title="@string/mark_point" android:id="@+id/map_mark_point" android:icon="@android:drawable/ic_menu_mylocation"></item>
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
<item android:id="@+id/map_navigate_to_point" android:title="@string/stop_navigation" android:visible="false" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
<item android:id="@+id/map_reload_tile" android:title="@string/update_tile" android:icon="@android:drawable/ic_menu_view"></item>
<item android:title="@string/map_specify_point" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>

View file

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="opening_hours">Рабочие часы: </string>
<string name="gps_status_app_not_found">Приложение Gps status не найдено</string>
<string name="show_gps_status">GPS статус</string>
<string name="opening_hours">Рабочие часы: </string>
<string name="opening_changeset">Открытие пакета правок</string>
<string name="closing_changeset">Закрытие пакета правок</string>
<string name="commiting_node">Сохранения объекта</string>

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="gps_status_app_not_found">Gps status app could not be found</string>
<string name="show_gps_status">Show gps status</string>
<string name="opening_hours">Opening hours : </string>
<string name="opening_changeset">Openging changeset</string>
<string name="closing_changeset">Closing changeset</string>

View file

@ -8,9 +8,12 @@ import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.PointF;
import android.hardware.Sensor;
@ -59,7 +62,10 @@ import com.osmand.views.PointNavigationLayer;
import com.osmand.views.RouteLayer;
public class MapActivity extends Activity implements LocationListener, IMapLocationListener, SensorEventListener {
private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2.GPSStatus"; //$NON-NLS-1$
private static final String GPS_STATUS_COMPONENT = "com.eclipsim.gpsstatus2"; //$NON-NLS-1$
// private static final String GPS_STATUS_ACTIVITY = "com.eclipsim.gpsstatus2"; //$NON-NLS-1$
/** Called when the activity is first created. */
private OsmandMapTileView mapView;
@ -540,6 +546,16 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
final Intent settings = new Intent(MapActivity.this, SettingsActivity.class);
startActivity(settings);
return true;
} else if (item.getItemId() == R.id.map_show_gps_status) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(GPS_STATUS_COMPONENT, GPS_STATUS_ACTIVITY));
ResolveInfo resolved = getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
if(resolved != null){
startActivity(intent);
} else {
Toast.makeText(this, getString(R.string.gps_status_app_not_found), Toast.LENGTH_LONG).show();
}
return true;
} else if (item.getItemId() == R.id.map_mark_point) {
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude(), true);
return true;