bugfixes
git-svn-id: https://osmand.googlecode.com/svn/trunk@238 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
e9ab2e0eb8
commit
1e960c1cbf
4 changed files with 56 additions and 19 deletions
|
@ -224,8 +224,8 @@ public class AmenityIndexRepository {
|
|||
String latCol = IndexPoiTable.LATITUDE.name();
|
||||
String lonCol = IndexPoiTable.LONGITUDE.name();
|
||||
db.execSQL("DELETE FROM " + IndexPoiTable.getTable() + " WHERE " + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
lonCol + ">= ? AND ? <=" + lonCol + " AND " + //$NON-NLS-1$//$NON-NLS-2$
|
||||
latCol + ">= ? AND ? <=" + latCol, new Double[] { leftLon, rightLon, bottomLat, topLat }); //$NON-NLS-1$
|
||||
lonCol + ">= ? AND ? >=" + lonCol + " AND " + //$NON-NLS-1$//$NON-NLS-2$
|
||||
latCol + ">= ? AND ? >=" + latCol, new Double[] { leftLon, rightLon, bottomLat, topLat }); //$NON-NLS-1$
|
||||
|
||||
SQLiteStatement stat = db.compileStatement(IndexConstants.generatePrepareStatementToInsert(IndexPoiTable.getTable(), 8));
|
||||
for (Amenity a : amenities) {
|
||||
|
|
|
@ -139,6 +139,18 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
setContentView(R.layout.main);
|
||||
|
||||
mapView = (OsmandMapTileView) findViewById(R.id.MapView);
|
||||
mapView.setTrackBallDelegate(new OsmandMapTileView.OnTrackBallListener(){
|
||||
@Override
|
||||
public boolean onTrackBallEvent(MotionEvent e) {
|
||||
return MapActivity.this.onTrackballEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTrackBallPressed() {
|
||||
contextMenuPoint(mapView.getLatitude(), mapView.getLongitude(), true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
MapTileDownloader.getInstance().addDownloaderCallback(new IMapDownloaderCallback(){
|
||||
@Override
|
||||
public void tileDownloaded(DownloadRequest request) {
|
||||
|
@ -236,6 +248,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
});
|
||||
|
||||
|
||||
|
||||
backToMenu = (ImageButton)findViewById(R.id.BackToMenu);
|
||||
backToMenu.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
@ -285,11 +298,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
|
|||
double lon = MapUtils.getLongitudeFromTile(mapView.getZoom(), x);
|
||||
setMapLocation(lat, lon);
|
||||
return true;
|
||||
// that doesn't work for now
|
||||
// } else if(event.getAction() == MotionEvent.ACTION_UP){
|
||||
// contextMenuPoint(mapView.getLatitude(), mapView.getLongitude());
|
||||
// return true;
|
||||
}
|
||||
}
|
||||
return super.onTrackballEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.osmand.osm.MapUtils;
|
|||
public class SearchHistoryActivity extends ListActivity {
|
||||
private LatLon location;
|
||||
private SearchHistoryHelper helper;
|
||||
private Button clearButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -36,23 +37,23 @@ public class SearchHistoryActivity extends ListActivity {
|
|||
helper = SearchHistoryHelper.getInstance();
|
||||
|
||||
|
||||
|
||||
clearButton = new Button(this);
|
||||
clearButton.setText(R.string.clear_all);
|
||||
clearButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
helper.removeAll(SearchHistoryActivity.this);
|
||||
setListAdapter(new HistoryAdapter(helper.getHistoryEntries(SearchHistoryActivity.this)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
List<HistoryEntry> historyEntries = helper.getHistoryEntries(this);
|
||||
|
||||
getListView().removeFooterView(clearButton);
|
||||
if (!historyEntries.isEmpty()) {
|
||||
Button clearButton = new Button(this);
|
||||
clearButton.setText(R.string.clear_all);
|
||||
clearButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
helper.removeAll(SearchHistoryActivity.this);
|
||||
setListAdapter(new HistoryAdapter(helper.getHistoryEntries(SearchHistoryActivity.this)));
|
||||
}
|
||||
});
|
||||
getListView().addFooterView(clearButton);
|
||||
}
|
||||
setListAdapter(new HistoryAdapter(historyEntries));
|
||||
|
|
|
@ -19,6 +19,7 @@ import android.os.Handler;
|
|||
import android.os.Message;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.FloatMath;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
@ -45,6 +46,11 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
protected final int timeForDraggingAnimation = 300;
|
||||
protected final int minimumDistanceForDraggingAnimation = 40;
|
||||
|
||||
public interface OnTrackBallListener{
|
||||
public boolean onTrackBallEvent(MotionEvent e);
|
||||
public boolean onTrackBallPressed();
|
||||
}
|
||||
|
||||
public interface OnLongClickListener {
|
||||
public boolean onLongPressEvent(PointF point);
|
||||
}
|
||||
|
@ -76,6 +82,8 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
|
||||
private OnClickListener onClickListener;
|
||||
|
||||
private OnTrackBallListener trackBallDelegate;
|
||||
|
||||
private List<OsmandMapLayer> layers = new ArrayList<OsmandMapLayer>();
|
||||
|
||||
// UI Part
|
||||
|
@ -131,6 +139,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
|
||||
setClickable(true);
|
||||
setLongClickable(true);
|
||||
setFocusable(true);
|
||||
super.setOnLongClickListener(this);
|
||||
super.setOnClickListener(this);
|
||||
|
||||
|
@ -142,8 +151,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
refreshMap();
|
||||
|
@ -660,6 +667,26 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if(trackBallDelegate != null && keyCode == KeyEvent.KEYCODE_DPAD_CENTER){
|
||||
return trackBallDelegate.onTrackBallPressed();
|
||||
}
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTrackballEvent(MotionEvent event) {
|
||||
if(trackBallDelegate != null){
|
||||
trackBallDelegate.onTrackBallEvent(event);
|
||||
}
|
||||
return super.onTrackballEvent(event);
|
||||
}
|
||||
|
||||
public void setTrackBallDelegate(OnTrackBallListener trackBallDelegate) {
|
||||
this.trackBallDelegate = trackBallDelegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
PointF point = startDragging;
|
||||
|
|
Loading…
Reference in a new issue