New version support
This commit is contained in:
parent
b59e5a4470
commit
9cc615f4ac
5 changed files with 25 additions and 16 deletions
|
@ -56,7 +56,6 @@ import android.os.Message;
|
|||
import android.text.format.DateFormat;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.bidforfix.andorid.BidForFixHelper;
|
||||
|
||||
public class OsmandApplication extends Application implements ClientContext {
|
||||
public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$
|
||||
|
@ -485,7 +484,7 @@ public class OsmandApplication extends Application implements ClientContext {
|
|||
osmandSettings.NATIVE_RENDERING_FAILED.set(true);
|
||||
startDialog.startTask(getString(R.string.init_native_library), -1);
|
||||
RenderingRulesStorage storage = rendererRegistry.getCurrentSelectedRenderer();
|
||||
boolean initialized = NativeOsmandLibrary.getLibrary(storage) != null;
|
||||
boolean initialized = NativeOsmandLibrary.getLibrary(storage, this) != null;
|
||||
osmandSettings.NATIVE_RENDERING_FAILED.set(false);
|
||||
if (!initialized) {
|
||||
LOG.info("Native library could not be loaded!");
|
||||
|
|
|
@ -612,14 +612,14 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
NativeOsmandLibrary.getLibrary(storage);
|
||||
NativeOsmandLibrary.getLibrary(storage, getMyApplication());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
progressDlg.dismiss();
|
||||
if (!NativeOsmandLibrary.isNativeSupported(storage)) {
|
||||
if (!NativeOsmandLibrary.isNativeSupported(storage, getMyApplication())) {
|
||||
AccessibleToast.makeText(SettingsActivity.this, R.string.native_library_not_supported, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,6 +20,7 @@ import android.app.Activity;
|
|||
import android.app.TabActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
|
@ -89,6 +90,7 @@ public class SearchActivity extends TabActivity implements OsmAndLocationListene
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
long t = System.currentTimeMillis();
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.search_main);
|
||||
settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
|
@ -205,6 +207,8 @@ public class SearchActivity extends TabActivity implements OsmAndLocationListene
|
|||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
|
||||
Log.i("net.osmand", "Start on create " + (System.currentTimeMillis() - t ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -477,7 +477,7 @@ public class MapRenderRepositories {
|
|||
}
|
||||
}
|
||||
renderingReq.saveState();
|
||||
NativeOsmandLibrary nativeLib = !prefs.SAFE_MODE.get() ? NativeOsmandLibrary.getLibrary(storage) : null;
|
||||
NativeOsmandLibrary nativeLib = !prefs.SAFE_MODE.get() ? NativeOsmandLibrary.getLibrary(storage, context) : null;
|
||||
|
||||
// prevent editing
|
||||
requestedBox = new RotatedTileBox(tileRect);
|
||||
|
|
|
@ -3,6 +3,8 @@ package net.osmand.plus.render;
|
|||
|
||||
import net.osmand.NativeLibrary;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.ClientContext;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
|
@ -23,7 +25,7 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
|||
}
|
||||
}
|
||||
|
||||
public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage) {
|
||||
public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage, ClientContext ctx) {
|
||||
if (!isLoaded()) {
|
||||
synchronized (NativeOsmandLibrary.class) {
|
||||
if (!isLoaded()) {
|
||||
|
@ -43,14 +45,18 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
|||
}
|
||||
final String libCpuSuffix = cpuHasNeonSupport() ? "_neon" : "";
|
||||
log.debug("Loading native libraries..."); //$NON-NLS-1$
|
||||
System.loadLibrary("Qt5Core" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Network" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Concurrent" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Sql" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Xml" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndCore" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndJNI" + libCpuSuffix);
|
||||
if(Version.isOldCoreVersion(ctx)) {
|
||||
System.loadLibrary("osmand" + libCpuSuffix);
|
||||
} else {
|
||||
System.loadLibrary("Qt5Core" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Network" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Concurrent" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Sql" + libCpuSuffix);
|
||||
System.loadLibrary("Qt5Xml" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndCore" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndCoreUtils" + libCpuSuffix);
|
||||
System.loadLibrary("OsmAndJNI" + libCpuSuffix);
|
||||
}
|
||||
log.debug("Creating NativeOsmandLibrary instance..."); //$NON-NLS-1$
|
||||
library = new NativeOsmandLibrary();
|
||||
log.debug("Initializing rendering rules storage..."); //$NON-NLS-1$
|
||||
|
@ -76,9 +82,9 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
|||
return isNativeSupported != null;
|
||||
}
|
||||
|
||||
public static boolean isNativeSupported(RenderingRulesStorage storage) {
|
||||
public static boolean isNativeSupported(RenderingRulesStorage storage, ClientContext ctx) {
|
||||
if(storage != null) {
|
||||
getLibrary(storage);
|
||||
getLibrary(storage, ctx);
|
||||
}
|
||||
return isSupported();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue