From 8eae34b9e1f6514fdf44e9bb02d6dfee49f6e34f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 13 Jan 2013 19:47:07 +0100 Subject: [PATCH] Add recordings to local manager --- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 13 ++++++++++++- .../net/osmand/plus/activities/MapActivity.java | 2 ++ .../osmand/plus/audionotes/AudioNotesLayer.java | 7 ------- .../plus/audionotes/AudioVideoNotesPlugin.java | 15 ++++++++++++--- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index 851c5851b1..702605d48d 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -150,6 +150,10 @@ public abstract class OsmandPlugin { public List indexingFiles(IProgress progress) { return null;} + public boolean mapActivityKeyUp(MapActivity mapActivity, int keyCode) { + return false; + } + public void onMapActivityExternalResult(int requestCode, int resultCode, Intent data) { } @@ -306,6 +310,13 @@ public abstract class OsmandPlugin { } } - + public static boolean onMapActivityKeyUp(MapActivity mapActivity, int keyCode) { + for(OsmandPlugin p : installedPlugins){ + if(p.mapActivityKeyUp(mapActivity, keyCode)) + return true; + } + return false; + } + } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 0b66ecc2d1..135c1a8dbc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1295,6 +1295,8 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + dx, mapView.getCenterPointY() + dy); setMapLocation(l.getLatitude(), l.getLongitude()); return true; + } else if(OsmandPlugin.onMapActivityKeyUp(this, keyCode)) { + return true; } return super.onKeyUp(keyCode,event); } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index 27d15ec0c8..1524bc9fba 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -18,23 +18,16 @@ import net.osmand.plus.views.OsmandMapTileView; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; -import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.graphics.BitmapFactory.Options; import android.graphics.Canvas; import android.graphics.Color; -import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.PointF; import android.graphics.RectF; -import android.media.MediaPlayer; -import android.media.MediaPlayer.OnPreparedListener; -import android.net.Uri; import android.util.DisplayMetrics; import android.view.WindowManager; -import android.widget.ImageView; import android.widget.Toast; public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index e72a082f9f..74bdb4402e 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -691,9 +691,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } }; if(ri.rec.isPhoto()) { - adapter.registerItem(R.string.recording_context_menu_show, 0, listener, -1); + adapter.registerItem(R.string.recording_context_menu_show, 0, listener, 0); } else { - adapter.registerItem(R.string.recording_context_menu_play, 0, listener, -1); + adapter.registerItem(R.string.recording_context_menu_play, 0, listener, 0); } adapter.registerItem(R.string.show_location, 0, new OnContextMenuClick() { @Override @@ -795,5 +795,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { AccessibleToast.makeText(ctx, R.string.recording_can_not_be_played, Toast.LENGTH_SHORT).show(); } } + + @Override + public boolean mapActivityKeyUp(MapActivity mapActivity, int keyCode) { + if (keyCode == KeyEvent.KEYCODE_CAMERA) { + defaultAction(mapActivity); + return true; + } + return false; + } -} +} \ No newline at end of file