Move newInstance and launch to the top of the file.

Following the style guide, constructors go before public methods.
newInstance and launch are basically constructors.
This commit is contained in:
Mike Harris 2017-09-26 20:39:51 -07:00
parent d790660b59
commit bdeee34eac
3 changed files with 33 additions and 36 deletions

View File

@ -156,8 +156,23 @@ public final class EmulationActivity extends AppCompatActivity
buttonsActionsMap.append(R.id.menu_emulation_load_4, EmulationActivity.MENU_ACTION_LOAD_SLOT4);
buttonsActionsMap.append(R.id.menu_emulation_load_5, EmulationActivity.MENU_ACTION_LOAD_SLOT5);
buttonsActionsMap.append(R.id.menu_exit, EmulationActivity.MENU_ACTION_EXIT);
}
public static void launch(Activity activity, String path, String title, String screenshotPath, int position, View sharedView)
{
Intent launcher = new Intent(activity, EmulationActivity.class);
launcher.putExtra("SelectedGame", path);
launcher.putExtra("SelectedTitle", title);
launcher.putExtra("ScreenPath", screenshotPath);
launcher.putExtra("GridPosition", position);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
activity,
sharedView,
"image_game_screenshot");
activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME, options.toBundle());
}
@Override
@ -941,21 +956,4 @@ public final class EmulationActivity extends AppCompatActivity
{
return mIsGameCubeGame;
}
public static void launch(Activity activity, String path, String title, String screenshotPath, int position, View sharedView)
{
Intent launcher = new Intent(activity, EmulationActivity.class);
launcher.putExtra("SelectedGame", path);
launcher.putExtra("SelectedTitle", title);
launcher.putExtra("ScreenPath", screenshotPath);
launcher.putExtra("GridPosition", position);
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
activity,
sharedView,
"image_game_screenshot");
activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME, options.toBundle());
}
}

View File

@ -22,6 +22,13 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
private static final String FRAGMENT_TAG = "settings";
private SettingsActivityPresenter mPresenter = new SettingsActivityPresenter(this);
public static void launch(Context context, String menuTag)
{
Intent settings = new Intent(context, SettingsActivity.class);
settings.putExtra(ARG_FILE_NAME, menuTag);
context.startActivity(settings);
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
@ -173,13 +180,4 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
{
return (SettingsFragment) getFragmentManager().findFragmentByTag(FRAGMENT_TAG);
}
public static void launch(Context context, String menuTag)
{
Intent settings = new Intent(context, SettingsActivity.class);
settings.putExtra(ARG_FILE_NAME, menuTag);
context.startActivity(settings);
}
}

View File

@ -30,6 +30,17 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
private SettingsAdapter mAdapter;
public static Fragment newInstance(String menuTag)
{
SettingsFragment fragment = new SettingsFragment();
Bundle arguments = new Bundle();
arguments.putString(ARGUMENT_MENU_TAG, menuTag);
fragment.setArguments(arguments);
return fragment;
}
@Override
public void onAttach(Context context)
{
@ -175,14 +186,4 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
mActivity.onExtensionSettingChanged(key, value);
}
public static Fragment newInstance(String menuTag)
{
SettingsFragment fragment = new SettingsFragment();
Bundle arguments = new Bundle();
arguments.putString(ARGUMENT_MENU_TAG, menuTag);
fragment.setArguments(arguments);
return fragment;
}
}