Android: Make touch gliding opt-in

This commit is contained in:
Connor McLaughlin 2021-03-06 15:56:46 +10:00
parent 491e3a36df
commit 977f5b69c2
5 changed files with 23 additions and 12 deletions

View File

@ -5,6 +5,7 @@ The following people have contributed to the project in some way, and are credit
- Connor McLaughlin - @stenzek
- @ggrtk
- @CookiePLMonster
- @PookaMustard
## Translators
- Anderson Cardoso - Portuguese (Br)

View File

@ -669,6 +669,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
final String controllerType = getStringSetting("Controller1/Type", "DigitalController");
final String viewType = getStringSetting("Controller1/TouchscreenControllerView", "digital");
final boolean autoHideTouchscreenController = getBooleanSetting("Controller1/AutoHideTouchscreenController", false);
final boolean touchGliding = getBooleanSetting("Controller1/TouchGliding", false);
final boolean hapticFeedback = getBooleanSetting("Controller1/HapticFeedback", false);
final boolean vibration = getBooleanSetting("Controller1/Vibration", false);
final FrameLayout activityLayout = findViewById(R.id.frameLayout);
@ -689,7 +690,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
activityLayout.addView(mTouchscreenController);
}
mTouchscreenController.init(0, controllerType, viewType, hapticFeedback);
mTouchscreenController.init(0, controllerType, viewType, hapticFeedback, touchGliding);
}
if (vibration)

View File

@ -186,7 +186,7 @@ public class TouchscreenControllerView extends FrameLayout {
requestLayout();
}
public void init(int controllerIndex, String controllerType, String viewType, boolean hapticFeedback) {
public void init(int controllerIndex, String controllerType, String viewType, boolean hapticFeedback, boolean gliding) {
mControllerIndex = controllerIndex;
mControllerType = controllerType;
mViewType = viewType;
@ -236,16 +236,16 @@ public class TouchscreenControllerView extends FrameLayout {
linkButton(mMainView, R.id.controller_button_right, "RightButton", "Right", true, false);
linkButton(mMainView, R.id.controller_button_down, "DownButton", "Down", true, false);
linkButton(mMainView, R.id.controller_button_left, "LeftButton", "Left", true, false);
linkButton(mMainView, R.id.controller_button_l1, "L1Button", "L1", true, true);
linkButton(mMainView, R.id.controller_button_l2, "L2Button", "L2", true, true);
linkButton(mMainView, R.id.controller_button_select, "SelectButton", "Select", true, true);
linkButton(mMainView, R.id.controller_button_start, "StartButton", "Start", true, true);
linkButton(mMainView, R.id.controller_button_triangle, "TriangleButton", "Triangle", true, true);
linkButton(mMainView, R.id.controller_button_circle, "CircleButton", "Circle", true, true);
linkButton(mMainView, R.id.controller_button_cross, "CrossButton", "Cross", true, true);
linkButton(mMainView, R.id.controller_button_square, "SquareButton", "Square", true, true);
linkButton(mMainView, R.id.controller_button_r1, "R1Button", "R1", true, true);
linkButton(mMainView, R.id.controller_button_r2, "R2Button", "R2", true, true);
linkButton(mMainView, R.id.controller_button_l1, "L1Button", "L1", true, gliding);
linkButton(mMainView, R.id.controller_button_l2, "L2Button", "L2", true, gliding);
linkButton(mMainView, R.id.controller_button_select, "SelectButton", "Select", true, gliding);
linkButton(mMainView, R.id.controller_button_start, "StartButton", "Start", true, gliding);
linkButton(mMainView, R.id.controller_button_triangle, "TriangleButton", "Triangle", true, gliding);
linkButton(mMainView, R.id.controller_button_circle, "CircleButton", "Circle", true, gliding);
linkButton(mMainView, R.id.controller_button_cross, "CrossButton", "Cross", true, gliding);
linkButton(mMainView, R.id.controller_button_square, "SquareButton", "Square", true, gliding);
linkButton(mMainView, R.id.controller_button_r1, "R1Button", "R1", true, gliding);
linkButton(mMainView, R.id.controller_button_r2, "R2Button", "R2", true, gliding);
if (!linkAxis(mMainView, R.id.controller_axis_left, "LeftAxis", "Left", true))
linkAxisToButtons(mMainView, R.id.controller_axis_left, "LeftAxis", "");

View File

@ -229,4 +229,6 @@
<string name="settings_summary_console_tty_output">Logs debug messages printed by games.</string>
<string name="action_show_game_list">List View</string>
<string name="action_show_game_grid">Grid View</string>
<string name="settings_touch_gliding">Touch Gliding</string>
<string name="settings_summary_touch_gliding">Allows you to press multiple controller face buttons by dragging your finger along the screen.</string>
</resources>

View File

@ -74,6 +74,13 @@
app:summary="@string/settings_summary_enable_vibration"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
app:key="Controller1/TouchGliding"
app:title="@string/settings_touch_gliding"
app:defaultValue="false"
app:summary="@string/settings_summary_touch_gliding"
app:iconSpaceReserved="false" />
<ListPreference
app:key="MemoryCards/Card1Type"
app:title="@string/settings_memory_card_1_type"