refactor backend Adapter classes
This commit is contained in:
@@ -23,10 +23,14 @@ import org.oscim.backend.AssetAdapter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class AndroidAssetAdapter extends AssetAdapter {
|
||||
public class AndroidAssets extends AssetAdapter {
|
||||
Context mContext;
|
||||
|
||||
public AndroidAssetAdapter(Context ctx) {
|
||||
public static void init(Context ctx) {
|
||||
g = new AndroidAssets(ctx);
|
||||
}
|
||||
|
||||
private AndroidAssets(Context ctx) {
|
||||
mContext = ctx;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.oscim.android;
|
||||
import org.oscim.android.canvas.AndroidGraphics;
|
||||
import org.oscim.android.gl.AndroidGL;
|
||||
import org.oscim.android.input.AndroidMotionEvent;
|
||||
import org.oscim.backend.AssetAdapter;
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.event.Gesture;
|
||||
@@ -58,9 +57,9 @@ public class MapView extends RelativeLayout {
|
||||
public MapView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
|
||||
CanvasAdapter.g = AndroidGraphics.INSTANCE;
|
||||
AssetAdapter.g = new AndroidAssetAdapter(context);
|
||||
GLAdapter.g = new AndroidGL();
|
||||
AndroidGraphics.init();
|
||||
AndroidAssets.init(context);
|
||||
GLAdapter.init(new AndroidGL());
|
||||
|
||||
this.setWillNotDraw(true);
|
||||
this.setClickable(true);
|
||||
|
||||
@@ -32,7 +32,10 @@ import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public final class AndroidGraphics extends CanvasAdapter {
|
||||
public static final AndroidGraphics INSTANCE = new AndroidGraphics();
|
||||
|
||||
public static void init() {
|
||||
g = new AndroidGraphics();
|
||||
}
|
||||
|
||||
public static android.graphics.Paint getAndroidPaint(Paint paint) {
|
||||
return ((AndroidPaint) paint).mPaint;
|
||||
@@ -97,7 +100,6 @@ public final class AndroidGraphics extends CanvasAdapter {
|
||||
return new MarkerSymbol(drawableToBitmap(drawable), place);
|
||||
}
|
||||
|
||||
|
||||
public static MarkerSymbol makeMarker(Resources res, int resId, HotspotPlace place) {
|
||||
if (place == null)
|
||||
place = HotspotPlace.CENTER;
|
||||
|
||||
Reference in New Issue
Block a user