| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.device.gamepad; | 5 package org.chromium.device.gamepad; |
| 6 | 6 |
| 7 import android.view.KeyEvent; | 7 import android.view.KeyEvent; |
| 8 import android.view.MotionEvent; | 8 import android.view.MotionEvent; |
| 9 | 9 |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 mapXYAxes(mappedAxes, rawAxes); | 262 mapXYAxes(mappedAxes, rawAxes); |
| 263 mapRXAndRYAxesToRightStick(mappedAxes, rawAxes); | 263 mapRXAndRYAxesToRightStick(mappedAxes, rawAxes); |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 private static class UnknownGamepadMappings extends GamepadMappings { | 267 private static class UnknownGamepadMappings extends GamepadMappings { |
| 268 private int mLeftTriggerAxis = -1; | 268 private int mLeftTriggerAxis = -1; |
| 269 private int mRightTriggerAxis = -1; | 269 private int mRightTriggerAxis = -1; |
| 270 private int mRightStickXAxis = -1; | 270 private int mRightStickXAxis = -1; |
| 271 private int mRightStickYAxis = -1; | 271 private int mRightStickYAxis = -1; |
| 272 private boolean mUseHatAxes = false; | 272 private boolean mUseHatAxes; |
| 273 | 273 |
| 274 UnknownGamepadMappings(int[] axes) { | 274 UnknownGamepadMappings(int[] axes) { |
| 275 int hatAxesFound = 0; | 275 int hatAxesFound = 0; |
| 276 | 276 |
| 277 for (int axis : axes) { | 277 for (int axis : axes) { |
| 278 switch (axis) { | 278 switch (axis) { |
| 279 case MotionEvent.AXIS_LTRIGGER: | 279 case MotionEvent.AXIS_LTRIGGER: |
| 280 case MotionEvent.AXIS_BRAKE: | 280 case MotionEvent.AXIS_BRAKE: |
| 281 mLeftTriggerAxis = axis; | 281 mLeftTriggerAxis = axis; |
| 282 break; | 282 break; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 if (mUseHatAxes) { | 346 if (mUseHatAxes) { |
| 347 mapHatAxisToDpadButtons(mappedButtons, rawAxes); | 347 mapHatAxisToDpadButtons(mappedButtons, rawAxes); |
| 348 } else { | 348 } else { |
| 349 mapCommonDpadButtons(mappedButtons, rawButtons); | 349 mapCommonDpadButtons(mappedButtons, rawButtons); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| OLD | NEW |