Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

let there be light

  • Loading branch information...
commit eb7796e6c10e44e22ca88b643753b3781f4e2fa5 1 parent f412776
@jonasb jonasb authored
View
6 res/menu/main_activity.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/menu_light"
+ android:title="Light"
+ android:showAsAction="always|withText"/>
+</menu>
View
2  res/values-v11/styles.xml
@@ -1,4 +1,4 @@
<resources>
- <style name="Main" parent="android:Theme.Holo.NoActionBar.Fullscreen">
+ <style name="Main" parent="android:Theme.Holo">
</style>
</resources>
View
20 src/se/forskningsavd/MainActivity.java
@@ -3,6 +3,9 @@
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
@@ -64,6 +67,23 @@ public void onClick(View view) {
}
@Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ final MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.main_activity, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == R.id.menu_light) {
+ mCommunicator.sendText("/light");
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
protected void onPause() {
mCommunicator.disconnect();
super.onPause();
Please sign in to comment.
Something went wrong with that request. Please try again.