Android: Hook up game list long press menu

This commit is contained in:
Connor McLaughlin 2020-09-01 12:03:51 +10:00
parent dd0ae0fc9d
commit c5044768a8
2 changed files with 12 additions and 16 deletions

View file

@ -85,6 +85,14 @@ public class MainActivity extends AppCompatActivity {
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
int id = item.getItemId();
if (id == R.id.game_list_entry_menu_start_game) {
startEmulation(mGameList.getEntry(position).getPath(), false);
return true;
} else if (id == R.id.game_list_entry_menu_resume_game) {
startEmulation(mGameList.getEntry(position).getPath(), true);
return true;
}
return false;
}
});

View file

@ -1,22 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/game_list_entry_menu_info"
android:title="Show Information" />
android:id="@+id/game_list_entry_menu_start_game"
android:title="Start Game" />
<item
android:id="@+id/game_list_entry_menu_fast_boot"
android:title="@string/settings_console_fast_boot" />
<item
android:id="@+id/game_list_entry_menu_slow_boot"
android:title="Slow Boot" />
<item
android:id="@+id/game_list_entry_menu_load_state"
android:title="Load State">
<menu>
<item android:title="Item" />
<item android:title="Item" />
</menu>
</item>
android:id="@+id/game_list_entry_menu_resume_game"
android:title="Resume Game" />
</menu>