diff options
Diffstat (limited to 'same-android/src')
-rw-r--r-- | same-android/src/main/java/com/orbekk/MainActivity.java | 29 | ||||
-rw-r--r-- | same-android/src/main/java/com/orbekk/SameControllerActivity.java | 22 |
2 files changed, 35 insertions, 16 deletions
diff --git a/same-android/src/main/java/com/orbekk/MainActivity.java b/same-android/src/main/java/com/orbekk/MainActivity.java new file mode 100644 index 0000000..80c4f6e --- /dev/null +++ b/same-android/src/main/java/com/orbekk/MainActivity.java @@ -0,0 +1,29 @@ +package com.orbekk; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.widget.Toast; + +public class MainActivity extends Activity { + @Override public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + } + + @Override public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.main_menu, menu); + return true; + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.same_settings) { + startActivity(new Intent(this, SameControllerActivity.class)); + } + return true; + } +} diff --git a/same-android/src/main/java/com/orbekk/SameControllerActivity.java b/same-android/src/main/java/com/orbekk/SameControllerActivity.java index 975a1df..fb9b103 100644 --- a/same-android/src/main/java/com/orbekk/SameControllerActivity.java +++ b/same-android/src/main/java/com/orbekk/SameControllerActivity.java @@ -46,6 +46,10 @@ public class SameControllerActivity extends Activity { t.setText(new Broadcaster(this).getBroadcastAddress().getHostAddress()); } + public void doneClicked(View unused) { + finish(); + } + /** * Called when the activity is first created. * @param savedInstanceState If the activity is being re-initialized after @@ -59,22 +63,8 @@ public class SameControllerActivity extends Activity { System.setProperty("java.net.preferIPv4Stack", "true"); System.setProperty("java.net.preferIPv6Addresses", "false"); - setContentView(R.layout.main); - showIpAddress(); - // showBroadcastAddress(); - -// 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(); -// Log.i(TAG, "Broadcast success: " + broadcaster.sendBroadcast(10010, "Broadcast test from Android".getBytes())); -// + setContentView(R.layout.controller); + showIpAddress(); } @Override |