From 2509b664df6a13e6ae9e6753dc9fa0d696a4f6c7 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 26 May 2015 23:05:11 -0700 Subject: altosdroid: Centralize debug printf code Create AltosDebug to hold the debug code, use it everywhere. Signed-off-by: Keith Packard --- .../src/org/altusmetrum/AltosDroid/TabMapOffline.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java') diff --git a/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java b/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java index 42d80ad5..ceabe7b4 100644 --- a/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java +++ b/altosdroid/src/org/altusmetrum/AltosDroid/TabMapOffline.java @@ -31,12 +31,8 @@ import android.view.*; import android.widget.*; import android.location.Location; import android.content.*; -import android.util.Log; public class TabMapOffline extends AltosDroidTab implements AltosMapInterface { - // Debugging - static final String TAG = "AltosDroid"; - static final boolean D = true; AltosDroid mAltosDroid; @@ -75,7 +71,7 @@ public class TabMapOffline extends AltosDroidTab implements AltosMapInterface { public boolean onScale(ScaleGestureDetector detector) { float f = detector.getScaleFactor(); - if (D) Log.d(TAG, String.format("onScale %f\n", f)); + AltosDebug.debug("onScale %f\n", f); if (f <= 0.8) { map.set_zoom(map.get_zoom() - 1); return true; @@ -88,12 +84,12 @@ public class TabMapOffline extends AltosDroidTab implements AltosMapInterface { } public boolean onScaleBegin(ScaleGestureDetector detector) { - if (D) Log.d(TAG, String.format("onScaleBegin %f\n", detector.getScaleFactor())); + AltosDebug.debug("onScaleBegin %f\n", detector.getScaleFactor()); return true; } public void onScaleEnd(ScaleGestureDetector detector) { - if (D) Log.d(TAG, String.format("onScaleEnd %f\n", detector.getScaleFactor())); + AltosDebug.debug("onScaleEnd %f\n", detector.getScaleFactor()); } @Override @@ -105,19 +101,19 @@ public class TabMapOffline extends AltosDroidTab implements AltosMapInterface { } if (scaling) { - if(D) Log.d(TAG, "scale in progress\n"); + if(AltosDebug.D) AltosDebug.debug("scale in progress\n"); if (event.getAction() == MotionEvent.ACTION_UP) { - if (D) Log.d(TAG, "scale finished\n"); + AltosDebug.debug("scale finished\n"); scaling = false; } return true; } if (event.getAction() == MotionEvent.ACTION_DOWN) { - if(D) Log.d(TAG, String.format("down event %g %g\n", event.getX(), event.getY())); + AltosDebug.debug("down event %g %g\n", event.getX(), event.getY()); map.touch_start((int) event.getX(), (int) event.getY(), true); } else if (event.getAction() == MotionEvent.ACTION_MOVE) { - if(D) Log.d(TAG, String.format("continue event %g %g\n", event.getX(), event.getY())); + AltosDebug.debug("continue event %g %g\n", event.getX(), event.getY()); map.touch_continue((int) event.getX(), (int) event.getY(), true); } return true; -- cgit v1.2.3