From 13392d0f20e368fe812e2cea2909ec26f1018ecd Mon Sep 17 00:00:00 2001 From: James Cotton Date: Mon, 6 Aug 2012 01:26:10 -0500 Subject: [PATCH] AndroidGCS: Get rid of remaining warnings --- .../Android/Widgets/DockPanel/DockPanel.java | 8 ++++---- .../Android/Widgets/Joystick/JoystickView.java | 10 ++++------ .../Android/Widgets/TilesLayout/TilesLayout.java | 5 +---- .../Android/Widgets/TilesLayout/TilesLayoutPreset.java | 2 -- androidgcs/src/org/openpilot/uavtalk/UAVTalk.java | 2 -- .../tests/org/openpilot/uavtalk/DataObjectTest.java | 2 -- .../tests/org/openpilot/uavtalk/ObjMngrTest.java | 2 -- androidgcs/tests/org/openpilot/uavtalk/TalkTest.java | 6 ------ .../org/openpilot/uavtalk/TelemetryMonitorTest.java | 9 +-------- 9 files changed, 10 insertions(+), 36 deletions(-) diff --git a/androidgcs/src/com/MobileAnarchy/Android/Widgets/DockPanel/DockPanel.java b/androidgcs/src/com/MobileAnarchy/Android/Widgets/DockPanel/DockPanel.java index e2397394e..bbc6dd276 100644 --- a/androidgcs/src/com/MobileAnarchy/Android/Widgets/DockPanel/DockPanel.java +++ b/androidgcs/src/com/MobileAnarchy/Android/Widgets/DockPanel/DockPanel.java @@ -82,16 +82,16 @@ public class DockPanel extends LinearLayout { if (position == DockPosition.LEFT || position == DockPosition.RIGHT) { handleContainer.setLayoutParams(new LayoutParams( android.view.ViewGroup.LayoutParams.WRAP_CONTENT, - android.view.ViewGroup.LayoutParams.FILL_PARENT, 1)); + android.view.ViewGroup.LayoutParams.MATCH_PARENT, 1)); contentPlaceHolder.setLayoutParams(new LayoutParams( android.view.ViewGroup.LayoutParams.WRAP_CONTENT, - android.view.ViewGroup.LayoutParams.FILL_PARENT, 1)); + android.view.ViewGroup.LayoutParams.MATCH_PARENT, 1)); } else { handleContainer.setLayoutParams(new LayoutParams( - android.view.ViewGroup.LayoutParams.FILL_PARENT, + android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1)); contentPlaceHolder.setLayoutParams(new LayoutParams( - android.view.ViewGroup.LayoutParams.FILL_PARENT, + android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1)); } diff --git a/androidgcs/src/com/MobileAnarchy/Android/Widgets/Joystick/JoystickView.java b/androidgcs/src/com/MobileAnarchy/Android/Widgets/Joystick/JoystickView.java index 88dc8815f..a61fdfd1a 100644 --- a/androidgcs/src/com/MobileAnarchy/Android/Widgets/Joystick/JoystickView.java +++ b/androidgcs/src/com/MobileAnarchy/Android/Widgets/Joystick/JoystickView.java @@ -4,8 +4,8 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; -import android.os.Handler; import android.util.AttributeSet; +import android.util.FloatMath; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; @@ -70,8 +70,8 @@ public class JoystickView extends View { private int cX, cY; //Size of the view in view coordinates - private int dimX, dimY; - + private int dimX; + //Cartesian coordinates of last touch point - joystick center is (0,0) private int cartX, cartY; @@ -242,8 +242,6 @@ public class JoystickView extends View { int d = Math.min(getMeasuredWidth(), getMeasuredHeight()); dimX = d; - dimY = d; - cX = d / 2; cY = d / 2; @@ -315,7 +313,7 @@ public class JoystickView extends View { private void constrainCircle() { float diffX = touchX; float diffY = touchY; - double radial = Math.sqrt((diffX*diffX) + (diffY*diffY)); + double radial = FloatMath.sqrt((diffX*diffX) + (diffY*diffY)); if ( radial > movementRadius ) { touchX = (int)((diffX / radial) * movementRadius); touchY = (int)((diffY / radial) * movementRadius); diff --git a/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayout.java b/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayout.java index c1728faff..b6086e0ca 100644 --- a/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayout.java +++ b/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayout.java @@ -3,10 +3,7 @@ package com.MobileAnarchy.Android.Widgets.TilesLayout; import java.util.ArrayList; import java.util.List; -import android.R; import android.content.Context; -import android.graphics.Color; -import android.os.Handler; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -108,7 +105,7 @@ public class TilesLayout extends FrameLayout { private void Init(AttributeSet attrs) { animatedTransitionDuration = 750; - tileBackgroundResourceId = R.drawable.edit_text; + tileBackgroundResourceId = android.R.drawable.edit_text; tiles = new ArrayList(); } diff --git a/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayoutPreset.java b/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayoutPreset.java index 76a13d73b..27c5514c4 100644 --- a/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayoutPreset.java +++ b/androidgcs/src/com/MobileAnarchy/Android/Widgets/TilesLayout/TilesLayoutPreset.java @@ -13,14 +13,12 @@ public class TilesLayoutPreset { // ========================================= private List _positions; - private String _presetName; // ========================================= // Constructors // ========================================= public TilesLayoutPreset(String name) { - _presetName = name; _positions = new LinkedList(); } diff --git a/androidgcs/src/org/openpilot/uavtalk/UAVTalk.java b/androidgcs/src/org/openpilot/uavtalk/UAVTalk.java index 003f7bccc..478fa5ac0 100644 --- a/androidgcs/src/org/openpilot/uavtalk/UAVTalk.java +++ b/androidgcs/src/org/openpilot/uavtalk/UAVTalk.java @@ -18,8 +18,6 @@ public class UAVTalk extends Observable { private Thread inputProcessingThread = null; - private boolean streamFailed = false; - /** * A reference to the thread for processing the incoming stream. Currently this method is ONLY * used for unit testing diff --git a/androidgcs/tests/org/openpilot/uavtalk/DataObjectTest.java b/androidgcs/tests/org/openpilot/uavtalk/DataObjectTest.java index 0f8106cc5..3efa7d300 100644 --- a/androidgcs/tests/org/openpilot/uavtalk/DataObjectTest.java +++ b/androidgcs/tests/org/openpilot/uavtalk/DataObjectTest.java @@ -10,8 +10,6 @@ import org.junit.Test; import org.openpilot.uavtalk.uavobjects.ActuatorCommand; import org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize; -import android.database.Observable; - public class DataObjectTest { boolean succeed = false; diff --git a/androidgcs/tests/org/openpilot/uavtalk/ObjMngrTest.java b/androidgcs/tests/org/openpilot/uavtalk/ObjMngrTest.java index 0131d1246..57e641c96 100644 --- a/androidgcs/tests/org/openpilot/uavtalk/ObjMngrTest.java +++ b/androidgcs/tests/org/openpilot/uavtalk/ObjMngrTest.java @@ -1,7 +1,5 @@ package org.openpilot.uavtalk; -import static org.junit.Assert.*; - import org.junit.BeforeClass; import org.junit.Test; import org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize; diff --git a/androidgcs/tests/org/openpilot/uavtalk/TalkTest.java b/androidgcs/tests/org/openpilot/uavtalk/TalkTest.java index 1b66d9660..5e6186442 100644 --- a/androidgcs/tests/org/openpilot/uavtalk/TalkTest.java +++ b/androidgcs/tests/org/openpilot/uavtalk/TalkTest.java @@ -4,14 +4,8 @@ import static org.junit.Assert.*; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.net.DatagramSocket; import java.net.InetAddress; import java.net.Socket; -import java.nio.ByteBuffer; import java.util.Observable; import java.util.Observer; diff --git a/androidgcs/tests/org/openpilot/uavtalk/TelemetryMonitorTest.java b/androidgcs/tests/org/openpilot/uavtalk/TelemetryMonitorTest.java index 1fc02d145..0b0cc1d73 100644 --- a/androidgcs/tests/org/openpilot/uavtalk/TelemetryMonitorTest.java +++ b/androidgcs/tests/org/openpilot/uavtalk/TelemetryMonitorTest.java @@ -3,17 +3,9 @@ package org.openpilot.uavtalk; import static org.junit.Assert.*; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.DatagramSocket; import java.net.InetAddress; import java.net.Socket; -import java.nio.ByteBuffer; -import java.util.Observable; -import java.util.Observer; -import org.junit.BeforeClass; import org.junit.Test; import org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize; import org.openpilot.uavtalk.UAVTalk; @@ -53,6 +45,7 @@ public class TelemetryMonitorTest { inputStream.start(); Telemetry tel = new Telemetry(talk, objMngr); + @SuppressWarnings("unused") TelemetryMonitor mon = new TelemetryMonitor(objMngr,tel); Thread.sleep(10000);