Add dialog for voltage monitor.
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;
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;
}
}
--- /dev/null
+<?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>
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
<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
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;
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"};
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);
}
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();
--- /dev/null
+package org.ocera.orte.demo;
+
+import org.ocera.orte.SubscriptionCallback;
+
+public class PwrVoltageSubscribe extends SubscriptionCallback {
+
+}
--- /dev/null
+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;
+ }
+
+}