fix some issues
git-svn-id: https://osmand.googlecode.com/svn/trunk@365 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
fb49f25a33
commit
3f8e13c79c
9 changed files with 96 additions and 17 deletions
|
@ -10,9 +10,6 @@ public class ToDoConstants {
|
|||
|
||||
// TODO ANDROID
|
||||
// for 0.3
|
||||
// 68. Implement service to app work with screen offline
|
||||
// (audio guidance & add new item to status bar & introduce error interval for gps building)
|
||||
// for offline service save gpx (combine in one trkseg)
|
||||
// 71. Implement different mechanism for tiles (big sqlite planet see rmaps)
|
||||
|
||||
// Improvement : Show stops in the transport route on the map
|
||||
|
@ -31,9 +28,7 @@ public class ToDoConstants {
|
|||
|
||||
// FIXME
|
||||
// 2. Bug with network location while routing (?) - fixed ?
|
||||
// 3. TODO options : using trackball as an option
|
||||
// 4. Add last turn as go straight (+)
|
||||
// 5. After return if there was previous route (countinue follow)
|
||||
// 5. After return if there was previous route (continue follow)
|
||||
// 6. Bug 13.
|
||||
|
||||
|
||||
|
@ -63,6 +58,8 @@ public class ToDoConstants {
|
|||
// BUGS Swing
|
||||
|
||||
// DONE ANDROID :
|
||||
// 68. Implement service to app work with screen offline
|
||||
// (audio guidance & add new item to status bar & introduce error interval for gps in buildings)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="use_trackball_descr">Использовать трекбол, чтобы перемещать карту</string>
|
||||
<string name="use_trackball">Использовать трекбол</string>
|
||||
<string name="background_service_wait_int_descr">Выберите время поиска позиции сервиса</string>
|
||||
<string name="background_service_wait_int">Время ожидания</string>
|
||||
<string name="service_stop_background_service">Остановить фоновый сервис</string>
|
||||
<string name="where_am_i">Где я?</string>
|
||||
<string name="network_provider">Сеть</string>
|
||||
<string name="gps_provider">GPS</string>
|
||||
<string name="int_seconds">секунд</string>
|
||||
<string name="int_min">мин.</string>
|
||||
<string name="background_service_int_descr">Выберите интервал позиционирования для сервиса</string>
|
||||
<string name="background_service_int">Интервал позиционирования</string>
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="use_trackball_descr">Use trackball to move map</string>
|
||||
<string name="use_trackball">Use trackball</string>
|
||||
<string name="background_service_wait_int_descr">Choose wait interval determining location</string>
|
||||
<string name="background_service_wait_int">Wait interval</string>
|
||||
<string name="service_stop_background_service">Switch off background navigation service</string>
|
||||
<string name="where_am_i">Where am I?</string>
|
||||
<string name="process_navigation_service">Osmand navigation service</string>
|
||||
<string name="network_provider">Network</string>
|
||||
<string name="gps_provider">GPS</string>
|
||||
<string name="int_seconds">seconds</string>
|
||||
<string name="int_min">min.</string>
|
||||
<string name="background_service_int_descr">Choose interval to determine location for background service</string>
|
||||
<string name="background_service_int">Positioning interval</string>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<CheckBoxPreference android:key="rotate_map_to_bearing" android:title="@string/rotate_map_to_bearing" android:summary="@string/rotate_map_to_bearing_descr"></CheckBoxPreference>
|
||||
<ListPreference android:key="map_screen_orientation" android:title="@string/map_screen_orientation" android:summary="@string/map_screen_orientation_descr"></ListPreference>
|
||||
<ListPreference android:key="position_on_map" android:title="@string/position_on_map" android:summary="@string/position_on_map_descr"></ListPreference>
|
||||
<CheckBoxPreference android:key="use_trackball_for_movements" android:title="@string/use_trackball" android:summary="@string/use_trackball_descr"></CheckBoxPreference>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="@string/data_settings" android:summary="@string/data_settings_descr">
|
||||
|
@ -29,6 +30,7 @@
|
|||
<CheckBoxPreference android:summary="@string/background_router_service_descr" android:title="@string/background_router_service" android:key="service_off_enabled"></CheckBoxPreference>
|
||||
<ListPreference android:key="service_off_provider" android:title="@string/background_service_provider" android:summary="@string/background_service_provider_descr"></ListPreference>
|
||||
<ListPreference android:key="service_off_interval" android:title="@string/background_service_int" android:summary="@string/background_service_int_descr"></ListPreference>
|
||||
<ListPreference android:key="service_off_wait_interval" android:title="@string/background_service_wait_int" android:summary="@string/background_service_wait_int_descr"></ListPreference>
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen android:title="@string/monitor_preferences" android:summary="@string/monitor_preferences_descr">
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.osmand;
|
||||
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
|
@ -20,6 +26,8 @@ public class NavigationService extends Service implements LocationListener {
|
|||
public static class NavigationServiceBinder extends Binder {
|
||||
|
||||
}
|
||||
private final static int NOTIFICATION_SERVICE_ID = 1;
|
||||
public final static String OSMAND_STOP_SERVICE_ACTION = "OSMAND_STOP_SERVICE_ACTION"; //$NON-NLS-1$
|
||||
private NavigationServiceBinder binder = new NavigationServiceBinder();
|
||||
private int serviceOffInterval;
|
||||
private String serviceOffProvider;
|
||||
|
@ -27,6 +35,8 @@ public class NavigationService extends Service implements LocationListener {
|
|||
private Handler handler;
|
||||
private int serviceError;
|
||||
private RoutingHelper routingHelper;
|
||||
private Notification notification;
|
||||
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
|
@ -51,7 +61,7 @@ public class NavigationService extends Service implements LocationListener {
|
|||
|
||||
}
|
||||
|
||||
}, serviceError);
|
||||
}, delay);
|
||||
|
||||
}
|
||||
|
||||
|
@ -63,11 +73,29 @@ public class NavigationService extends Service implements LocationListener {
|
|||
|
||||
serviceOffInterval = OsmandSettings.getServiceOffInterval(this);
|
||||
serviceOffProvider = OsmandSettings.getServiceOffProvider(this);
|
||||
serviceError = OsmandSettings.getServiceOffErrorInterval(this);
|
||||
serviceError = OsmandSettings.getServiceOffWaitInterval(this);
|
||||
savingTrackHelper = new SavingTrackHelper(this);
|
||||
delayedAction(true, 500);
|
||||
routingHelper = RoutingHelper.getInstance(this);
|
||||
OsmandSettings.setServiceOffEnabled(this, true);
|
||||
|
||||
registerReceiver(new BroadcastReceiver(){
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
NavigationService.this.stopSelf();
|
||||
}
|
||||
|
||||
}, new IntentFilter(OSMAND_STOP_SERVICE_ACTION));
|
||||
|
||||
Intent notificationIntent = new Intent(OSMAND_STOP_SERVICE_ACTION);
|
||||
notification = new Notification(R.drawable.icon, "", //$NON-NLS-1$
|
||||
System.currentTimeMillis());
|
||||
notification.flags = Notification.FLAG_NO_CLEAR;
|
||||
notification.setLatestEventInfo(this, Version.APP_NAME,
|
||||
getString(R.string.service_stop_background_service), PendingIntent.getBroadcast(this, 0, notificationIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
mNotificationManager.notify(NOTIFICATION_SERVICE_ID, notification);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,6 +105,9 @@ public class NavigationService extends Service implements LocationListener {
|
|||
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
|
||||
locationManager.removeUpdates(this);
|
||||
OsmandSettings.setServiceOffEnabled(this, false);
|
||||
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
mNotificationManager.cancel(NOTIFICATION_SERVICE_ID);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,6 +52,16 @@ public class OsmandSettings {
|
|||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.getBoolean(USE_INTERNET_TO_DOWNLOAD_TILES, USE_INTERNET_TO_DOWNLOAD_TILES_DEF);
|
||||
}
|
||||
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String USE_TRACKBALL_FOR_MOVEMENTS = "use_trackball_for_movements"; //$NON-NLS-1$
|
||||
public static final boolean USE_TRACKBALL_FOR_MOVEMENTS_DEF = true;
|
||||
|
||||
public static boolean isUsingTrackBall(Context ctx) {
|
||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.getBoolean(USE_TRACKBALL_FOR_MOVEMENTS, USE_TRACKBALL_FOR_MOVEMENTS_DEF);
|
||||
}
|
||||
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
|
@ -578,11 +588,11 @@ public class OsmandSettings {
|
|||
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public static final String SERVICE_OFF_ERROR_INTERVAL = "service_off_error_interval"; //$NON-NLS-1$
|
||||
public static final int SERVICE_OFF_ERROR_INTERVAL_DEF = 60 * 1000;
|
||||
public static int getServiceOffErrorInterval(Context ctx) {
|
||||
public static final String SERVICE_OFF_WAIT_INTERVAL = "service_off_wait_interval"; //$NON-NLS-1$
|
||||
public static final int SERVICE_OFF_WAIT_INTERVAL_DEF = 90 * 1000;
|
||||
public static int getServiceOffWaitInterval(Context ctx) {
|
||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||
return prefs.getInt(SERVICE_OFF_ERROR_INTERVAL, SERVICE_OFF_ERROR_INTERVAL_DEF);
|
||||
return prefs.getInt(SERVICE_OFF_WAIT_INTERVAL, SERVICE_OFF_WAIT_INTERVAL_DEF);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
}
|
||||
@Override
|
||||
public boolean onTrackballEvent(MotionEvent event) {
|
||||
if(event.getAction() == MotionEvent.ACTION_MOVE){
|
||||
if(event.getAction() == MotionEvent.ACTION_MOVE && OsmandSettings.isUsingTrackBall(this)){
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + x * 15, mapView.getCenterPointY() + y * 15);
|
||||
|
|
|
@ -6,16 +6,18 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Environment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.EditTextPreference;
|
||||
import android.preference.ListPreference;
|
||||
|
@ -82,6 +84,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
private ListPreference mapScreenOrientation;
|
||||
private ListPreference voicePreference;
|
||||
private ListPreference routeServiceInterval;
|
||||
private ListPreference routeServiceWaitInterval;
|
||||
private ListPreference routeServiceProvider;
|
||||
private CheckBoxPreference routeServiceEnabled;
|
||||
|
||||
|
@ -91,6 +94,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
new BooleanPreference(OsmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES, OsmandSettings.USE_INTERNET_TO_DOWNLOAD_TILES_DEF),
|
||||
new BooleanPreference(OsmandSettings.ROTATE_MAP_TO_BEARING, OsmandSettings.ROTATE_MAP_TO_BEARING_DEF),
|
||||
new BooleanPreference(OsmandSettings.SHOW_VIEW_ANGLE, OsmandSettings.SHOW_VIEW_ANGLE_DEF),
|
||||
new BooleanPreference(OsmandSettings.USE_TRACKBALL_FOR_MOVEMENTS, OsmandSettings.USE_TRACKBALL_FOR_MOVEMENTS_DEF),
|
||||
new BooleanPreference(OsmandSettings.USE_ENGLISH_NAMES, OsmandSettings.USE_ENGLISH_NAMES_DEF),
|
||||
new BooleanPreference(OsmandSettings.SHOW_OSM_BUGS, OsmandSettings.SHOW_OSM_BUGS_DEF),
|
||||
new BooleanPreference(OsmandSettings.AUTO_ZOOM_MAP, OsmandSettings.AUTO_ZOOM_MAP_DEF),
|
||||
|
@ -145,11 +149,21 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
|
||||
routeServiceInterval =(ListPreference) screen.findPreference(OsmandSettings.SERVICE_OFF_INTERVAL);
|
||||
routeServiceInterval.setOnPreferenceChangeListener(this);
|
||||
routeServiceWaitInterval =(ListPreference) screen.findPreference(OsmandSettings.SERVICE_OFF_WAIT_INTERVAL);
|
||||
routeServiceWaitInterval.setOnPreferenceChangeListener(this);
|
||||
routeServiceProvider =(ListPreference) screen.findPreference(OsmandSettings.SERVICE_OFF_PROVIDER);
|
||||
routeServiceProvider.setOnPreferenceChangeListener(this);
|
||||
routeServiceEnabled =(CheckBoxPreference) screen.findPreference(OsmandSettings.SERVICE_OFF_ENABLED);
|
||||
routeServiceEnabled.setOnPreferenceChangeListener(this);
|
||||
|
||||
|
||||
registerReceiver(new BroadcastReceiver(){
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
routeServiceEnabled.setChecked(false);
|
||||
}
|
||||
|
||||
}, new IntentFilter(NavigationService.OSMAND_STOP_SERVICE_ACTION));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,6 +208,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
routeServiceInterval.setEntryValues(ints);
|
||||
routeServiceInterval.setValue(OsmandSettings.getServiceOffInterval(this)/60000+""); //$NON-NLS-1$
|
||||
|
||||
ints = new String[]{"15", "30", "45", "60", "90", "120", "180", "300", "600"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
|
||||
intDescriptions = new String[ints.length];
|
||||
for(int i=0; i<intDescriptions.length; i++){
|
||||
intDescriptions[i] = ints[i] + " " + getString(R.string.int_seconds); //$NON-NLS-1$
|
||||
}
|
||||
routeServiceWaitInterval.setEntries(intDescriptions);
|
||||
routeServiceWaitInterval.setEntryValues(ints);
|
||||
routeServiceWaitInterval.setValue(OsmandSettings.getServiceOffWaitInterval(this)/1000+""); //$NON-NLS-1$
|
||||
|
||||
|
||||
routeServiceProvider.setEntries(new String[]{getString(R.string.gps_provider), getString(R.string.network_provider)});
|
||||
routeServiceProvider.setEntryValues(new String[]{LocationManager.GPS_PROVIDER, LocationManager.NETWORK_PROVIDER});
|
||||
routeServiceProvider.setValue(OsmandSettings.getServiceOffProvider(this));
|
||||
|
@ -330,6 +354,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
} else if (preference == routeServiceInterval) {
|
||||
edit.putInt(OsmandSettings.SERVICE_OFF_INTERVAL, Integer.parseInt((String) newValue) * 60000);
|
||||
edit.commit();
|
||||
} else if (preference == routeServiceWaitInterval) {
|
||||
edit.putInt(OsmandSettings.SERVICE_OFF_WAIT_INTERVAL, Integer.parseInt((String) newValue) * 1000);
|
||||
edit.commit();
|
||||
} else if (preference == routeServiceProvider) {
|
||||
edit.putString(OsmandSettings.SERVICE_OFF_PROVIDER, (String) newValue);
|
||||
edit.commit();
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
*/
|
||||
package com.osmand.activities.search;
|
||||
|
||||
import com.osmand.R;
|
||||
import com.osmand.activities.NavigatePointActivity;
|
||||
|
||||
import android.app.TabActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -13,6 +10,9 @@ import android.widget.Button;
|
|||
import android.widget.TabHost;
|
||||
import android.widget.TabHost.TabSpec;
|
||||
|
||||
import com.osmand.R;
|
||||
import com.osmand.activities.NavigatePointActivity;
|
||||
|
||||
/**
|
||||
* @author Maxim Frolov
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue