summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-26 17:29:37 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-26 17:29:37 +0100
commitd11cd76a7f64262424687421a1d78496dde356fe (patch)
tree6cc81e899f50afe0b55e6037c98cfa260167a7ac
parentc2c1e4c5aad74a7fbca5c281f9d8ea2d0ba99ad3 (diff)
Rename DiscoveryService => SameService.
-rw-r--r--same-android/AndroidManifest.xml2
-rw-r--r--same-android/src/main/java/com/orbekk/discovery/SameService.java (renamed from same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java)16
2 files changed, 9 insertions, 9 deletions
diff --git a/same-android/AndroidManifest.xml b/same-android/AndroidManifest.xml
index 66ceb4f..332cade 100644
--- a/same-android/AndroidManifest.xml
+++ b/same-android/AndroidManifest.xml
@@ -11,7 +11,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <service android:name="com.orbekk.discovery.DiscoveryService"/>
+ <service android:name=".discovery.SameService"/>
</application>
</manifest>
diff --git a/same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java b/same-android/src/main/java/com/orbekk/discovery/SameService.java
index e9aac5f..149b882 100644
--- a/same-android/src/main/java/com/orbekk/discovery/DiscoveryService.java
+++ b/same-android/src/main/java/com/orbekk/discovery/SameService.java
@@ -12,15 +12,15 @@ import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class DiscoveryService extends Service {
+public class SameService extends Service {
private Logger logger = LoggerFactory.getLogger(getClass());
- private Thread thread = null;
+ private Thread discoveryThread = null;
public final class DiscoveryThread extends Thread {
Broadcast broadcast;
public DiscoveryThread() {
- broadcast = new Broadcast(DiscoveryService.this);
+ broadcast = new Broadcast(SameService.this);
}
@Override public void run() {
@@ -42,7 +42,7 @@ public class DiscoveryService extends Service {
private Handler toastHandler = new Handler() {
@Override public void handleMessage(Message message) {
- Toast.makeText(DiscoveryService.this,
+ Toast.makeText(SameService.this,
(String)message.obj, Toast.LENGTH_SHORT)
.show();
logger.info("Display toast: {}", (String)message.obj);
@@ -58,10 +58,10 @@ public class DiscoveryService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
Toast.makeText(this, "service start: " + intent.getAction(),
Toast.LENGTH_SHORT).show();
- if (thread == null) {
+ if (discoveryThread == null) {
synchronized (this) {
- thread = new DiscoveryThread();
- thread.start();
+ discoveryThread = new DiscoveryThread();
+ discoveryThread.start();
}
}
return START_STICKY;
@@ -70,7 +70,7 @@ public class DiscoveryService extends Service {
@Override
public void onDestroy() {
Toast.makeText(this, "service stopped", Toast.LENGTH_SHORT).show();
- thread.interrupt();
+ discoveryThread.interrupt();
}
}