Skip to content
Permalink
Browse files

MapView: disable hardware acceleration on old Android

  • Loading branch information...
devemux86 committed Sep 29, 2019
1 parent 90be199 commit b35362dd3e9710f5d23d00ac177dce43fb67e9f3
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2018 devemux86
* Copyright 2015-2019 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -37,6 +37,10 @@ public RotateView(Context context) {

public RotateView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
}

@Override
@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2014 Ludwig M Brinckmann
* Copyright 2014-2018 devemux86
* Copyright 2014-2019 devemux86
* Copyright 2015 Andreas Schildbach
* Copyright 2018 mikes222
*
@@ -20,16 +20,11 @@

import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.ViewGroup;

import android.view.*;
import org.mapsforge.core.graphics.GraphicFactory;
import org.mapsforge.core.model.BoundingBox;
import org.mapsforge.core.model.Dimension;
@@ -132,6 +127,10 @@ public MapView(Context context) {
public MapView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN) {
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
setWillNotDraw(false);

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 devemux86
* Copyright 2015-2019 devemux86
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
@@ -21,7 +21,6 @@
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageButton;

import org.mapsforge.map.android.graphics.AndroidGraphicFactory;
import org.mapsforge.map.android.rotation.RotateView;
import org.mapsforge.map.android.util.AndroidUtil;
@@ -64,13 +63,9 @@ public void onClick(View v) {
});
}

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void createMapViews() {
mapView = getMapView();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
findViewById(R.id.rotateView).setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
mapView.getModel().frameBufferModel.setOverdrawFactor(1.0d);
mapView.getModel().init(this.preferencesFacade);
mapView.setClickable(true);

0 comments on commit b35362d

Please sign in to comment.
You can’t perform that action at this time.