Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-09-22 18:07:39 +02:00
commit 1eba565e1f

View file

@ -828,7 +828,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
((AudioManager) activity.getSystemService(Context.AUDIO_SERVICE)).registerMediaButtonEventReceiver( ((AudioManager) activity.getSystemService(Context.AUDIO_SERVICE)).registerMediaButtonEventReceiver(
new ComponentName(activity, MediaRemoteControlReceiver.class)); new ComponentName(activity, MediaRemoteControlReceiver.class));
if (runAction != -1) { if (runAction != -1) {
takeAction(activity, actionLat, actionLon, runAction); takeAction(activity, actionLon, actionLat, runAction);
runAction = -1; runAction = -1;
} }
} }
@ -1275,7 +1275,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
} }
if (parameters.getSupportedFlashModes() != null if (parameters.getSupportedFlashModes() != null
&& parameters.getSupportedFlashModes().contains(Parameters.FLASH_MODE_AUTO)) { && parameters.getSupportedFlashModes().contains(Parameters.FLASH_MODE_AUTO)) {
parameters.setFlashMode(Parameters.FLASH_MODE_AUTO); //parameters.setFlashMode(Parameters.FLASH_MODE_AUTO);
} }
int cameraOrientation = getCamOrientation(mapActivity, Camera.CameraInfo.CAMERA_FACING_BACK); int cameraOrientation = getCamOrientation(mapActivity, Camera.CameraInfo.CAMERA_FACING_BACK);
@ -1313,24 +1313,29 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
private void internalShoot() { private void internalShoot() {
if (!autofocus) { getMapActivity().getMyApplication().runInUIThread(new Runnable() {
cam.takePicture(null, null, new JpegPhotoHandler()); @Override
} else { public void run() {
cam.autoFocus(new Camera.AutoFocusCallback() { if (!autofocus) {
@Override cam.takePicture(null, null, new JpegPhotoHandler());
public void onAutoFocus(boolean success, Camera camera) { } else {
try { cam.autoFocus(new Camera.AutoFocusCallback() {
cam.takePicture(null, null, new JpegPhotoHandler()); @Override
} catch (Exception e) { public void onAutoFocus(boolean success, Camera camera) {
logErr(e); try {
closeRecordingMenu(); cam.takePicture(null, null, new JpegPhotoHandler());
closeCamera(); } catch (Exception e) {
finishRecording(); logErr(e);
e.printStackTrace(); closeRecordingMenu();
} closeCamera();
finishRecording();
e.printStackTrace();
}
}
});
} }
}); }
} }, 200);
} }
private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) { private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) {
@ -1902,11 +1907,13 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
app.showToastMessage(R.string.no_microphone_permission); app.showToastMessage(R.string.no_microphone_permission);
} }
} }
/*
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null && !mapActivity.isDestroyed()) { if (mapActivity != null && !mapActivity.isDestroyed()) {
takeAction(mapActivity, actionLat, actionLon, runAction); takeAction(mapActivity, actionLon, actionLat, runAction);
runAction = -1; runAction = -1;
} }
*/
} }
public class JpegPhotoHandler implements PictureCallback { public class JpegPhotoHandler implements PictureCallback {