mirror of
				https://github.com/encounter/SDL.git
				synced 2025-10-25 19:20:25 +00:00 
			
		
		
		
	Android: remove duplicate code in SDLGenericMotionListener_API24
and use parent method
This commit is contained in:
		
							parent
							
								
									55838d8bd6
								
							
						
					
					
						commit
						9d10c73853
					
				| @ -620,51 +620,24 @@ class SDLGenericMotionListener_API24 extends SDLGenericMotionListener_API12 { | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean onGenericMotion(View v, MotionEvent event) { |     public boolean onGenericMotion(View v, MotionEvent event) { | ||||||
|         float x, y; |  | ||||||
|         int action; |  | ||||||
| 
 | 
 | ||||||
|         switch ( event.getSource() ) { |         // Handle relative mouse mode | ||||||
|             case InputDevice.SOURCE_JOYSTICK: |  | ||||||
|             case InputDevice.SOURCE_GAMEPAD: |  | ||||||
|             case InputDevice.SOURCE_DPAD: |  | ||||||
|                 return SDLControllerManager.handleJoystickMotionEvent(event); |  | ||||||
| 
 |  | ||||||
|             case InputDevice.SOURCE_MOUSE: |  | ||||||
|                 if (!SDLActivity.mSeparateMouseAndTouch) { |  | ||||||
|                     break; |  | ||||||
|                 } |  | ||||||
|                 action = event.getActionMasked(); |  | ||||||
|                 switch (action) { |  | ||||||
|                     case MotionEvent.ACTION_SCROLL: |  | ||||||
|                         x = event.getAxisValue(MotionEvent.AXIS_HSCROLL, 0); |  | ||||||
|                         y = event.getAxisValue(MotionEvent.AXIS_VSCROLL, 0); |  | ||||||
|                         SDLActivity.onNativeMouse(0, action, x, y, false); |  | ||||||
|                         return true; |  | ||||||
| 
 |  | ||||||
|                     case MotionEvent.ACTION_HOVER_MOVE: |  | ||||||
|         if (mRelativeModeEnabled) { |         if (mRelativeModeEnabled) { | ||||||
|                             x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); |             if (event.getSource() == InputDevice.SOURCE_MOUSE) { | ||||||
|                             y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); |                 if (SDLActivity.mSeparateMouseAndTouch) { | ||||||
|                         } |                     int action = event.getActionMasked(); | ||||||
|                         else { |                     if (action == MotionEvent.ACTION_HOVER_MOVE) { | ||||||
|                             x = event.getX(0); |                         float x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X); | ||||||
|                             y = event.getY(0); |                         float y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y); | ||||||
|                         } |                         SDLActivity.onNativeMouse(0, action, x, y, true); | ||||||
| 
 |  | ||||||
|                         SDLActivity.onNativeMouse(0, action, x, y, mRelativeModeEnabled); |  | ||||||
|                         return true; |                         return true; | ||||||
| 
 |  | ||||||
|                     default: |  | ||||||
|                         break; |  | ||||||
|                     } |                     } | ||||||
|                 break; |                 } | ||||||
| 
 |             } | ||||||
|             default: |  | ||||||
|                 break; |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         // Event was not managed |         // Event was not managed, call SDLGenericMotionListener_API12 method | ||||||
|         return false; |         return super.onGenericMotion(v, event); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user