Fixed accelerometer joystick, added on-screen keyboard DPAD acting as a joystick

This commit is contained in:
pelya
2010-10-15 19:41:13 +03:00
parent 11d99e03fb
commit a6dba1278e
9 changed files with 197 additions and 102 deletions

View File

@@ -297,7 +297,7 @@ class Settings
static void showAdditionalInputConfig(final MainActivity p)
{
if( ! Globals.AppNeedsArrowKeys )
if( ! Globals.AppNeedsArrowKeys && ! Globals.AppUsesJoystick )
{
showAccelerometerConfig(p);
return;
@@ -341,7 +341,7 @@ class Settings
Globals.AccelerometerSensitivity = 0;
if( ! Globals.UseAccelerometerAsArrowKeys )
{
showScreenKeyboardConfig(p);
showAccelerometerCenterConfig(p);
return;
}
@@ -357,6 +357,36 @@ class Settings
{
Globals.AccelerometerSensitivity = item;
dialog.dismiss();
showAccelerometerCenterConfig(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
}
static void showAccelerometerCenterConfig(final MainActivity p)
{
Globals.AccelerometerSensitivity = 0;
if( ! Globals.UseAccelerometerAsArrowKeys )
{
showScreenKeyboardConfig(p);
return;
}
final CharSequence[] items = { p.getResources().getString(R.string.accel_floating),
p.getResources().getString(R.string.accel_fixed_start),
p.getResources().getString(R.string.accel_fixed_horiz) };
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle(R.string.accel_question_center);
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
Globals.AccelerometerCenterPos = item;
dialog.dismiss();
showScreenKeyboardConfig(p);
}
@@ -366,6 +396,7 @@ class Settings
alert.show();
}
static void showScreenKeyboardConfig(final MainActivity p)
{
Globals.TouchscreenKeyboardSize = 0;
@@ -463,11 +494,11 @@ class Settings
nativeSetTrackballUsed();
if( Globals.AppUsesMouse )
nativeSetMouseUsed();
if( Globals.AppUsesJoystick && !Globals.UseAccelerometerAsArrowKeys )
if( Globals.AppUsesJoystick )
nativeSetJoystickUsed();
if( Globals.AppUsesMultitouch )
nativeSetMultitouchUsed();
nativeSetAccelerometerSensitivity(Globals.AccelerometerSensitivity);
nativeSetAccelerometerSettings(Globals.AccelerometerSensitivity, Globals.AccelerometerCenterPos);
nativeSetTrackballDampening(Globals.TrackballDampening);
if( Globals.UseTouchscreenKeyboard )
{
@@ -534,7 +565,7 @@ class Settings
private static native void nativeIsSdcardUsed(int flag);
private static native void nativeSetTrackballUsed();
private static native void nativeSetTrackballDampening(int value);
private static native void nativeSetAccelerometerSensitivity(int value);
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
private static native void nativeSetMouseUsed();
private static native void nativeSetJoystickUsed();
private static native void nativeSetMultitouchUsed();