Update application

This commit is contained in:
Victor Shcherb 2012-12-19 01:45:05 +01:00
parent ad7e286749
commit 1ca798beb1
15 changed files with 49 additions and 13 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -9,6 +9,10 @@
1. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="av_def_action_video">Record video</string>
<string name="av_def_action_audio">Record audio</string>
<string name="av_widget_action_descr">Select default widget action</string>
<string name="av_widget_action">Default widget action</string>
<string name="av_video_format_descr">Select video output format</string>
<string name="av_video_format">Video output format</string>
<string name="av_use_external_recorder_descr">Use system recorder for video</string>

View file

@ -25,6 +25,7 @@ import net.osmand.plus.views.OsmandMapTileView;
import org.apache.commons.logging.Log;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceScreen;
@ -138,6 +139,9 @@ public abstract class OsmandPlugin {
public List<String> indexingFiles(IProgress progress) { return null;}
public void onMapActivityExternalResult(int requestCode, int resultCode, Intent data) {
}
public static void refreshLayers(OsmandMapTileView mapView, MapActivity activity) {
for (OsmandPlugin plugin : activePlugins) {
plugin.updateLayers(mapView, activity);
@ -199,7 +203,13 @@ public abstract class OsmandPlugin {
}
}
public static void onMapActivityResult(int requestCode, int resultCode, Intent data) {
for (OsmandPlugin plugin : activePlugins) {
plugin.onMapActivityExternalResult(requestCode, resultCode, data);
}
}
public static void onSettingsActivityCreate(SettingsActivity activity, PreferenceScreen screen) {
for (OsmandPlugin plugin : activePlugins) {
plugin.settingsActivityCreate(activity, screen);
@ -261,5 +271,6 @@ public abstract class OsmandPlugin {
}
}
}

View file

@ -1424,7 +1424,11 @@ public class OsmandSettings {
public static final int VIDEO_OUTPUT_MP4 = 0;
public static final int VIDEO_OUTPUT_3GP = 1;
public final CommonPreference<Integer> AV_VIDEO_FORMAT = new IntPreference("av_video_format", 0).makeGlobal();
public final CommonPreference<Integer> AV_VIDEO_FORMAT = new IntPreference("av_video_format", VIDEO_OUTPUT_MP4).makeGlobal();
public static final int AV_DEFAULT_ACTION_AUDIO = 0;
public static final int AV_DEFAULT_ACTION_VIDEO = 1;
public final CommonPreference<Integer> AV_DEFAULT_ACTION = new IntPreference("av_default_action", AV_DEFAULT_ACTION_AUDIO).makeGlobal();
public final OsmandPreference<Integer> NUMBER_OF_FREE_DOWNLOADS = new IntPreference("free_downloads_v1", 0).makeGlobal();

View file

@ -1407,5 +1407,10 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
public NavigationInfo getNavigationInfo() {
return navigationInfo;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
OsmandPlugin.onMapActivityResult(requestCode, resultCode, data);
}
}

View file

@ -44,14 +44,12 @@ import android.preference.PreferenceScreen;
import android.provider.MediaStore;
import android.text.format.DateFormat;
import android.view.Display;
import android.view.Gravity;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.Toast;
public class AudioVideoNotesPlugin extends OsmandPlugin {
@ -233,7 +231,11 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
AccessibleToast.makeText(app, R.string.audionotes_location_not_defined, Toast.LENGTH_LONG).show();
return;
}
recordAudio(loc.getLatitude(), loc.getLongitude(), mapActivity);
if(app.getSettings().AV_DEFAULT_ACTION.get() == OsmandSettings.AV_DEFAULT_ACTION_VIDEO) {
recordVideo(loc.getLatitude(), loc.getLongitude(), mapActivity);
} else {
recordAudio(loc.getLatitude(), loc.getLongitude(), mapActivity);
}
}
});
}
@ -288,7 +290,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
public void recordVideoCamera(final double lat, final double lon, final MapActivity mapActivity) {
Dialog dlg = new Dialog(mapActivity);
final Dialog dlg = new Dialog(mapActivity);
SurfaceView view = new SurfaceView(dlg.getContext());
view.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
view.getHolder().addCallback(new Callback() {
@ -315,7 +317,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
giveMediaRecorderHintRotatedScreen(mapActivity, mr);
// mr.setPreviewDisplay(holder.getSurface());
mr.setPreviewDisplay(holder.getSurface());
mr.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
mr.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
mr.setOutputFile(f.getAbsolutePath());
@ -324,6 +326,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
mr.start();
mediaRec = mr;
AccessibleToast.makeText(mapActivity, R.string.recording_is_recorded, Toast.LENGTH_LONG).show();
dlg.dismiss();
recordControl.setText(app.getString(R.string.av_control_stop), "");
recordControl.setOnClickListener(new View.OnClickListener() {
@Override
@ -343,19 +346,14 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
});
// FrameLayout p = (FrameLayout) mapActivity.getMapView().getParent();
// android.widget.FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(50, 50);
// lp.gravity = Gravity.CENTER;
// p.addView(view, lp);
dlg.setContentView(view);
dlg.show();
// ((MapStackControl) view.getParent()).addView(view);
}
private void giveMediaRecorderHintRotatedScreen(final MapActivity mapActivity, final MediaRecorder mr) {
if(Build.VERSION.SDK_INT >= 9) {
try {
Method m = mr.getClass().getDeclaredMethod("setOrientationHint", Integer.class);
Method m = mr.getClass().getDeclaredMethod("setOrientationHint", Integer.TYPE);
Display display = ((WindowManager)mapActivity.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
if(display.getRotation() == Surface.ROTATION_0) {
m.invoke(mr, 90);
@ -450,6 +448,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
public List<String> indexingFiles(IProgress progress) {
File avPath = app.getSettings().extendOsmandPath(ResourceManager.AV_PATH);
if (avPath.canRead()) {
recordings.clear();
File[] files = avPath.listFiles();
if (files != null) {
for (File f : files) {
@ -494,6 +493,19 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
entries, intValues, R.string.av_video_format, R.string.av_video_format_descr);
grp.addPreference(lp);
entries = new String[] {app.getString(R.string.av_def_action_audio), app.getString(R.string.av_def_action_video)};
intValues = new Integer[] {OsmandSettings.AV_DEFAULT_ACTION_AUDIO, OsmandSettings.AV_DEFAULT_ACTION_VIDEO};
ListPreference defAct = activity.createListPreference(settings.AV_DEFAULT_ACTION,
entries, intValues, R.string.av_widget_action, R.string.av_widget_action_descr);
grp.addPreference(defAct);
}
@Override
public void onMapActivityExternalResult(int requestCode, int resultCode, Intent data) {
if(requestCode == 205) {
indexingFiles(null);
}
}
}

View file

@ -80,7 +80,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
if (mapInfoLayer != null ) {
distanceControl = createDistanceControl(activity, mapInfoLayer.getPaintText(), mapInfoLayer.getPaintSubText());
mapInfoLayer.getMapInfoControls().registerSideWidget(distanceControl,
0/*R.drawable.widget_parking*/, R.string.map_widget_distancemeasurement, "distance.measurement", false,
R.drawable.widget_distance, R.string.map_widget_distancemeasurement, "distance.measurement", false,
EnumSet.of(ApplicationMode.DEFAULT, ApplicationMode.PEDESTRIAN),
EnumSet.noneOf(ApplicationMode.class), 21);
mapInfoLayer.recreateControls();