Fixed right mouse button acting as Back key on Samsung devices with USB/Bluetooth mouse, bumped minimum Android version to Gingerbread.

This commit is contained in:
Sergii Pylypenko
2015-06-05 20:38:42 +03:00
parent b5557d0be0
commit 8a747fc9ba
3 changed files with 17 additions and 4 deletions

View File

@@ -40,7 +40,7 @@
/>
</application>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="21"/>
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="21"/>
<!-- ==INTERNET== --> <uses-permission android:name="android.permission.INTERNET"></uses-permission>
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<!-- ==EXTERNAL_STORAGE== --> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"></uses-permission>

View File

@@ -85,6 +85,7 @@ import android.app.ProgressDialog;
import android.app.KeyguardManager;
import android.view.ViewTreeObserver;
import android.graphics.Rect;
import android.view.InputDevice;
public class MainActivity extends Activity
@@ -764,7 +765,13 @@ public class MainActivity extends Activity
@Override
public boolean onKeyDown(int keyCode, final KeyEvent event)
{
if(_screenKeyboard != null)
if( keyCode == KeyEvent.KEYCODE_BACK && event.getSource() == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 1);
return true;
}
if( _screenKeyboard != null )
_screenKeyboard.onKeyDown(keyCode, event);
else
if( mGLView != null )
@@ -786,7 +793,13 @@ public class MainActivity extends Activity
@Override
public boolean onKeyUp(int keyCode, final KeyEvent event)
{
if(_screenKeyboard != null)
if( keyCode == KeyEvent.KEYCODE_BACK && event.getSource() == InputDevice.SOURCE_MOUSE )
{
// Stupid Samsung remaps right mouse button to BACK key
DemoGLSurfaceView.nativeMouseButtonsPressed(2, 0);
return true;
}
if( _screenKeyboard != null )
_screenKeyboard.onKeyUp(keyCode, event);
else
if( mGLView != null )

View File

@@ -14,7 +14,7 @@ Install latest Android SDK and NDK from http://developer.android.com/index.html
You'll need to install Java Ant too. Since for building apk files some java classes are needed as well,
it is recommended to install OpenJDK and its development files. (On RPM based distros
usually called java-x.x.x-openjdk and java-x.x.x-openjdk-devel)
The application will run on Android 1.6 and above, but will use features from Android 5.1 if available.
The application will run on Android 2.3 and above, but will use features from Android 5.1 if available.
The most supported environment for this port is Linux, MacOs should be okay too.
If you're developing under Windows you'd better install Portable Ubuntu, to get proper Linux environment
running inside Windows, then install Linux toolchain on it.