This repository was archived by the owner on Jan 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +38
-7
lines changed
Expand file tree Collapse file tree 5 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ public final class EmulationActivity extends AppCompatActivity
9696 public static final int MENU_ACTION_TOGGLE_DEPTH_SLIDER = 18 ;
9797 public static final int MENU_ACTION_ADJUST_OPACITY = 19 ;
9898 public static final int MENU_ACTION_FACE_BUTTON_SLIDE_ENABLE = 20 ;
99+ public static final int MENU_ACTION_VIBRATE_ON_RELEASE = 21 ;
99100
100101 public static final int REQUEST_SELECT_AMIIBO = 2 ;
101102 private static final int EMULATION_RUNNING_NOTIFICATION = 0x1000 ;
@@ -158,6 +159,8 @@ public final class EmulationActivity extends AppCompatActivity
158159 EmulationActivity .MENU_ACTION_DPAD_SLIDE_ENABLE );
159160 buttonsActionsMap .append (R .id .menu_emulation_haptic_feedback ,
160161 EmulationActivity .MENU_ACTION_HAPTIC_FEEDBACK );
162+ buttonsActionsMap .append (R .id .menu_emulation_vibrate_on_release ,
163+ EmulationActivity .MENU_ACTION_VIBRATE_ON_RELEASE );
161164 }
162165
163166 private View mDecorView ;
@@ -583,6 +586,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
583586 case MENU_ACTION_HAPTIC_FEEDBACK :
584587 adjustHapticFeedback ();
585588 break ;
589+ case MENU_ACTION_VIBRATE_ON_RELEASE :
590+ final boolean isVibrateOnReleaseEnabled = !EmulationMenuSettings .getVibrateOnReleaseEnable ();
591+ EmulationMenuSettings .setVibrateOnReleaseEnable (isVibrateOnReleaseEnabled );
592+ item .setChecked (isVibrateOnReleaseEnabled );
593+ break ;
586594 }
587595
588596 return true ;
Original file line number Diff line number Diff line change @@ -676,7 +676,13 @@ else if (right)
676676 newButtonsPressed ++;
677677 }
678678 }
679- if (newButtonsPressed >0 ||numButtonsReleased >0 ){
679+ if (
680+ newButtonsPressed > 0
681+ || (
682+ EmulationMenuSettings .getVibrateOnReleaseEnable ()
683+ && numButtonsReleased > 0
684+ )
685+ ){
680686 // Not all devices that support VibrationEffect (API>=26) allow Amplitude Control
681687 // TODO: could expose vibration duration (ms) and amplitude as separate user preferences
682688 // Could also allow them (if they're crazy enough) to let it keep vibrating for the duration of the press?
Original file line number Diff line number Diff line change @@ -79,9 +79,20 @@ public static void setShowOverlay(boolean value) {
7979 public static boolean getFaceButtonSlideEnable () {
8080 return mPreferences .getBoolean ("EmulationMenuSettings_FaceButtonSlideEnable" , true );
8181 }
82+
8283 public static void setFaceButtonSlideEnable (boolean value ) {
8384 final SharedPreferences .Editor editor = mPreferences .edit ();
8485 editor .putBoolean ("EmulationMenuSettings_FaceButtonSlideEnable" , value );
8586 editor .apply ();
8687 }
88+
89+ public static void setVibrateOnReleaseEnable (boolean value ) {
90+ final SharedPreferences .Editor editor = mPreferences .edit ();
91+ editor .putBoolean ("EmulationMenuSettings_VibrateOnReleaseEnable" , value );
92+ editor .apply ();
93+ }
94+
95+ public static boolean getVibrateOnReleaseEnable () {
96+ return mPreferences .getBoolean ("EmulationMenuSettings_VibrateOnReleaseEnable" , false );
97+ }
8798}
Original file line number Diff line number Diff line change 3535 android : id =" @+id/menu_emulation_adjust_opacity"
3636 android : title =" @string/emulation_control_opacity" />
3737
38+ <item
39+ android : id =" @+id/menu_emulation_toggle_depth_slider"
40+ app : showAsAction =" never"
41+ android : title =" @string/emulation_toggle_depth_slider"
42+ android : checkable =" true" />
43+
3844 <group android : checkableBehavior =" all" >
3945 <item
4046 android : id =" @+id/menu_emulation_joystick_rel_center"
4854 android : id =" @+id/menu_emulation_face_button_slide_enable"
4955 android : checkable =" true"
5056 android : title =" @string/emulation_control_face_button_slide_enable" />
57+
58+ <item
59+ android : id =" @+id/menu_emulation_vibrate_on_release"
60+ android : checkable =" true"
61+ android : title =" @string/emulation_control_vibrate_on_release" />
5162 </group >
5263
5364 <item
117128 android : title =" @string/emulation_show_overlay"
118129 android : checkable =" true" />
119130
120- <item
121- android : id =" @+id/menu_emulation_toggle_depth_slider"
122- app : showAsAction =" never"
123- android : title =" @string/emulation_toggle_depth_slider"
124- android : checkable =" true" />
125-
126131 <item
127132 android : id =" @+id/menu_emulation_open_settings"
128133 app : showAsAction =" never"
Original file line number Diff line number Diff line change 228228 <string name =" preparing_shaders" >Preparing shaders</string >
229229 <string name =" building_shaders" >Building shaders</string >
230230 <string name =" emulation_control_opacity" >Adjust Opacity</string >
231+ <string name =" emulation_control_vibrate_on_release" >Vibrate on Release</string >
231232</resources >
You can’t perform that action at this time.
0 commit comments