Replace all Anonymouse class with lambdas or method refernce where applicable
This commit is contained in:
parent
c6bc25a189
commit
e61e4d4b3c
|
@ -384,14 +384,7 @@ public final class NativeLibrary
|
|||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity != null)
|
||||
{
|
||||
emulationActivity.runOnUiThread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Toast.makeText(emulationActivity, "Panic Alert: " + alert, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
emulationActivity.runOnUiThread(() -> Toast.makeText(emulationActivity, "Panic Alert: " + alert, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -175,24 +175,13 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
// Get a handle to the Window containing the UI.
|
||||
mDecorView = getWindow().getDecorView();
|
||||
mDecorView.setOnSystemUiVisibilityChangeListener
|
||||
(new View.OnSystemUiVisibilityChangeListener() {
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int visibility) {
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
|
||||
{
|
||||
// Go back to immersive fullscreen mode in 3s
|
||||
Handler handler = new Handler(getMainLooper());
|
||||
handler.postDelayed(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
enableFullscreenImmersive();
|
||||
}
|
||||
},
|
||||
3000 /* 3s */);
|
||||
}
|
||||
mDecorView.setOnSystemUiVisibilityChangeListener(visibility ->
|
||||
{
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0)
|
||||
{
|
||||
// Go back to immersive fullscreen mode in 3s
|
||||
Handler handler = new Handler(getMainLooper());
|
||||
handler.postDelayed(this::enableFullscreenImmersive, 3000 /* 3s */);
|
||||
}
|
||||
});
|
||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||
|
@ -251,14 +240,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
Animations.fadeViewOut(mImageView)
|
||||
.setStartDelay(2000)
|
||||
.withEndAction(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mImageView.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
.withEndAction(() -> mImageView.setVisibility(View.GONE));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -328,35 +310,27 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
}
|
||||
}
|
||||
|
||||
public void exitWithAnimation()
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
public void exitWithAnimation() {
|
||||
runOnUiThread(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Picasso.with(EmulationActivity.this)
|
||||
.invalidate(mScreenPath);
|
||||
Picasso.with(EmulationActivity.this)
|
||||
.invalidate(mScreenPath);
|
||||
|
||||
Picasso.with(EmulationActivity.this)
|
||||
.load(mScreenPath)
|
||||
.noFade()
|
||||
.noPlaceholder()
|
||||
.into(mImageView, new Callback()
|
||||
{
|
||||
@Override
|
||||
public void onSuccess()
|
||||
{
|
||||
showScreenshot();
|
||||
}
|
||||
Picasso.with(EmulationActivity.this)
|
||||
.load(mScreenPath)
|
||||
.noFade()
|
||||
.noPlaceholder()
|
||||
.into(mImageView, new Callback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
showScreenshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onError() {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -575,60 +549,31 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleGc" + i, true);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.gcpadButtons, enabledButtons,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
|
||||
editor.putBoolean("buttonToggleGc" + indexSelected, isChecked);
|
||||
}
|
||||
});
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleGc" + indexSelected, isChecked));
|
||||
} else if (mPreferences.getInt("wiiController", 3) == 4) {
|
||||
for (int i = 0; i < enabledButtons.length; i++) {
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleClassic" + i, true);
|
||||
}
|
||||
builder.setMultiChoiceItems(R.array.classicButtons, enabledButtons,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
|
||||
editor.putBoolean("buttonToggleClassic" + indexSelected, isChecked);
|
||||
}
|
||||
});
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleClassic" + indexSelected, isChecked));
|
||||
} else {
|
||||
for (int i = 0; i < enabledButtons.length; i++) {
|
||||
enabledButtons[i] = mPreferences.getBoolean("buttonToggleWii" + i, true);
|
||||
}
|
||||
if (mPreferences.getInt("wiiController", 3) == 3) {
|
||||
builder.setMultiChoiceItems(R.array.nunchukButtons, enabledButtons,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
|
||||
editor.putBoolean("buttonToggleWii" + indexSelected, isChecked);
|
||||
}
|
||||
});
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
} else {
|
||||
builder.setMultiChoiceItems(R.array.wiimoteButtons, enabledButtons,
|
||||
new DialogInterface.OnMultiChoiceClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int indexSelected, boolean isChecked) {
|
||||
editor.putBoolean("buttonToggleWii" + indexSelected, isChecked);
|
||||
}
|
||||
});
|
||||
(dialog, indexSelected, isChecked) -> editor.putBoolean("buttonToggleWii" + indexSelected, isChecked));
|
||||
}
|
||||
}
|
||||
builder.setNeutralButton(getString(R.string.emulation_toggle_all), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
mEmulationFragment.toggleInputOverlayVisibility();
|
||||
}
|
||||
});
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i)
|
||||
{
|
||||
editor.apply();
|
||||
builder.setNeutralButton(getString(R.string.emulation_toggle_all), (dialogInterface, i) -> mEmulationFragment.toggleInputOverlayVisibility());
|
||||
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
|
||||
{
|
||||
editor.apply();
|
||||
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
}
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = builder.create();
|
||||
|
@ -665,15 +610,13 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.emulation_control_scale);
|
||||
builder.setView(view);
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putInt("controlScale", seekbar.getProgress());
|
||||
editor.apply();
|
||||
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
|
||||
{
|
||||
SharedPreferences.Editor editor = mPreferences.edit();
|
||||
editor.putInt("controlScale", seekbar.getProgress());
|
||||
editor.apply();
|
||||
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
}
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = builder.create();
|
||||
|
@ -685,24 +628,20 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle(R.string.emulation_choose_controller);
|
||||
builder.setSingleChoiceItems(R.array.controllersEntries, mPreferences.getInt("wiiController", 3),
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int indexSelected) {
|
||||
editor.putInt("wiiController", indexSelected);
|
||||
(dialog, indexSelected) ->
|
||||
{
|
||||
editor.putInt("wiiController", indexSelected);
|
||||
|
||||
NativeLibrary.SetConfig("WiimoteNew.ini", "Wiimote1", "Extension",
|
||||
getResources().getStringArray(R.array.controllersValues)[indexSelected]);
|
||||
}
|
||||
NativeLibrary.SetConfig("WiimoteNew.ini", "Wiimote1", "Extension",
|
||||
getResources().getStringArray(R.array.controllersValues)[indexSelected]);
|
||||
});
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
editor.apply();
|
||||
builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
|
||||
{
|
||||
editor.apply();
|
||||
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
mEmulationFragment.refreshInputOverlay();
|
||||
|
||||
Toast.makeText(getApplication(), R.string.emulation_controller_changed, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Toast.makeText(getApplication(), R.string.emulation_controller_changed, Toast.LENGTH_SHORT).show();
|
||||
});
|
||||
|
||||
AlertDialog alertDialog = builder.create();
|
||||
|
|
|
@ -132,15 +132,11 @@ public final class FileAdapter extends RecyclerView.Adapter<FileViewHolder> impl
|
|||
// Delay the loading of the new directory to give a little bit of time for UI feedback
|
||||
// to happen. Hacky, but good enough for now; this is necessary because we're modifying
|
||||
// the RecyclerView's contents, rather than constructing a new one.
|
||||
view.getHandler().postDelayed(new Runnable()
|
||||
view.getHandler().postDelayed(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mFileList = fileList;
|
||||
notifyDataSetChanged();
|
||||
mListener.updateSubtitle(path);
|
||||
}
|
||||
mFileList = fileList;
|
||||
notifyDataSetChanged();
|
||||
mListener.updateSubtitle(path);
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,19 +68,15 @@ public final class GameDetailsDialog extends DialogFragment
|
|||
textCountry.setText(country);
|
||||
textDate.setText(getArguments().getString(ARG_GAME_DATE));
|
||||
|
||||
buttonLaunch.setOnClickListener(new View.OnClickListener()
|
||||
buttonLaunch.setOnClickListener(view ->
|
||||
{
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
// Start the emulation activity and send the path of the clicked ROM to it.
|
||||
EmulationActivity.launch(getActivity(),
|
||||
getArguments().getString(ARG_GAME_PATH),
|
||||
getArguments().getString(ARG_GAME_TITLE),
|
||||
getArguments().getString(ARG_GAME_SCREENSHOT_PATH),
|
||||
-1,
|
||||
imageGameScreen);
|
||||
}
|
||||
// Start the emulation activity and send the path of the clicked ROM to it.
|
||||
EmulationActivity.launch(getActivity(),
|
||||
getArguments().getString(ARG_GAME_PATH),
|
||||
getArguments().getString(ARG_GAME_TITLE),
|
||||
getArguments().getString(ARG_GAME_SCREENSHOT_PATH),
|
||||
-1,
|
||||
imageGameScreen);
|
||||
});
|
||||
|
||||
// Fill in the view contents.
|
||||
|
|
|
@ -96,14 +96,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
Button doneButton = contents.findViewById(R.id.done_control_config);
|
||||
if (doneButton != null)
|
||||
{
|
||||
doneButton.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
stopConfiguringControls();
|
||||
}
|
||||
});
|
||||
doneButton.setOnClickListener(v -> stopConfiguringControls());
|
||||
}
|
||||
|
||||
// The new Surface created here will get passed to the native code via onSurfaceChanged.
|
||||
|
@ -327,15 +320,11 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
{
|
||||
Log.debug("[EmulationFragment] Starting emulation thread.");
|
||||
|
||||
mEmulationThread = new Thread(new Runnable()
|
||||
mEmulationThread = new Thread(() ->
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
NativeLibrary.SurfaceChanged(mSurface);
|
||||
NativeLibrary.Run(mGamePath);
|
||||
}},
|
||||
"NativeEmulation");
|
||||
NativeLibrary.SurfaceChanged(mSurface);
|
||||
NativeLibrary.Run(mGamePath);
|
||||
}, "NativeEmulation");
|
||||
mEmulationThread.start();
|
||||
|
||||
}
|
||||
|
|
|
@ -262,32 +262,28 @@ public final class GameDatabase extends SQLiteOpenHelper
|
|||
|
||||
public Observable<Cursor> getGamesForPlatform(final Platform platform)
|
||||
{
|
||||
return Observable.create(new Observable.OnSubscribe<Cursor>()
|
||||
return Observable.create(subscriber ->
|
||||
{
|
||||
@Override
|
||||
public void call(Subscriber<? super Cursor> subscriber)
|
||||
{
|
||||
Log.info("[GameDatabase] Reading games list...");
|
||||
Log.info("[GameDatabase] Reading games list...");
|
||||
|
||||
String[] whereArgs = new String[]{Integer.toString(platform.toInt())};
|
||||
String[] whereArgs = new String[]{Integer.toString(platform.toInt())};
|
||||
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
Cursor resultCursor = database.query(
|
||||
TABLE_NAME_GAMES,
|
||||
null,
|
||||
KEY_GAME_PLATFORM + " = ?",
|
||||
whereArgs,
|
||||
null,
|
||||
null,
|
||||
KEY_GAME_TITLE + " ASC"
|
||||
);
|
||||
SQLiteDatabase database = getReadableDatabase();
|
||||
Cursor resultCursor = database.query(
|
||||
TABLE_NAME_GAMES,
|
||||
null,
|
||||
KEY_GAME_PLATFORM + " = ?",
|
||||
whereArgs,
|
||||
null,
|
||||
null,
|
||||
KEY_GAME_TITLE + " ASC"
|
||||
);
|
||||
|
||||
// Pass the result cursor to the consumer.
|
||||
subscriber.onNext(resultCursor);
|
||||
// Pass the result cursor to the consumer.
|
||||
subscriber.onNext(resultCursor);
|
||||
|
||||
// Tell the consumer we're done; it will unsubscribe implicitly.
|
||||
subscriber.onCompleted();
|
||||
}
|
||||
// Tell the consumer we're done; it will unsubscribe implicitly.
|
||||
subscriber.onCompleted();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -52,14 +52,7 @@ public final class MainActivity extends AppCompatActivity implements MainView
|
|||
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 final class MainPresenter
|
|||
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 @@ public final class TvMainActivity extends FragmentActivity implements MainView
|
|||
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;
|
||||
(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);
|
||||
}
|
||||
}
|
||||
});
|
||||
// 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 @@ public final class PlatformGamesPresenter
|
|||
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 final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
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)
|
||||
{
|
||||
StringSetting setting = new StringSetting(item.getKey(), item.getSection(), item.getFile(), item.getValue());
|
||||
notifyItemChanged(position);
|
||||
|
||||
if (setting != null)
|
||||
{
|
||||
mView.putSetting(setting);
|
||||
}
|
||||
|
||||
mView.onSettingChanged();
|
||||
mView.putSetting(setting);
|
||||
}
|
||||
|
||||
mView.onSettingChanged();
|
||||
});
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.show();
|
||||
|
|
|
@ -137,14 +137,7 @@ public class Java_GCAdapter {
|
|||
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 class PermissionsHandler {
|
|||
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 @@ public class PermissionsHandler {
|
|||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue