summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'same-android/src/main/java/com/orbekk/HelloAndroidActivity.java')
-rw-r--r--same-android/src/main/java/com/orbekk/HelloAndroidActivity.java43
1 files changed, 31 insertions, 12 deletions
diff --git a/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java b/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
index a1d71f9..a8ac1e5 100644
--- a/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
+++ b/same-android/src/main/java/com/orbekk/HelloAndroidActivity.java
@@ -1,18 +1,37 @@
package com.orbekk;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.orbekk.discovery.SameService;
import com.orbekk.net.Broadcaster;
import com.orbekk.same.ClientApp;
import com.orbekk.same.ClientServiceImpl;
import com.orbekk.same.SameInterface;
import android.app.Activity;
+import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
+import android.view.View;
-public class HelloAndroidActivity extends Activity {
-
- private static String TAG = "master";
+public class HelloAndroidActivity extends Activity {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+ public void createNetwork(View unused) {
+ logger.info("Creating network");
+ Intent intent = new Intent(this, SameService.class);
+ intent.setAction("create");
+ startService(intent);
+ }
+
+ public void joinNetwork(View unused) {
+ logger.info("Joining network");
+ Intent intent = new Intent(this, SameService.class);
+ intent.setAction("join");
+ startService(intent);
+ }
+
/**
* Called when the activity is first created.
* @param savedInstanceState If the activity is being re-initialized after
@@ -25,16 +44,16 @@ public class HelloAndroidActivity extends Activity {
System.setProperty("java.net.preferIPv4Stack", "true");
System.setProperty("java.net.preferIPv6Addresses", "false");
+
+ setContentView(R.layout.main);
- Log.i(TAG, "onCreate");
- // setContentView(R.layout.main);
- ClientApp client = new ClientApp();
- SameInterface client_ = client.getClient(10015, "ClientNetwork",
- "http://10.0.0.6:10010/");
- GameController controller = GameController.create(
- GameController.newPlayer(), client_);
- setContentView(new GameView(this, controller));
-
+// ClientApp client = new ClientApp();
+// SameInterface client_ = client.getClient(10015, "ClientNetwork",
+// "http://10.0.0.6:10010/");
+// GameController controller = GameController.create(
+// GameController.newPlayer(), client_);
+// setContentView(new GameView(this, controller));
+
// Broadcast broadcast = new Broadcast(this);
// broadcast.sendBroadcast("Broadcast test".getBytes(), 10010);
// Broadcaster broadcaster = new Broadcaster();