Updated build scripts, added sorting for SDL keycodes in config menu
This commit is contained in:
@@ -3,6 +3,7 @@ package net.sourceforge.clonekeenplus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
||||
@@ -495,6 +496,10 @@ class SDL_Keys
|
||||
{
|
||||
public static String [] names = null;
|
||||
public static Integer [] values = null;
|
||||
|
||||
public static String [] namesSorted = null;
|
||||
public static Integer [] namesSortedIdx = null;
|
||||
public static Integer [] namesSortedBackIdx = null;
|
||||
|
||||
static final int JAVA_KEYCODE_LAST = 110; // Android 2.3 added several new gaming keys, it ends up at keycode 110 currently - plz keep in sync with javakeycodes.h
|
||||
|
||||
@@ -535,5 +540,21 @@ class SDL_Keys
|
||||
|
||||
names = Names.toArray(new String[0]);
|
||||
values = Values.toArray(new Integer[0]);
|
||||
namesSorted = Names.toArray(new String[0]);
|
||||
namesSortedIdx = new Integer[values.length];
|
||||
namesSortedBackIdx = new Integer[values.length];
|
||||
Arrays.sort(namesSorted);
|
||||
for( int i = 0; i < namesSorted.length; i++ )
|
||||
{
|
||||
for( int j = 0; j < namesSorted.length; j++ )
|
||||
{
|
||||
if( namesSorted[i].equals( names[j] ) )
|
||||
{
|
||||
namesSortedIdx[i] = j;
|
||||
namesSortedBackIdx[j] = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.Locale;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.Collections;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
@@ -1518,11 +1519,11 @@ class Settings
|
||||
final int KeyIndexFinal = keyIndex;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(R.string.remap_hwkeys_select);
|
||||
builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapHwKeycode[keyIndex], new DialogInterface.OnClickListener()
|
||||
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapHwKeycode[keyIndex]], new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
Globals.RemapHwKeycode[KeyIndexFinal] = item;
|
||||
Globals.RemapHwKeycode[KeyIndexFinal] = SDL_Keys.namesSortedIdx[item];
|
||||
|
||||
dialog.dismiss();
|
||||
showConfigMainMenu(p);
|
||||
@@ -1620,11 +1621,11 @@ class Settings
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(items[currentButton]);
|
||||
builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapScreenKbKeycode[currentButton], new DialogInterface.OnClickListener()
|
||||
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapScreenKbKeycode[currentButton]], new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
Globals.RemapScreenKbKeycode[currentButton] = item;
|
||||
Globals.RemapScreenKbKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
|
||||
|
||||
dialog.dismiss();
|
||||
showRemapScreenKbConfig2(p, currentButton + 1);
|
||||
@@ -1742,11 +1743,11 @@ class Settings
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(p);
|
||||
builder.setTitle(items[currentButton]);
|
||||
builder.setSingleChoiceItems(SDL_Keys.names, Globals.RemapMultitouchGestureKeycode[currentButton], new DialogInterface.OnClickListener()
|
||||
builder.setSingleChoiceItems(SDL_Keys.namesSorted, SDL_Keys.namesSortedBackIdx[Globals.RemapMultitouchGestureKeycode[currentButton]], new DialogInterface.OnClickListener()
|
||||
{
|
||||
public void onClick(DialogInterface dialog, int item)
|
||||
{
|
||||
Globals.RemapMultitouchGestureKeycode[currentButton] = item;
|
||||
Globals.RemapMultitouchGestureKeycode[currentButton] = SDL_Keys.namesSortedIdx[item];
|
||||
|
||||
dialog.dismiss();
|
||||
showScreenGesturesConfig3(p, currentButton + 1);
|
||||
|
||||
Reference in New Issue
Block a user