]> rtime.felk.cvut.cz Git - orte.git/commitdiff
ROBOT_DEMO: prepare for voltage monitor
authorMartin Vajnar <martin.vajnar@gmail.com>
Thu, 22 Aug 2013 20:44:46 +0000 (22:44 +0200)
committerMartin Vajnar <martin.vajnar@gmail.com>
Thu, 22 Aug 2013 20:44:46 +0000 (22:44 +0200)
Add dialog for voltage monitor.

orte/Robot_Demo/gen/org/ocera/orte/demo/R.java
orte/Robot_Demo/res/layout/status_dialog.xml [new file with mode: 0644]
orte/Robot_Demo/res/menu/activity_main.xml
orte/Robot_Demo/res/values/styles.xml
orte/Robot_Demo/src/org/ocera/orte/demo/MainActivity.java
orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageSubscribe.java [new file with mode: 0644]
orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageType.java [new file with mode: 0644]

index db9b42ac99928cd7f83775a7268c50c9d5bb5a75..d179362d67e17449b56ce7d645f4ee4d698fcea7 100644 (file)
@@ -14,16 +14,31 @@ public final class R {
         public static final int ic_launcher=0x7f020000;
     }
     public static final class id {
-        public static final int exit=0x7f070006;
-        public static final int hokuyo=0x7f070003;
+        public static final int button1=0x7f07000d;
+        public static final int editText1=0x7f070003;
+        public static final int editText2=0x7f070006;
+        public static final int editText3=0x7f070009;
+        public static final int editText4=0x7f07000c;
+        public static final int exit=0x7f070014;
+        public static final int hokuyo=0x7f070010;
         public static final int hokuyo_view=0x7f070000;
-        public static final int lift=0x7f070004;
-        public static final int magnet=0x7f070005;
-        public static final int speed=0x7f070001;
-        public static final int speed_mon=0x7f070002;
+        public static final int lift=0x7f070011;
+        public static final int magnet=0x7f070012;
+        public static final int speed=0x7f07000e;
+        public static final int speed_mon=0x7f07000f;
+        public static final int tableRow1=0x7f070001;
+        public static final int tableRow2=0x7f070004;
+        public static final int tableRow3=0x7f070007;
+        public static final int tableRow4=0x7f07000a;
+        public static final int textView1=0x7f070002;
+        public static final int textView2=0x7f070005;
+        public static final int textView3=0x7f070008;
+        public static final int textView4=0x7f07000b;
+        public static final int voltage=0x7f070013;
     }
     public static final class layout {
         public static final int hokuyo_view=0x7f030000;
+        public static final int status_dialog=0x7f030001;
     }
     public static final class menu {
         public static final int activity_main=0x7f060000;
@@ -80,5 +95,6 @@ public final class R {
  All customizations that are NOT specific to a particular API-level can go here. 
          */
         public static final int AppTheme=0x7f050001;
+        public static final int voltage_dialog=0x7f050002;
     }
 }
diff --git a/orte/Robot_Demo/res/layout/status_dialog.xml b/orte/Robot_Demo/res/layout/status_dialog.xml
new file mode 100644 (file)
index 0000000..23f398b
--- /dev/null
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:gravity="center"
+    android:orientation="vertical" >
+
+    <TableLayout
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" >
+
+        <TableRow
+            android:id="@+id/tableRow1"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <TextView
+                android:id="@+id/textView1"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:text="3.3V" />
+
+            <EditText
+                android:id="@+id/editText1"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:clickable="false"
+                android:focusable="false"
+                android:focusableInTouchMode="false"
+                android:minWidth="70dp" />
+
+        </TableRow>
+
+        <TableRow
+            android:id="@+id/tableRow2"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <TextView
+                android:id="@+id/textView2"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:text="5V" />
+
+            <EditText
+                android:id="@+id/editText2"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:clickable="false"
+                android:focusable="false"
+                android:focusableInTouchMode="false"
+                android:minWidth="70dp" />
+
+        </TableRow>
+
+        <TableRow
+            android:id="@+id/tableRow3"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <TextView
+                android:id="@+id/textView3"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:text="8V" />
+
+            <EditText
+                android:id="@+id/editText3"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:clickable="false"
+                android:focusable="false"
+                android:focusableInTouchMode="false"
+                android:minWidth="70dp" />
+
+        </TableRow>
+
+        <TableRow
+            android:id="@+id/tableRow4"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <TextView
+                android:id="@+id/textView4"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:text="BAT" />
+
+            <EditText
+                android:id="@+id/editText4"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:clickable="false"
+                android:focusable="false"
+                android:focusableInTouchMode="false"
+                android:minWidth="70dp" />
+
+        </TableRow>
+
+    </TableLayout>
+
+    <Button
+        android:id="@+id/button1"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:text="OK" />
+
+</LinearLayout>
index d111b503bb4dd3ecd00d3cefb85a2417e43d808f..05560e2a06dee79e6697dab8ba84cf8a834e1726 100644 (file)
         android:showAsAction="never">
     </item>
 
+    <item android:id="@+id/voltage"
+        android:title="Voltage monitor"
+        android:orderInCategory="6"
+        android:showAsAction="never">
+    </item>
+    
     <item android:id="@+id/exit"
         android:title="Exit"
-        android:orderInCategory="6"
+        android:orderInCategory="7"
         android:showAsAction="never">
     </item>
 </menu>
\ No newline at end of file
index 4a10ca492dd2610011d3979b4dc551f471fa27ab..8351a3a619cdf06a453c88dfcfe6854f9c1db8e8 100644 (file)
     <style name="AppTheme" parent="AppBaseTheme">
         <!-- All customizations that are NOT specific to a particular API-level can go here. -->
     </style>
+    
+    <style name="voltage_dialog" parent="@android:style/Theme.Dialog">
+        <item name="android:backgroundDimEnabled">true</item>
+        <item name="android:layout_height">fill_parent</item>
+        <item name="android:layout_width">fill_parent</item>
+        <item name="android:windowIsFloating">true</item>
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowCloseOnTouchOutside">false</item>
+    </style>
+    
 
 </resources>
\ No newline at end of file
index d05df2617df4ebcabdd9cdedc797add5270c655b..61d4627521d5bcb833437286cc8107f8d32c4aa7 100644 (file)
@@ -4,6 +4,7 @@ import org.ocera.orte.DomainApp;
 import org.ocera.orte.Manager;
 
 import android.app.Activity;
+import android.app.Dialog;
 import android.content.Context;
 import android.content.pm.ActivityInfo;
 import android.hardware.Sensor;
@@ -15,8 +16,12 @@ import android.os.PowerManager;
 import android.os.PowerManager.WakeLock;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
  
 public class MainActivity extends Activity {
+       private Dialog voltageDialog = null;
        
        private Manager manager = null;
     private String[] mgrs = {"192.168.1.5","192.168.1.8","192.168.1.29","10.1.1.1"};
@@ -93,6 +98,8 @@ public class MainActivity extends Activity {
        super.onCreate(savedInstanceState);
         setContentView(R.layout.hokuyo_view);
         
+        voltageDialog = new Dialog(this,R.style.voltage_dialog);
+        voltageDialog.setCancelable(false);
         mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
         mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
         
@@ -174,6 +181,17 @@ public class MainActivity extends Activity {
                }
                else if (item.getTitle().equals("Magnet off")) {
                        
+               }
+               else if (item.getTitle().equals("Voltage monitor")) {
+                       voltageDialog.setContentView(R.layout.status_dialog);
+                       Button okButton = (Button)voltageDialog.findViewById(R.id.button1);
+                       okButton.setOnClickListener(new OnClickListener() {
+                               @Override
+                               public void onClick(View arg0) {
+                                       voltageDialog.dismiss();
+                               }
+                       });
+                       voltageDialog.show();
                }
                else if (item.getTitle().equals("Exit")) {
                        finish();
diff --git a/orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageSubscribe.java b/orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageSubscribe.java
new file mode 100644 (file)
index 0000000..bebef86
--- /dev/null
@@ -0,0 +1,7 @@
+package org.ocera.orte.demo;
+
+import org.ocera.orte.SubscriptionCallback;
+
+public class PwrVoltageSubscribe extends SubscriptionCallback {
+
+}
diff --git a/orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageType.java b/orte/Robot_Demo/src/org/ocera/orte/demo/PwrVoltageType.java
new file mode 100644 (file)
index 0000000..2cbc65f
--- /dev/null
@@ -0,0 +1,25 @@
+package org.ocera.orte.demo;
+
+import org.ocera.orte.types.MessageData;
+
+public class PwrVoltageType extends MessageData {
+
+       @Override
+       public void read() {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public void write() {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public int getMaxDataLength() {
+               // TODO Auto-generated method stub
+               return 0;
+       }
+
+}