diff --git a/src/paulscode/android/mupen64plusae/input/provider/AxisProvider.java b/src/paulscode/android/mupen64plusae/input/provider/AxisProvider.java index fd0dae6f1d..8e53c96d05 100644 --- a/src/paulscode/android/mupen64plusae/input/provider/AxisProvider.java +++ b/src/paulscode/android/mupen64plusae/input/provider/AxisProvider.java @@ -41,16 +41,25 @@ public class AxisProvider extends AbstractProvider /** * Instantiates a new axis provider. - * - * @param view The view receiving MotionEvent data. */ @TargetApi( 12 ) - public AxisProvider( View view ) + public AxisProvider() { // By default, provide data from all possible axes mInputCodes = new int[DEFAULT_NUM_INPUTS]; for( int i = 0; i < mInputCodes.length; i++ ) mInputCodes[i] = -( i + 1 ); + } + + /** + * Instantiates a new axis provider. + * + * @param view The view receiving MotionEvent data. + */ + @TargetApi( 12 ) + public AxisProvider( View view ) + { + this(); // Connect the input source view.setOnGenericMotionListener( new GenericMotionListener() ); @@ -69,6 +78,11 @@ public void setInputCodeFilter( int[] inputCodeFilter ) mInputCodes = inputCodeFilter.clone(); } + public boolean onGenericMotion( MotionEvent event ) + { + return new GenericMotionListener().onGenericMotion( null, event ); + } + /** * Just an indirection class that eliminates some logcat chatter about benign errors. If we make * the parent class implement View.OnGenericMotionListener, then we get logcat error messages diff --git a/src/paulscode/android/mupen64plusae/input/provider/KeyProvider.java b/src/paulscode/android/mupen64plusae/input/provider/KeyProvider.java index 003f9d8a44..acfa4ccea0 100644 --- a/src/paulscode/android/mupen64plusae/input/provider/KeyProvider.java +++ b/src/paulscode/android/mupen64plusae/input/provider/KeyProvider.java @@ -57,15 +57,26 @@ public enum ImeFormula /** * Instantiates a new key provider. * - * @param view The view receiving KeyEvent data. * @param formula The decoding formula to be used. * @param ignoredCodes List of key codes that should be ignored. */ - public KeyProvider( View view, ImeFormula formula, List ignoredCodes ) + public KeyProvider( ImeFormula formula, List ignoredCodes ) { // Assign the fields mImeFormula = formula; mIgnoredCodes = ignoredCodes; + } + + /** + * Instantiates a new key provider. + * + * @param view The view receiving KeyEvent data. + * @param formula The decoding formula to be used. + * @param ignoredCodes List of key codes that should be ignored. + */ + public KeyProvider( View view, ImeFormula formula, List ignoredCodes ) + { + this( formula, ignoredCodes ); // Connect the input source view.setOnKeyListener( this ); @@ -83,9 +94,7 @@ public KeyProvider( View view, ImeFormula formula, List ignoredCodes ) */ public KeyProvider( Builder builder, ImeFormula formula, List ignoredCodes ) { - // Assign the fields - mImeFormula = formula; - mIgnoredCodes = ignoredCodes; + this( formula, ignoredCodes ); // Connect the input source builder.setOnKeyListener( this ); @@ -121,7 +130,7 @@ public boolean onKey( DialogInterface dialog, int keyCode, KeyEvent event ) * @param event the event * @return True if the listener has consumed the event, false otherwise. */ - private boolean onKey( int keyCode, KeyEvent event ) + public boolean onKey( int keyCode, KeyEvent event ) { // Ignore specified key codes if( mIgnoredCodes != null && mIgnoredCodes.contains( keyCode ) )