Android Studio auto-reformat of new virtual controller code

This commit is contained in:
Cameron Gutman 2016-01-07 00:24:39 -06:00
parent b6bd48584f
commit 2736bd9165
9 changed files with 851 additions and 826 deletions

View File

@ -18,13 +18,21 @@ import java.util.List;
*/
public class AnalogStick extends VirtualControllerElement {
/** outer radius size in percent of the ui element */
/**
* outer radius size in percent of the ui element
*/
public static final int SIZE_RADIUS_COMPLETE = 90;
/** analog stick size in percent of the ui element */
/**
* analog stick size in percent of the ui element
*/
public static final int SIZE_RADIUS_ANALOG_STICK = 90;
/** dead zone size in percent of the ui element */
/**
* dead zone size in percent of the ui element
*/
public static final int SIZE_RADIUS_DEADZONE = 90;
/** time frame for a double click */
/**
* time frame for a double click
*/
public final static long timeoutDoubleClick = 250;
/**
@ -34,6 +42,7 @@ public class AnalogStick extends VirtualControllerElement {
/**
* onMovement event will be fired on real analog stick movement (outside of the deadzone).
*
* @param x horizontal position, value from -1.0 ... 0 .. 1.0
* @param y vertical position, value from -1.0 ... 0 .. 1.0
*/
@ -73,19 +82,31 @@ public class AnalogStick extends VirtualControllerElement {
DOUBLE
}
/** configuration if the analog stick should be displayed as circle or square*/
/**
* configuration if the analog stick should be displayed as circle or square
*/
private boolean circle_stick = true; // TODO: implement square sick for simulations
/** outer radius, this size will be automatically updated on resize */
/**
* outer radius, this size will be automatically updated on resize
*/
private float radius_complete = 0;
/** analog stick radius, this size will be automatically updated on resize */
/**
* analog stick radius, this size will be automatically updated on resize
*/
private float radius_analog_stick = 0;
/** dead zone radius, this size will be automatically updated on resize */
/**
* dead zone radius, this size will be automatically updated on resize
*/
private float radius_dead_zone = 0;
/** horizontal position in relation to the center of the element */
/**
* horizontal position in relation to the center of the element
*/
private float relative_x = 0;
/** vertical position in relation to the center of the element */
/**
* vertical position in relation to the center of the element
*/
private float relative_y = 0;

View File

@ -112,8 +112,8 @@ public class DigitalButton extends VirtualControllerElement {
private void checkMovementForAllButtons(float x, float y) {
for (VirtualControllerElement element : virtualController.getElements()) {
if (element != this && element instanceof DigitalButton){
((DigitalButton)element).checkMovement(x, y, this);
if (element != this && element instanceof DigitalButton) {
((DigitalButton) element).checkMovement(x, y, this);
}
}
}

View File

@ -14,19 +14,20 @@ public class LeftTrigger extends DigitalButton {
public void onClick() {
VirtualController.ControllerInputContext inputContext =
controller.getControllerInputContext();
inputContext.leftTrigger = (byte)0xFF;
inputContext.leftTrigger = (byte) 0xFF;
controller.sendControllerInputContext();
}
@Override
public void onLongClick() {}
public void onLongClick() {
}
@Override
public void onRelease() {
VirtualController.ControllerInputContext inputContext =
controller.getControllerInputContext();
inputContext.leftTrigger = (byte)0x00;
inputContext.leftTrigger = (byte) 0x00;
controller.sendControllerInputContext();
}

View File

@ -14,19 +14,20 @@ public class RightTrigger extends DigitalButton {
public void onClick() {
VirtualController.ControllerInputContext inputContext =
controller.getControllerInputContext();
inputContext.rightTrigger = (byte)0xFF;
inputContext.rightTrigger = (byte) 0xFF;
controller.sendControllerInputContext();
}
@Override
public void onLongClick() {}
public void onLongClick() {
}
@Override
public void onRelease() {
VirtualController.ControllerInputContext inputContext =
controller.getControllerInputContext();
inputContext.rightTrigger = (byte)0x00;
inputContext.rightTrigger = (byte) 0x00;
controller.sendControllerInputContext();
}

View File

@ -110,11 +110,11 @@ public class VirtualController {
VirtualControllerConfigurationLoader.createDefaultLayout(this, context);
}
public ControllerMode getControllerMode () {
public ControllerMode getControllerMode() {
return currentMode;
}
public ControllerInputContext getControllerInputContext () {
public ControllerInputContext getControllerInputContext() {
return inputContext;
}

View File

@ -20,6 +20,7 @@ import java.util.List;
public class VirtualControllerConfigurationLoader {
private static final String PROFILE_PATH = "profiles";
private static int getPercent(
int percent,
int total) {

View File

@ -46,8 +46,8 @@ public abstract class VirtualControllerElement extends View {
}
protected void moveElement(int pressed_x, int pressed_y, int x, int y) {
int newPos_x = (int)getX() + x - pressed_x;
int newPos_y = (int)getY() + y - pressed_y;
int newPos_x = (int) getX() + x - pressed_x;
int newPos_y = (int) getY() + y - pressed_y;
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams();
@ -186,7 +186,7 @@ public abstract class VirtualControllerElement extends View {
AlertDialog alert = alertBuilder.create();
// show menu
alert.show();
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@ -245,6 +245,7 @@ public abstract class VirtualControllerElement extends View {
}
abstract protected void onElementDraw(Canvas canvas);
abstract public boolean onElementTouchEvent(MotionEvent event);
protected static final void _DBG(String text) {