<NME> DistanceDrawer.java
<BEF> package cgeo.geocaching.maps;

import cgeo.geocaching.location.Geopoint;

import android.graphics.Canvas;
import android.location.Location;
import android.view.View;

public class DistanceDrawer {
    private final Geopoint destinationCoords;

    private float distance = 0.0f;
    private float realDistance = 0.0f;
    private boolean showBothDistances = false;
    private float routeDistance = 0.0f;

    private final MapDistanceDrawerCommons mapDistanceDrawer;

    public DistanceDrawer(final View root, final Geopoint destinationCoords, final boolean showBothDistances) {
        this.destinationCoords = destinationCoords;
        this.showBothDistances = showBothDistances;
        mapDistanceDrawer = new MapDistanceDrawerCommons(root);
    }

    public void setCoordinates(final Location location) {
    private BlurMaskFilter blurBoxShadow = null;

    private final boolean needsInvertedColors;
    private float pixelDensity = 0;
    private final float boxWidth, boxHeight, boxCornerRadius, boxShadowSize, boxPadding;
    private final float textHeight, maxTextWidth;
    private final float boxX, boxY;

    public Geopoint getDestinationCoords() {
        return destinationCoords;
    }

    public void setRealDistance(final float realDistance) {
        this.realDistance = realDistance;
        final WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
        windowManager.getDefaultDisplay().getMetrics(metrics);

        pixelDensity = metrics.density;

        boxPadding = 2;
        boxWidth = 100 * pixelDensity + 3 * boxPadding;
        mapDistanceDrawer.drawDistance(showBothDistances, distance, realDistance);
        mapDistanceDrawer.drawRouteDistance(routeDistance);
    }
}

<MSG> refactoring: convert field to local variable

<DFF> @@ -26,7 +26,6 @@ public class DistanceDrawer {
     private BlurMaskFilter blurBoxShadow = null;
 
     private final boolean needsInvertedColors;
-    private float pixelDensity = 0;
     private final float boxWidth, boxHeight, boxCornerRadius, boxShadowSize, boxPadding;
     private final float textHeight, maxTextWidth;
     private final float boxX, boxY;
@@ -40,7 +39,7 @@ public class DistanceDrawer {
         final WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
         windowManager.getDefaultDisplay().getMetrics(metrics);
 
-        pixelDensity = metrics.density;
+        final float pixelDensity = metrics.density;
 
         boxPadding = 2;
         boxWidth = 100 * pixelDensity + 3 * boxPadding;

refactoring: convert field to local variable