Add constants for UI handler events
This commit is contained in:
parent
6c7cd3d3c2
commit
a25d361ae9
10 changed files with 41 additions and 18 deletions
16
OsmAnd/src/net/osmand/plus/OsmAndConstants.java
Normal file
16
OsmAnd/src/net/osmand/plus/OsmAndConstants.java
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
package net.osmand.plus;
|
||||||
|
|
||||||
|
public interface OsmAndConstants {
|
||||||
|
|
||||||
|
|
||||||
|
public int UI_HANDLER_MAP_VIEW = 300;
|
||||||
|
|
||||||
|
public int UI_HANDLER_MAP_CONTROLS = 400;
|
||||||
|
|
||||||
|
public int UI_HANDLER_LOCATION_SERVICE = 500;
|
||||||
|
|
||||||
|
public int UI_HANDLER_PROGRESS = 600;
|
||||||
|
|
||||||
|
public int UI_HANDLER_SEARCH = 700;
|
||||||
|
|
||||||
|
}
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
import net.osmand.GeoidAltitudeCorrection;
|
import net.osmand.GeoidAltitudeCorrection;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.access.NavigationInfo;
|
import net.osmand.access.NavigationInfo;
|
||||||
import net.osmand.binary.BinaryMapDataObject;
|
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
|
@ -44,11 +43,11 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int INTERVAL_TO_CLEAR_SET_LOCATION = 30 * 1000;
|
private static final int INTERVAL_TO_CLEAR_SET_LOCATION = 30 * 1000;
|
||||||
private static final int LOST_LOCATION_MSG_ID = 53;
|
private static final int LOST_LOCATION_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 1;
|
||||||
private static final int START_SIMULATE_LOCATION_MSG_ID = 54;
|
private static final int START_SIMULATE_LOCATION_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 2;
|
||||||
private static final int RUN_SIMULATE_LOCATION_MSG_ID = 55;
|
private static final int RUN_SIMULATE_LOCATION_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 3;
|
||||||
private static final long LOST_LOCATION_CHECK_DELAY = 18000;
|
private static final long LOST_LOCATION_CHECK_DELAY = 18000;
|
||||||
private static final long START_LOCATION_SIMULATION_DELAY = 4000;
|
private static final long START_LOCATION_SIMULATION_DELAY = 3000;
|
||||||
|
|
||||||
private static final float ACCURACY_FOR_GPX_AND_ROUTING = 50;
|
private static final float ACCURACY_FOR_GPX_AND_ROUTING = 50;
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import android.os.Message;
|
||||||
|
|
||||||
public class ProgressDialogImplementation implements IProgress {
|
public class ProgressDialogImplementation implements IProgress {
|
||||||
|
|
||||||
private static final int HANDLER_START_TASK = 0;
|
private static final int HANDLER_START_TASK = OsmAndConstants.UI_HANDLER_PROGRESS + 1;
|
||||||
private static final int HADLER_UPDATE_PROGRESS = 1;
|
private static final int HADLER_UPDATE_PROGRESS = OsmAndConstants.UI_HANDLER_PROGRESS + 2;
|
||||||
private String taskName;
|
private String taskName;
|
||||||
private int progress;
|
private int progress;
|
||||||
private int deltaProgress;
|
private int deltaProgress;
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.BusyIndicator;
|
import net.osmand.plus.BusyIndicator;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -68,8 +69,8 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class MapActivity extends AccessibleActivity {
|
public class MapActivity extends AccessibleActivity {
|
||||||
|
|
||||||
private static final int SHOW_POSITION_MSG_ID = 7;
|
private static final int SHOW_POSITION_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 1;
|
||||||
private static final int LONG_KEYPRESS_MSG_ID = 28;
|
private static final int LONG_KEYPRESS_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_VIEW + 2;
|
||||||
private static final int LONG_KEYPRESS_DELAY = 500;
|
private static final int LONG_KEYPRESS_DELAY = 500;
|
||||||
|
|
||||||
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
private static MapViewTrackingUtilities mapViewTrackingUtilities;
|
||||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.CollatorStringMatcher.StringMatcherMode;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.MapObject;
|
import net.osmand.data.MapObject;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -66,8 +67,8 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
||||||
private EditText searchText;
|
private EditText searchText;
|
||||||
private AsyncTask<Object, ?, ?> initializeTask;
|
private AsyncTask<Object, ?, ?> initializeTask;
|
||||||
|
|
||||||
protected static final int MESSAGE_CLEAR_LIST = 1;
|
protected static final int MESSAGE_CLEAR_LIST = OsmAndConstants.UI_HANDLER_SEARCH + 2;
|
||||||
protected static final int MESSAGE_ADD_ENTITY = 2;
|
protected static final int MESSAGE_ADD_ENTITY = OsmAndConstants.UI_HANDLER_SEARCH + 3;
|
||||||
protected static final String SEQUENTIAL_SEARCH = "SEQUENTIAL_SEARCH";
|
protected static final String SEQUENTIAL_SEARCH = "SEQUENTIAL_SEARCH";
|
||||||
|
|
||||||
protected ProgressBar progress;
|
protected ProgressBar progress;
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.osmand.plus.NameFinderPoiFilter;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.PoiFilter;
|
import net.osmand.plus.PoiFilter;
|
||||||
|
@ -94,6 +95,7 @@ import com.actionbarsherlock.view.Window;
|
||||||
*/
|
*/
|
||||||
public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompassListener, OsmAndLocationListener {
|
public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompassListener, OsmAndLocationListener {
|
||||||
|
|
||||||
|
private static final int COMPASS_REFRESH_MSG_ID = OsmAndConstants.UI_HANDLER_SEARCH + 3;
|
||||||
public static final String AMENITY_FILTER = "net.osmand.amenity_filter"; //$NON-NLS-1$
|
public static final String AMENITY_FILTER = "net.osmand.amenity_filter"; //$NON-NLS-1$
|
||||||
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT; //$NON-NLS-1$
|
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT; //$NON-NLS-1$
|
||||||
public static final String SEARCH_LON = SearchActivity.SEARCH_LON; //$NON-NLS-1$
|
public static final String SEARCH_LON = SearchActivity.SEARCH_LON; //$NON-NLS-1$
|
||||||
|
@ -517,14 +519,14 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
@Override
|
@Override
|
||||||
public void updateCompassValue(float value) {
|
public void updateCompassValue(float value) {
|
||||||
heading = value;
|
heading = value;
|
||||||
if(!uiHandler.hasMessages(5)){
|
if(!uiHandler.hasMessages(COMPASS_REFRESH_MSG_ID)){
|
||||||
Message msg = Message.obtain(uiHandler, new Runnable(){
|
Message msg = Message.obtain(uiHandler, new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
amenityAdapter.notifyDataSetChanged();
|
amenityAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
msg.what = 5;
|
msg.what = COMPASS_REFRESH_MSG_ID;
|
||||||
uiHandler.sendMessageDelayed(msg, 100);
|
uiHandler.sendMessageDelayed(msg, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
import net.osmand.IProgress;
|
import net.osmand.IProgress;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -77,7 +78,7 @@ public abstract class BasicProgressAsyncTask<Params, Progress, Result> extends A
|
||||||
updateProgress(updateOnlyProgress);
|
updateProgress(updateOnlyProgress);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
msg.what = 1;
|
msg.what = OsmAndConstants.UI_HANDLER_PROGRESS + 2;
|
||||||
uiHandler.sendMessage(msg);
|
uiHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
import net.osmand.plus.OsmandSettings.AutoZoomMap;
|
||||||
|
@ -19,7 +20,7 @@ import android.content.Context;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLocationListener, OsmAndCompassListener {
|
public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLocationListener, OsmAndCompassListener {
|
||||||
private static final int AUTO_FOLLOW_MSG_ID = 8;
|
private static final int AUTO_FOLLOW_MSG_ID = OsmAndConstants.UI_HANDLER_LOCATION_SERVICE + 4;
|
||||||
|
|
||||||
private long lastTimeAutoZooming = 0;
|
private long lastTimeAutoZooming = 0;
|
||||||
private long lastTimeSensorMapRotation = 0;
|
private long lastTimeSensorMapRotation = 0;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.londatiga.android.ActionItem;
|
||||||
import net.londatiga.android.QuickAction;
|
import net.londatiga.android.QuickAction;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||||
|
@ -41,7 +42,7 @@ import android.widget.SeekBar;
|
||||||
|
|
||||||
public class MapControlsLayer extends OsmandMapLayer {
|
public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private static final int SHOW_ZOOM_LEVEL_MSG_ID = 3;
|
private static final int SHOW_ZOOM_LEVEL_MSG_ID = OsmAndConstants.UI_HANDLER_MAP_CONTROLS + 1;
|
||||||
private static final int SHOW_ZOOM_LEVEL_DELAY = 4000;
|
private static final int SHOW_ZOOM_LEVEL_DELAY = 4000;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.map.IMapLocationListener;
|
import net.osmand.map.IMapLocationListener;
|
||||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||||
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
@ -53,8 +54,8 @@ import android.widget.Toast;
|
||||||
|
|
||||||
public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCallback, Callback {
|
public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCallback, Callback {
|
||||||
|
|
||||||
private static final int MAP_REFRESH_MESSAGE = 1;
|
private static final int MAP_REFRESH_MESSAGE = OsmAndConstants.UI_HANDLER_MAP_VIEW + 4;
|
||||||
private static final int BASE_REFRESH_MESSAGE = 2;
|
private static final int BASE_REFRESH_MESSAGE = OsmAndConstants.UI_HANDLER_MAP_VIEW + 3;
|
||||||
protected final static int LOWEST_ZOOM_TO_ROTATE = 9;
|
protected final static int LOWEST_ZOOM_TO_ROTATE = 9;
|
||||||
private boolean MEASURE_FPS = false;
|
private boolean MEASURE_FPS = false;
|
||||||
private FPSMeasurement main = new FPSMeasurement();
|
private FPSMeasurement main = new FPSMeasurement();
|
||||||
|
|
Loading…
Reference in a new issue