summaryrefslogtreecommitdiff
path: root/navit/android/src/org/navitproject/navit/NavitTimeout.java
diff options
context:
space:
mode:
Diffstat (limited to 'navit/android/src/org/navitproject/navit/NavitTimeout.java')
-rw-r--r--navit/android/src/org/navitproject/navit/NavitTimeout.java79
1 files changed, 40 insertions, 39 deletions
diff --git a/navit/android/src/org/navitproject/navit/NavitTimeout.java b/navit/android/src/org/navitproject/navit/NavitTimeout.java
index 81451ab47..0975e9454 100644
--- a/navit/android/src/org/navitproject/navit/NavitTimeout.java
+++ b/navit/android/src/org/navitproject/navit/NavitTimeout.java
@@ -1,20 +1,20 @@
-/**
- * Navit, a modular navigation system.
- * Copyright (C) 2005-2008 Navit Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+/*
+ Navit, a modular navigation system.
+ Copyright (C) 2005-2008 Navit Team
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
package org.navitproject.navit;
@@ -24,36 +24,37 @@ import android.os.Message;
import android.util.Log;
+class NavitTimeout implements Runnable {
-public class NavitTimeout implements Runnable {
- private static Handler handler = new Handler() {
- public void handleMessage(Message m) {
- Log.e("Navit","Handler received message");
- }
- };
- private boolean event_multi;
- private int event_callbackid;
- private int event_timeout;
-
- public native void TimeoutCallback(int id);
-
- NavitTimeout(int timeout, boolean multi, int callbackid) {
- event_timeout = timeout;
- event_multi = multi;
- event_callbackid = callbackid;
- handler.postDelayed(this, event_timeout);
+ private static final TimeoutHandler handler = new TimeoutHandler();
+ private final long mEventCallbackid;
+ private final int mEventTimeout;
+ private final boolean mEventMulti;
+
+ NavitTimeout(int timeout, boolean multi, long callbackid) {
+ mEventTimeout = timeout;
+ mEventMulti = multi;
+ mEventCallbackid = callbackid;
+ handler.postDelayed(this, mEventTimeout);
}
+ public native void timeoutCallback(long id);
+
public void run() {
- // Log.e("Navit","Handle Event");
- if (event_multi) {
- handler.postDelayed(this, event_timeout);
+ Log.v("Navit","Handle Event");
+ if (mEventMulti) {
+ handler.postDelayed(this, mEventTimeout);
}
- TimeoutCallback(event_callbackid);
+ timeoutCallback(mEventCallbackid);
}
public void remove() {
handler.removeCallbacks(this);
}
-}
+ static class TimeoutHandler extends Handler {
+ public void handleMessage(Message m) {
+ Log.d("NavitTimeout", "Handler received message");
+ }
+ }
+}