Add recordings to local manager

This commit is contained in:
Victor Shcherb 2013-01-13 19:47:07 +01:00
parent c8612654be
commit 8eae34b9e1
4 changed files with 26 additions and 11 deletions

View file

@ -150,6 +150,10 @@ public abstract class OsmandPlugin {
public List<String> indexingFiles(IProgress progress) { return null;} public List<String> indexingFiles(IProgress progress) { return null;}
public boolean mapActivityKeyUp(MapActivity mapActivity, int keyCode) {
return false;
}
public void onMapActivityExternalResult(int requestCode, int resultCode, Intent data) { 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;
}
} }

View file

@ -1295,6 +1295,8 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + dx, mapView.getCenterPointY() + dy); LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + dx, mapView.getCenterPointY() + dy);
setMapLocation(l.getLatitude(), l.getLongitude()); setMapLocation(l.getLatitude(), l.getLongitude());
return true; return true;
} else if(OsmandPlugin.onMapActivityKeyUp(this, keyCode)) {
return true;
} }
return super.onKeyUp(keyCode,event); return super.onKeyUp(keyCode,event);
} }

View file

@ -18,23 +18,16 @@ import net.osmand.plus.views.OsmandMapTileView;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Paint.Style; import android.graphics.Paint.Style;
import android.graphics.PointF; import android.graphics.PointF;
import android.graphics.RectF; import android.graphics.RectF;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnPreparedListener;
import android.net.Uri;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider { public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvider {

View file

@ -691,9 +691,9 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
} }
}; };
if(ri.rec.isPhoto()) { 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 { } 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() { adapter.registerItem(R.string.show_location, 0, new OnContextMenuClick() {
@Override @Override
@ -795,5 +795,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
AccessibleToast.makeText(ctx, R.string.recording_can_not_be_played, Toast.LENGTH_SHORT).show(); 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;
}
} }