2 * Copyright © 2015 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.AltosDroid;
20 import java.util.Arrays;
24 import org.altusmetrum.altoslib_13.*;
26 import android.app.Activity;
27 import android.graphics.*;
28 import android.os.Bundle;
29 import android.support.v4.app.Fragment;
30 import android.support.v4.app.FragmentTransaction;
31 import android.view.*;
32 import android.widget.*;
33 import android.location.Location;
34 import android.content.*;
35 import android.util.Log;
37 import android.content.pm.*;
39 public class AltosDebug {
41 static final String TAG = "AltosDroid";
43 static boolean D = true;
45 static void init(Context context) {
46 ApplicationInfo app_info = context.getApplicationInfo();
48 if ((app_info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
49 Log.d(TAG, "Enable debugging\n");
52 Log.d(TAG, "Disable debugging\n");
58 static void info(String format, Object ... arguments) {
59 Log.i(TAG, String.format(format, arguments));
62 static void debug(String format, Object ... arguments) {
64 Log.d(TAG, String.format(format, arguments));
67 static void error(String format, Object ... arguments) {
68 Log.e(TAG, String.format(format, arguments));
71 static void check_ui(String format, Object ... arguments) {
72 if (Looper.myLooper() == Looper.getMainLooper()) {
73 Log.e(TAG, String.format("ON UI THREAD " + format, arguments));
74 for (StackTraceElement el : Thread.currentThread().getStackTrace())
75 Log.e(TAG, "\t" + el.toString() + "\n");