[Android] Fix edit controls layout

Not checking the none existing key in the buttonsActionsMap
leads to break the sub menu of the configure controls menu
on Android phones.
This commit is contained in:
Mahdi Hijazi 2017-04-29 22:01:22 +02:00
parent ecf5f7d5f4
commit ff475a2c02
4 changed files with 20 additions and 4 deletions

View File

@ -468,7 +468,11 @@ public final class EmulationActivity extends AppCompatActivity
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
handleMenuAction(buttonsActionsMap.get(item.getItemId()));
int action = buttonsActionsMap.get(item.getItemId(), -1);
if (action >= 0)
{
handleMenuAction(action);
}
return true;
}

View File

@ -62,6 +62,10 @@ public final class LoadStateFragment extends Fragment implements View.OnClickLis
@Override
public void onClick(View button)
{
((EmulationActivity) getActivity()).handleMenuAction(buttonsActionsMap.get(button.getId()));
int action = buttonsActionsMap.get(button.getId(), -1);
if (action >= 0)
{
((EmulationActivity) getActivity()).handleMenuAction(action);
}
}
}

View File

@ -54,7 +54,11 @@ public final class MenuFragment extends Fragment implements View.OnClickListener
@Override
public void onClick(View button)
{
((EmulationActivity) getActivity()).handleMenuAction(buttonsActionsMap.get(button.getId()));
int action = buttonsActionsMap.get(button.getId());
if (action >= 0)
{
((EmulationActivity) getActivity()).handleMenuAction(action);
}
}
public void setTitleText(String title)

View File

@ -62,6 +62,10 @@ public final class SaveStateFragment extends Fragment implements View.OnClickLis
@Override
public void onClick(View button)
{
((EmulationActivity) getActivity()).handleMenuAction(buttonsActionsMap.get(button.getId()));
int action = buttonsActionsMap.get(button.getId(), -1);
if (action >= 0)
{
((EmulationActivity) getActivity()).handleMenuAction(action);
}
}
}