diff --git a/android/phoenix/res/layout/key_bind_dialog.xml b/android/phoenix/res/layout/key_bind_dialog.xml
index 112bae443a..2d90848487 100644
--- a/android/phoenix/res/layout/key_bind_dialog.xml
+++ b/android/phoenix/res/layout/key_bind_dialog.xml
@@ -20,14 +20,25 @@
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/key_bind_title"
android:layout_below="@+id/key_bind_title"
- android:text="_"
android:textAppearance="?android:attr/textAppearanceMedium" />
+
+
+
+
diff --git a/android/phoenix/res/values/array.xml b/android/phoenix/res/values/array.xml
index c98138988e..2a62fa352c 100644
--- a/android/phoenix/res/values/array.xml
+++ b/android/phoenix/res/values/array.xml
@@ -35,4 +35,218 @@
- 4.0
- 5.0
+
+
+ - UNBOUND
+ - SOFT LEFT
+ - SOFT RIGHT
+ - HOME
+ - BACK
+ - CALL
+ - ENDCALL
+ - 0
+ - 1
+ - 2
+ - 3
+ - 4
+ - 5
+ - 6
+ - 7
+ - 8
+ - 9
+ - STAR
+ - POUND
+ - DPAD UP
+ - DPAD DOWN
+ - DPAD LEFT
+ - DPAD RIGHT
+ - DPAD CENTER
+ - VOLUME UP
+ - VOLUME DOWN
+ - POWER
+ - CAMERA
+ - CLEAR
+ - A
+ - B
+ - C
+ - D
+ - E
+ - F
+ - G
+ - H
+ - I
+ - J
+ - K
+ - L
+ - M
+ - N
+ - O
+ - P
+ - Q
+ - R
+ - S
+ - T
+ - U
+ - V
+ - W
+ - X
+ - Y
+ - Z
+ - COMMA
+ - PERIOD
+ - ALT LEFT
+ - ALT RIGHT
+ - SHIFT LEFT
+ - SHIFT RIGHT
+ - TAB
+ - SPACE
+ - SYM
+ - EXPLORER
+ - ENVELOPE
+ - ENTER
+ - DEL
+ - GRAVE
+ - MINUS
+ - EQUALS
+ - LEFT BRACKET
+ - RIGHT BRACKET
+ - BACKSLASH
+ - SEMICOLON
+ - APOSTROPHE
+ - SLASH
+ - AT
+ - NUM
+ - HEADSETHOOK
+ - FOCUS
+ - PLUS
+ - MENU
+ - NOTIFICATION
+ - SEARCH
+ - MEDIA PLAY PAUSE=
+ - MEDIA STOP
+ - MEDIA NEXT
+ - MEDIA PREVIOUS
+ - MEDIA REWIND
+ - MEDIA FAST FORWARD
+ - MUTE
+ - PAGE UP
+ - PAGE DOWN
+ - PICTSYMBOLS
+ - SWITCH CHARSET
+ - BUTTON A
+ - BUTTON B
+ - BUTTON C
+ - BUTTON X
+ - BUTTON Y
+ - BUTTON Z
+ - BUTTON L1
+ - BUTTON R1
+ - BUTTON L2
+ - BUTTON R2
+ - BUTTON THUMBL
+ - BUTTON THUMBR
+ - BUTTON START
+ - BUTTON SELECT
+ - BUTTON MODE
+ - ESCAPE
+ - FORWARD DEL
+ - CTRL LEFT
+ - CTRL RIGHT
+ - CAPS LOCK
+ - SCROLL LOCK
+ - META LEFT
+ - META RIGHT
+ - FUNCTION
+ - SYSRQ
+ - BREAK
+ - MOVE HOME
+ - MOVE END
+ - INSERT
+ - FORWARD
+ - MEDIA PLAY
+ - MEDIA PAUSE
+ - MEDIA CLOSE
+ - MEDIA EJECT
+ - MEDIA RECORD
+ - F1
+ - F2
+ - F3
+ - F4
+ - F5
+ - F6
+ - F7
+ - F8
+ - F9
+ - F10
+ - F11
+ - F12
+ - NUM LOCK
+ - NUMPAD 0
+ - NUMPAD 1
+ - NUMPAD 2
+ - NUMPAD 3
+ - NUMPAD 4
+ - NUMPAD 5
+ - NUMPAD 6
+ - NUMPAD 7
+ - NUMPAD 8
+ - NUMPAD 9
+ - NUMPAD DIVIDE
+ - NUMPAD MULTIPLY
+ - NUMPAD SUBTRACT
+ - NUMPAD ADD
+ - NUMPAD DOT
+ - NUMPAD COMMA
+ - NUMPAD ENTER
+ - NUMPAD EQUALS
+ - NUMPAD LEFT PAREN
+ - NUMPAD RIGHT PAREN
+ - VOLUME MUTE
+ - INFO
+ - CHANNEL UP
+ - CHANNEL DOWN
+ - ZOOM IN
+ - ZOOM OUT
+ - TV
+ - WINDOW
+ - GUIDE
+ - DVR
+ - BOOKMARK
+ - CAPTIONS
+ - SETTINGS
+ - TV POWER
+ - TV INPUT
+ - STB POWER
+ - STB INPUT
+ - AVR POWER
+ - AVR INPUT
+ - PROG RED
+ - PROG GREEN
+ - PROG YELLOW
+ - PROG BLUE
+ - APP SWITCH
+ - BUTTON 1
+ - BUTTON 2
+ - BUTTON 3
+ - BUTTON 4
+ - BUTTON 5
+ - BUTTON 6
+ - BUTTON 7
+ - BUTTON 8
+ - BUTTON 9
+ - BUTTON 10
+ - BUTTON 11
+ - BUTTON 12
+ - BUTTON 13
+ - BUTTON 14
+ - BUTTON 15
+ - BUTTON 16
+ - LANGUAGE SWITCH
+ - MANNER MODE
+ - 3D MODE
+ - CONTACTS
+ - CALENDAR
+ - MUSIC
+ - CALCULATOR
+
\ No newline at end of file
diff --git a/android/phoenix/res/values/strings.xml b/android/phoenix/res/values/strings.xml
index 07cab56efe..5be6771bdd 100644
--- a/android/phoenix/res/values/strings.xml
+++ b/android/phoenix/res/values/strings.xml
@@ -13,7 +13,7 @@
Cores Guide
Overlay How-to Guide
Shader Pack
- Press the button to use
- Clear
+ Press the button to use, or select it from the list
+ Unbind
diff --git a/android/phoenix/src/org/retroarch/browser/KeyBindPreference.java b/android/phoenix/src/org/retroarch/browser/KeyBindPreference.java
index c4694ba5e1..3780713f1c 100644
--- a/android/phoenix/src/org/retroarch/browser/KeyBindPreference.java
+++ b/android/phoenix/src/org/retroarch/browser/KeyBindPreference.java
@@ -7,15 +7,28 @@ import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
+import android.widget.AdapterView;
+import android.widget.Button;
+import android.widget.ListView;
import android.widget.TextView;
import org.retroarch.R;
-class KeyBindPreference extends DialogPreference implements View.OnKeyListener {
+class KeyBindPreference extends DialogPreference implements View.OnKeyListener, AdapterView.OnItemClickListener, View.OnClickListener {
private int key_bind_code;
TextView keyText;
+ private String[] key_labels;
+ private final int DEFAULT_KEYCODE = 0;
+
public KeyBindPreference(Context context, AttributeSet attrs) {
super(context, attrs);
+ key_labels = getContext().getResources().getStringArray(R.array.key_bind_values);
+ }
+
+ private void setKey(int keyCode)
+ {
+ key_bind_code = keyCode;
+ keyText.setText("Current: " + key_labels[key_bind_code]);
}
@Override
@@ -30,6 +43,9 @@ class KeyBindPreference extends DialogPreference implements View.OnKeyListener {
View view = inflater.inflate(R.layout.key_bind_dialog, null);
keyText = (TextView) view.findViewById(R.id.key_bind_value);
view.setOnKeyListener(this);
+ ((ListView) view.findViewById(R.id.key_bind_list)).setOnItemClickListener(this);
+ ((Button) view.findViewById(R.id.key_bind_clear)).setOnClickListener(this);
+ setKey(getPersistedInt(DEFAULT_KEYCODE));
return view;
}
@@ -38,18 +54,37 @@ class KeyBindPreference extends DialogPreference implements View.OnKeyListener {
super.onDialogClosed(positiveResult);
if (positiveResult) {
- // deal with persisting your values here
+ persistInt(key_bind_code);
+ notifyChanged();
}
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
Log.i("RetroArch", "Key event!");
- if (event.getAction() == KeyEvent.ACTION_DOWN)
+ if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode != 0 && keyCode < key_labels.length)
{
- key_bind_code = keyCode;
- keyText.setText(String.valueOf(key_bind_code));
+ setKey(keyCode);
}
return false;
}
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ setKey((int)id);
+ }
+
+ @Override
+ public void onClick(View v) {
+ setKey(0);
+ }
+
+ @Override
+ public CharSequence getSummary() {
+ int code = getPersistedInt(DEFAULT_KEYCODE);
+ if (code >= key_labels.length)
+ return "";
+ else
+ return key_labels[code];
+ }
}
\ No newline at end of file