Little refactor to class names. Created class for native cpp libaries.
This commit is contained in:
parent
c004d93891
commit
6cc5a576fe
6 changed files with 40 additions and 19 deletions
|
@ -14,7 +14,7 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.helpers.SimpleTwoFingerTapDetector;
|
import net.osmand.plus.helpers.TwoFingerTapDetector;
|
||||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -75,7 +75,7 @@ public class GLActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean afterTwoFingerTap = false;
|
private boolean afterTwoFingerTap = false;
|
||||||
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
|
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
|
||||||
@Override
|
@Override
|
||||||
public void onTwoFingerTap() {
|
public void onTwoFingerTap() {
|
||||||
afterTwoFingerTap = true;
|
afterTwoFingerTap = true;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.view.ViewConfiguration;
|
||||||
/**
|
/**
|
||||||
* Created by Barsik on 24.06.2014.
|
* Created by Barsik on 24.06.2014.
|
||||||
*/
|
*/
|
||||||
public abstract class SimpleTwoFingerTapDetector {
|
public abstract class TwoFingerTapDetector {
|
||||||
private static final int TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
|
private static final int TIMEOUT = ViewConfiguration.getTapTimeout() + 100;
|
||||||
private long mFirstDownTime = 0;
|
private long mFirstDownTime = 0;
|
||||||
private byte mTwoFingerTapCount = 0;
|
private byte mTwoFingerTapCount = 0;
|
23
OsmAnd/src/net/osmand/plus/render/NativeCppLibrary.java
Normal file
23
OsmAnd/src/net/osmand/plus/render/NativeCppLibrary.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@ import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
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.MultiTouchSupport.MultiTouchZoomListener;
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
import net.osmand.plus.views.controllers.JavaViewController;
|
import net.osmand.plus.views.controllers.JavaViewController;
|
||||||
|
@ -81,9 +81,6 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
|
|
||||||
protected static final int emptyTileDivisor = 16;
|
protected static final int emptyTileDivisor = 16;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface OnLongClickListener {
|
public interface OnLongClickListener {
|
||||||
public boolean onLongPressEvent(PointF point);
|
public boolean onLongPressEvent(PointF point);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +145,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
private Paint paintImg;
|
private Paint paintImg;
|
||||||
|
|
||||||
private boolean afterTwoFingerTap = false;
|
private boolean afterTwoFingerTap = false;
|
||||||
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
|
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
|
||||||
@Override
|
@Override
|
||||||
public void onTwoFingerTap() {
|
public void onTwoFingerTap() {
|
||||||
afterTwoFingerTap = true;
|
afterTwoFingerTap = true;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||||
* Created by Натали on 29.09.2014.
|
* Created by Натали on 29.09.2014.
|
||||||
*/
|
*/
|
||||||
public class JavaViewController extends MapViewBaseController {
|
public class JavaViewController extends MapViewBaseController {
|
||||||
private GLSurfaceView glSurfaceView;
|
|
||||||
private OsmandMapTileView mapTileView;
|
private OsmandMapTileView mapTileView;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
|
|
@ -22,7 +22,8 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.MapActivityLayers;
|
import net.osmand.plus.activities.MapActivityLayers;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
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.render.NativeOsmandLibrary;
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -36,14 +37,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class NativeViewController extends MapViewBaseController {
|
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 GLSurfaceView glSurfaceView;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
@ -74,7 +67,7 @@ public class NativeViewController extends MapViewBaseController {
|
||||||
public static final String NATIVE_TAG = "NativeRender";
|
public static final String NATIVE_TAG = "NativeRender";
|
||||||
private CoreResourcesFromAndroidAssets coreResources;
|
private CoreResourcesFromAndroidAssets coreResources;
|
||||||
|
|
||||||
SimpleTwoFingerTapDetector twoFingerTapDetector = new SimpleTwoFingerTapDetector() {
|
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
|
||||||
@Override
|
@Override
|
||||||
public void onTwoFingerTap() {
|
public void onTwoFingerTap() {
|
||||||
currentViewport.setZoom(currentViewport.getZoom() - 1);
|
currentViewport.setZoom(currentViewport.getZoom() - 1);
|
||||||
|
@ -87,9 +80,18 @@ public class NativeViewController extends MapViewBaseController {
|
||||||
this.glSurfaceView = surfaceView;
|
this.glSurfaceView = surfaceView;
|
||||||
this.settings = activity.getMyApplication().getSettings();
|
this.settings = activity.getMyApplication().getSettings();
|
||||||
this.mapActivity = activity;
|
this.mapActivity = activity;
|
||||||
|
loadLibraries();
|
||||||
setupView();
|
setupView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadLibraries() {
|
||||||
|
NativeCppLibrary.loadLibrary("gnustl_shared");
|
||||||
|
NativeCppLibrary.loadLibrary("Qt5Core");
|
||||||
|
NativeCppLibrary.loadLibrary("Qt5Network");
|
||||||
|
NativeCppLibrary.loadLibrary("Qt5Sql");
|
||||||
|
NativeCppLibrary.loadLibrary("OsmAndCoreWithJNI");
|
||||||
|
}
|
||||||
|
|
||||||
private void setupView() {
|
private void setupView() {
|
||||||
WindowManager mgr = (WindowManager)mapActivity.getSystemService(Context.WINDOW_SERVICE);
|
WindowManager mgr = (WindowManager)mapActivity.getSystemService(Context.WINDOW_SERVICE);
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
|
|
Loading…
Reference in a new issue