diff --git a/projects/mtg/Android/src/net/wagic/utils/StorageOptions.java b/projects/mtg/Android/src/net/wagic/utils/StorageOptions.java index ce2c37c7c..acac6faea 100644 --- a/projects/mtg/Android/src/net/wagic/utils/StorageOptions.java +++ b/projects/mtg/Android/src/net/wagic/utils/StorageOptions.java @@ -14,6 +14,7 @@ import android.util.Log; public class StorageOptions { + private static final String TAG = StorageOptions.class.getCanonicalName(); private static ArrayList mMounts = new ArrayList(); private static ArrayList mVold = new ArrayList(); @@ -77,11 +78,11 @@ public class StorageOptions } catch (FileNotFoundException fnfex) { // if proc/mount doesn't exist we just use - Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); + Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); mMounts.add(defaultMountPoint); } catch (Exception e) { - Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); + Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file"); mMounts.add(defaultMountPoint); } } @@ -111,11 +112,11 @@ public class StorageOptions } catch (FileNotFoundException fnfex) { // if proc/mount doesn't exist we just use - Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); + Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); mMounts.add(defaultMountPoint); } catch (Exception e) { - Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); + Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file"); mMounts.add(defaultMountPoint); } } @@ -144,11 +145,11 @@ public class StorageOptions } catch (FileNotFoundException fnfex) { // if vold.fstab doesn't exist we use the value gathered from the Environment - Log.i(StorageOptions.class.getCanonicalName(), fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); + Log.i(TAG, fnfex.getMessage() + ": assuming " + defaultMountPoint + " is the only mount point"); mMounts.add(defaultMountPoint); } catch (Exception e) { - Log.e(StorageOptions.class.getCanonicalName(), e.getMessage() + ": unknown exception while reading mounts file"); + Log.e(TAG, e.getMessage() + ": unknown exception while reading mounts file"); mMounts.add(defaultMountPoint); } } diff --git a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java index 64b2a95b4..7c07936f0 100644 --- a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java +++ b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java @@ -66,12 +66,11 @@ import android.widget.FrameLayout.LayoutParams; */ public class SDLActivity extends Activity implements OnKeyListener { + private static final String TAG = SDLActivity.class.getCanonicalName(); + //import deck globals - public ArrayList myresult = new ArrayList(); - public String myclickedItem = ""; - - // TAG used for debugging in DDMS - public static String TAG = Activity.class.getCanonicalName(); + public ArrayList myresult = new ArrayList(); + public String myclickedItem = ""; // Main components private static SDLActivity mSingleton; @@ -350,7 +349,7 @@ public class SDLActivity extends Activity implements OnKeyListener updateStorageLocations(); } catch (Exception ioex) { - Log.e("SDL", "An error occurred in setting up the storage locations."); + Log.e(TAG, "An error occurred in setting up the storage locations."); } } @@ -495,7 +494,7 @@ public class SDLActivity extends Activity implements OnKeyListener @Override protected void onCreate(Bundle savedInstanceState) { - // Log.v("SDL", "onCreate()"); + //Log.d(TAG, "onCreate()"); super.onCreate(savedInstanceState); // So we can call stuff from static callbacks @@ -530,7 +529,7 @@ public class SDLActivity extends Activity implements OnKeyListener @Override protected void onPause() { - // Log.v("SDL", "onPause()"); + // Log.d(TAG, "onPause()"); super.onPause(); SDLActivity.nativePause(); } @@ -538,7 +537,7 @@ public class SDLActivity extends Activity implements OnKeyListener @Override protected void onResume() { - // Log.v("SDL", "onResume()"); + // Log.d(TAG, "onResume()"); super.onResume(); SDLActivity.nativeResume(); } @@ -546,8 +545,7 @@ public class SDLActivity extends Activity implements OnKeyListener @Override public void onDestroy() { - // Log.v("SDL", "onDestroy()"); - + // Log.d(TAG, "onDestroy()"); super.onDestroy(); mSurface.onDestroy(); } @@ -658,7 +656,7 @@ public class SDLActivity extends Activity implements OnKeyListener int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); - // Log.v("SDL", "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); + // Log.d(TAG, "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + ((float)sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); // Let the user pick a larger buffer if they really want -- but ye // gods they probably shouldn't, the minimums are horrifyingly high @@ -669,7 +667,7 @@ public class SDLActivity extends Activity implements OnKeyListener audioStartThread(); - // Log.v("SDL", "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + + // Log.d(TAG, "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + ((float)mAudioTrack.getSampleRate() / 1000f) + // "kHz, " + desiredFrames + " frames buffer"); if (is16Bit) @@ -717,7 +715,7 @@ public class SDLActivity extends Activity implements OnKeyListener } } else { - Log.w("SDL", "SDL audio: error return from write(short)"); + Log.w(TAG, "SDL audio: error return from write(short)"); return; } } @@ -742,7 +740,7 @@ public class SDLActivity extends Activity implements OnKeyListener } } else { - Log.w("SDL", "SDL audio: error return from write(short)"); + Log.w(TAG, "SDL audio: error return from write(short)"); return; } } @@ -757,11 +755,11 @@ public class SDLActivity extends Activity implements OnKeyListener mAudioThread.join(); } catch (Exception e) { - Log.v("SDL", "Problem stopping audio thread: " + e); + Log.e(TAG, "Problem stopping audio thread: " + e); } mAudioThread = null; - // Log.v("SDL", "Finished waiting for audio thread"); + // Log.d(TAG, "Finished waiting for audio thread"); } if (mAudioTrack != null) @@ -773,7 +771,7 @@ public class SDLActivity extends Activity implements OnKeyListener class DownloadFileAsync extends AsyncTask { - final String TAG1 = DownloadFileAsync.class.getCanonicalName(); + private final String TAG = DownloadFileAsync.class.getCanonicalName(); @Override protected void onPreExecute() @@ -792,7 +790,6 @@ public class SDLActivity extends Activity implements OnKeyListener try { - // // Prepare the sdcard folders in order to download the resource file // @@ -813,7 +810,7 @@ public class SDLActivity extends Activity implements OnKeyListener conexion.connect(); int lengthOfFile = conexion.getContentLength(); - // Log.d("Wagic - " + TAG1, " Length of file: " + lengthOfFile); + // Log.d(TAG, " Length of file: " + lengthOfFile); input = new BufferedInputStream(url.openStream()); // create a File object for the output file @@ -836,8 +833,8 @@ public class SDLActivity extends Activity implements OnKeyListener { String errorMessage = "An error happened while downloading the resources. It could be that our server is temporarily down, that your device is not connected to a network, or that we cannot write to " + mSingleton.getSystemStorageLocation() + ". Please check your phone settings and try again. For more help please go to http://wagic.net"; mSingleton.downloadError(errorMessage); - Log.e(TAG1, errorMessage); - Log.e(TAG1, e.getMessage()); + Log.e(TAG, errorMessage); + Log.e(TAG, e.getMessage()); } return Long.valueOf(totalBytes); @@ -847,7 +844,7 @@ public class SDLActivity extends Activity implements OnKeyListener { if (progress[0] != mProgressDialog.getProgress()) { - // Log.d("Wagic - " + TAG1, "current progress : " + progress[0]); + // Log.d(TAG, "current progress : " + progress[0]); mProgressDialog.setProgress(progress[0]); } } @@ -920,6 +917,7 @@ public class SDLActivity extends Activity implements OnKeyListener */ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnKeyListener, View.OnTouchListener, SensorEventListener { + private static final String TAG = SDLSurface.class.getCanonicalName(); // This is what SDL runs in. It invokes SDL_main(), eventually private Thread mSDLThread; @@ -959,7 +957,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK SDLActivity.nativeQuit(); - Log.v("SDL", "SDL thread terminated"); + Log.d(TAG, "SDL thread terminated"); // On exit, tear everything down for a fresh restart next time. System.exit(0); @@ -986,7 +984,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK // Called when we have a valid drawing surface public void surfaceCreated(SurfaceHolder holder) { - Log.v("SDL", "surfaceCreated()"); + //Log.d(TAG, "surfaceCreated()"); enableSensor(Sensor.TYPE_ACCELEROMETER, true); } @@ -1006,18 +1004,18 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK mSDLThread.join(); } catch (Exception e) { - Log.v("SDL", "Problem stopping thread: " + e); + Log.e(TAG, "Problem stopping thread: " + e); } mSDLThread = null; - // Log.v("SDL", "Finished waiting for SDL thread"); + // Log.d(TAG, "Finished waiting for SDL thread"); } } // Called when we lose the surface public void surfaceDestroyed(SurfaceHolder holder) { - Log.v("SDL", "surfaceDestroyed()"); + Log.d(TAG, "surfaceDestroyed()"); synchronized (mSemSurface) { mSurfaceValid = false; @@ -1029,51 +1027,51 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK // Called when the surface is resized public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { - Log.d("SDL", "surfaceChanged()"); + Log.d(TAG, "surfaceChanged()"); int sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 by default switch (format) { case PixelFormat.A_8: - Log.d("SDL", "pixel format A_8"); + Log.d("TAG", "pixel format A_8"); break; case PixelFormat.LA_88: - Log.d("SDL", "pixel format LA_88"); + Log.d("TAG", "pixel format LA_88"); break; case PixelFormat.L_8: - Log.d("SDL", "pixel format L_8"); + Log.d("TAG", "pixel format L_8"); break; case PixelFormat.RGBA_4444: - Log.d("SDL", "pixel format RGBA_4444"); + Log.d("TAG", "pixel format RGBA_4444"); sdlFormat = 0x85421002; // SDL_PIXELFORMAT_RGBA4444 break; case PixelFormat.RGBA_5551: - Log.d("SDL", "pixel format RGBA_5551"); + Log.d(TAG, "pixel format RGBA_5551"); sdlFormat = 0x85441002; // SDL_PIXELFORMAT_RGBA5551 break; case PixelFormat.RGBA_8888: - Log.d("SDL", "pixel format RGBA_8888"); + Log.d(TAG, "pixel format RGBA_8888"); sdlFormat = 0x86462004; // SDL_PIXELFORMAT_RGBA8888 break; case PixelFormat.RGBX_8888: - Log.d("SDL", "pixel format RGBX_8888"); + Log.d(TAG, "pixel format RGBX_8888"); sdlFormat = 0x86262004; // SDL_PIXELFORMAT_RGBX8888 break; case PixelFormat.RGB_332: - Log.d("SDL", "pixel format RGB_332"); + Log.d(TAG, "pixel format RGB_332"); sdlFormat = 0x84110801; // SDL_PIXELFORMAT_RGB332 break; case PixelFormat.RGB_565: - Log.d("SDL", "pixel format RGB_565"); + Log.d(TAG, "pixel format RGB_565"); sdlFormat = 0x85151002; // SDL_PIXELFORMAT_RGB565 break; case PixelFormat.RGB_888: - Log.d("SDL", "pixel format RGB_888"); + Log.d(TAG, "pixel format RGB_888"); // Not sure this is right, maybe SDL_PIXELFORMAT_RGB24 instead? sdlFormat = 0x86161804; // SDL_PIXELFORMAT_RGB888 break; default: - Log.d("SDL", "pixel format unknown " + format); + Log.d(TAG, "pixel format unknown " + format); break; } SDLActivity.onNativeResize(width, height, sdlFormat); @@ -1090,7 +1088,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK // EGL functions public boolean initEGL(int majorVersion, int minorVersion) { - Log.d("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); + Log.d(TAG, "Starting up OpenGL ES " + majorVersion + "." + minorVersion); try { @@ -1119,7 +1117,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK int[] num_config = new int[1]; if (!egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config) || num_config[0] == 0) { - Log.e("SDL", "No EGL config available"); + Log.e(TAG, "No EGL config available"); return false; } mEGLConfig = configs[0]; @@ -1127,7 +1125,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK EGLContext ctx = egl.eglCreateContext(dpy, mEGLConfig, EGL10.EGL_NO_CONTEXT, null); if (ctx == EGL10.EGL_NO_CONTEXT) { - Log.e("SDL", "Couldn't create context"); + Log.e(TAG, "Couldn't create context"); return false; } @@ -1141,10 +1139,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK } catch (Exception e) { - Log.e("SDL", e + ""); + Log.e(TAG, e + ""); for (StackTraceElement s : e.getStackTrace()) { - Log.e("SDL", s.toString()); + Log.e(TAG, s.toString()); } } @@ -1172,7 +1170,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK mEGLSurface = egl.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, holder, null); if (mEGLSurface == EGL10.EGL_NO_SURFACE) { - Log.e("SDL", "Couldn't create surface"); + Log.e(TAG, "Couldn't create surface"); return false; } @@ -1181,7 +1179,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK */ if (!egl.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) { - Log.e("SDL", "Couldn't make context current"); + Log.e(TAG, "Couldn't make context current"); return false; } @@ -1212,10 +1210,10 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK } catch (Exception e) { - Log.e("SDL", "flipEGL(): " + e); + Log.e(TAG, "flipEGL(): " + e); for (StackTraceElement s : e.getStackTrace()) { - Log.e("SDL", s.toString()); + Log.e(TAG, s.toString()); } } } @@ -1231,12 +1229,12 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback, View.OnK if (event.getAction() == KeyEvent.ACTION_DOWN) { - // Log.d("SDL", "key down: " + keyCode); + // Log.d(TAG, "key down: " + keyCode); SDLActivity.onNativeKeyDown(keyCode); return true; } else if (event.getAction() == KeyEvent.ACTION_UP) { - // Log.d("SDL", "key up: " + keyCode); + // Log.d(TAG, "key up: " + keyCode); SDLActivity.onNativeKeyUp(keyCode); return true; }