Support "Select" as menu, Mapping, "Menu" hardware key
This commit is contained in:
parent
88eea7f0e9
commit
3d7b8570b6
|
@ -656,6 +656,57 @@
|
|||
android:text="@string/remove" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_marginTop="25dp"
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/select_button_icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/input" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/select_button_key"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:ems="10"
|
||||
android:text="Select Button" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/select_button_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="6"
|
||||
android:text="@string/select" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/remove_select"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ems="6"
|
||||
android:text="@string/remove" />
|
||||
</LinearLayout>
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -392,6 +392,26 @@ public class InputModFragment extends Fragment {
|
|||
remKeyCode("start_button", start_button_text);
|
||||
}
|
||||
});
|
||||
|
||||
ImageView select_button_icon = (ImageView) getView().findViewById(
|
||||
R.id.select_button_icon);
|
||||
select_button_icon.setImageResource(R.drawable.ic_drawer);
|
||||
final TextView select_button_text = (TextView) getView().findViewById(
|
||||
R.id.select_button_key);
|
||||
Button select_button = (Button) getView().findViewById(
|
||||
R.id.select_button_edit);
|
||||
select_button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
mKey.intiateSearch("select_button", select_button_text);
|
||||
}
|
||||
});
|
||||
Button select_remove = (Button) getView()
|
||||
.findViewById(R.id.remove_select);
|
||||
select_remove.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
remKeyCode("select_button", select_button_text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,7 @@ import android.view.Gravity;
|
|||
import android.view.InputDevice;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.view.Window;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -543,15 +544,28 @@ public class GL2JNIActivity extends Activity {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (isXperiaPlay) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BUTTON_SELECT) {
|
||||
return showMenu();
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1
|
||||
|| (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
|
||||
&& ViewConfiguration.get(this).hasPermanentMenuKey())) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
return showMenu();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == OuyaController.BUTTON_MENU) {
|
||||
=======
|
||||
}
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
if (isXperiaPlay) {
|
||||
return true;
|
||||
} else {
|
||||
>>>>>>> Support "Select" as menu, Mapping, "Menu" hardware key
|
||||
return showMenu();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ public class Gamepad {
|
|||
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
|
||||
|
||||
KeyEvent.KEYCODE_BUTTON_START, key_CONT_START,
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT, KeyEvent.KEYCODE_BACK
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT, KeyEvent.KEYCODE_BUTTON_SELECT
|
||||
// Redundant, but verifies it is mapped properly
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -57,7 +58,8 @@ public class Gamepad {
|
|||
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
|
||||
|
||||
KeyEvent.KEYCODE_BUTTON_START, key_CONT_START,
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT, KeyEvent.KEYCODE_MENU
|
||||
KeyEvent.KEYCODE_BUTTON_SELECT, KeyEvent.KEYCODE_BUTTON_SELECT
|
||||
// Redundant, but verifies it is mapped properly
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -73,8 +75,14 @@ public class Gamepad {
|
|||
OuyaController.BUTTON_DPAD_LEFT, key_CONT_DPAD_LEFT,
|
||||
OuyaController.BUTTON_DPAD_RIGHT, key_CONT_DPAD_RIGHT,
|
||||
|
||||
<<<<<<< HEAD
|
||||
OuyaController.BUTTON_R3, key_CONT_START,
|
||||
KeyEvent.KEYCODE_BUTTON_START, key_CONT_START
|
||||
=======
|
||||
OuyaController.BUTTON_MENU, key_CONT_START,
|
||||
KeyEvent.KEYCODE_BUTTON_START, key_CONT_START,
|
||||
OuyaController.BUTTON_R3, KeyEvent.KEYCODE_BUTTON_SELECT
|
||||
>>>>>>> Support "Select" as menu, Mapping, "Menu" hardware key
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,6 +99,7 @@ public class Gamepad {
|
|||
mPrefs.getInt("dpad_right" + id, OuyaController.BUTTON_DPAD_RIGHT), key_CONT_DPAD_RIGHT,
|
||||
|
||||
mPrefs.getInt("start_button" + id, KeyEvent.KEYCODE_BUTTON_START), key_CONT_START,
|
||||
mPrefs.getInt("select_button" + id, KeyEvent.KEYCODE_BUTTON_SELECT), KeyEvent.KEYCODE_BUTTON_SELECT
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue