public static final int logo_flamingos=0x7f020002;
}
public static final class id {
- public static final int about=0x7f070018;
- public static final int crane=0x7f070015;
- public static final int editText1=0x7f070008;
- public static final int editText2=0x7f07000b;
- public static final int editText3=0x7f07000e;
- public static final int editText4=0x7f070011;
- public static final int exit=0x7f070019;
- public static final int hokuyo=0x7f070014;
+ public static final int about=0x7f07001a;
+ public static final int crane=0x7f070017;
+ public static final int editText1=0x7f07000a;
+ public static final int editText2=0x7f07000d;
+ public static final int editText3=0x7f070010;
+ public static final int editText4=0x7f070013;
+ public static final int exit=0x7f07001b;
+ public static final int hokuyo=0x7f070016;
public static final int hokuyo_view=0x7f070004;
public static final int hokuyo_view_bg=0x7f070003;
public static final int imageView1=0x7f070001;
- public static final int magnet=0x7f070016;
- public static final int managers=0x7f070005;
- public static final int ownIP=0x7f070006;
+ public static final int magnet=0x7f070018;
+ public static final int managers=0x7f070006;
+ public static final int ownIP=0x7f070007;
public static final int scrollView1=0x7f070000;
- public static final int speed=0x7f070012;
- public static final int speed_mon=0x7f070013;
- public static final int tableRow1=0x7f070007;
- public static final int tableRow2=0x7f070009;
- public static final int tableRow3=0x7f07000c;
- public static final int tableRow4=0x7f07000f;
+ public static final int scrollView2=0x7f070005;
+ public static final int scrollView3=0x7f070008;
+ public static final int speed=0x7f070014;
+ public static final int speed_mon=0x7f070015;
+ public static final int tableRow1=0x7f070009;
+ public static final int tableRow2=0x7f07000b;
+ public static final int tableRow3=0x7f07000e;
+ public static final int tableRow4=0x7f070011;
public static final int textView1=0x7f070002;
- public static final int textView2=0x7f07000a;
- public static final int textView3=0x7f07000d;
- public static final int textView4=0x7f070010;
- public static final int voltage=0x7f070017;
+ public static final int textView2=0x7f07000c;
+ public static final int textView3=0x7f07000f;
+ public static final int textView4=0x7f070012;
+ public static final int voltage=0x7f070019;
}
public static final class layout {
public static final int about_dialog=0x7f030000;
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
android:scrollbars="vertical" >
<LinearLayout
<?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" >
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/scrollView2"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_gravity="center_horizontal"
+ android:scrollbars="vertical" >
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_horizontal"
+ android:orientation="vertical" >
+
+ <EditText
+ android:id="@+id/managers"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:ems="10"
+ android:inputType="textMultiLine" >
+
+ <requestFocus />
+ </EditText>
+
+ <TextView
+ android:id="@+id/ownIP"
+ android:gravity="center_horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent" />
+
+ </LinearLayout>
- <EditText
- android:id="@+id/managers"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:ems="10"
- android:inputType="textMultiLine" >
-
- <requestFocus />
- </EditText>
-
- <TextView
- android:id="@+id/ownIP"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</LinearLayout>
+</ScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/scrollView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center"
- android:orientation="vertical" >
-
- <TableLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center" >
-
- <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>
-
-</LinearLayout>
+ android:scrollbars="vertical" >
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <TableLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center" >
+
+ <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:inputType="numberDecimal"
+ android:minWidth="90sp" />
+
+ </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:inputType="numberDecimal"
+ android:minWidth="90sp" />
+
+ </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:inputType="numberDecimal"
+ android:minWidth="90sp" />
+
+ </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:inputType="numberDecimal"
+ android:minWidth="90sp" />
+
+ </TableRow>
+
+ </TableLayout>
+
+ </LinearLayout>
+
+</ScrollView>
\ No newline at end of file
</item>
<item android:id="@+id/crane"
- android:title="Crane up"
+ android:title="Crane: up"
android:orderInCategory="4"
android:showAsAction="never">
</item>
<item android:id="@+id/magnet"
- android:title="Magnet on"
+ android:title="Magnet"
android:orderInCategory="5"
+ android:checkable="true"
android:showAsAction="never">
</item>
x = (temp[0]-y)/0.30;
speedCo[1] = -y;
- speedCo[0] = speedCo[1]>0 ? -x : x;
+ speedCo[0] = x;
}
public void run(boolean run) {
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.content.DialogInterface.OnDismissListener;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.hardware.Sensor;
}
}
- @SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AlertDialog.Builder voltageBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
View voltageView = inflater.inflate(R.layout.status_dialog, null);
- voltageBuilder.setCancelable(false);
voltageBuilder.setView(voltageView);
- voltageBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
+ voltageBuilder.setPositiveButton("OK",null);
+ voltageBuilder.setTitle("Voltages");
+ voltageDialog = voltageBuilder.create();
+ voltageDialog.setOnDismissListener(new OnDismissListener(){
@Override
- public void onClick(DialogInterface dialog, int which) {
+ public void onDismiss(DialogInterface arg0) {
voltageDialog.dismiss();
pwr_voltage.cancel();
mWakeLock.release();
mWifiLock.release();
}
});
- voltageBuilder.setTitle("Voltages");
- voltageDialog = voltageBuilder.create();
voltage33 = (EditText)voltageView.findViewById(R.id.editText1);
voltage50 = (EditText)voltageView.findViewById(R.id.editText2);
voltage80 = (EditText)voltageView.findViewById(R.id.editText3);
managersField = (EditText)managersView.findViewById(R.id.managers);
managersField.setText(mgrs);
- managersBuilder.setCancelable(false);
managersBuilder.setView(managersView);
managersBuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = prefs.edit();
mgrs = managersField.getText().toString();
- System.out.println(mgrs);
editor.putString("managers", mgrs);
editor.commit();
manager.destroy();
manager = new Manager(mgrs);
- wifiInfoTask.cancel(false);
managersDialog.dismiss();
}
});
+ managersBuilder.setNeutralButton("Cancel", null);
managersBuilder.setTitle("Set fellow managers");
managersDialog = managersBuilder.create();
+ managersDialog.setOnDismissListener(new OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface arg0) {
+ managersField.setText(mgrs);
+ wifiInfoTask.cancel(false);
+ }
+ });
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mGravity = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mWifiLock.release();
}
}
- else if (item.getTitle().equals("Crane up")) {
- crane_cmd.send(0x100);
- item.setTitle("Crane down");
- }
- else if (item.getTitle().equals("Crane down")) {
+ else if (item.getTitle().equals("Crane: up")) {
crane_cmd.send(0x190);
- item.setTitle("Crane up");
+ item.setTitle("Crane: down");
}
- else if (item.getTitle().equals("Magnet on")) {
- magnet_cmd.send(1);
- item.setTitle("Magnet off");
+ else if (item.getTitle().equals("Crane: down")) {
+ crane_cmd.send(0x100);
+ item.setTitle("Crane: up");
}
- else if (item.getTitle().equals("Magnet off")) {
- magnet_cmd.send(0);
- item.setTitle("Magnet on");
+ else if (item.getTitle().equals("Magnet")) {
+ if (!item.isChecked()) {
+ magnet_cmd.send(1);
+ item.setChecked(true);
+ }
+ else {
+ magnet_cmd.send(0);
+ item.setChecked(false);
+ }
}
else if (item.getTitle().equals("Voltage monitor")) {
mWakeLock.acquire();