Move Save/LoadFragment's layout ID inline and private.
Fix the hack of using the layout resource ID as a save/load ID, and instead use a proper enum.
This commit is contained in:
parent
96525cbaaa
commit
ab90a3029d
|
@ -72,6 +72,11 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
private static boolean mIsGameCubeGame;
|
||||
|
||||
private enum MenuType
|
||||
{
|
||||
SAVE, LOAD
|
||||
}
|
||||
|
||||
/**
|
||||
* Handlers are a way to pass a message to an Activity telling it to do something
|
||||
* on the UI thread. This Handler responds to any message, even blank ones, by
|
||||
|
@ -522,14 +527,14 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
case MENU_ACTION_SAVE_ROOT:
|
||||
if (!mDeviceHasTouchScreen)
|
||||
{
|
||||
showMenu(SaveStateFragment.FRAGMENT_ID);
|
||||
showMenu(MenuType.SAVE);
|
||||
}
|
||||
return;
|
||||
|
||||
case MENU_ACTION_LOAD_ROOT:
|
||||
if (!mDeviceHasTouchScreen)
|
||||
{
|
||||
showMenu(LoadStateFragment.FRAGMENT_ID);
|
||||
showMenu(MenuType.LOAD);
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -862,18 +867,18 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
});
|
||||
}
|
||||
|
||||
private void showMenu(int menuId)
|
||||
private void showMenu(MenuType menuId)
|
||||
{
|
||||
Fragment fragment;
|
||||
|
||||
switch (menuId)
|
||||
{
|
||||
case SaveStateFragment.FRAGMENT_ID:
|
||||
case SAVE:
|
||||
fragment = SaveStateFragment.newInstance();
|
||||
mSubmenuFragmentTag = SaveStateFragment.FRAGMENT_TAG;
|
||||
break;
|
||||
|
||||
case LoadStateFragment.FRAGMENT_ID:
|
||||
case LOAD:
|
||||
fragment = LoadStateFragment.newInstance();
|
||||
mSubmenuFragmentTag = LoadStateFragment.FRAGMENT_TAG;
|
||||
break;
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
|||
public final class LoadStateFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".load_state";
|
||||
public static final int FRAGMENT_ID = R.layout.fragment_state_load;
|
||||
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
|
@ -42,7 +41,7 @@ public final class LoadStateFragment extends Fragment implements View.OnClickLis
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(FRAGMENT_ID, container, false);
|
||||
View rootView = inflater.inflate(R.layout.fragment_state_load, container, false);
|
||||
|
||||
GridLayout grid = (GridLayout) rootView.findViewById(R.id.grid_state_slots);
|
||||
for (int childIndex = 0; childIndex < grid.getChildCount(); childIndex++)
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
|||
public final class SaveStateFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".save_state";
|
||||
public static final int FRAGMENT_ID = R.layout.fragment_state_save;
|
||||
|
||||
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
|
||||
static {
|
||||
|
@ -42,7 +41,7 @@ public final class SaveStateFragment extends Fragment implements View.OnClickLis
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(FRAGMENT_ID, container, false);
|
||||
View rootView = inflater.inflate(R.layout.fragment_state_save, container, false);
|
||||
|
||||
GridLayout grid = (GridLayout) rootView.findViewById(R.id.grid_state_slots);
|
||||
for (int childIndex = 0; childIndex < grid.getChildCount(); childIndex++)
|
||||
|
|
Loading…
Reference in New Issue