Skip to content
Permalink
Browse files
Merge pull request #9217 from JosJuice/android-touch-checks
Android: Remove some touchscreen checks from EmulationActivity
  • Loading branch information
lioncash committed Nov 2, 2020
2 parents cbaf8f8 + 8123263 commit 4e2875e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
@@ -73,7 +73,6 @@ public final class EmulationActivity extends AppCompatActivity

private Settings mSettings;

private boolean mDeviceHasTouchScreen;
private boolean mMenuVisible;

private static boolean sIgnoreLaunchRequests = false;
@@ -229,7 +228,6 @@ protected void onCreate(Bundle savedInstanceState)

updateOrientation();

mDeviceHasTouchScreen = getPackageManager().hasSystemFeature("android.hardware.touchscreen");
mMotionListener = new MotionListener(this);

// Set these options now so that the SurfaceView the game renders into is the right size.
@@ -311,8 +309,7 @@ public void onTitleChanged()
setTitle(NativeLibrary.GetCurrentTitleDescription());
updateMotionListener();

if (mDeviceHasTouchScreen)
mEmulationFragment.refreshInputOverlay();
mEmulationFragment.refreshInputOverlay();
}

private void updateMotionListener()
@@ -1169,7 +1166,6 @@ public Settings getSettings()

public void initInputPointer()
{
if (mDeviceHasTouchScreen)
mEmulationFragment.initInputPointer();
mEmulationFragment.initInputPointer();
}
}
@@ -124,22 +124,27 @@ public void toggleInputOverlayVisibility(Settings settings)
{
BooleanSetting.MAIN_SHOW_INPUT_OVERLAY
.setBoolean(settings, !BooleanSetting.MAIN_SHOW_INPUT_OVERLAY.getBoolean(settings));
mInputOverlay.refreshControls();

if (mInputOverlay != null)
mInputOverlay.refreshControls();
}

public void initInputPointer()
{
mInputOverlay.initTouchPointer();
if (mInputOverlay != null)
mInputOverlay.initTouchPointer();
}

public void refreshInputOverlay()
{
mInputOverlay.refreshControls();
if (mInputOverlay != null)
mInputOverlay.refreshControls();
}

public void resetInputOverlay()
{
mInputOverlay.resetButtonPlacement();
if (mInputOverlay != null)
mInputOverlay.resetButtonPlacement();
}

@Override
@@ -169,19 +174,25 @@ public void stopEmulation()

public void startConfiguringControls()
{
getView().findViewById(R.id.done_control_config).setVisibility(View.VISIBLE);
mInputOverlay.setIsInEditMode(true);
if (mInputOverlay != null)
{
requireView().findViewById(R.id.done_control_config).setVisibility(View.VISIBLE);
mInputOverlay.setIsInEditMode(true);
}
}

public void stopConfiguringControls()
{
getView().findViewById(R.id.done_control_config).setVisibility(View.GONE);
mInputOverlay.setIsInEditMode(false);
if (mInputOverlay != null)
{
requireView().findViewById(R.id.done_control_config).setVisibility(View.GONE);
mInputOverlay.setIsInEditMode(false);
}
}

public boolean isConfiguringControls()
{
return mInputOverlay.isInEditMode();
return mInputOverlay != null && mInputOverlay.isInEditMode();
}

private static class EmulationState

0 comments on commit 4e2875e

Please sign in to comment.