summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjandegr <jandegr@users.noreply.github.com>2018-05-29 19:18:35 +0200
committerGitHub <noreply@github.com>2018-05-29 19:18:35 +0200
commit0b9374333e90dd603bdba030d5501daf3da63339 (patch)
tree7e8778653ac1565be51407670fe825d6a06ff47e
parent7d842f21b022a0387caa0cd977adaf6f197b284f (diff)
downloadnavit-test_AR.tar.gz
cleanuptest_AR
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java2
-rw-r--r--navit/android/src/org/navitproject/navit/NavitWatch.java57
2 files changed, 29 insertions, 30 deletions
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
index 1530d06e0..6fc7f1d5f 100644
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
@@ -31,7 +31,7 @@ import android.util.Log;
class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
private TextToSpeech mTts;
private final Navit mNavit;
- private final int MY_DATA_CHECK_CODE = 1;
+ private static final int MY_DATA_CHECK_CODE = 1;
private static final String TAG = NavitSpeech2.class.getName();
public void onInit(int status) {
diff --git a/navit/android/src/org/navitproject/navit/NavitWatch.java b/navit/android/src/org/navitproject/navit/NavitWatch.java
index 2c93bd935..88b77fca8 100644
--- a/navit/android/src/org/navitproject/navit/NavitWatch.java
+++ b/navit/android/src/org/navitproject/navit/NavitWatch.java
@@ -30,26 +30,25 @@ class NavitWatch implements Runnable {
Log.e("NavitWatch","Handler received message");
}
};
- private boolean removed;
- private int watch_func;
- private int watch_fd;
- private int watch_cond;
- private int watch_callbackid;
- private boolean callback_pending;
- private Runnable callback_runnable;
+ private boolean mRemoved;
+ private int mWatchFunc;
+ private int mWatchFd;
+ private int mWatchCond;
+ private int mWatchCallbackid;
+ private boolean mCallbackPending;
+ private Runnable mCallbackRunnable;
public native void poll(int func, int fd, int cond);
public native void watchCallback(int id);
- NavitWatch(int func, int fd, int cond, int callbackid)
- {
+ NavitWatch(int func, int fd, int cond, int callbackid) {
// Log.e("NavitWatch","Creating new thread for "+fd+" "+cond+" from current thread "
// + java.lang.Thread.currentThread().getName());
- watch_func = func;
- watch_fd = fd;
- watch_cond = cond;
- watch_callbackid = callbackid;
+ mWatchFunc = func;
+ mWatchFd = fd;
+ mWatchCond = cond;
+ mWatchCallbackid = callbackid;
final NavitWatch navitwatch = this;
- callback_runnable = new Runnable() {
+ mCallbackRunnable = new Runnable() {
public void run() {
navitwatch.callback();
}
@@ -57,30 +56,30 @@ class NavitWatch implements Runnable {
mThread = new Thread(this, "poll thread");
mThread.start();
}
- public void run()
- {
+
+ public void run() {
for (;;) {
// Log.e("NavitWatch","Polling "+watch_fd+" "+watch_cond + " from "
// + java.lang.Thread.currentThread().getName());
- poll(watch_func, watch_fd, watch_cond);
+ poll(mWatchFunc, mWatchFd, mWatchCond);
// Log.e("NavitWatch","poll returned");
- if (removed) {
+ if (mRemoved) {
break;
}
- callback_pending = true;
- handler.post(callback_runnable);
+ mCallbackPending = true;
+ handler.post(mCallbackRunnable);
try {
// Log.e("NavitWatch","wait");
- synchronized(this) {
- if (callback_pending) {
+ synchronized (this) {
+ if (mCallbackPending) {
this.wait();
}
}
// Log.e("NavitWatch","wait returned");
} catch (Exception e) {
- Log.e("NavitWatch","Exception "+e.getMessage());
+ Log.e("NavitWatch","Exception " + e.getMessage());
}
- if (removed) {
+ if (mRemoved) {
break;
}
}
@@ -88,17 +87,17 @@ class NavitWatch implements Runnable {
public void callback() {
// Log.e("NavitWatch","Calling Callback");
- if (!removed) {
- watchCallback(watch_callbackid);
+ if (!mRemoved) {
+ watchCallback(mWatchCallbackid);
}
- synchronized(this) {
- callback_pending = false;
+ synchronized (this) {
+ mCallbackPending = false;
// Log.e("NavitWatch","Waking up");
this.notify();
}
}
public void remove() {
- removed = true;
+ mRemoved = true;
mThread.interrupt();
}
}