summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjandegr <jandegr@users.noreply.github.com>2018-05-29 19:02:00 +0200
committerGitHub <noreply@github.com>2018-05-29 19:02:00 +0200
commit7d842f21b022a0387caa0cd977adaf6f197b284f (patch)
treed41a9b61b78bc42574746d9f7a49c7e6678bce77
parent73c921d55d35ba16f642949a635d8324d5ccd7bd (diff)
downloadnavit-7d842f21b022a0387caa0cd977adaf6f197b284f.tar.gz
cleanup
-rw-r--r--navit/android/src/org/navitproject/navit/NavitSpeech2.java60
-rw-r--r--navit/android/src/org/navitproject/navit/NavitWatch.java32
2 files changed, 46 insertions, 46 deletions
diff --git a/navit/android/src/org/navitproject/navit/NavitSpeech2.java b/navit/android/src/org/navitproject/navit/NavitSpeech2.java
index f6fe2a327..1530d06e0 100644
--- a/navit/android/src/org/navitproject/navit/NavitSpeech2.java
+++ b/navit/android/src/org/navitproject/navit/NavitSpeech2.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;
@@ -28,18 +28,18 @@ import android.util.Log;
@SuppressWarnings("unused")
-public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
+class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityResult {
private TextToSpeech mTts;
private final Navit mNavit;
private final int MY_DATA_CHECK_CODE = 1;
private static final String TAG = NavitSpeech2.class.getName();
public void onInit(int status) {
- Log.d(TAG,"Status "+status);
+ Log.d(TAG,"Status " + status);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
- Log.d(TAG,"onActivityResult "+requestCode+" "+resultCode);
+ Log.d(TAG,"onActivityResult " + requestCode + " " + resultCode);
if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
// success, create the TTS instance
@@ -47,21 +47,20 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
} else {
// missing data, ask to install it
AlertDialog.Builder builder = new AlertDialog.Builder(mNavit);
- builder.setTitle(R.string.TTS_title_data_missing).setMessage(R.string.TTS_qery_install_data)
- .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent installIntent = new Intent();
- installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
- mNavit.startActivity(installIntent);
- }
- })
- .setNegativeButton(R.string.no, null).show();
+ builder.setTitle(R.string.TTS_title_data_missing).setMessage(R.string.TTS_qery_install_data)
+ .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ Intent installIntent = new Intent();
+ installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
+ mNavit.startActivity(installIntent);
+ }
+ }).setNegativeButton(R.string.no, null).show();
}
}
}
NavitSpeech2(Navit navit) {
- this.mNavit =navit;
+ this.mNavit = navit;
navit.setActivityResult(1, this);
Log.d(TAG,"Create");
Intent checkIntent = new Intent();
@@ -81,4 +80,3 @@ public class NavitSpeech2 implements TextToSpeech.OnInitListener, NavitActivityR
}
}
}
-
diff --git a/navit/android/src/org/navitproject/navit/NavitWatch.java b/navit/android/src/org/navitproject/navit/NavitWatch.java
index d21ca64e3..2c93bd935 100644
--- a/navit/android/src/org/navitproject/navit/NavitWatch.java
+++ b/navit/android/src/org/navitproject/navit/NavitWatch.java
@@ -24,7 +24,7 @@ import android.os.Message;
import android.util.Log;
class NavitWatch implements Runnable {
- private Thread thread;
+ private Thread mThread;
private static Handler handler = new Handler() {
public void handleMessage(Message m) {
Log.e("NavitWatch","Handler received message");
@@ -50,13 +50,12 @@ class NavitWatch implements Runnable {
watch_callbackid = callbackid;
final NavitWatch navitwatch = this;
callback_runnable = new Runnable() {
- public void run()
- {
+ public void run() {
navitwatch.callback();
}
};
- thread = new Thread(this, "poll thread");
- thread.start();
+ mThread = new Thread(this, "poll thread");
+ mThread.start();
}
public void run()
{
@@ -65,39 +64,42 @@ class NavitWatch implements Runnable {
// + java.lang.Thread.currentThread().getName());
poll(watch_func, watch_fd, watch_cond);
// Log.e("NavitWatch","poll returned");
- if (removed)
+ if (removed) {
break;
+ }
callback_pending = true;
handler.post(callback_runnable);
try {
// Log.e("NavitWatch","wait");
synchronized(this) {
- if (callback_pending)
+ if (callback_pending) {
this.wait();
+ }
}
// Log.e("NavitWatch","wait returned");
} catch (Exception e) {
Log.e("NavitWatch","Exception "+e.getMessage());
}
- if (removed)
+ if (removed) {
break;
+ }
}
}
- public void callback()
- {
+
+ public void callback() {
// Log.e("NavitWatch","Calling Callback");
- if (!removed)
+ if (!removed) {
watchCallback(watch_callbackid);
+ }
synchronized(this) {
callback_pending = false;
// Log.e("NavitWatch","Waking up");
this.notify();
}
}
- public void remove()
- {
- removed=true;
- thread.interrupt();
+ public void remove() {
+ removed = true;
+ mThread.interrupt();
}
}