@@ -52,14 +52,7 @@ protected void onCreate(Bundle savedInstanceState)
mTabLayout.setupWithViewPager(mViewPager);

// Set up the FAB.
mFab.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
{
mPresenter.onFabClick();
}
});
mFab.setOnClickListener(view -> mPresenter.onFabClick());

mPresenter.onCreate();

@@ -96,14 +96,6 @@ public void loadGames(final Platform platform)
databaseHelper.getGamesForPlatform(platform)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Cursor>()
{
@Override
public void call(Cursor games)
{
mView.showGames(platform, games);
}
}
);
.subscribe(games -> mView.showGames(platform, games));
}
}
@@ -71,31 +71,27 @@ void setupUI() {
buildRowsAdapter();

mBrowseFragment.setOnItemViewClickedListener(
new OnItemViewClickedListener()
{
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row)
{
// Special case: user clicked on a settings row item.
if (item instanceof TvSettingsItem)
{
TvSettingsItem settingsItem = (TvSettingsItem) item;
mPresenter.handleOptionSelection(settingsItem.getItemId());
}
else
{
TvGameViewHolder holder = (TvGameViewHolder) itemViewHolder;

// Start the emulation activity and send the path of the clicked ISO to it.
EmulationActivity.launch(TvMainActivity.this,
holder.path,
holder.title,
holder.screenshotPath,
-1,
holder.imageScreenshot);
}
}
});
(itemViewHolder, item, rowViewHolder, row) ->
{
// Special case: user clicked on a settings row item.
if (item instanceof TvSettingsItem)
{
TvSettingsItem settingsItem = (TvSettingsItem) item;
mPresenter.handleOptionSelection(settingsItem.getItemId());
}
else
{
TvGameViewHolder holder = (TvGameViewHolder) itemViewHolder;

// Start the emulation activity and send the path of the clicked ISO to it.
EmulationActivity.launch(TvMainActivity.this,
holder.path,
holder.title,
holder.screenshotPath,
-1,
holder.imageScreenshot);
}
});
}
/**
* MainView
@@ -47,15 +47,11 @@ private void loadGames()
databaseHelper.getGamesForPlatform(mPlatform)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Cursor>()
.subscribe(games ->
{
@Override
public void call(Cursor games)
{
Log.debug("[PlatformGamesPresenter] " + mPlatform + ": Load finished, swapping cursor...");
Log.debug("[PlatformGamesPresenter] " + mPlatform + ": Load finished, swapping cursor...");

mView.showGames(games);
}
mView.showGames(games);
});
}
}
@@ -201,34 +201,26 @@ public void onInputBindingClick(final InputBindingSetting item, final int positi
dialog.setTitle(R.string.input_binding);
dialog.setMessage(String.format(mContext.getString(R.string.input_binding_descrip), mContext.getString(item.getNameId())));
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, mContext.getString(R.string.cancel), this);
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear), new AlertDialog.OnClickListener()
dialog.setButton(AlertDialog.BUTTON_NEUTRAL, mContext.getString(R.string.clear), (dialogInterface, i) ->
{
@Override
public void onClick(DialogInterface dialogInterface, int i)
{
item.setValue("");
item.setValue("");

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove(item.getKey());
editor.apply();
}
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove(item.getKey());
editor.apply();
});
dialog.setOnDismissListener(new AlertDialog.OnDismissListener()
dialog.setOnDismissListener(dialog1 ->
{
@Override
public void onDismiss(DialogInterface dialog)
{
StringSetting setting = new StringSetting(item.getKey(), item.getSection(), item.getFile(), item.getValue());
notifyItemChanged(position);

if (setting != null)
{
mView.putSetting(setting);
}
StringSetting setting = new StringSetting(item.getKey(), item.getSection(), item.getFile(), item.getValue());
notifyItemChanged(position);

mView.onSettingChanged();
if (setting != null)
{
mView.putSetting(setting);
}

mView.onSettingChanged();
});
dialog.setCanceledOnTouchOutside(false);
dialog.show();
@@ -137,14 +137,7 @@ public static boolean OpenAdapter()
final Activity emulationActivity = NativeLibrary.sEmulationActivity.get();
if (emulationActivity != null)
{
emulationActivity.runOnUiThread(new Runnable()
{
@Override
public void run()
{
Toast.makeText(emulationActivity, "GameCube Adapter couldn't be opened. Please re-plug the device.", Toast.LENGTH_LONG).show();
}
});
emulationActivity.runOnUiThread(() -> Toast.makeText(emulationActivity, "GameCube Adapter couldn't be opened. Please re-plug the device.", Toast.LENGTH_LONG).show());
}
else
{
@@ -27,13 +27,8 @@ public static boolean checkWritePermission(final FragmentActivity activity) {
if (hasWritePermission != PackageManager.PERMISSION_GRANTED) {
if (activity.shouldShowRequestPermissionRationale(WRITE_EXTERNAL_STORAGE)) {
showMessageOKCancel(activity, activity.getString(R.string.write_permission_needed),
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.requestPermissions(new String[] {WRITE_EXTERNAL_STORAGE},
REQUEST_CODE_WRITE_PERMISSION);
}
});
(dialog, which) -> activity.requestPermissions(new String[] {WRITE_EXTERNAL_STORAGE},
REQUEST_CODE_WRITE_PERMISSION));
return false;
}

@@ -58,13 +53,8 @@ private static void showMessageOKCancel(final FragmentActivity activity, String
new AlertDialog.Builder(activity)
.setMessage(message)
.setPositiveButton(android.R.string.ok, okListener)
.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(activity, R.string.write_permission_needed, Toast.LENGTH_SHORT)
.show();
}
})
.setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->
Toast.makeText(activity, R.string.write_permission_needed, Toast.LENGTH_SHORT).show())
.create()
.show();
}