Merge branch 'master' of ssh://github.com/osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2014-10-03 16:49:03 +02:00
commit 965d5c685d
13 changed files with 104 additions and 51 deletions

View file

@ -1890,17 +1890,17 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
<string name="traffic_warning_speed_limit">Velocitat màxima</string>
<string name="traffic_warning_border_control">Control de fronteres</string>
<string name="traffic_warning_payment">Estació de peatge</string>
<string name="traffic_warning_stop">Senyal de stop</string>
<string name="traffic_warning_stop">Senyal d\'stop</string>
<string name="traffic_warning_calming">Ressalt</string>
<string name="traffic_warning_speed_camera">Càmera de control de velocitat</string>
<string name="traffic_warning">Avís de circulació</string>
<string name="local_index_description">Premeu qualsevol indicació existent per veure més detalls, mantingueu premuda per desactivar o esborrar. Dades actuals al dispositiu (%1$s lliure):</string>
<string name="text_size_descr">Definiu la mida del text en el mapa.</string>
<string name="text_size">Mida del text</string>
<string name="fav_point_dublicate">Aquest nom de punt preferit ja s\'ha utilitzat</string>
<string name="fav_point_dublicate">Nom de punt preferit duplicat</string>
<string name="fav_point_dublicate_message">S\'ha canviat el nom del vostre punt preferit a %1$s per evitar duplicitats.</string>
<string name="test_native_render">Prova de renderització nativa</string>
<string name="test_native_render_msg">Iniciar activitat amb renderització nativa</string>
<string name="use_native_render">Utilitzar renderització nativa</string>
<string name="use_native_render_descr">Ús de renderitzacio C++ en comptes de Java</string>
<string name="test_native_render_msg">Inicia l\'activitat amb renderització nativa</string>
<string name="use_native_render">Utilitza la renderització nativa</string>
<string name="use_native_render_descr">Ús de renderització C++ en comptes de Java</string>
</resources>

View file

@ -1738,4 +1738,8 @@ s často kladenými otázkami.</string>
<string name="text_size_descr">Nastavit velikost písma na mapě.</string>
<string name="fav_point_dublicate">Název oblíbeného bodu je již použit</string>
<string name="fav_point_dublicate_message">Aby nevznikla duplicita, oblíbený bod byl uložen jako %1$s.</string>
<string name="test_native_render">Test nativního vykreslování</string>
<string name="test_native_render_msg">Spustí činnost s nativním vykreslováním</string>
<string name="use_native_render">Použít nativní vykreslování</string>
<string name="use_native_render_descr">Použít C++ vykreslování místo Javy</string>
</resources>

View file

@ -1976,4 +1976,8 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="text_size">Schriftgröße</string>
<string name="fav_point_dublicate">Doppelung beim Favoriten-Namen</string>
<string name="fav_point_dublicate_message">Name des Favoriten bereits vergeben, er wurde auf %1$s geändert.</string>
<string name="test_native_render">Nativen Renderer testen</string>
<string name="test_native_render_msg">Nutzt den nativen Renderer</string>
<string name="use_native_render">Nativen Renderer benutzen</string>
<string name="use_native_render_descr">C++ Renderer statt Java-Renderer nutzen</string>
</resources>

View file

@ -1991,4 +1991,10 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
<string name="local_index_description">Clicca su un oggetto per visualizzare maggiori dettagli, tieni premuto per disattivarlo o cancellarlo. Dati attualmente nel dispositivo (%1$s liberi):</string>
<string name="text_size_descr">Imposta la dimensione del testo sulla mappa.</string>
<string name="text_size">Dimensione del testo</string>
<string name="test_native_render">Prova la rappresentazione nativa</string>
<string name="test_native_render_msg">Inizia l\'attività con la rappresentazione nativa</string>
<string name="fav_point_dublicate">Nome del punto preferito duplicato</string>
<string name="fav_point_dublicate_message">Per evitare duplicati il nome del vostro punto preferito è stato modificato in %1$s.</string>
<string name="use_native_render">Utilizza la rappresentazione nativa</string>
<string name="use_native_render_descr">Usa la rappresentazione C++ anziché Java</string>
</resources>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><resources><string name="close_changeset">Değişiklik listesini kapat</string>
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="close_changeset">Değişiklik listesini kapat</string>
<string name="zxing_barcode_scanner_not_found">ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz?</string>
<string name="rendering_attr_roadColors_description">Yol renk şemasını seç:</string>
<string name="rendering_attr_roadColors_name">Yol renk şeması</string>
@ -353,7 +354,7 @@
<string name="vector_map_not_needed">Hayır, teşekkürler</string>
<string name="local_index_mi_delete">Sil</string>
<string name="local_index_mi_reload">Sd card\'tan tekrar yükle</string>
<string name="local_index_download">İndiriliyor…</string>
<string name="local_index_download">İndir</string>
<string name="search_offline_clear_search">Yeni Arama</string>
<string name="map_text_size_descr">Haritadaki yer adları için yazı boyutunu seçin</string>
<string name="map_text_size">Harita yazı karakteri boyutu</string>
@ -788,7 +789,7 @@
<string name="context_menu_item_search">Buraya yakın ara</string>
<string name="save_route_dialog_title">Rotayı GPX olarak kaydet</string>
<string name="route_successfully_saved_at">Rota \'%1$s\' olarak kaydedildi.</string>
<string name="filename_input">Dosya adı:…</string>
<string name="filename_input">"Dosya adı: "</string>
<string name="menu_save_directions">Tarifi Kaydet</string>
<string name="local_index_upload_gpx_description">OSM Comunity üzerine haritaları geliştirmek için kullanılacak GPX dosyaları yükleyin.</string>
<string name="local_index_items_uploaded">%2$d/%1$d nesne yüklendi.</string>
@ -906,7 +907,7 @@
<string name="edit_tilesource_elliptic_tile">Eliptik izdüşümü</string>
<string name="edit_tilesource_expiration_time">Sona erecek (dakika)</string>
<string name="edit_tilesource_url_to_load">Adres</string>
<string name="edit_tilesource_choose_existing">Mevcut olanı seç...</string>
<string name="edit_tilesource_choose_existing">Varolanı seçin…</string>
<string name="edit_tilesource_name">İsim</string>
<string name="maps_define_edit">Tanımla/Düzenle…</string>
<string name="clear_intermediate_points">Ara noktaları temizle</string>
@ -1204,4 +1205,4 @@
\n\t* Yeniden tasarlanmış arayüz↵
→→\n\t* Ashklat düzeltmek ↵
</string>
</resources>
</resources>

View file

@ -14,7 +14,7 @@ import net.osmand.data.RotatedTileBox;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.helpers.SimpleTwoFingerTapDetector;
import net.osmand.plus.helpers.TwoFingerTapDetector;
import net.osmand.plus.render.NativeOsmandLibrary;
import android.app.Activity;
import android.content.Context;
@ -75,7 +75,7 @@ public class GLActivity extends Activity {
}
private boolean afterTwoFingerTap = false;
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
@Override
public void onTwoFingerTap() {
afterTwoFingerTap = true;

View file

@ -12,6 +12,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import android.os.*;
import android.view.View;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibilityPlugin;
@ -54,9 +56,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.text.format.DateFormat;
import android.util.TypedValue;
import android.view.accessibility.AccessibilityManager;
@ -127,7 +126,7 @@ public class OsmandApplication extends Application {
}
}
super.onCreate();
new Toast(this); // activate in UI thread to avoid further exceptions
createInUiThread();
sqliteAPI = new SQLiteAPIImpl(this);
try {
bRouterServiceConnection = BRouterServiceConnection.connect(this);
@ -183,7 +182,20 @@ public class OsmandApplication extends Application {
}
private void createInUiThread() {
new Toast(this); // activate in UI thread to avoid further exceptions
new AsyncTask<View, Void, Void>() {
@Override
protected Void doInBackground(View... params) {
return null;
}
protected void onPostExecute(Void result) {
}
}.execute();
}
@Override
public void onTerminate() {
super.onTerminate();

View file

@ -777,4 +777,9 @@ public class MapActivity extends AccessibleActivity {
public View getLayout() {
return getWindow().getDecorView().findViewById(android.R.id.content);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return mapViewController.onTouchEvent(event);
}
}

View file

@ -6,7 +6,7 @@ import android.view.ViewConfiguration;
/**
* Created by Barsik on 24.06.2014.
*/
public abstract class SimpleTwoFingerTapDetector {
public abstract class TwoFingerTapDetector {
private static final int TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
private long mFirstDownTime = 0;
private byte mTwoFingerTapCount = 0;

View file

@ -0,0 +1,23 @@
package net.osmand.plus.render;
import net.osmand.NativeLibrary;
/**
* Created by Denis on 02.10.2014.
*/
public class NativeCppLibrary extends NativeLibrary {
public NativeCppLibrary(boolean newLibrary) {
super(newLibrary);
}
public static void loadLibrary(String name) {
try {
System.out.println("Loading " + name);
System.loadLibrary(name);
} catch( UnsatisfiedLinkError e ) {
System.err.println("Failed to load '"+name + "':" + e);
throw e;
}
}
}

View file

@ -23,7 +23,7 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.helpers.SimpleTwoFingerTapDetector;
import net.osmand.plus.helpers.TwoFingerTapDetector;
import net.osmand.plus.views.MultiTouchSupport.MultiTouchZoomListener;
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
import net.osmand.plus.views.controllers.JavaViewController;
@ -81,9 +81,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
protected static final int emptyTileDivisor = 16;
public interface OnLongClickListener {
public boolean onLongPressEvent(PointF point);
}
@ -148,7 +145,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
private Paint paintImg;
private boolean afterTwoFingerTap = false;
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
@Override
public void onTwoFingerTap() {
afterTwoFingerTap = true;

View file

@ -24,7 +24,6 @@ import java.util.List;
* Created by Натали on 29.09.2014.
*/
public class JavaViewController extends MapViewBaseController {
private GLSurfaceView glSurfaceView;
private OsmandMapTileView mapTileView;
private OsmandSettings settings;
private MapActivity mapActivity;

View file

@ -22,7 +22,8 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.helpers.SimpleTwoFingerTapDetector;
import net.osmand.plus.helpers.TwoFingerTapDetector;
import net.osmand.plus.render.NativeCppLibrary;
import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.views.OsmandMapLayer;
import net.osmand.plus.views.OsmandMapTileView;
@ -36,14 +37,6 @@ import java.util.List;
*/
public class NativeViewController extends MapViewBaseController {
static {
NativeOsmandLibrary.loadLibrary("gnustl_shared");
NativeOsmandLibrary.loadLibrary("Qt5Core");
NativeOsmandLibrary.loadLibrary("Qt5Network");
NativeOsmandLibrary.loadLibrary("Qt5Sql");
NativeOsmandLibrary.loadLibrary("OsmAndCoreWithJNI");
}
private GLSurfaceView glSurfaceView;
private OsmandSettings settings;
private MapActivity mapActivity;
@ -74,7 +67,7 @@ public class NativeViewController extends MapViewBaseController {
public static final String NATIVE_TAG = "NativeRender";
private CoreResourcesFromAndroidAssetsCustom coreResources;
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
@Override
public void onTwoFingerTap() {
currentViewport.setZoom(currentViewport.getZoom() - 1);
@ -87,9 +80,18 @@ public class NativeViewController extends MapViewBaseController {
this.glSurfaceView = surfaceView;
this.settings = activity.getMyApplication().getSettings();
this.mapActivity = activity;
loadLibraries();
setupView();
}
private void loadLibraries() {
NativeCppLibrary.loadLibrary("gnustl_shared");
NativeCppLibrary.loadLibrary("Qt5Core");
NativeCppLibrary.loadLibrary("Qt5Network");
NativeCppLibrary.loadLibrary("Qt5Sql");
NativeCppLibrary.loadLibrary("OsmAndCoreWithJNI");
}
private void setupView() {
WindowManager mgr = (WindowManager)mapActivity.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
@ -252,8 +254,8 @@ public class NativeViewController extends MapViewBaseController {
}
private class EGLContextFactory implements GLSurfaceView.EGLContextFactory {
private EGLContext _gpuWorkerContext;
private EGLSurface _gpuWorkerFakeSurface;
private EGLContext gpuWorkerContext;
private EGLSurface gpuWorkerFakeSurface;
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
final String eglExtensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS);
@ -280,7 +282,7 @@ public class NativeViewController extends MapViewBaseController {
Log.i(NATIVE_TAG, "Creating GPU worker context...");
try {
_gpuWorkerContext = egl.eglCreateContext(
gpuWorkerContext = egl.eglCreateContext(
display,
eglConfig,
mainContext,
@ -288,13 +290,13 @@ public class NativeViewController extends MapViewBaseController {
} catch (Exception e) {
Log.e(NATIVE_TAG, "Failed to create GPU worker context", e);
}
if (_gpuWorkerContext == null || _gpuWorkerContext == EGL10.EGL_NO_CONTEXT)
if (gpuWorkerContext == null || gpuWorkerContext == EGL10.EGL_NO_CONTEXT)
{
Log.e(NATIVE_TAG, "Failed to create GPU worker context: " + egl.eglGetError());
_gpuWorkerContext = null;
gpuWorkerContext = null;
}
if (_gpuWorkerContext != null)
if (gpuWorkerContext != null)
{
Log.i(NATIVE_TAG, "Creating GPU worker fake surface...");
try {
@ -302,21 +304,21 @@ public class NativeViewController extends MapViewBaseController {
EGL10.EGL_WIDTH, 1,
EGL10.EGL_HEIGHT, 1,
EGL10.EGL_NONE };
_gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList);
gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList);
} catch (Exception e) {
Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface", e);
}
if (_gpuWorkerFakeSurface == null || _gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE)
if (gpuWorkerFakeSurface == null || gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE)
{
Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface: " + egl.eglGetError());
_gpuWorkerFakeSurface = null;
gpuWorkerFakeSurface = null;
}
}
MapRendererSetupOptions rendererSetupOptions = new MapRendererSetupOptions();
if (_gpuWorkerContext != null && _gpuWorkerFakeSurface != null) {
if (gpuWorkerContext != null && gpuWorkerFakeSurface != null) {
rendererSetupOptions.setGpuWorkerThreadEnabled(true);
gpuWorkerThreadPrologue = new GpuWorkerThreadPrologue(egl, display, _gpuWorkerContext, _gpuWorkerFakeSurface);
gpuWorkerThreadPrologue = new GpuWorkerThreadPrologue(egl, display, gpuWorkerContext, gpuWorkerFakeSurface);
rendererSetupOptions.setGpuWorkerThreadPrologue(gpuWorkerThreadPrologue.getBinding());
gpuWorkerThreadEpilogue = new GpuWorkerThreadEpilogue(egl);
rendererSetupOptions.setGpuWorkerThreadEpilogue(gpuWorkerThreadEpilogue.getBinding());
@ -333,14 +335,14 @@ public class NativeViewController extends MapViewBaseController {
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
egl.eglDestroyContext(display, context);
if (_gpuWorkerContext != null) {
egl.eglDestroyContext(display, _gpuWorkerContext);
_gpuWorkerContext = null;
if (gpuWorkerContext != null) {
egl.eglDestroyContext(display, gpuWorkerContext);
gpuWorkerContext = null;
}
if (_gpuWorkerFakeSurface != null) {
egl.eglDestroySurface(display, _gpuWorkerFakeSurface);
_gpuWorkerFakeSurface = null;
if (gpuWorkerFakeSurface != null) {
egl.eglDestroySurface(display, gpuWorkerFakeSurface);
gpuWorkerFakeSurface = null;
}
}
}