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 // 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. // 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). // Some icons are not fine (as back menu from map - it is blured).
@ -43,16 +39,17 @@ public class ToDoConstants {
// FUTURE RELEASES // FUTURE RELEASES
// 49. Calculate route from specified point (not from your location only) // 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. // 48. Enable change favorite point : (for example fav - "car") means last point you left car. It is not static point,
// 43. Enable poi filter by name (?) // you can always use the same name for different locations.
// 44. Show gps status (possibly open existing gps-compass app (free) or suggest to install it - no sense to write own activity) // 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. // 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 // 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). // (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. // Internet using now for : edit POI osm, show osm bugs layer, download tiles.
// 47. Internet connectivity could be checked before trying to use // 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 (?) // 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) (?) // 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. (?) // 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?)
@ -64,9 +61,9 @@ public class ToDoConstants {
// TODO swing // 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 ! // 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) // Current result : for big file (1 - task 60-80% time, 90% memory)
// 1. Download tiles without using dir tiles (?)
// 10. Improve address indexing (use relations). // 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). // use relation "a6" (to accumulate streets!), "a3" to read all cities & define boundaries for city (& define that street in city).
@ -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 // 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). // DONE : add to app settings preference (Refresh indexes).
// 31. Translation. // 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 // DONE SWING

View file

@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/map_context_menu" android:menuCategory="container"> <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/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_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: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> <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"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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="opening_changeset">Открытие пакета правок</string>
<string name="closing_changeset">Закрытие пакета правок</string> <string name="closing_changeset">Закрытие пакета правок</string>
<string name="commiting_node">Сохранения объекта</string> <string name="commiting_node">Сохранения объекта</string>

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <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_hours">Opening hours : </string>
<string name="opening_changeset">Openging changeset</string> <string name="opening_changeset">Openging changeset</string>
<string name="closing_changeset">Closing 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.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.AlertDialog.Builder; import android.app.AlertDialog.Builder;
import android.content.ComponentName;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.PointF; import android.graphics.PointF;
import android.hardware.Sensor; import android.hardware.Sensor;
@ -60,6 +63,9 @@ import com.osmand.views.RouteLayer;
public class MapActivity extends Activity implements LocationListener, IMapLocationListener, SensorEventListener { 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. */ /** Called when the activity is first created. */
private OsmandMapTileView mapView; private OsmandMapTileView mapView;
@ -540,6 +546,16 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
final Intent settings = new Intent(MapActivity.this, SettingsActivity.class); final Intent settings = new Intent(MapActivity.this, SettingsActivity.class);
startActivity(settings); startActivity(settings);
return true; 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) { } else if (item.getItemId() == R.id.map_mark_point) {
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude(), true); contextMenuPoint(mapView.getLatitude(), mapView.getLongitude(), true);
return true; return true;