diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 826f210..fffe704 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -11,11 +11,14 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:ignore="AllowBackup,GoogleAppIndexingWarning">
-
+
+
+
-
diff --git a/java/com/example/ex4/Joystick.java b/java/com/example/ex4/Joystick.java
index 7fd64a6..52c94c8 100644
--- a/java/com/example/ex4/Joystick.java
+++ b/java/com/example/ex4/Joystick.java
@@ -50,8 +50,8 @@ public class Joystick extends SurfaceView implements SurfaceHolder.Callback, Vie
{
centerX = getWidth() / 2;
centerY = getHeight() / 2;
- baseRadius = Math.min(getWidth(), getHeight()) / 3;
- hatRadius = Math.min(getWidth(), getHeight()) / 5;
+ baseRadius = Math.min(getWidth(), getHeight()) / 4;
+ hatRadius = Math.min(getWidth(), getHeight()) / 7;
}
//method to be called when Joystick surface is created
@Override
@@ -71,7 +71,7 @@ public class Joystick extends SurfaceView implements SurfaceHolder.Callback, Vie
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder)
{
- UserHandler.getInstance().disconnect();
+ //nothing...
}
/*when Joystick is touched, method will be called and will compute values to be sent as
* arguments to the JoystickCallBack onJoystickMoved even handler*/
@@ -112,10 +112,10 @@ public class Joystick extends SurfaceView implements SurfaceHolder.Callback, Vie
{
Canvas drawCanvas = this.getHolder().lockCanvas();
Paint colors = new Paint();
- drawCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
- colors.setARGB(255, 50, 50, 50);
+ drawCanvas.drawColor(Color.WHITE);
+ colors.setARGB(175, 50, 50, 50);
drawCanvas.drawCircle(centerX, centerY, baseRadius, colors);
- colors.setARGB(255, 0, 0, 255);
+ colors.setARGB(200, 50, 50, 200);
drawCanvas.drawCircle(x, y, hatRadius, colors);
getHolder().unlockCanvasAndPost(drawCanvas);
}
diff --git a/java/com/example/ex4/JoystickActivity.java b/java/com/example/ex4/JoystickActivity.java
index 116c789..5589974 100644
--- a/java/com/example/ex4/JoystickActivity.java
+++ b/java/com/example/ex4/JoystickActivity.java
@@ -18,4 +18,10 @@ public class JoystickActivity extends AppCompatActivity implements Joystick.Joys
handler.send_message(true, xPercent); //true is aileron
handler.send_message(false, yPercent); //false is elevator
}
+ @Override
+ protected void onDestroy()
+ {
+ super.onDestroy();
+ UserHandler.getInstance().disconnect();
+ }
}
\ No newline at end of file
diff --git a/java/com/example/ex4/UserHandler.java b/java/com/example/ex4/UserHandler.java
index dd61a73..ec3ad32 100644
--- a/java/com/example/ex4/UserHandler.java
+++ b/java/com/example/ex4/UserHandler.java
@@ -59,9 +59,7 @@ public class UserHandler
{
synchronized (this)
{
- if (message != null) {
- writer.print(message);
- message = null; }
+ if (message != null) { writer.printf(message); message = null; }
}
}
sock.close();
@@ -101,6 +99,7 @@ public class UserHandler
{
aileron_or_elevator = aileron_path;
}
+ if (val < 0.99 && val > -0.99) { val *= -1; }
synchronized (this)
{
message = "set " + aileron_or_elevator + " " + Float.toString(val) + " \r\n";
diff --git a/res/layout-land/activity_main.xml b/res/layout-land/activity_main.xml
index c0d558c..7de133b 100644
--- a/res/layout-land/activity_main.xml
+++ b/res/layout-land/activity_main.xml
@@ -87,17 +87,16 @@
\ No newline at end of file
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index ab2ed2c..8045235 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -84,8 +84,8 @@